Skip to content

Commit

Permalink
fix(ui): add suggest and fix parameters list
Browse files Browse the repository at this point in the history
close #3124
close #3125
  • Loading branch information
bnjjj authored and yesnault committed Aug 1, 2018
1 parent 904ef0a commit 023fed7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
8 changes: 8 additions & 0 deletions engine/api/suggest.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,24 @@ func (api *API) getVariablesHandler() Handler {
"{{.cds.buildNumber}}",
"{{.cds.environment}}",
"{{.cds.job}}",
"{{.cds.manual}}",
"{{.cds.node}}",
"{{.cds.node.id}}",
"{{.cds.parent.application}}",
"{{.cds.parent.buildNumber}}",
"{{.cds.parent.pipeline}}",
"{{.cds.pipeline}}",
"{{.cds.project}}",
"{{.cds.run}}",
"{{.cds.run.number}}",
"{{.cds.run.subnumber}}",
"{{.cds.stage}}",
"{{.cds.triggered_by.email}}",
"{{.cds.triggered_by.fullname}}",
"{{.cds.triggered_by.username}}",
"{{.cds.ui.pipeline.run}}",
"{{.cds.worker}}",
"{{.cds.workflow}}",
}
allVariables = append(allVariables, cdsVar...)

Expand Down
11 changes: 7 additions & 4 deletions ui/src/app/shared/parameter/list/parameter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ParameterListComponent extends Table implements OnInit {
}

if (this.ready) {
this.data = this.getDataForCurrentPage();
this.getDataForCurrentPage();
}
}
get parameters() {
Expand Down Expand Up @@ -63,14 +63,17 @@ export class ParameterListComponent extends Table implements OnInit {
}

ngOnInit() {
this.data = this.getDataForCurrentPage();
this.getDataForCurrentPage();
}

getDataForCurrentPage(): any[] {
if (this.mode === 'job') {
return this.getData();
this.data = this.getData();
return this.data;
}
return super.getDataForCurrentPage();
this.data = super.getDataForCurrentPage();

return this.data;
}

getData(): any[] {
Expand Down
3 changes: 3 additions & 0 deletions ui/src/app/shared/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ export abstract class Table {
upPage(): void {
let maxPage = this.getNbOfPages();
this.currentPage = (this.currentPage === maxPage) ? this.currentPage : this.currentPage + 1;
this.getDataForCurrentPage();
}

/**
* Go to previous page.
*/
downPage(): void {
this.currentPage = (this.currentPage === 1) ? this.currentPage : this.currentPage - 1;
this.getDataForCurrentPage();
}

/**
Expand All @@ -56,5 +58,6 @@ export abstract class Table {
return;
}
this.currentPage = page;
this.getDataForCurrentPage();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class WorkflowNodeConditionListComponent extends Table implements OnInit
data.plain = new Array<WorkflowNodeCondition>();
}
this._conditions = data;
this.data = this.getData();
this.getDataForCurrentPage();
}
get conditions(): WorkflowNodeConditions {
return this._conditions;
Expand Down Expand Up @@ -54,7 +54,12 @@ export class WorkflowNodeConditionListComponent extends Table implements OnInit
this.mode = 'advanced';
}

this.data = this.getData();
this.getDataForCurrentPage();
}

getDataForCurrentPage(): any[] {
this.data = super.getDataForCurrentPage();
return this.data;
}

getData(): any[] {
Expand Down

0 comments on commit 023fed7

Please sign in to comment.