diff --git a/package-lock.json b/package-lock.json index 207e5328b0ba08a318c1f26d94ccf26fe7709bdf..092bfcc76412d821cb47cb119c66bb0718ab3e2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "dayjs": "~1.11.9", "dompurify": "~3.0.5", "filesize": "~10.0.12", + "idb-keyval": "^6.2.1", "pinia": "~2.1.6", "semver": "~7.5.4", "showdown": "~2.1.0", @@ -201,19 +202,19 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@aws-sdk/client-s3": { - "version": "3.430.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.430.0.tgz", - "integrity": "sha512-KpK6mZsLyxfHTPfXA3Bnuu5li15QhhWCzhSPx6moH6XGPH0hVNHFy05DM9T/1exf6tEAQhi5FJrek9dM/sOdeA==", + "version": "3.431.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.431.0.tgz", + "integrity": "sha512-Kh9GAKdhWfW//Q4HvH7yPO+2emN0h4PLoVk9rin1cCg78mkirnhJ5ffng6fRZDGDCvo7rDwrAqK/WrbcojMH9A==", "dependencies": { "@aws-crypto/sha1-browser": "3.0.0", "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sts": "3.430.0", - "@aws-sdk/credential-provider-node": "3.430.0", + "@aws-sdk/client-sts": "3.431.0", + "@aws-sdk/credential-provider-node": "3.431.0", "@aws-sdk/middleware-bucket-endpoint": "3.430.0", "@aws-sdk/middleware-expect-continue": "3.428.0", "@aws-sdk/middleware-flexible-checksums": "3.428.0", - "@aws-sdk/middleware-host-header": "3.429.0", + "@aws-sdk/middleware-host-header": "3.431.0", "@aws-sdk/middleware-location-constraint": "3.428.0", "@aws-sdk/middleware-logger": "3.428.0", "@aws-sdk/middleware-recursion-detection": "3.428.0", @@ -266,13 +267,13 @@ } }, "node_modules/@aws-sdk/client-sso": { - "version": "3.430.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.430.0.tgz", - "integrity": "sha512-NxQJkTZCgl6LpdY12MCwsqGned6Ax19WsTCGLEiA/tsNE4vNrYLHHBR317G0sGWbIUQuhwsoM7wIrqJO7CacuQ==", + "version": "3.431.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.431.0.tgz", + "integrity": "sha512-iK8RxdBHFj1HtWpdTVfFdljZHXLWFv62SuIdkDswGE7L0zNbZIqBDGfEBnbagiQuxkz5D2YtnasydC5R3BcwVw==", "dependencies": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/middleware-host-header": "3.429.0", + "@aws-sdk/middleware-host-header": "3.431.0", "@aws-sdk/middleware-logger": "3.428.0", "@aws-sdk/middleware-recursion-detection": "3.428.0", "@aws-sdk/middleware-user-agent": "3.428.0", @@ -310,14 +311,14 @@ } }, "node_modules/@aws-sdk/client-sts": { - "version": "3.430.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.430.0.tgz", - "integrity": "sha512-njUY3QeZH0CG+tG/6jhoG+Zr7rI1aGoVkZi3l6woKTz57hIlkwu2jQlLbJujm7PKrLhPaN5+4AqBQuHFVgMobw==", + "version": "3.431.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.431.0.tgz", + "integrity": "sha512-IM/Fg3H1WuM9fnVriEoM6+sZ9LNUExxklxAnHwjLnprPRTDGbUXUfYjSry52LaQsZffP3RgWP11CYyjCYC8CfQ==", "dependencies": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/credential-provider-node": "3.430.0", - "@aws-sdk/middleware-host-header": "3.429.0", + "@aws-sdk/credential-provider-node": "3.431.0", + "@aws-sdk/middleware-host-header": "3.431.0", "@aws-sdk/middleware-logger": "3.428.0", "@aws-sdk/middleware-recursion-detection": "3.428.0", "@aws-sdk/middleware-sdk-sts": "3.428.0", @@ -372,13 +373,13 @@ } }, "node_modules/@aws-sdk/credential-provider-ini": { - "version": "3.430.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.430.0.tgz", - "integrity": "sha512-m3NcmDyVYr/w8RV9kMArrA/0982aXMsvoSXi4wFVbgg/T5hO+6i5CY7fB/0xpKIuEJ+rw63rYNnBzLwwW48kWg==", + "version": "3.431.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.431.0.tgz", + "integrity": "sha512-SILMZuscwxeqB4kuZjWiu24wfvmvN3Tx7/j5n0t0Ob+cdpweK0IqkBQ/QkTbTiG0M1l8trMtMkrTb5510fupcQ==", "dependencies": { "@aws-sdk/credential-provider-env": "3.428.0", "@aws-sdk/credential-provider-process": "3.428.0", - "@aws-sdk/credential-provider-sso": "3.430.0", + "@aws-sdk/credential-provider-sso": "3.431.0", "@aws-sdk/credential-provider-web-identity": "3.428.0", "@aws-sdk/types": "3.428.0", "@smithy/credential-provider-imds": "^2.0.0", @@ -392,14 +393,14 @@ } }, "node_modules/@aws-sdk/credential-provider-node": { - "version": "3.430.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.430.0.tgz", - "integrity": "sha512-ItOHJcqOhpI0QM+aho5uMrk2ZP34hsdisMHxd8/6FT41U8TOe9kQKaZ2l2AsVf4QuM6RJe2LangcVGGstCf8Sw==", + "version": "3.431.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.431.0.tgz", + "integrity": "sha512-jj2gm92nfsFw5e48+7OCYM5PfiW3pd9FvhEoBfvKANwM6ztXzmNpQcz3iWsGVfzd+MUooVBoO2exhH9M8t+VDg==", "dependencies": { "@aws-sdk/credential-provider-env": "3.428.0", - "@aws-sdk/credential-provider-ini": "3.430.0", + "@aws-sdk/credential-provider-ini": "3.431.0", "@aws-sdk/credential-provider-process": "3.428.0", - "@aws-sdk/credential-provider-sso": "3.430.0", + "@aws-sdk/credential-provider-sso": "3.431.0", "@aws-sdk/credential-provider-web-identity": "3.428.0", "@aws-sdk/types": "3.428.0", "@smithy/credential-provider-imds": "^2.0.0", @@ -428,12 +429,12 @@ } }, "node_modules/@aws-sdk/credential-provider-sso": { - "version": "3.430.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.430.0.tgz", - "integrity": "sha512-6de/aH9OFI+Ah7hL4alrZFqiNw5D6F+R92tLbIpFRQg7DxO/TuQTTtK94mLkft/AP/mGzVVBENjsyS1nJt166w==", + "version": "3.431.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.431.0.tgz", + "integrity": "sha512-fh/yWKJtgEpxfuzd/KTVPQz0FjykbiPnU0OLm1wKgNZAyKTE9EyNvWR6P57TWv/sU8faa5uLaxdD0TBPxWReDA==", "dependencies": { - "@aws-sdk/client-sso": "3.430.0", - "@aws-sdk/token-providers": "3.430.0", + "@aws-sdk/client-sso": "3.431.0", + "@aws-sdk/token-providers": "3.431.0", "@aws-sdk/types": "3.428.0", "@smithy/property-provider": "^2.0.0", "@smithy/shared-ini-file-loader": "^2.0.6", @@ -459,9 +460,9 @@ } }, "node_modules/@aws-sdk/lib-storage": { - "version": "3.430.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/lib-storage/-/lib-storage-3.430.0.tgz", - "integrity": "sha512-CPBu7lBGYAbQ/PeTLNXYvBYJ9A1y/vbochfOxB9Eru6lzRZjxwEy+MgHTSB9pNqTi+1L2o4xznPnZ3itjWkUOw==", + "version": "3.431.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/lib-storage/-/lib-storage-3.431.0.tgz", + "integrity": "sha512-lpf/yh0QeSSryNML/Kjep8ruhMopXxfKlx7h8JujkI9H0pGVi71D+RoKfCA+D1k4F5MhV9JltWrHBPh65CqUzA==", "dependencies": { "@smithy/abort-controller": "^2.0.1", "@smithy/middleware-endpoint": "^2.1.2", @@ -528,9 +529,9 @@ } }, "node_modules/@aws-sdk/middleware-host-header": { - "version": "3.429.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.429.0.tgz", - "integrity": "sha512-3v9WoDCmbfH28znQ43cQLvLlm8fhJFIDJLW19moFI8QbXMv85yojGEphBMlT2XZUw79+tyh7GWLFaNugYZ1o9A==", + "version": "3.431.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.431.0.tgz", + "integrity": "sha512-j+OBsCDDRXlMEQ4GCtTxVaMwxIHNKiwbDIZVyB6CDor8AFflKxWbO3cPSpUuGKlUN9OEexMR+XgwsjmaI6AGwg==", "dependencies": { "@aws-sdk/types": "3.428.0", "@smithy/protocol-http": "^3.0.7", @@ -672,9 +673,9 @@ } }, "node_modules/@aws-sdk/s3-request-presigner": { - "version": "3.430.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/s3-request-presigner/-/s3-request-presigner-3.430.0.tgz", - "integrity": "sha512-8+vatOoqEQTwhNXOG6QoTJ6Fszaagc+bQpgfKbRIotCLGh7g4/qgQXo73LVyFVLkS4Tg2bn/KHN8aG3qTPd1KQ==", + "version": "3.431.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/s3-request-presigner/-/s3-request-presigner-3.431.0.tgz", + "integrity": "sha512-R6hZfJozs9a8p5pxncMRyJOKgteshe5GGqeX6pobKZX9y29fVQkTknqFLgnSk/Zcp1JcUZz2ZiVgzoLwWaqunQ==", "dependencies": { "@aws-sdk/signature-v4-multi-region": "3.428.0", "@aws-sdk/types": "3.428.0", @@ -705,13 +706,13 @@ } }, "node_modules/@aws-sdk/token-providers": { - "version": "3.430.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.430.0.tgz", - "integrity": "sha512-vE+QnqG0A4MWhMEFXXPg8gPXjw03b4Q3XZbHyrANoZ+tVrzh8JhpHIcbkesGh6WrjirNqId0UghzI9VanKxsLw==", + "version": "3.431.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.431.0.tgz", + "integrity": "sha512-0ksZogF3Gy2i+yBb7T2g2e7QXzwZeQHmf09ihR1cwXwg7UIjsap6P3gPtC085bDkOD9iY8OdpL0Esp06N6xmCg==", "dependencies": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/middleware-host-header": "3.429.0", + "@aws-sdk/middleware-host-header": "3.431.0", "@aws-sdk/middleware-logger": "3.428.0", "@aws-sdk/middleware-recursion-detection": "3.428.0", "@aws-sdk/middleware-user-agent": "3.428.0", @@ -2108,27 +2109,27 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.18.58", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.58.tgz", - "integrity": "sha512-YGncyA25/MaVtQkjWW9r0EFBukZ+JulsLcVZBlGUfIb96OBMjkoRWwQo5IEWJ8Fj06Go3GHw+bjYDitv6BaGsA==", + "version": "16.18.59", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.59.tgz", + "integrity": "sha512-PJ1w2cNeKUEdey4LiPra0ZuxZFOGvetswE8qHRriV/sUkL5Al4tTmPV9D2+Y/TPIxTHHgxTfRjZVKWhPw/ORhQ==", "dev": true }, "node_modules/@types/semver": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz", - "integrity": "sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", "dev": true }, "node_modules/@types/showdown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@types/showdown/-/showdown-2.0.2.tgz", - "integrity": "sha512-0UnGnwRsiTojb5VGCkgbk3mKJpyAR2EPhalhHGY4/NCFwDyacqVmPWP7uV0mbXC4eh6n7lO3HPCpb2NP+B5NPQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/showdown/-/showdown-2.0.3.tgz", + "integrity": "sha512-cFuAcA3p2YPq8HR8KxvDXnOdccOZ74ypANB3kb3AL5Srji0QnteVw6vf4o7GJ8hMyz+uZ+nSQHVgXSgjYD1a5g==", "dev": true }, "node_modules/@types/trusted-types": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.4.tgz", - "integrity": "sha512-IDaobHimLQhjwsQ/NMwRVfa/yL7L/wriQPMhw1ZJall0KX6E1oxk29XMDeilW5qTIg5aoiqf5Udy8U/51aNoQQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.5.tgz", + "integrity": "sha512-I3pkr8j/6tmQtKV/ZzHtuaqYSQvyjGRKH4go60Rr0IDLlFxuRT5V32uvB1mecM5G1EVAUyF/4r4QZ1GHgz+mxA==", "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { @@ -4215,6 +4216,11 @@ "node": ">=14.18.0" } }, + "node_modules/idb-keyval": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/idb-keyval/-/idb-keyval-6.2.1.tgz", + "integrity": "sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg==" + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", diff --git a/package.json b/package.json index 4f1c1caaa7f9b2bc16f6fdee3ee370ae9dcd2c92..7b3cd26aebf11cabd77f2e8a65322d487a330a63 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "dayjs": "~1.11.9", "dompurify": "~3.0.5", "filesize": "~10.0.12", + "idb-keyval": "^6.2.1", "pinia": "~2.1.6", "semver": "~7.5.4", "showdown": "~2.1.0", diff --git a/src/components/workflows/modals/ArbitraryWorkflowModal.vue b/src/components/workflows/modals/ArbitraryWorkflowModal.vue index b933ab7624d3f756a23dcb1fd07ccbc77439c219..92ae9243e7074ad2ea9994b35c2367551a25440e 100644 --- a/src/components/workflows/modals/ArbitraryWorkflowModal.vue +++ b/src/components/workflows/modals/ArbitraryWorkflowModal.vue @@ -101,22 +101,25 @@ function modalClosed() { function viewWorkflow() { createWorkflowModal?.hide(); - const wid = workflowStore.setArbitraryWorkflow({ - ...workflow, - name: "", - short_description: "", - modes: workflowMode.modeEnabled ? [workflowMode.mode] : [], - token: - repositoryCredentials.token.length > 0 - ? repositoryCredentials.token - : undefined, - }); - router.push({ - name: "arbitrary-workflow", - query: { - wid: wid, - }, - }); + workflowStore + .setArbitraryWorkflow({ + ...workflow, + name: "", + short_description: "", + modes: workflowMode.modeEnabled ? [workflowMode.mode] : [], + token: + repositoryCredentials.token.length > 0 + ? repositoryCredentials.token + : undefined, + }) + .then((wid) => { + router.push({ + name: "arbitrary-workflow", + query: { + wid: wid, + }, + }); + }); } function checkRepository() { diff --git a/src/stores/users.ts b/src/stores/users.ts index 8a8d258ea9fec6797f0c38067a38e0fbeea1f1b6..37497e582784ef6f0fdebcdb2ce205aeb561dc10 100644 --- a/src/stores/users.ts +++ b/src/stores/users.ts @@ -9,6 +9,7 @@ import { useBucketStore } from "@/stores/buckets"; import { useWorkflowStore } from "@/stores/workflows"; import { useS3KeyStore } from "@/stores/s3keys"; import { useS3ObjectStore } from "@/stores/s3objects"; +import { clear as dbclear } from "idb-keyval"; type DecodedToken = { exp: number; @@ -98,9 +99,7 @@ export const useAuthStore = defineStore({ this.token = null; }); } else { - this.token = null; - this.decodedToken = null; - this.user = null; + this.logout(); } }, updateUser(user: User) { @@ -109,6 +108,7 @@ export const useAuthStore = defineStore({ logout() { this.$reset(); localStorage.clear(); + dbclear(); useWorkflowExecutionStore().$reset(); useBucketStore().$reset(); useWorkflowStore().$reset(); diff --git a/src/stores/workflows.ts b/src/stores/workflows.ts index 044f74b605ad1ecc0499accaa679d003b2bd5ab6..6c7e04b3e2ba72d49ffed420cd41953e2a6e3b81 100644 --- a/src/stores/workflows.ts +++ b/src/stores/workflows.ts @@ -17,6 +17,7 @@ import { WorkflowVersionService, } from "@/client/workflow"; import { useAuthStore } from "@/stores/users"; +import { set, get } from "idb-keyval"; export const useWorkflowStore = defineStore({ id: "workflows", @@ -27,13 +28,11 @@ export const useWorkflowStore = defineStore({ comprehensiveWorkflowMapping: {}, modeMapping: {}, modeNameMapping: {}, - arbitraryWorkflows: {}, }) as { workflowMapping: Record<string, WorkflowOut>; nameMapping: Record<string, string>; comprehensiveWorkflowMapping: Record<string, WorkflowOut>; modeMapping: Record<string, WorkflowModeOut>; - arbitraryWorkflows: Record<string, WorkflowIn>; }, getters: { workflows(): WorkflowOut[] { @@ -66,6 +65,9 @@ export const useWorkflowStore = defineStore({ return (objectID) => this.nameMapping[objectID] ?? localStorage.getItem(objectID); }, + getArbitraryWorkflow(): (wid: string) => Promise<WorkflowIn | undefined> { + return (wid: string) => get(wid); + }, }, actions: { __addNameToMapping(key: string, value: string) { @@ -224,9 +226,9 @@ export const useWorkflowStore = defineStore({ return modes; }); }, - setArbitraryWorkflow(workflow: WorkflowIn) { + async setArbitraryWorkflow(workflow: WorkflowIn) { const wid = crypto.randomUUID(); - this.arbitraryWorkflows[wid] = workflow; + await set(wid, workflow); return wid; }, deprecateWorkflowVersion( diff --git a/src/views/workflows/ArbitraryWorkflowView.vue b/src/views/workflows/ArbitraryWorkflowView.vue index 2510fb49f7ad89751cb31c1f7023fa61fa0c5d54..f84204c54c4c4509814a44b7ff3d8a921f947dad 100644 --- a/src/views/workflows/ArbitraryWorkflowView.vue +++ b/src/views/workflows/ArbitraryWorkflowView.vue @@ -136,7 +136,9 @@ function startWorkflow( onMounted(() => { errorToast = new Toast("#arbitraryWorkflowExecutionViewErrorToast"); - workflowState.workflow = workflowStore.arbitraryWorkflows[props.wid]; + workflowStore.getArbitraryWorkflow(props.wid).then((workflow) => { + workflowState.workflow = workflow; + }); }); </script> diff --git a/src/views/workflows/ListWorkflowExecutionsView.vue b/src/views/workflows/ListWorkflowExecutionsView.vue index 6013459f6181a637eba8b95bf2ca03de372969d4..bda5cfd1668d35c5437596f87e8cbca8847ff743 100644 --- a/src/views/workflows/ListWorkflowExecutionsView.vue +++ b/src/views/workflows/ListWorkflowExecutionsView.vue @@ -2,7 +2,6 @@ import FontAwesomeIcon from "@/components/FontAwesomeIcon.vue"; import { onMounted, reactive, computed, onUnmounted } from "vue"; import type { WorkflowExecutionOut } from "@/client/workflow"; -import { WorkflowExecutionStatus } from "@/client/workflow"; import dayjs from "dayjs"; import { Tooltip } from "bootstrap"; import DeleteModal from "@/components/modals/DeleteModal.vue"; @@ -78,32 +77,9 @@ const deleteModalString = computed<string>(() => { // Functions // ----------------------------------------------------------------------------- function updateExecutions() { - executionRepository - .fetchExecutions(() => { - executionsState.loading = false; - }) - .then((executions) => { - Promise.all( - executions - .filter((executions) => executions.workflow_id) - .filter( - // filter executions with unique workflow ids - (execution, index, array) => - array.findIndex( - (val) => val.workflow_id === execution.workflow_id, - ) === index, - ) - .filter( - (execution) => - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - workflowRepository.getName(execution.workflow_id!) == undefined, - ) - .map((execution) => - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - workflowRepository.fetchWorkflow(execution.workflow_id!), - ), - ); - }); + executionRepository.fetchExecutions(() => { + executionsState.loading = false; + }); } function refreshExecutions() { @@ -113,20 +89,8 @@ function refreshExecutions() { }, 500); } -function workflowExecutionDeletable(status: WorkflowExecutionStatus): boolean { - return [ - WorkflowExecutionStatus.ERROR, - WorkflowExecutionStatus.CANCELED, - WorkflowExecutionStatus.SUCCESS, - ].includes(status); -} - -function workflowExecutionCancelable(status: WorkflowExecutionStatus): boolean { - return [ - WorkflowExecutionStatus.RUNNING, - WorkflowExecutionStatus.PENDING, - WorkflowExecutionStatus.SCHEDULED, - ].includes(status); +function workflowExecutionCancelable(execution: WorkflowExecutionOut): boolean { + return execution.end_time == undefined; } function deleteWorkflowExecution(executionId?: string) { @@ -142,7 +106,7 @@ function cancelWorkflowExecution(executionId: string) { function refreshRunningWorkflowExecution() { Promise.all( executionRepository.executions - .filter((execution) => workflowExecutionCancelable(execution.status)) + .filter((execution) => workflowExecutionCancelable(execution)) .map((execution) => executionRepository.fetchExecution(execution.execution_id), ), @@ -151,6 +115,7 @@ function refreshRunningWorkflowExecution() { onMounted(() => { updateExecutions(); + workflowRepository.fetchWorkflows(); intervalId = setInterval(refreshRunningWorkflowExecution, 5000); new Tooltip("#refreshExecutionsButton"); }); @@ -293,7 +258,7 @@ onUnmounted(() => { <span class="visually-hidden">Toggle Dropdown</span> </button> <ul class="dropdown-menu dropdown-menu"> - <li v-if="workflowExecutionCancelable(execution.status)"> + <li v-if="workflowExecutionCancelable(execution)"> <button class="dropdown-item text-danger align-middle" type="button" @@ -303,7 +268,7 @@ onUnmounted(() => { <span class="ms-1">Cancel</span> </button> </li> - <li v-if="workflowExecutionDeletable(execution.status)"> + <li v-if="!workflowExecutionCancelable(execution)"> <button class="dropdown-item text-danger align-middle" type="button"