Skip to content

Commit 74b61ec

Browse files
authored
feat: Add dropdown list for additional tabs (#5046)
* feat: Add dropdown list for additional tabs * fix: workflow menu and tabs styles
1 parent 8646ca4 commit 74b61ec

File tree

3 files changed

+57
-2
lines changed

3 files changed

+57
-2
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<template>
2+
<div>
3+
<Button
4+
v-tooltip="{ value: $t('g.moreWorkflows'), showDelay: 300 }"
5+
class="rounded-none"
6+
icon="pi pi-ellipsis-h"
7+
text
8+
severity="secondary"
9+
:aria-label="$t('g.moreWorkflows')"
10+
@click="menu?.toggle($event)"
11+
/>
12+
<Menu
13+
ref="menu"
14+
:model="menuItems"
15+
:popup="true"
16+
class="max-h-[40vh] overflow-auto"
17+
/>
18+
</div>
19+
</template>
20+
21+
<script setup lang="ts">
22+
import Button from 'primevue/button'
23+
import Menu from 'primevue/menu'
24+
import { computed, ref } from 'vue'
25+
26+
import { useWorkflowService } from '@/services/workflowService'
27+
import type { ComfyWorkflow } from '@/stores/workflowStore'
28+
29+
const props = defineProps<{
30+
workflows: ComfyWorkflow[]
31+
activeWorkflow: ComfyWorkflow | null
32+
}>()
33+
34+
const menu = ref<InstanceType<typeof Menu> | null>(null)
35+
const workflowService = useWorkflowService()
36+
37+
const menuItems = computed(() =>
38+
props.workflows.map((workflow: ComfyWorkflow) => ({
39+
label: workflow.filename,
40+
icon:
41+
props.activeWorkflow?.key === workflow.key ? 'pi pi-check' : undefined,
42+
command: () => {
43+
void workflowService.openWorkflow(workflow)
44+
}
45+
}))
46+
)
47+
</script>

src/components/topbar/WorkflowTabs.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
ref="scrollPanelRef"
1717
class="overflow-hidden no-drag"
1818
:pt:content="{
19-
class: 'p-0 w-full',
19+
class: 'p-0 w-full flex',
2020
onwheel: handleWheel
2121
}"
2222
pt:bar-x="h-1"
@@ -48,6 +48,11 @@
4848
:disabled="!rightArrowEnabled"
4949
@mousedown="whileMouseDown($event, () => scroll(1))"
5050
/>
51+
<WorkflowOverflowMenu
52+
v-if="showOverflowArrows"
53+
:workflows="workflowStore.openWorkflows"
54+
:active-workflow="workflowStore.activeWorkflow"
55+
/>
5156
<Button
5257
v-tooltip="{ value: $t('sideToolbar.newBlankWorkflow'), showDelay: 300 }"
5358
class="new-blank-workflow-button flex-shrink-0 no-drag rounded-none"
@@ -85,6 +90,8 @@ import { useWorkspaceStore } from '@/stores/workspaceStore'
8590
import { isElectron } from '@/utils/envUtil'
8691
import { whileMouseDown } from '@/utils/mouseDownUtil'
8792
93+
import WorkflowOverflowMenu from './WorkflowOverflowMenu.vue'
94+
8895
interface WorkflowOption {
8996
value: string
9097
workflow: ComfyWorkflow

src/locales/en/main.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@
148148
"micPermissionDenied": "Microphone permission denied",
149149
"noAudioRecorded": "No audio recorded",
150150
"nodesRunning": "nodes running",
151-
"duplicate": "Duplicate"
151+
"duplicate": "Duplicate",
152+
"moreWorkflows": "More workflows"
152153
},
153154
"manager": {
154155
"title": "Custom Nodes Manager",

0 commit comments

Comments
 (0)