Add Comfy.User.SignOut command (#3608)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Chenlei Hu
2025-04-24 16:33:26 -04:00
committed by GitHub
parent 26f98d24fb
commit 0caf1686c3
16 changed files with 59 additions and 25 deletions

View File

@@ -82,16 +82,12 @@ import Divider from 'primevue/divider'
import ProgressSpinner from 'primevue/progressspinner'
import TabPanel from 'primevue/tabpanel'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { useDialogService } from '@/services/dialogService'
import { useCommandStore } from '@/stores/commandStore'
import { useFirebaseAuthStore } from '@/stores/firebaseAuthStore'
import { useToastStore } from '@/stores/toastStore'
const toast = useToastStore()
const { t } = useI18n()
const authStore = useFirebaseAuthStore()
const dialogService = useDialogService()
const commandStore = useCommandStore()
const user = computed(() => authStore.currentUser)
const loading = computed(() => authStore.loading)
@@ -118,20 +114,10 @@ const providerIcon = computed(() => {
})
const handleSignOut = async () => {
await authStore.logout()
if (authStore.error) {
toast.addAlert(authStore.error)
} else {
toast.add({
severity: 'success',
summary: t('auth.signOut.success'),
detail: t('auth.signOut.successDetail'),
life: 5000
})
}
await commandStore.execute('Comfy.User.SignOut')
}
const handleSignIn = async () => {
await dialogService.showSignInDialog()
await commandStore.execute('Comfy.User.OpenSignInDialog')
}
</script>

View File

@@ -16,6 +16,7 @@ import { useDialogService } from '@/services/dialogService'
import { useLitegraphService } from '@/services/litegraphService'
import { useWorkflowService } from '@/services/workflowService'
import type { ComfyCommand } from '@/stores/commandStore'
import { useFirebaseAuthStore } from '@/stores/firebaseAuthStore'
import { useTitleEditorStore } from '@/stores/graphStore'
import { useQueueSettingsStore, useQueueStore } from '@/stores/queueStore'
import { useSettingStore } from '@/stores/settingStore'
@@ -31,6 +32,8 @@ export function useCoreCommands(): ComfyCommand[] {
const workflowStore = useWorkflowStore()
const dialogService = useDialogService()
const colorPaletteStore = useColorPaletteStore()
const authStore = useFirebaseAuthStore()
const toastStore = useToastStore()
const getTracker = () => workflowStore.activeWorkflow?.changeTracker
const getSelectedNodes = (): LGraphNode[] => {
@@ -55,8 +58,6 @@ export function useCoreCommands(): ComfyCommand[] {
})
}
const commonProps = { source: 'System' }
const commands = [
{
id: 'Comfy.NewBlankWorkflow',
@@ -184,7 +185,7 @@ export function useCoreCommands(): ComfyCommand[] {
label: 'Interrupt',
function: async () => {
await api.interrupt()
useToastStore().add({
toastStore.add({
severity: 'info',
summary: t('g.interrupted'),
detail: t('toastMessages.interrupted'),
@@ -198,7 +199,7 @@ export function useCoreCommands(): ComfyCommand[] {
label: 'Clear Pending Tasks',
function: async () => {
await useQueueStore().clear(['queue'])
useToastStore().add({
toastStore.add({
severity: 'info',
summary: t('g.confirmed'),
detail: t('toastMessages.pendingTasksDeleted'),
@@ -246,7 +247,7 @@ export function useCoreCommands(): ComfyCommand[] {
label: 'Fit view to selected nodes',
function: () => {
if (app.canvas.empty) {
useToastStore().add({
toastStore.add({
severity: 'error',
summary: t('toastMessages.emptyCanvas'),
life: 3000
@@ -328,7 +329,7 @@ export function useCoreCommands(): ComfyCommand[] {
function: () => {
const { canvas } = app
if (!canvas.selectedItems?.size) {
useToastStore().add({
toastStore.add({
severity: 'error',
summary: t('toastMessages.nothingToGroup'),
detail: t('toastMessages.pleaseSelectNodesToGroup'),
@@ -641,8 +642,27 @@ export function useCoreCommands(): ComfyCommand[] {
function: async () => {
await dialogService.showSignInDialog()
}
},
{
id: 'Comfy.User.SignOut',
icon: 'pi pi-sign-out',
label: 'Sign Out',
versionAdded: '1.18.1',
function: async () => {
await authStore.logout()
if (authStore.error) {
toastStore.addAlert(authStore.error)
} else {
toastStore.add({
severity: 'success',
summary: t('auth.signOut.success'),
detail: t('auth.signOut.successDetail'),
life: 5000
})
}
}
}
]
return commands.map((command) => ({ ...command, ...commonProps }))
return commands.map((command) => ({ ...command, source: 'System' }))
}

View File

@@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "Open Sign In Dialog"
},
"Comfy_User_SignOut": {
"label": "Sign Out"
},
"Workspace_CloseWorkflow": {
"label": "Close Current Workflow"
},

View File

@@ -678,6 +678,7 @@
"Toggle Theme (Dark/Light)": "Toggle Theme (Dark/Light)",
"Undo": "Undo",
"Open Sign In Dialog": "Open Sign In Dialog",
"Sign Out": "Sign Out",
"Close Current Workflow": "Close Current Workflow",
"Next Opened Workflow": "Next Opened Workflow",
"Previous Opened Workflow": "Previous Opened Workflow",

View File

@@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "Abrir diálogo de inicio de sesión"
},
"Comfy_User_SignOut": {
"label": "Cerrar sesión"
},
"Workspace_CloseWorkflow": {
"label": "Cerrar Flujo de Trabajo Actual"
},

View File

@@ -664,6 +664,7 @@
"Save": "Guardar",
"Save As": "Guardar como",
"Show Settings Dialog": "Mostrar diálogo de configuración",
"Sign Out": "Cerrar sesión",
"Toggle Bottom Panel": "Alternar panel inferior",
"Toggle Focus Mode": "Alternar modo de enfoque",
"Toggle Logs Bottom Panel": "Alternar panel inferior de registros",

View File

@@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "Ouvrir la boîte de dialogue de connexion"
},
"Comfy_User_SignOut": {
"label": "Se déconnecter"
},
"Workspace_CloseWorkflow": {
"label": "Fermer le flux de travail actuel"
},

View File

@@ -664,6 +664,7 @@
"Save": "Enregistrer",
"Save As": "Enregistrer sous",
"Show Settings Dialog": "Afficher la boîte de dialogue des paramètres",
"Sign Out": "Se déconnecter",
"Toggle Bottom Panel": "Basculer le panneau inférieur",
"Toggle Focus Mode": "Basculer le mode focus",
"Toggle Logs Bottom Panel": "Basculer le panneau inférieur des journaux",

View File

@@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "サインインダイアログを開く"
},
"Comfy_User_SignOut": {
"label": "サインアウト"
},
"Workspace_CloseWorkflow": {
"label": "現在のワークフローを閉じる"
},

View File

@@ -664,6 +664,7 @@
"Save": "保存",
"Save As": "名前を付けて保存",
"Show Settings Dialog": "設定ダイアログを表示",
"Sign Out": "サインアウト",
"Toggle Bottom Panel": "下部パネルの切り替え",
"Toggle Focus Mode": "フォーカスモードの切り替え",
"Toggle Logs Bottom Panel": "ログパネル下部を切り替え",

View File

@@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "로그인 대화상자 열기"
},
"Comfy_User_SignOut": {
"label": "로그아웃"
},
"Workspace_CloseWorkflow": {
"label": "현재 워크플로우 닫기"
},

View File

@@ -664,6 +664,7 @@
"Save": "저장",
"Save As": "다른 이름으로 저장",
"Show Settings Dialog": "설정 대화상자 표시",
"Sign Out": "로그아웃",
"Toggle Bottom Panel": "하단 패널 전환",
"Toggle Focus Mode": "포커스 모드 전환",
"Toggle Logs Bottom Panel": "로그 하단 패널 전환",

View File

@@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "Открыть окно входа"
},
"Comfy_User_SignOut": {
"label": "Выйти"
},
"Workspace_CloseWorkflow": {
"label": "Закрыть текущий рабочий процесс"
},

View File

@@ -664,6 +664,7 @@
"Save": "Сохранить",
"Save As": "Сохранить как",
"Show Settings Dialog": "Показать диалог настроек",
"Sign Out": "Выйти",
"Toggle Bottom Panel": "Переключить нижнюю панель",
"Toggle Focus Mode": "Переключить режим фокуса",
"Toggle Logs Bottom Panel": "Переключение нижней панели журналов",

View File

@@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "打开登录对话框"
},
"Comfy_User_SignOut": {
"label": "退出登录"
},
"Workspace_CloseWorkflow": {
"label": "关闭当前工作流"
},

View File

@@ -664,6 +664,7 @@
"Save": "保存",
"Save As": "另存为",
"Show Settings Dialog": "显示设置对话框",
"Sign Out": "退出登录",
"Toggle Bottom Panel": "切换底部面板",
"Toggle Focus Mode": "切换专注模式",
"Toggle Logs Bottom Panel": "切换日志底部面板",