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
7 changes: 7 additions & 0 deletions src/constants/serverConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,13 @@ export const SERVER_CONFIG_ITEMS: ServerConfig<any>[] = [
type: 'boolean',
defaultValue: false
},
{
id: 'enable-manager-legacy-ui',
name: 'Use legacy Manager UI',
tooltip: 'Uses the legacy ComfyUI-Manager UI instead of the new UI.',
type: 'boolean',
defaultValue: false
},
{
id: 'disable-all-custom-nodes',
name: 'Disable loading all custom nodes.',
Expand Down
10 changes: 8 additions & 2 deletions src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,9 @@
"serverConfig": {
"modifiedConfigs": "You have modified the following server configurations. Restart to apply changes.",
"revertChanges": "Revert Changes",
"restart": "Restart"
"restart": "Restart",
"restartRequiredToastSummary": "Restart required",
"restartRequiredToastDetail": "Restart the app to apply server configuration changes."
},
"shape": {
"default": "Default",
Expand Down Expand Up @@ -1333,6 +1335,10 @@
"disable-metadata": {
"name": "Disable saving prompt metadata in files."
},
"enable-manager-legacy-ui": {
"name": "Use legacy Manager UI",
"tooltip": "Uses the legacy ComfyUI-Manager UI instead of the new UI."
},
"disable-all-custom-nodes": {
"name": "Disable loading all custom nodes."
},
Expand Down Expand Up @@ -2444,4 +2450,4 @@
"recentReleases": "Recent releases",
"helpCenterMenu": "Help Center Menu"
}
}
}
25 changes: 24 additions & 1 deletion src/platform/settings/components/ServerConfigPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import { storeToRefs } from 'pinia'
import Button from 'primevue/button'
import Divider from 'primevue/divider'
import Message from 'primevue/message'
import { watch } from 'vue'
import { onBeforeUnmount, watch } from 'vue'
import { useI18n } from 'vue-i18n'

import FormItem from '@/components/common/FormItem.vue'
Expand All @@ -79,11 +79,13 @@ import { useCopyToClipboard } from '@/composables/useCopyToClipboard'
import type { ServerConfig } from '@/constants/serverConfig'
import { useSettingStore } from '@/platform/settings/settingStore'
import type { FormItem as FormItemType } from '@/platform/settings/types'
import { useToastStore } from '@/platform/updates/common/toastStore'
import { useServerConfigStore } from '@/stores/serverConfigStore'
import { electronAPI } from '@/utils/envUtil'

const settingStore = useSettingStore()
const serverConfigStore = useServerConfigStore()
const toastStore = useToastStore()
const {
serverConfigsByCategory,
serverConfigValues,
Expand All @@ -92,11 +94,14 @@ const {
modifiedConfigs
} = storeToRefs(serverConfigStore)

let restartTriggered = false

const revertChanges = () => {
serverConfigStore.revertChanges()
}

const restartApp = async () => {
restartTriggered = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the toast say that a restart is required while the app is already restarting?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, restartTriggered should be guarding that

await electronAPI().restartApp()
}

Expand All @@ -114,6 +119,24 @@ const copyCommandLineArgs = async () => {
}

const { t } = useI18n()

onBeforeUnmount(() => {
if (restartTriggered) {
return
}

if (modifiedConfigs.value.length === 0) {
return
}

toastStore.add({
severity: 'warn',
summary: t('serverConfig.restartRequiredToastSummary'),
detail: t('serverConfig.restartRequiredToastDetail'),
life: 10_000
})
})

const translateItem = (item: ServerConfig<any>): FormItemType => {
return {
...item,
Expand Down
Loading