Line data Source code
1 : import { useSettingStore } from '@/platform/settings/settingStore'
2 :
3 2356 : const MISSING_WARNING_SETTING_IDS = {
4 : nodes: 'Comfy.Workflow.ShowMissingNodesWarning',
5 : models: 'Comfy.ErrorSystem.ShowMissingModels',
6 : media: 'Comfy.Workflow.ShowMissingMediaWarning'
7 : } as const
8 :
9 : type MissingWarningKind = keyof typeof MISSING_WARNING_SETTING_IDS
10 :
11 : type VisibilitySettingId =
12 : | 'Comfy.RightSidePanel.ShowErrorsTab'
13 : | (typeof MISSING_WARNING_SETTING_IDS)[MissingWarningKind]
14 :
15 : /** A setting that is not registered yet reads as enabled. */
16 36005 : function enabledByDefault(value: boolean | undefined): boolean {
17 36005 : return value ?? true
18 : }
19 :
20 36005 : function isEnabled(id: VisibilitySettingId): boolean {
21 36005 : return enabledByDefault(useSettingStore().get(id))
22 : }
23 :
24 248 : export function isIssuesTabEnabled(): boolean {
25 248 : return isEnabled('Comfy.RightSidePanel.ShowErrorsTab')
26 : }
27 :
28 35757 : export function isMissingWarningVisible(kind: MissingWarningKind): boolean {
29 35757 : return isEnabled(MISSING_WARNING_SETTING_IDS[kind])
30 : }
|