Skip to content

Commit d068b83

Browse files
authored
Feat: add duplicate workflow on sidebar (#4895)
1 parent 1cf8087 commit d068b83

File tree

10 files changed

+43
-8
lines changed

10 files changed

+43
-8
lines changed

browser_tests/tests/sidebar/workflows.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,25 @@ test.describe('Workflows sidebar', () => {
317317
])
318318
})
319319

320+
test('Can duplicate workflow from context menu', async ({ comfyPage }) => {
321+
await comfyPage.setupWorkflowsDirectory({
322+
'workflow1.json': 'default.json'
323+
})
324+
325+
const { workflowsTab } = comfyPage.menu
326+
await workflowsTab.open()
327+
328+
await workflowsTab
329+
.getPersistedItem('workflow1.json')
330+
.click({ button: 'right' })
331+
await comfyPage.clickContextMenuItem('Duplicate')
332+
333+
expect(await workflowsTab.getOpenedWorkflowNames()).toEqual([
334+
'*Unsaved Workflow.json',
335+
'*workflow1 (Copy).json'
336+
])
337+
})
338+
320339
test('Can drop workflow from workflows sidebar', async ({ comfyPage }) => {
321340
await comfyPage.setupWorkflowsDirectory({
322341
'workflow1.json': 'default.json'

src/components/sidebar/tabs/WorkflowsSidebarTab.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,14 @@ const renderTreeNode = (
265265
const workflow = node.data
266266
await workflowService.insertWorkflow(workflow)
267267
}
268+
},
269+
{
270+
label: t('g.duplicate'),
271+
icon: 'pi pi-file-export',
272+
command: async () => {
273+
const workflow = node.data
274+
await workflowService.duplicateWorkflow(workflow)
275+
}
268276
}
269277
]
270278
},

src/locales/en/main.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@
145145
"stopRecording": "Stop Recording",
146146
"micPermissionDenied": "Microphone permission denied",
147147
"noAudioRecorded": "No audio recorded",
148-
"nodesRunning": "nodes running"
148+
"nodesRunning": "nodes running",
149+
"duplicate": "Duplicate"
149150
},
150151
"manager": {
151152
"title": "Custom Nodes Manager",

src/locales/es/main.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@
402402
"versionMismatchWarning": "Advertencia de compatibilidad de versión",
403403
"versionMismatchWarningMessage": "{warning}: {detail} Visita https://docs.comfy.org/installation/update_comfyui#common-update-issues para obtener instrucciones de actualización.",
404404
"videoFailedToLoad": "Falló la carga del video",
405-
"workflow": "Flujo de trabajo"
405+
"workflow": "Flujo de trabajo",
406+
"duplicate": "Duplicar"
406407
},
407408
"graphCanvasMenu": {
408409
"fitView": "Ajustar vista",

src/locales/fr/main.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@
402402
"versionMismatchWarning": "Avertissement de compatibilité de version",
403403
"versionMismatchWarningMessage": "{warning} : {detail} Consultez https://docs.comfy.org/installation/update_comfyui#common-update-issues pour les instructions de mise à jour.",
404404
"videoFailedToLoad": "Échec du chargement de la vidéo",
405-
"workflow": "Flux de travail"
405+
"workflow": "Flux de travail",
406+
"duplicate": "Dupliquer"
406407
},
407408
"graphCanvasMenu": {
408409
"fitView": "Adapter la vue",

src/locales/ja/main.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@
402402
"versionMismatchWarning": "バージョン互換性の警告",
403403
"versionMismatchWarningMessage": "{warning}: {detail} 更新手順については https://docs.comfy.org/installation/update_comfyui#common-update-issues をご覧ください。",
404404
"videoFailedToLoad": "ビデオの読み込みに失敗しました",
405-
"workflow": "ワークフロー"
405+
"workflow": "ワークフロー",
406+
"duplicate": "複製"
406407
},
407408
"graphCanvasMenu": {
408409
"fitView": "ビューに合わせる",

src/locales/ko/main.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@
402402
"versionMismatchWarning": "버전 호환성 경고",
403403
"versionMismatchWarningMessage": "{warning}: {detail} 업데이트 지침은 https://docs.comfy.org/installation/update_comfyui#common-update-issues 를 방문하세요.",
404404
"videoFailedToLoad": "비디오를 로드하지 못했습니다.",
405-
"workflow": "워크플로"
405+
"workflow": "워크플로",
406+
"duplicate": "복제"
406407
},
407408
"graphCanvasMenu": {
408409
"fitView": "보기 맞춤",

src/locales/ru/main.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@
402402
"versionMismatchWarning": "Предупреждение о несовместимости версий",
403403
"versionMismatchWarningMessage": "{warning}: {detail} Посетите https://docs.comfy.org/installation/update_comfyui#common-update-issues для инструкций по обновлению.",
404404
"videoFailedToLoad": "Не удалось загрузить видео",
405-
"workflow": "Рабочий процесс"
405+
"workflow": "Рабочий процесс",
406+
"duplicate": "Дублировать"
406407
},
407408
"graphCanvasMenu": {
408409
"fitView": "Подгонять под выделенные",

src/locales/zh-TW/main.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@
402402
"versionMismatchWarning": "版本相容性警告",
403403
"versionMismatchWarningMessage": "{warning}:{detail} 請參閱 https://docs.comfy.org/installation/update_comfyui#common-update-issues 以取得更新說明。",
404404
"videoFailedToLoad": "無法載入影片",
405-
"workflow": "工作流程"
405+
"workflow": "工作流程",
406+
"duplicate": "複製"
406407
},
407408
"graphCanvasMenu": {
408409
"fitView": "適合視窗",

src/locales/zh/main.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@
402402
"versionMismatchWarning": "版本相容性警告",
403403
"versionMismatchWarningMessage": "{warning}:{detail} 請參閱 https://docs.comfy.org/installation/update_comfyui#common-update-issues 以取得更新說明。",
404404
"videoFailedToLoad": "视频加载失败",
405-
"workflow": "工作流"
405+
"workflow": "工作流",
406+
"duplicate": "复制"
406407
},
407408
"graphCanvasMenu": {
408409
"fitView": "适应视图",

0 commit comments

Comments
 (0)