From e971ba31e095dde7f20ea6deb78dccf5dbe58ef8 Mon Sep 17 00:00:00 2001 From: bymyself Date: Sat, 25 Jan 2025 09:42:01 -0700 Subject: [PATCH] Add "Don't show this again" checkbox to missing models dialog (#2344) Co-authored-by: github-actions --- browser_tests/dialog.spec.ts | 45 ++++++++++++++++++- .../dialog/content/MissingModelsWarning.vue | 25 +++++++++-- src/locales/en/main.json | 5 +++ src/locales/fr/main.json | 5 +++ src/locales/ja/main.json | 5 +++ src/locales/ko/main.json | 5 +++ src/locales/ru/main.json | 5 +++ src/locales/zh/main.json | 5 +++ 8 files changed, 96 insertions(+), 4 deletions(-) diff --git a/browser_tests/dialog.spec.ts b/browser_tests/dialog.spec.ts index 46ad6e31d..dcc20afd5 100644 --- a/browser_tests/dialog.spec.ts +++ b/browser_tests/dialog.spec.ts @@ -1,4 +1,4 @@ -import { expect } from '@playwright/test' +import { Locator, expect } from '@playwright/test' import { Keybinding } from '../src/types/keyBindingTypes' import { comfyPageFixture as test } from './fixtures/ComfyPage' @@ -140,6 +140,49 @@ test.describe('Missing models warning', () => { const download = await downloadPromise expect(download.suggestedFilename()).toBe('fake_model.safetensors') }) + + test.describe('Do not show again checkbox', () => { + let checkbox: Locator + let closeButton: Locator + + test.beforeEach(async ({ comfyPage }) => { + await comfyPage.setSetting( + 'Comfy.Workflow.ShowMissingModelsWarning', + true + ) + await comfyPage.loadWorkflow('missing_models') + + checkbox = comfyPage.page.getByLabel("Don't show this again") + closeButton = comfyPage.page.getByLabel('Close') + }) + + test('Should disable warning dialog when checkbox is checked', async ({ + comfyPage + }) => { + await checkbox.click() + const changeSettingPromise = comfyPage.page.waitForRequest( + '**/api/settings/Comfy.Workflow.ShowMissingModelsWarning' + ) + await closeButton.click() + await changeSettingPromise + + const settingValue = await comfyPage.getSetting( + 'Comfy.Workflow.ShowMissingModelsWarning' + ) + expect(settingValue).toBe(false) + }) + + test('Should keep warning dialog enabled when checkbox is unchecked', async ({ + comfyPage + }) => { + await closeButton.click() + + const settingValue = await comfyPage.getSetting( + 'Comfy.Workflow.ShowMissingModelsWarning' + ) + expect(settingValue).toBe(true) + }) + }) }) test.describe('Settings', () => { diff --git a/src/components/dialog/content/MissingModelsWarning.vue b/src/components/dialog/content/MissingModelsWarning.vue index 257746d11..7ca1f2b20 100644 --- a/src/components/dialog/content/MissingModelsWarning.vue +++ b/src/components/dialog/content/MissingModelsWarning.vue @@ -2,9 +2,15 @@ +
+ + +