Skip to content

Commit 85ca0a7

Browse files
authored
fix(ui): display sidebar tags (#5072)
1 parent 454d726 commit 85ca0a7

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

ui/src/app/shared/workflow/sidebar/run-list/workflow.sidebar.run.component.ts

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class WorkflowSidebarRunListComponent implements OnDestroy {
8888
return;
8989
}
9090
this.workflowRuns = runs;
91-
if (!this.durationIntervalID) {
91+
if (!this.durationIntervalID && this.workflowRuns && this.workflow && this.workflowRuns.length > 0) {
9292
this.refreshRun();
9393
}
9494
this._cd.markForCheck();
@@ -144,9 +144,10 @@ export class WorkflowSidebarRunListComponent implements OnDestroy {
144144
}
145145
});
146146
});
147-
if (!this.durationIntervalID) {
147+
if (!this.durationIntervalID && this.workflowRuns && this.workflow && this.workflowRuns.length > 0) {
148148
this.refreshRun();
149149
}
150+
this._cd.detectChanges();
150151
}
151152

152153
getFilteredTags(tags: WorkflowRunTags[]): WorkflowRunTags[] {
@@ -189,37 +190,31 @@ export class WorkflowSidebarRunListComponent implements OnDestroy {
189190
}
190191

191192
refreshRun(): void {
192-
this.refreshDuration();
193193
if (this.durationIntervalID) {
194194
this.deleteInterval();
195195
}
196-
if (this.workflowRuns) {
196+
this.refreshDuration();
197+
this.durationIntervalID = window.setInterval(() => {
197198
this.refreshDuration();
198-
this.durationIntervalID = window.setInterval(() => {
199-
this.refreshDuration();
200-
}, 5000);
201-
}
199+
this._cd.markForCheck();
200+
}, 5000);
202201
}
203202

204203
refreshDuration(): void {
205-
if (this.workflowRuns) {
206-
let stillWorking = false;
207-
if (this.workflow && this.workflow.metadata && this.workflow.metadata['default_tags']) {
208-
this.tagToDisplay = this.workflow.metadata['default_tags'].split(',');
209-
}
210-
this.workflowRuns.forEach((r) => {
211-
if (PipelineStatus.isActive(r.status)) {
212-
stillWorking = true;
213-
}
214-
this.filteredTags[r.id] = this.getFilteredTags(r.tags);
215-
this.durationMap[r.id] = this.getDuration(r.status, r.start, r.last_execution);
216-
});
217-
if (!stillWorking) {
218-
this.deleteInterval();
204+
let stillWorking = false;
205+
if (this.workflow && this.workflow.metadata && this.workflow.metadata['default_tags']) {
206+
this.tagToDisplay = this.workflow.metadata['default_tags'].split(',');
207+
}
208+
this.workflowRuns.forEach((r) => {
209+
if (PipelineStatus.isActive(r.status)) {
210+
stillWorking = true;
219211
}
220-
this._cd.markForCheck();
212+
this.filteredTags[r.id] = this.getFilteredTags(r.tags);
213+
this.durationMap[r.id] = this.getDuration(r.status, r.start, r.last_execution);
214+
});
215+
if (!stillWorking) {
216+
this.deleteInterval();
221217
}
222-
223218
}
224219

225220
changeRun(num: number) {

0 commit comments

Comments
 (0)