diff --git a/web_src/js/components/projects/ProjectWorkflow.vue b/web_src/js/components/projects/ProjectWorkflow.vue index 72a0111451..75af557b83 100644 --- a/web_src/js/components/projects/ProjectWorkflow.vue +++ b/web_src/js/components/projects/ProjectWorkflow.vue @@ -249,15 +249,6 @@ const getFilterDescription = (workflow) => { return descriptions.length > 0 ? ` (${descriptions.join(', ')})` : ''; }; -// Get display name with filters -const getWorkflowDisplayName = (workflow) => { - const baseName = workflow.display_name || workflow.workflow_event || workflow.event_id; - if (isWorkflowConfigured(workflow)) { - return baseName + getFilterDescription(workflow); - } - return baseName; -}; - // Get flat list of all workflows - use cached data to prevent frequent recomputation const workflowList = computed(() => { // Use a stable reference to prevent unnecessary DOM updates @@ -270,7 +261,7 @@ const workflowList = computed(() => { ...workflow, isConfigured: isWorkflowConfigured(workflow), base_event_type: workflow.base_event_type || workflow.workflow_event || workflow.event_id, - display_name: getWorkflowDisplayName(workflow), + display_name: workflow.display_name || workflow.workflow_event || workflow.event_id, })); }); @@ -381,6 +372,32 @@ const isItemSelected = (item) => { return store.selectedItem === item.base_event_type; }; +// Get display name for workflow with numbering for same types +const getWorkflowDisplayName = (item, index) => { + const list = workflowList.value; + const baseEventType = item.base_event_type || item.workflow_event; + + // Find all workflows of the same type + const sameTypeWorkflows = list.filter(w => + (w.base_event_type || w.workflow_event) === baseEventType && + (w.isConfigured || w.id === 0) // Only count configured workflows + ); + + // If there's only one of this type, return the display name as-is + if (sameTypeWorkflows.length <= 1) { + return item.display_name; + } + + // Find the index of this workflow among same-type workflows + const sameTypeIndex = sameTypeWorkflows.findIndex(w => w.event_id === item.event_id); + + // Extract base name without filter summary (remove anything in parentheses) + const baseName = item.display_name.replace(/\s*\([^)]*\)\s*$/g, ''); + + // Add numbering + return `${baseName} #${sameTypeIndex + 1}`; +}; + // Toggle label selection for add_labels, remove_labels, or filter_labels const toggleLabel = (type, labelId) => { let labels; @@ -565,7 +582,7 @@ onUnmounted(() => {