Skip to content

Commit

Permalink
feat (ui): add filter on artifact list (#2856)
Browse files Browse the repository at this point in the history
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
  • Loading branch information
yesnault authored and sguiheux committed Jun 11, 2018
1 parent 102f336 commit 6b30445
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions ui/src/app/model/workflow.run.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class WorkflowNodeRunArtifact {
size: number;
perm: number;
md5sum: string;
sha512sum: string;
object_path: string;
created: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ export class WorkflowRunArtifactListComponent extends Table {

// Allow angular update from work started outside angular context
zone: NgZone;
filter: string;

constructor() {
super();
this.zone = new NgZone({enableLongStackTrace: false});
}

getData(): any[] {
return this.artifacts;
if (!this.filter) {
return this.artifacts;
}
return this.artifacts.filter(v => (v.name.indexOf(this.filter) !== -1 || v.sha512sum.indexOf(this.filter) !== -1));
}

getHumainFileSize(size: number): string {
Expand Down
14 changes: 13 additions & 1 deletion ui/src/app/views/workflow/run/node/artifact/artifact.list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<div class="artifact" *ngIf="artifacts">
<table class="ui fixed celled table">
<div class="ui form">
<div class="field">
<div class="fields">
<div class="sixteen wide field">
<input type="text" placeholder="{{ 'filter' | translate }}" [(ngModel)]="filter">
</div>
</div>
</div>
</div>
<table class="ui fixed celled table" *ngIf="getDataForCurrentPage().length > 0">
<thead>
<tr>
<th class="four wide">{{ 'artifact_name' | translate }}</th>
Expand Down Expand Up @@ -41,4 +50,7 @@
</tr>
</tfoot>
</table>
<div class="ui info message" *ngIf="getDataForCurrentPage().length === 0">
{{ 'artifact_none' | translate }}
</div>
</div>
1 change: 1 addition & 0 deletions ui/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"artifact_name": "Artifact name",
"artifact_tag": "Tag",
"artifact_sha512": "SHA512 Checksum",
"artifact_none": "No artifact",

"audit_change": "Change",
"audit_no": "No audit",
Expand Down
1 change: 1 addition & 0 deletions ui/src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"artifact_name": "Nom de l'artefact",
"artifact_tag": "Tag",
"artifact_sha512": "SHA512 Checksum",
"artifact_none": "Aucun artefact",

"audit_change": "Modification",
"audit_no": "Aucun audit",
Expand Down

0 comments on commit 6b30445

Please sign in to comment.