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> <span v-else>-</span>
</template> </template>
</Column> </Column>
<Column field="source" :header="$t('g.source')">
<template #body="slotProps">
<span class="overflow-hidden text-ellipsis">{{
slotProps.data.source || '-'
}}</span>
</template>
</Column>
</DataTable> </DataTable>
<Dialog <Dialog
@@ -160,6 +167,7 @@ interface ICommandData {
id: string id: string
keybinding: KeybindingImpl | null keybinding: KeybindingImpl | null
label: string label: string
source?: string
} }
const commandsData = computed<ICommandData[]>(() => { const commandsData = computed<ICommandData[]>(() => {
@@ -169,7 +177,8 @@ const commandsData = computed<ICommandData[]>(() => {
`commands.${normalizeI18nKey(command.id)}.label`, `commands.${normalizeI18nKey(command.id)}.label`,
command.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', id: 'Comfy.NewBlankWorkflow',
icon: 'pi pi-plus', 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", "name": "Name",
"category": "Category", "category": "Category",
"sort": "Sort", "sort": "Sort",
"source": "Source",
"filter": "Filter", "filter": "Filter",
"apply": "Apply", "apply": "Apply",
"enabled": "Enabled", "enabled": "Enabled",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -13,11 +13,10 @@ export interface ComfyCommand {
label?: string | (() => string) label?: string | (() => string)
icon?: string | (() => string) icon?: string | (() => string)
tooltip?: string | (() => string) tooltip?: string | (() => string)
/** Menubar item label, if different from command label */ menubarLabel?: string | (() => string) // Menubar item label, if different from command label
menubarLabel?: string | (() => string)
versionAdded?: string versionAdded?: string
/** If non-nullish, this command will prompt for confirmation. */ confirmation?: string // If non-nullish, this command will prompt for confirmation
confirmation?: string source?: string
} }
export class ComfyCommandImpl implements ComfyCommand { export class ComfyCommandImpl implements ComfyCommand {
@@ -29,6 +28,7 @@ export class ComfyCommandImpl implements ComfyCommand {
_menubarLabel?: string | (() => string) _menubarLabel?: string | (() => string)
versionAdded?: string versionAdded?: string
confirmation?: string confirmation?: string
source?: string
constructor(command: ComfyCommand) { constructor(command: ComfyCommand) {
this.id = command.id this.id = command.id
@@ -39,6 +39,7 @@ export class ComfyCommandImpl implements ComfyCommand {
this._menubarLabel = command.menubarLabel ?? command.label this._menubarLabel = command.menubarLabel ?? command.label
this.versionAdded = command.versionAdded this.versionAdded = command.versionAdded
this.confirmation = command.confirmation this.confirmation = command.confirmation
this.source = command.source
} }
get label() { get label() {
@@ -105,7 +106,10 @@ export const useCommandStore = defineStore('command', () => {
const loadExtensionCommands = (extension: ComfyExtension) => { const loadExtensionCommands = (extension: ComfyExtension) => {
if (extension.commands) { if (extension.commands) {
for (const command of 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}`, id: `Workspace.ToggleBottomPanelTab.${tab.id}`,
icon: 'pi pi-list', icon: 'pi pi-list',
label: `Toggle ${tab.title} Bottom Panel`, 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', versionAdded: '1.3.9',
function: () => { function: () => {
toggleSidebarTab(tab.id) toggleSidebarTab(tab.id)
} },
source: 'System'
}) })
} }