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) {