This commit is contained in:
j3d1 2026-07-23 05:17:44 +02:00
parent 796fef81be
commit 7df585d774
11 changed files with 246 additions and 72 deletions

View file

@ -10,10 +10,10 @@
<li class="breadcrumb-item">
<router-link to="/workflows" class="text-decoration-none">Workflows</router-link>
</li>
<li class="breadcrumb-item active" aria-current="page">{{ workflowInstance?.workflow_type || 'Loading...' }}</li>
<li class="breadcrumb-item active" aria-current="page">{{ workflowDefinition?.name || workflowInstance?.name || 'Loading...' }}</li>
</ol>
</nav>
<h1 class="h3 mb-0">{{ workflowInstance?.workflow_type || 'Workflow Detail' }}</h1>
<h1 class="h3 mb-0">{{ workflowDefinition?.name || workflowInstance?.name || 'Workflow Detail' }}</h1>
</div>
<div class="btn-group" role="group">
<button class="btn btn-outline-secondary" @click="$router.go(-1)">
@ -236,8 +236,9 @@ export default {
},
workflowDefinition() {
if (!this.workflowInstance?.workflow_type) return null;
return workflowRegistry.get(this.workflowInstance.workflow_type);
// `name` doubles as the workflow type identifier (e.g. 'import-items').
if (!this.workflowInstance?.name) return null;
return workflowRegistry.get(this.workflowInstance.name);
},
stepDefinitions() {
@ -258,8 +259,7 @@ export default {
stepComponent() {
// Return step-specific component if it exists using the component registry
const workflowType = this.workflowInstance?.workflow_type;
console.log('Determining step component for workflow type:', this.workflowInstance, 'and step:', this.currentStep);
const workflowType = this.workflowInstance?.name;
if (workflowType && this.currentStep) {
return getStepComponent(workflowType, this.currentStep);
}
@ -467,7 +467,7 @@ export default {
hasStepComponent(stepNumber) {
// Check if a specific step has a custom component available
const workflowType = this.workflowInstance?.workflow_type;
const workflowType = this.workflowInstance?.name;
return workflowType ? hasStepComponent(workflowType, stepNumber) : false;
}
}

View file

@ -27,7 +27,7 @@
<tbody>
<tr v-for="workflow in activeWorkflows" :key="workflow.id">
<td>
<strong>{{ workflow.workflow_type }}</strong>
<strong>{{ getWorkflowDisplayName(workflow) }}</strong>
<br>
<small class="text-muted">{{ workflow.payload?.workflow_config?.category || 'System' }}</small>
</td>
@ -215,10 +215,14 @@ export default {
},
isWorkflowRunning(workflowId) {
return this.activeWorkflows.some(active =>
active.workflow_type === workflowId &&
active.name === workflowId &&
active.state === 'running'
);
},
getWorkflowDisplayName(workflow) {
// `name` doubles as the workflow type identifier (e.g. 'import-items').
return workflowRegistry.get(workflow.name)?.name || workflow.name;
},
async startWorkflow(workflow) {
try {
this.loading = true;
@ -266,16 +270,17 @@ export default {
});
},
async abortWorkflowInstance(workflow) {
if (confirm(`Are you sure you want to abort "${workflow.workflow_type}"?`)) {
const displayName = this.getWorkflowDisplayName(workflow);
if (confirm(`Are you sure you want to abort "${displayName}"?`)) {
try {
this.loading = true;
this.error = null;
await this.deleteWorkflow(workflow.id);
await this.loadActiveWorkflows();
console.log('Workflow aborted successfully:', workflow.workflow_type);
console.log('Workflow aborted successfully:', displayName);
} catch (error) {
console.error('Error aborting workflow:', error);
this.error = `Failed to abort ${workflow.workflow_type}`;
this.error = `Failed to abort ${displayName}`;
} finally {
this.loading = false;
}