Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions src/components/dialog/content/setting/UserPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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>
34 changes: 27 additions & 7 deletions src/composables/useCoreCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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[] => {
Expand All @@ -55,8 +58,6 @@ export function useCoreCommands(): ComfyCommand[] {
})
}

const commonProps = { source: 'System' }

const commands = [
{
id: 'Comfy.NewBlankWorkflow',
Expand Down Expand Up @@ -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'),
Expand All @@ -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'),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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' }))
}
3 changes: 3 additions & 0 deletions src/locales/en/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "Open Sign In Dialog"
},
"Comfy_User_SignOut": {
"label": "Sign Out"
},
"Workspace_CloseWorkflow": {
"label": "Close Current Workflow"
},
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/es/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 1 addition & 0 deletions src/locales/es/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/fr/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 1 addition & 0 deletions src/locales/fr/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/ja/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "サインインダイアログを開く"
},
"Comfy_User_SignOut": {
"label": "サインアウト"
},
"Workspace_CloseWorkflow": {
"label": "現在のワークフローを閉じる"
},
Expand Down
1 change: 1 addition & 0 deletions src/locales/ja/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@
"Save": "保存",
"Save As": "名前を付けて保存",
"Show Settings Dialog": "設定ダイアログを表示",
"Sign Out": "サインアウト",
"Toggle Bottom Panel": "下部パネルの切り替え",
"Toggle Focus Mode": "フォーカスモードの切り替え",
"Toggle Logs Bottom Panel": "ログパネル下部を切り替え",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/ko/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "로그인 대화상자 열기"
},
"Comfy_User_SignOut": {
"label": "로그아웃"
},
"Workspace_CloseWorkflow": {
"label": "현재 워크플로우 닫기"
},
Expand Down
1 change: 1 addition & 0 deletions src/locales/ko/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@
"Save": "저장",
"Save As": "다른 이름으로 저장",
"Show Settings Dialog": "설정 대화상자 표시",
"Sign Out": "로그아웃",
"Toggle Bottom Panel": "하단 패널 전환",
"Toggle Focus Mode": "포커스 모드 전환",
"Toggle Logs Bottom Panel": "로그 하단 패널 전환",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/ru/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "Открыть окно входа"
},
"Comfy_User_SignOut": {
"label": "Выйти"
},
"Workspace_CloseWorkflow": {
"label": "Закрыть текущий рабочий процесс"
},
Expand Down
1 change: 1 addition & 0 deletions src/locales/ru/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@
"Save": "Сохранить",
"Save As": "Сохранить как",
"Show Settings Dialog": "Показать диалог настроек",
"Sign Out": "Выйти",
"Toggle Bottom Panel": "Переключить нижнюю панель",
"Toggle Focus Mode": "Переключить режим фокуса",
"Toggle Logs Bottom Panel": "Переключение нижней панели журналов",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/zh/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@
"Comfy_User_OpenSignInDialog": {
"label": "打开登录对话框"
},
"Comfy_User_SignOut": {
"label": "退出登录"
},
"Workspace_CloseWorkflow": {
"label": "关闭当前工作流"
},
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@
"Save": "保存",
"Save As": "另存为",
"Show Settings Dialog": "显示设置对话框",
"Sign Out": "退出登录",
"Toggle Bottom Panel": "切换底部面板",
"Toggle Focus Mode": "切换专注模式",
"Toggle Logs Bottom Panel": "切换日志底部面板",
Expand Down