From 4c228f3207c3cd130ff744ecbb99ed96b35d300d Mon Sep 17 00:00:00 2001 From: jfrer Date: Fri, 14 Jun 2024 14:55:15 +0200 Subject: [PATCH 1/2] fix: use api for latest runs instead of local filtering --- src/components/Workflows.vue | 6 ++++++ src/helpers/api.ts | 2 +- src/store/workflows-store.ts | 9 +++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/Workflows.vue b/src/components/Workflows.vue index 9ad66e6..773a57c 100644 --- a/src/components/Workflows.vue +++ b/src/components/Workflows.vue @@ -50,6 +50,7 @@ } workflowsStore.runs = await api.getRuns() + workflowsStore.latestRuns = await api.getLatestRuns() workflowsStore.gt = await api.getGroundTruth() workflowsStore.workflows = await api.getWorkflows() @@ -58,6 +59,11 @@ if (!workflowsStore.gt.find(gt => gt.id === gtId)) console.log(gtId) }) + workflowsStore.latestRuns.forEach(run => { + const gtId = mapGtId(run.metadata.gt_workspace.id) + + if (!workflowsStore.gt.find(gt => gt.id === gtId)) console.log(gtId) + }) const releasesObj = workflowsStore.runs.reduce((acc, cur) => { acc[cur.metadata.release_info.tag_name] = cur.metadata.release_info diff --git a/src/helpers/api.ts b/src/helpers/api.ts index 98dc337..6e09a71 100644 --- a/src/helpers/api.ts +++ b/src/helpers/api.ts @@ -39,7 +39,7 @@ async function getLatestRuns(gtId?: string, workflowId?: string): Promise EvaluationRun[] getLatestRuns: () => EvaluationRun[], @@ -19,6 +20,7 @@ export default reactive<{ gt: [], workflows: [], runs: [], + latestRuns: [], releases: [], getRuns(gtId: string, workflowId?: string) { return this.runs @@ -32,12 +34,7 @@ export default reactive<{ ) }, getLatestRuns() { - const dates = Object.keys(this.runs.reduce((acc, cur) => { - acc[normalizeDate(cur.metadata.timestamp)] = null - return acc - }, <{ [key: string]: null}>{})) - - return this.runs.filter(({ metadata }) => normalizeDate(metadata.timestamp) === dates[dates.length - 1]) + return this.latestRuns }, getGtById(id: string): GroundTruth | null { return this.gt.find((item) => item.id === id) ?? null From 6cd3d17aa25911770c6748a3c79cc93b33e6d141 Mon Sep 17 00:00:00 2001 From: jfrer Date: Fri, 5 Jul 2024 16:08:28 +0200 Subject: [PATCH 2/2] docs: add comment explaining the workaround --- src/helpers/api.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/helpers/api.ts b/src/helpers/api.ts index 6e09a71..dccf74c 100644 --- a/src/helpers/api.ts +++ b/src/helpers/api.ts @@ -38,7 +38,13 @@ async function getLatestRuns(gtId?: string, workflowId?: string): Promise