diff --git a/ui/src/app/shared/workflow/node/conditions/condition-form/condition.component.ts b/ui/src/app/shared/workflow/node/conditions/condition-form/condition.component.ts index 6700ba0db9..a49060d8f4 100644 --- a/ui/src/app/shared/workflow/node/conditions/condition-form/condition.component.ts +++ b/ui/src/app/shared/workflow/node/conditions/condition-form/condition.component.ts @@ -95,7 +95,7 @@ export class WorkflowNodeConditionFormComponent implements OnInit { variableChanged(event: any) { this.condition.value = null; - this.condition.operator = '='; + this.condition.operator = 'eq'; if (event.target.value === 'cds.manual') { this.condition.value = 'false'; } diff --git a/ui/src/app/shared/workflow/node/conditions/condition-list/condition.list.component.ts b/ui/src/app/shared/workflow/node/conditions/condition-list/condition.list.component.ts index 6642e1977f..c2e1edc320 100644 --- a/ui/src/app/shared/workflow/node/conditions/condition-list/condition.list.component.ts +++ b/ui/src/app/shared/workflow/node/conditions/condition-list/condition.list.component.ts @@ -11,7 +11,20 @@ import {Table} from '../../../../table/table'; }) export class WorkflowNodeConditionListComponent extends Table implements OnInit { - @Input() conditions: WorkflowNodeConditions; + @Input('conditions') + set conditions(data: WorkflowNodeConditions) { + if (!data) { + data = new WorkflowNodeConditions(); + } + if (!data.plain) { + data.plain = new Array(); + } + this._conditions = data; + this.data = this.getData(); + } + get conditions(): WorkflowNodeConditions { + return this._conditions; + } @Output() conditionChange = new EventEmitter(); @Input() workflow: Workflow; @Input() operators: {}; @@ -21,6 +34,7 @@ export class WorkflowNodeConditionListComponent extends Table implements OnInit statuses = [PipelineStatus.SUCCESS, PipelineStatus.FAIL, PipelineStatus.SKIPPED]; mode: 'advanced'|'basic' = 'basic'; data: any[] = []; + _conditions: WorkflowNodeConditions; constructor() { super(); @@ -44,13 +58,9 @@ export class WorkflowNodeConditionListComponent extends Table implements OnInit } getData(): any[] { - if (!this.conditions) { - this.conditions = new WorkflowNodeConditions(); + if (!this.conditions || !this.conditions.plain) { + return []; } - if (!this.conditions.plain) { - this.conditions.plain = new Array(); - } - return this.conditions.plain; }