From d536eec36729ad69102cd41dd04ca7a1be878878 Mon Sep 17 00:00:00 2001 From: Petri Kivikangas <36138+Kitanotori@users.noreply.github.com> Date: Mon, 6 Mar 2023 02:48:02 +0900 Subject: [PATCH] fix: Fix broken archive UI Fixes #10606 (#10622) Signed-off-by: Petri Kivikangas <36138+Kitanotori@users.noreply.github.com> --- .../archived-workflow-filters.tsx | 7 +++---- .../app/shared/services/archived-workflows-service.ts | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ui/src/app/archived-workflows/components/archived-workflow-filters/archived-workflow-filters.tsx b/ui/src/app/archived-workflows/components/archived-workflow-filters/archived-workflow-filters.tsx index 33a6a7ada6b4..111c2a52d404 100644 --- a/ui/src/app/archived-workflows/components/archived-workflow-filters/archived-workflow-filters.tsx +++ b/ui/src/app/archived-workflows/components/archived-workflow-filters/archived-workflow-filters.tsx @@ -199,9 +199,8 @@ export class ArchivedWorkflowFilters extends React.Component { - return services.archivedWorkflows.listLabelValues(key, this.props.namespace).then(list => { - return list.items.map(i => key + '=' + i).sort((a, b) => a.localeCompare(b)); - }); + private async fetchArchivedWorkflowsLabels(key: string): Promise { + const labels = await services.archivedWorkflows.listLabelValues(key, this.props?.namespace); + return labels.items.map(i => key + '=' + i).sort((a, b) => a.localeCompare(b)); } } diff --git a/ui/src/app/shared/services/archived-workflows-service.ts b/ui/src/app/shared/services/archived-workflows-service.ts index 1159fcd22ae0..c6697f1b9611 100644 --- a/ui/src/app/shared/services/archived-workflows-service.ts +++ b/ui/src/app/shared/services/archived-workflows-service.ts @@ -39,12 +39,12 @@ export class ArchivedWorkflowsService { } } - public listLabelValues(key: string, namespace: string) { - if (namespace === '') { - return requests.get(`api/v1/archived-workflows-label-values?listOptions.labelSelector=${key}`).then(res => res.body as models.Labels); - } else { - return requests.get(`api/v1/archived-workflows-label-values?namespace=${namespace}&listOptions.labelSelector=${key}`).then(res => res.body as models.Labels); + public async listLabelValues(key: string, namespace: string): Promise { + let url = `api/v1/archived-workflows-label-values?listOptions.labelSelector=${key}`; + if (namespace !== '') { + url += `&namespace=${namespace}`; } + return (await requests.get(url)).body as models.Labels; } public resubmit(uid: string, namespace: string) {