Skip to content

Commit

Permalink
fix(ui): no more christmas tree in run conditions (#3781)
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <[email protected]>
  • Loading branch information
bnjjj authored Dec 27, 2018
1 parent 89d9f42 commit 427a88a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
import {cloneDeep} from 'lodash';
import {CodemirrorComponent} from 'ng2-codemirror-typescript/Codemirror';
import {PipelineStatus} from '../../../../../model/pipeline.model';
import {Workflow, WorkflowNodeCondition, WorkflowNodeConditions} from '../../../../../model/workflow.model';
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { cloneDeep } from 'lodash';
import { CodemirrorComponent } from 'ng2-codemirror-typescript/Codemirror';
import { PipelineStatus } from '../../../../../model/pipeline.model';
import { Workflow, WorkflowNodeCondition, WorkflowNodeConditions } from '../../../../../model/workflow.model';
declare var CodeMirror: any;

@Component({
Expand Down Expand Up @@ -35,6 +35,7 @@ export class WorkflowNodeConditionFormComponent {
_names: Array<string> = [];
suggest: Array<string> = [];
condition = new WorkflowNodeCondition();
oldVariableCondition: string;
codeMirrorConfig: {};
statuses = [PipelineStatus.SUCCESS, PipelineStatus.FAIL, PipelineStatus.SKIPPED];

Expand Down Expand Up @@ -87,10 +88,13 @@ export class WorkflowNodeConditionFormComponent {
this.condition.value = event.target.checked ? 'true' : 'false';
}

variableChanged(event: any) {
this.condition.value = null;
this.condition.operator = 'eq';
if (event.target.value === 'cds.manual') {
variableChanged(variable: any) {
if (!variable || variable !== this.oldVariableCondition) {
this.condition.value = null;
this.condition.operator = 'eq';
}
this.oldVariableCondition = variable;
if (variable === 'cds.manual') {
this.condition.value = 'false';
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h4>{{ 'workflow_node_condition_form' | translate}}</h4>
*ngIf="names"
class="search"
[(model)]="condition.variable"
(change)="variableChanged($event)"
(click)="variableChanged(condition.variable)"
[options]="{'fullTextSearch': true, 'allowAdditions': true}">
<option *ngFor="let n of names" [value]="n">{{n}}</option>
</sm-select>
Expand Down

0 comments on commit 427a88a

Please sign in to comment.