From 21e046dd50aceb9055d4fe11371394f3dcb43ed2 Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Wed, 21 Dec 2022 11:08:37 +0100 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=90=9B=20Only=20add=20current=20workf?= =?UTF-8?q?low=20executions=20to=20to=20store=20when=20loading=20execution?= =?UTF-8?q?s=20from=20global=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-ui/src/stores/workflows.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor-ui/src/stores/workflows.ts b/packages/editor-ui/src/stores/workflows.ts index 28452d8a4759e..01a4d7bcd13f3 100644 --- a/packages/editor-ui/src/stores/workflows.ts +++ b/packages/editor-ui/src/stores/workflows.ts @@ -947,7 +947,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, { addToCurrentExecutions(executions: IExecutionsSummary[]): void { executions.forEach(execution => { const exists = this.currentWorkflowExecutions.find(ex => ex.id === execution.id); - if (!exists) { + if (!exists && execution.workflowId === this.workflowId) { this.currentWorkflowExecutions.push(execution); } }); From d9bee4fd2d23b898b042ba6235ffa5bb02df488f Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Wed, 21 Dec 2022 11:27:28 +0100 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=90=9B=20Fixing=20infinite=20scroll?= =?UTF-8?q?=20on=20executions=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-ui/src/stores/workflows.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor-ui/src/stores/workflows.ts b/packages/editor-ui/src/stores/workflows.ts index 01a4d7bcd13f3..f9bd865ac04cf 100644 --- a/packages/editor-ui/src/stores/workflows.ts +++ b/packages/editor-ui/src/stores/workflows.ts @@ -935,7 +935,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, { requestFilter, ); } - // context.commit('setTotalFinishedExecutionsCount', finishedExecutions.count); + this.finishedExecutionsCount = finishedExecutions.count; return [...activeExecutions, ...(finishedExecutions.results || [])]; } catch (error) { throw error; From d0fe3c01bb1200bd98c1d0086b72f0ca424e6163 Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Wed, 21 Dec 2022 11:49:41 +0100 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=90=9B=20Fixing=20global=20and=20curr?= =?UTF-8?q?ent=20executions=20list=20sync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/ExecutionsView/ExecutionsView.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue b/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue index 7594bc0d68059..5172d5422056f 100644 --- a/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue +++ b/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue @@ -174,7 +174,13 @@ export default mixins( const shouldUpdate = workflowUpdated && !onNewWorkflow; await this.initView(shouldUpdate); if (!shouldUpdate) { - await this.setExecutions(); + if (this.workflowsStore.currentWorkflowExecutions.length > 0) { + const workflowExecutions = await this.loadExecutions(); + this.workflowsStore.addToCurrentExecutions(workflowExecutions); + this.setActiveExecution(); + } else { + await this.setExecutions(); + } } this.loading = false; }, From 6f0e2f8e4e97fa275feeb67764c1245c3169c671 Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Wed, 21 Dec 2022 13:34:20 +0100 Subject: [PATCH 4/6] =?UTF-8?q?=E2=9A=A1=20Resetting=20executions=20list?= =?UTF-8?q?=20when=20opening=20new=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-ui/src/views/NodeView.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 169f7717b86c5..89912870c5c60 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -940,6 +940,7 @@ export default mixins( this.canvasStore.zoomToFit(); this.$externalHooks().run('workflow.open', { workflowId, workflowName: data.name }); this.workflowsStore.activeWorkflowExecution = null; + this.workflowsStore.currentWorkflowExecutions = []; this.stopLoading(); return data; }, From fd2d316cc8906d1be1d69758399ebe1fa066a928 Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Wed, 21 Dec 2022 14:36:55 +0100 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=90=9B=20Handling=20opening=20executi?= =?UTF-8?q?on=20from=20global=20list=20before=20opening=20a=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-ui/src/components/ExecutionsList.vue | 10 ++++++++-- .../src/components/ExecutionsView/ExecutionsView.vue | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/components/ExecutionsList.vue b/packages/editor-ui/src/components/ExecutionsList.vue index d9679116933c4..34414b117e5bf 100644 --- a/packages/editor-ui/src/components/ExecutionsList.vue +++ b/packages/editor-ui/src/components/ExecutionsList.vue @@ -273,7 +273,7 @@ import WorkflowActivator from '@/components/WorkflowActivator.vue'; import Modal from '@/components/Modal.vue'; import { externalHooks } from '@/mixins/externalHooks'; -import { WAIT_TIME_UNLIMITED, EXECUTIONS_MODAL_KEY, VIEWS } from '@/constants'; +import { WAIT_TIME_UNLIMITED, EXECUTIONS_MODAL_KEY, VIEWS, PLACEHOLDER_EMPTY_WORKFLOW_ID } from '@/constants'; import { restApi } from '@/mixins/restApi'; import { genericHelpers } from '@/mixins/genericHelpers'; @@ -434,7 +434,13 @@ export default mixins(externalHooks, genericHelpers, restApi, showMessage).exten this.modalBus.$emit('close'); }, convertToDisplayDate, - displayExecution(execution: IExecutionShortResponse, e: PointerEvent) { + displayExecution(execution: IExecutionsSummary, e: PointerEvent) { + if (!this.workflowsStore.workflowId || this.workflowsStore.workflowId === PLACEHOLDER_EMPTY_WORKFLOW_ID || execution.workflowId !== this.workflowsStore.workflowId) { + const workflowExecutions: IExecutionsSummary[] = this.combinedExecutions.filter(ex => ex.workflowId === execution.workflowId); + this.workflowsStore.currentWorkflowExecutions = workflowExecutions; + this.workflowsStore.activeWorkflowExecution = execution; + } + if (e.metaKey || e.ctrlKey) { const route = this.$router.resolve({ name: VIEWS.EXECUTION_PREVIEW, diff --git a/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue b/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue index 5172d5422056f..909e88917c298 100644 --- a/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue +++ b/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue @@ -192,7 +192,9 @@ export default mixins( } await this.openWorkflow(this.$route.params.name); this.uiStore.nodeViewInitialized = false; - this.setExecutions(); + if(this.workflowsStore.currentWorkflowExecutions.length === 0) { + this.setExecutions(); + } if (this.activeExecution) { this.$router .push({ From d6e648ddc9cf7d16338fd0271cb9bcc2ef04a8f7 Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Thu, 22 Dec 2022 10:45:03 +0100 Subject: [PATCH 6/6] =?UTF-8?q?=E2=9A=A1=20Scrolling=20to=20active=20execu?= =?UTF-8?q?tion=20card=20if=20out=20of=20view,=20keeping=20selected=20exec?= =?UTF-8?q?ution=20after=20workflow=20load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExecutionsView/ExecutionsSidebar.vue | 17 ++++++++++++++++- packages/editor-ui/src/views/NodeView.vue | 11 +++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/components/ExecutionsView/ExecutionsSidebar.vue b/packages/editor-ui/src/components/ExecutionsView/ExecutionsSidebar.vue index 966d67fc9137e..f78d77ffe0868 100644 --- a/packages/editor-ui/src/components/ExecutionsView/ExecutionsSidebar.vue +++ b/packages/editor-ui/src/components/ExecutionsView/ExecutionsSidebar.vue @@ -71,6 +71,7 @@ v-for="execution in executions" :key="execution.id" :execution="execution" + :ref="`execution-${execution.id}`" @refresh="onRefresh" @retryExecution="onRetryExecution" /> @@ -95,6 +96,7 @@ import Vue from 'vue'; import { PropType } from 'vue'; import { mapStores } from 'pinia'; import { useUIStore } from '@/stores/ui'; +import { useWorkflowsStore } from '@/stores/workflows'; export default Vue.extend({ name: 'executions-sidebar', @@ -127,7 +129,7 @@ export default Vue.extend({ }; }, computed: { - ...mapStores(useUIStore), + ...mapStores(useUIStore, useWorkflowsStore), statusFilterApplied(): boolean { return this.filter.status !== ''; }, @@ -153,6 +155,7 @@ export default Vue.extend({ if (this.autoRefresh) { this.autoRefreshInterval = setInterval(() => this.onRefresh(), 4000); } + this.scrollToActiveCard(); }, beforeDestroy() { if (this.autoRefreshInterval) { @@ -206,6 +209,18 @@ export default Vue.extend({ status: this.filter.status, }; }, + scrollToActiveCard(): void { + const executionsList = this.$refs.executionList as HTMLElement; + const currentExecutionCard = this.$refs[`execution-${this.workflowsStore.activeWorkflowExecution?.id}`] as Vue[]; + + if (executionsList && currentExecutionCard && this.workflowsStore.activeWorkflowExecution) { + const cardElement = currentExecutionCard[0].$el as HTMLElement; + const cardRect = cardElement.getBoundingClientRect(); + if (cardRect.top > executionsList.offsetHeight) { + executionsList.scrollTo({ top: cardRect.top }); + } + } + }, }, }); diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 89912870c5c60..3f0d5a5820beb 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -884,6 +884,9 @@ export default mixins( }, async openWorkflow(workflowId: string) { this.startLoading(); + + const selectedExecution = this.workflowsStore.activeWorkflowExecution; + this.resetWorkspace(); let data: IWorkflowDb | undefined; try { @@ -939,8 +942,12 @@ export default mixins( } this.canvasStore.zoomToFit(); this.$externalHooks().run('workflow.open', { workflowId, workflowName: data.name }); - this.workflowsStore.activeWorkflowExecution = null; - this.workflowsStore.currentWorkflowExecutions = []; + if (selectedExecution?.workflowId !== workflowId) { + this.workflowsStore.activeWorkflowExecution = null; + this.workflowsStore.currentWorkflowExecutions = []; + } else { + this.workflowsStore.activeWorkflowExecution = selectedExecution; + } this.stopLoading(); return data; },