Skip to content

Commit 79939da

Browse files
authored
fix(utask-lib): use UTaskLibOptions uiBaseUrl if provided (#338)
Signed-off-by: Thomas Bétrancourt <thomas@betrancourt.net>
1 parent b9f73a8 commit 79939da

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

ui/dashboard/projects/utask-lib/src/lib/@components/stepslist/stepslist.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ModalEditResolutionStepStateComponent } from '../../@modals/modal-edit-
1010
import { NzNotificationService } from 'ng-zorro-antd/notification';
1111
import Step from '../../@models/step.model';
1212
import { ModalApiYamlEditComponent } from '../../@modals/modal-api-yaml-edit/modal-api-yaml-edit.component';
13-
import { ApiService } from '../../@services/api.service';
13+
import { ApiService, UTaskLibOptions } from '../../@services/api.service';
1414
import { TasksListComponentOptions } from '../tasks-list/tasks-list.component';
1515

1616
@Component({
@@ -22,7 +22,7 @@ export class StepsListComponent implements OnChanges {
2222
@Input() resolution: any;
2323
@Input() selectedStep: string;
2424
@Output() stepChanged = new EventEmitter<Step>();
25-
@Input() options?: TasksListComponentOptions = new TasksListComponentOptions();
25+
@Input() options?: TasksListComponentOptions = new TasksListComponentOptions({}, this._options);
2626
displayDetails: { [key: string]: boolean } = {};
2727
filter: any = {
2828
tags: []
@@ -46,6 +46,7 @@ export class StepsListComponent implements OnChanges {
4646
defaultState;
4747

4848
constructor(
49+
private _options: UTaskLibOptions,
4950
private _modal: NzModalService,
5051
private _workflowService: WorkflowService,
5152
private _notif: NzNotificationService,

ui/dashboard/projects/utask-lib/src/lib/@components/tasks-list/tasks-list.component.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import get from 'lodash-es/get';
3434
import cloneDeep from 'lodash-es/cloneDeep';
3535
import moment from 'moment';
3636
import Task, { TaskType } from '../../@models/task.model';
37-
import { ParamsListTasks, ApiService } from '../../@services/api.service';
37+
import { ParamsListTasks, ApiService, UTaskLibOptions } from '../../@services/api.service';
3838
import Meta from '../../@models/meta.model';
3939
import { ResolutionService } from '../../@services/resolution.service';
4040
import { TaskService } from '../../@services/task.service';
@@ -82,7 +82,17 @@ export class TasksListComponentOptions {
8282
public routingTaskPath = '/task/';
8383
public disableBulk = false;
8484

85-
public constructor(init?: Partial<TasksListComponentOptions>) {
85+
public constructor(init?: Partial<TasksListComponentOptions>, options?: UTaskLibOptions) {
86+
if (!init) {
87+
init = {};
88+
}
89+
if (init.routingTaskPath === undefined && options) {
90+
init.routingTaskPath = options.uiBaseUrl;
91+
if (!init.routingTaskPath.endsWith('/')) {
92+
init.routingTaskPath += '/';
93+
}
94+
init.routingTaskPath += 'task/';
95+
}
8696
Object.assign(this, init);
8797
}
8898
}

0 commit comments

Comments
 (0)