This commit is contained in:
j3d1 2026-08-01 22:20:45 +02:00
parent cfcc2c15d3
commit 4f2fe011c0
28 changed files with 3499 additions and 2922 deletions

View file

@ -128,7 +128,7 @@
import * as BIcons from "bootstrap-icons-vue";
import BaseLayout from "@/components/BaseLayout.vue";
import { mapState, mapActions } from 'vuex';
import { workflowRegistry } from '@/workflows.js';
import { getAllWorkflows, getWorkflow, buildWorkflowApiPayload } from '@/workflows.js';
export default {
name: 'Workflows',
@ -148,7 +148,7 @@ export default {
return this.active_workflows;
},
availableWorkflows() {
return workflowRegistry.getAll();
return getAllWorkflows();
}
},
async mounted() {
@ -221,22 +221,22 @@ export default {
},
getWorkflowDisplayName(workflow) {
// `name` doubles as the workflow type identifier (e.g. 'import-items').
return workflowRegistry.get(workflow.name)?.name || workflow.name;
return getWorkflow(workflow.name)?.name || workflow.name;
},
async startWorkflow(workflow) {
try {
this.loading = true;
this.error = null;
// Use the workflow's toApiFormat method to get properly formatted data
const workflowData = workflow.toApiFormat();
// Build the properly formatted data to start this workflow
const workflowData = buildWorkflowApiPayload(workflow);
const newWorkflow = await this.createWorkflow(workflowData);
console.log('Workflow started successfully:', newWorkflow);
// Immediately navigate to the workflow detail view
// Get the first step from the workflow definition
const firstStep = workflow.getStepDefinitions()?.[0]?.step || "initial";
const firstStep = workflow.stepDefinitions?.[0]?.step || "initial";
this.$router.push({
name: 'workflow-detail',
params: {
@ -258,7 +258,7 @@ export default {
// Use the workflow's current step if available, otherwise use the first step
const currentStep = workflow.current_step ||
workflow.payload?.current_step ||
workflow.getStepDefinitions?.()?.[0]?.step ||
getWorkflow(workflow.name)?.stepDefinitions?.[0]?.step ||
"initial";
this.$router.push({