clear workflow state on close

This commit is contained in:
pythongosssss
2026-03-17 09:57:24 -07:00
parent 49e052ef97
commit 89e634d431
2 changed files with 20 additions and 2 deletions

View File

@@ -56,9 +56,10 @@ vi.mock('@/composables/useWorkflowActionsMenu', () => ({
})
}))
const mockCloseWorkflow = vi.fn().mockResolvedValue(true)
vi.mock('@/platform/workflow/core/services/workflowService', () => ({
useWorkflowService: () => ({
closeWorkflow: vi.fn()
closeWorkflow: mockCloseWorkflow
})
}))
@@ -120,7 +121,10 @@ function mountTab({
i18n
],
stubs: {
WorkflowActionsList: true
WorkflowActionsList: true,
Button: {
template: '<button v-bind="$attrs"><slot /></button>'
}
}
},
props: {
@@ -205,4 +209,16 @@ describe('WorkflowTab - job state indicator', () => {
'/workflows/test.json'
)
})
it('clears workflow status when close succeeds', async () => {
mockCloseWorkflow.mockResolvedValue(true)
const wrapper = mountTab()
await wrapper.find('button[aria-label="Close"]').trigger('click')
expect(mockCloseWorkflow).toHaveBeenCalled()
expect(mockExecutionStore.clearWorkflowStatus).toHaveBeenCalledWith(
'/workflows/test.json'
)
})
})

View File

@@ -233,6 +233,8 @@ const closeWorkflows = async (options: WorkflowOption[]) => {
// User clicked cancel
break
}
const path = opt.workflow.path
if (path) executionStore.clearWorkflowStatus(path)
}
}