Add source prop to commands (#3429)

Co-authored-by: Benjamin Lu <templu1107@proton.me>
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Benjamin Lu
2025-04-12 21:20:53 -04:00
committed by GitHub
parent c8b8953e0a
commit b22713daf0
12 changed files with 35 additions and 9 deletions

View File

@@ -71,6 +71,13 @@
<span v-else>-</span>
</template>
</Column>
<Column field="source" :header="$t('g.source')">
<template #body="slotProps">
<span class="overflow-hidden text-ellipsis">{{
slotProps.data.source || '-'
}}</span>
</template>
</Column>
</DataTable>
<Dialog
@@ -160,6 +167,7 @@ interface ICommandData {
id: string
keybinding: KeybindingImpl | null
label: string
source?: string
}
const commandsData = computed<ICommandData[]>(() => {
@@ -169,7 +177,8 @@ const commandsData = computed<ICommandData[]>(() => {
`commands.${normalizeI18nKey(command.id)}.label`,
command.label ?? ''
),
keybinding: keybindingStore.getKeybindingByCommandId(command.id)
keybinding: keybindingStore.getKeybindingByCommandId(command.id),
source: command.source
}))
})

View File

@@ -55,7 +55,9 @@ export function useCoreCommands(): ComfyCommand[] {
})
}
return [
const commonProps = { source: 'System' }
const commands = [
{
id: 'Comfy.NewBlankWorkflow',
icon: 'pi pi-plus',
@@ -616,4 +618,6 @@ export function useCoreCommands(): ComfyCommand[] {
}
}
]
return commands.map((command) => ({ ...command, ...commonProps }))
}

View File

@@ -94,6 +94,7 @@
"name": "Name",
"category": "Category",
"sort": "Sort",
"source": "Source",
"filter": "Filter",
"apply": "Apply",
"enabled": "Enabled",

View File

@@ -215,6 +215,7 @@
"settings": "Configuraciones",
"showReport": "Mostrar informe",
"sort": "Ordenar",
"source": "Fuente",
"status": "Estado",
"success": "Éxito",
"systemInfo": "Información del sistema",

View File

@@ -215,6 +215,7 @@
"settings": "Paramètres",
"showReport": "Afficher le rapport",
"sort": "Trier",
"source": "Source",
"status": "Statut",
"success": "Succès",
"systemInfo": "Informations système",

View File

@@ -215,6 +215,7 @@
"settings": "設定",
"showReport": "レポートを表示",
"sort": "並び替え",
"source": "ソース",
"status": "ステータス",
"success": "成功",
"systemInfo": "システム情報",

View File

@@ -215,6 +215,7 @@
"settings": "설정",
"showReport": "보고서 보기",
"sort": "정렬",
"source": "소스",
"status": "상태",
"success": "성공",
"systemInfo": "시스템 정보",

View File

@@ -215,6 +215,7 @@
"settings": "Настройки",
"showReport": "Показать отчёт",
"sort": "Сортировать",
"source": "Источник",
"status": "Статус",
"success": "Успех",
"systemInfo": "Информация о системе",

View File

@@ -215,6 +215,7 @@
"settings": "设置",
"showReport": "显示报告",
"sort": "排序",
"source": "来源",
"status": "状态",
"success": "成功",
"systemInfo": "系统信息",

View File

@@ -13,11 +13,10 @@ export interface ComfyCommand {
label?: string | (() => string)
icon?: string | (() => string)
tooltip?: string | (() => string)
/** Menubar item label, if different from command label */
menubarLabel?: string | (() => string)
menubarLabel?: string | (() => string) // Menubar item label, if different from command label
versionAdded?: string
/** If non-nullish, this command will prompt for confirmation. */
confirmation?: string
confirmation?: string // If non-nullish, this command will prompt for confirmation
source?: string
}
export class ComfyCommandImpl implements ComfyCommand {
@@ -29,6 +28,7 @@ export class ComfyCommandImpl implements ComfyCommand {
_menubarLabel?: string | (() => string)
versionAdded?: string
confirmation?: string
source?: string
constructor(command: ComfyCommand) {
this.id = command.id
@@ -39,6 +39,7 @@ export class ComfyCommandImpl implements ComfyCommand {
this._menubarLabel = command.menubarLabel ?? command.label
this.versionAdded = command.versionAdded
this.confirmation = command.confirmation
this.source = command.source
}
get label() {
@@ -105,7 +106,10 @@ export const useCommandStore = defineStore('command', () => {
const loadExtensionCommands = (extension: ComfyExtension) => {
if (extension.commands) {
for (const command of extension.commands) {
registerCommand(command)
registerCommand({
...command,
source: extension.name
})
}
}
}

View File

@@ -49,7 +49,8 @@ export const useBottomPanelStore = defineStore('bottomPanel', () => {
id: `Workspace.ToggleBottomPanelTab.${tab.id}`,
icon: 'pi pi-list',
label: `Toggle ${tab.title} Bottom Panel`,
function: () => toggleBottomPanelTab(tab.id)
function: () => toggleBottomPanelTab(tab.id),
source: 'System'
})
}

View File

@@ -33,7 +33,8 @@ export const useSidebarTabStore = defineStore('sidebarTab', () => {
versionAdded: '1.3.9',
function: () => {
toggleSidebarTab(tab.id)
}
},
source: 'System'
})
}