diff --git a/src/components/dialog/content/ConfirmationDialogContent.vue b/src/components/dialog/content/ConfirmationDialogContent.vue index 81feebd9c0..b1108288f6 100644 --- a/src/components/dialog/content/ConfirmationDialogContent.vue +++ b/src/components/dialog/content/ConfirmationDialogContent.vue @@ -26,7 +26,7 @@ @click="onConfirm" icon="pi pi-save" /> - @@ -42,10 +57,11 @@ + + diff --git a/src/extensions/core/electronAdapter.ts b/src/extensions/core/electronAdapter.ts index 6bd6a2ade9..3d267a133c 100644 --- a/src/extensions/core/electronAdapter.ts +++ b/src/extensions/core/electronAdapter.ts @@ -1,4 +1,6 @@ +import { t } from '@/i18n' import { app } from '@/scripts/app' +import { showConfirmationDialog } from '@/services/dialogService' import { electronAPI as getElectronAPI, isElectron } from '@/utils/envUtil' ;(async () => { if (!isElectron()) return @@ -101,11 +103,16 @@ import { electronAPI as getElectronAPI, isElectron } from '@/utils/envUtil' }, { id: 'Comfy-Desktop.Reinstall', - label: 'Reinstall', + label: t('desktopMenu.reinstall'), icon: 'pi pi-refresh', - function() { - // TODO(huchenlei): Add a confirmation dialog. - electronAPI.reinstall() + async function() { + const proceed = await showConfirmationDialog({ + message: t('desktopMenu.confirmReinstall'), + title: t('desktopMenu.reinstall'), + type: 'reinstall' + }) + + if (proceed) electronAPI.reinstall() } }, { diff --git a/src/locales/en.json b/src/locales/en.json index afb48b8b1e..e691ad2d3c 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -136,6 +136,7 @@ "save": "Save", "no": "No", "cancel": "Cancel", + "close": "Close", "overwrite": "Overwrite", "customize": "Customize", "experimental": "BETA", @@ -598,7 +599,7 @@ }, "desktopMenu": { "reinstall": "Reinstall", - "confirmReinstall": "This will clear your extra_models_config.yaml file, and begin installation again. Are you sure?" + "confirmReinstall": "This will clear your extra_models_config.yaml file,\nand begin installation again.\n\nAre you sure?" }, "settingsCategories": { "Comfy-Desktop": "Comfy-Desktop", diff --git a/src/locales/ja.json b/src/locales/ja.json index 35570ef58b..74509754ef 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -5,6 +5,7 @@ "box": "ボックス", "briefcase": "ブリーフケース", "cancel": "キャンセル", + "close": "閉じる", "color": "色", "comingSoon": "近日公開", "confirm": "確認", diff --git a/src/locales/ru.json b/src/locales/ru.json index 2c863c8ee4..f43543373c 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -5,6 +5,7 @@ "box": "Ящик", "briefcase": "Чемодан", "cancel": "Отмена", + "close": "Закрыть", "color": "Цвет", "comingSoon": "Скоро", "confirm": "Подтвердить", diff --git a/src/locales/zh.json b/src/locales/zh.json index 42552a6f59..7290d12a1c 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -5,6 +5,7 @@ "box": "盒子", "briefcase": "公文包", "cancel": "取消", + "close": "关闭", "color": "颜色", "comingSoon": "敬请期待", "confirm": "确认", diff --git a/src/services/dialogService.ts b/src/services/dialogService.ts index 205e9818b9..72ff290793 100644 --- a/src/services/dialogService.ts +++ b/src/services/dialogService.ts @@ -97,6 +97,12 @@ export async function showPromptDialog({ }) } +export type ConfirmationDialogType = + | 'overwrite' + | 'delete' + | 'dirtyClose' + | 'reinstall' + /** * * @returns `true` if the user confirms the dialog, @@ -112,7 +118,7 @@ export async function showConfirmationDialog({ /** Dialog heading */ title: string /** Pre-configured dialog type */ - type: 'overwrite' | 'delete' | 'dirtyClose' + type: ConfirmationDialogType /** The main message body */ message: string /** Displayed as an unorderd list immediately below the message body */