Skip to content

Commit

Permalink
fix(ui): fix conditions list (#3121)
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
  • Loading branch information
bnjjj authored and fsamin committed Aug 1, 2018
1 parent c4fc6b4 commit d74c73c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Expand Up @@ -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';
}
Expand Down
Expand Up @@ -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<WorkflowNodeCondition>();
}
this._conditions = data;
this.data = this.getData();
}
get conditions(): WorkflowNodeConditions {
return this._conditions;
}
@Output() conditionChange = new EventEmitter<WorkflowNodeCondition[]>();
@Input() workflow: Workflow;
@Input() operators: {};
Expand All @@ -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();
Expand All @@ -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<WorkflowNodeCondition>();
}

return this.conditions.plain;
}

Expand Down

0 comments on commit d74c73c

Please sign in to comment.