Line data Source code
1 : <template>
2 36 : <div class="shrink-0 self-center">
3 : <Menu :items="menuItems" max-height="viewport">
4 : <template #trigger>
5 : <Button
6 : :tooltip="$t('g.moreWorkflows')"
7 : variant="muted-textonly"
8 : size="icon"
9 : :aria-label="$t('g.moreWorkflows')"
10 : icon="icon-[lucide--ellipsis]"
11 : />
12 : </template>
13 : <template #item="{ item }">
14 : <i v-if="item.icon" :class="item.icon" />
15 : <WorkflowAgentTargetIndicator
16 : v-if="item.key"
17 : :workflow-path="item.key"
18 : />
19 : <span>{{ item.label }}</span>
20 : </template>
21 : </Menu>
22 : </div>
23 : </template>
24 :
25 : <script setup lang="ts">
26 : import { computed } from 'vue'
27 :
28 : import Button from '@comfyorg/design-system/button/Button'
29 : import Menu from '@comfyorg/design-system/menu/Menu'
30 : import { useWorkflowService } from '@/platform/workflow/core/services/workflowService'
31 : import type { ComfyWorkflow } from '@/platform/workflow/management/stores/workflowStore'
32 :
33 : import WorkflowAgentTargetIndicator from './WorkflowAgentTargetIndicator.vue'
34 :
35 6 : const props = defineProps<{
36 : workflows: ComfyWorkflow[]
37 : activeWorkflow: ComfyWorkflow | null
38 : }>()
39 :
40 6 : const workflowService = useWorkflowService()
41 :
42 6 : const menuItems = computed(() =>
43 : props.workflows.map((workflow: ComfyWorkflow) => ({
44 : label: workflow.filename,
45 : key: workflow.path,
46 : icon:
47 : props.activeWorkflow?.key === workflow.key
48 : ? 'icon-[lucide--check]'
49 : : undefined,
50 : command: () => {
51 1 : void workflowService.openWorkflow(workflow, { initiator: 'user' })
52 : }
53 : }))
54 : )
55 : </script>
|