diff --git a/README.md b/README.md index 3d1ad807..6142e6fc 100644 --- a/README.md +++ b/README.md @@ -332,7 +332,7 @@ The comprehensive gallery system provides complete access to all your ComfyUI ou The gallery's **Settings** opens System › Appearance in a new tab: image quality, details on cards, collapsed viewer details, video autoplay/mute/loop, metadata loading and file paths are set there and apply to this page too. -The gallery's **Page options** keep the page's own settings: the thumbnail check at startup, lazy loading, default view mode, items per page, grid columns, infinite scrolling, debug mode and API timeout. Reset puts back only these. +The gallery's **Page options** keep the page's own settings: the thumbnail check at startup, lazy loading, items per page, grid columns, infinite scrolling, debug mode and API timeout. Reset puts back only these. Thumbnail generation, the server thumbnail and browser cache clears, refreshing the file listing and finding duplicate images are in System › Sources & scans and System › Maintenance (Page options links both); each runs as an Activity job you can follow after closing the page. diff --git a/TESTING.md b/TESTING.md index bfe84c84..15dc292a 100644 --- a/TESTING.md +++ b/TESTING.md @@ -4121,9 +4121,11 @@ opens `workspace#/system/` in a new tab) and removes the legacy copy of a ca only when its row above is `covered`. One row per removed capability: Capability is the exact Capability cell of its coverage row, Page is `admin` or `gallery`, Removed ids and Removed methods list what went (`—` for none), and Native test copies that row's Test -cell. An id that stays on a System link is not listed, only its handler. The gallery keeps -its Default View Mode in Page options: System › Appearance's Default layout writes the -workspace's own `workspaceLayout`, and nothing native writes the legacy `defaultViewMode`. +cell. An id that stays on a System link is not listed, only its handler. The gallery's +Default View Mode left Page options too: System › Appearance's Default layout is the one +default-layout control. Nothing writes the legacy `defaultViewMode` any more; a stored +value still picks the view the legacy gallery opens in (grid otherwise), and Page options +Save and Reset keep it. `tests/vendor/legacy-coverage.test.mjs` fails when a row cites a capability that is not `covered` or copies another test, when an id or method is listed twice for one page, or @@ -4156,7 +4158,7 @@ legacy page workflows), not by this check. | Database backup | admin | — | `backupDatabase()` | Back up downloads through the api client and revokes the object URL (D103) (workspace-system-backups.spec.mjs) | | Restore from file | admin | `#restoreModal`, `#restoreFileInput`, `#confirmRestore`, `#cancelRestore` | `showRestoreModal()`, `confirmRestore()` | Review restore stages the chosen file and shows the real summary with the backup box (D105) (workspace-system-backups.spec.mjs) | | Gallery thumbnail generation | gallery | `#generateThumbnailsBtn`, `#thumbnailStatus`, `#thumbnailProgress`, `#progressText`, `#progressPercent`, `#cancelThumbnailsBtn`, `#progressBar`, `#progressDetails`, `#progressETA` | `generateThumbnails()`, `generateThumbnailsWithProgress()` | Start closes the dialog, toasts, and opens the job in Activity (workspace-system-sources.spec.mjs) | -| Default view mode, image quality | gallery | `#imageQualitySelect` | — | defaults apply to a new visit but not to the current view or a saved view (workspace-system.spec.mjs) | +| Default view mode, image quality | gallery | `#defaultViewModeSelect`, `#imageQualitySelect` | — | defaults apply to a new visit but not to the current view or a saved view (workspace-system.spec.mjs) | | Image info on cards; sidebar collapsed | gallery | `#showImageInfoToggle`, `#sidebarCollapsedByDefaultToggle` | — | added rows reach their consumers (workspace-system.spec.mjs) | | Video autoplay, mute, loop | gallery | `#videoAutoplayToggle`, `#videoMuteToggle`, `#videoLoopToggle` | — | video defaults reach the viewer (workspace-system.spec.mjs) | | Auto-load metadata, cache metadata, show file paths | gallery | `#autoLoadMetadataToggle`, `#cacheMetadataToggle`, `#showFilePathsToggle` | — | metadata off shows an explicit load and loads once on request (workspace-system.spec.mjs) | diff --git a/tests/browser/legacy-system-links.spec.mjs b/tests/browser/legacy-system-links.spec.mjs index 856cb875..37fe9e9e 100644 --- a/tests/browser/legacy-system-links.spec.mjs +++ b/tests/browser/legacy-system-links.spec.mjs @@ -221,7 +221,7 @@ test('Page options keeps the page-only settings gallery', async ({ page }) => { // Native Appearance keys and the startup prompt's own keys are in the shared object before the page opens. const stored = { imageQuality: 'high', showImageInfo: false, videoMute: false, autoLoadMetadata: false, workspaceLayout: 'masonry', thumbnailPromptDismissed: 'sig', thumbnailsGenerated: true, - checkThumbnailsAtStartup: false }; + checkThumbnailsAtStartup: false, defaultViewMode: 'list' }; await page.addInitScript(value => { if (!sessionStorage.getItem('seeded')) { sessionStorage.setItem('seeded', '1'); @@ -231,30 +231,32 @@ test('Page options keeps the page-only settings gallery', async ({ page }) => { const listed = page.waitForResponse(item => item.url().includes('/prompt_manager/images/output?')); await page.goto(PAGES.gallery); await listed; + // With no Page options control, a stored default view still opens the page in it. + await expect(page.locator('#listViewBtn')).toHaveClass(/bg-pm-accent/); await openPageOptions(page); const dialog = page.locator('#settingsModal'); await expect(dialog.locator('h3')).toHaveText('Page options'); - // Exactly the page-only settings (G5). + // Exactly the page-only settings (G5); the default view is System › Appearance's Default layout. expect(await dialog.locator('input, select, textarea').evaluateAll(fields => fields.map(field => field.id))).toEqual([ - 'checkThumbnailsAtStartup', 'lazyLoadingToggle', 'defaultViewModeSelect', 'defaultLimitSelect', 'gridColumnsSelect', + 'checkThumbnailsAtStartup', 'lazyLoadingToggle', 'defaultLimitSelect', 'gridColumnsSelect', 'infiniteScrollToggle', 'debugModeToggle', 'apiTimeoutInput']); + await expect(dialog.getByText('Default View Mode')).toHaveCount(0); await page.locator('#defaultLimitSelect').selectOption('50'); - await page.locator('#defaultViewModeSelect').selectOption('list'); await page.locator('#debugModeToggle').check(); await page.locator('#saveSettingsBtn').click(); await expect(dialog).toBeHidden(); const read = () => page.evaluate(() => JSON.parse(localStorage.getItem('gallerySettings'))); let saved = await read(); - expect(saved).toMatchObject({ ...stored, defaultLimit: 50, debugMode: true, defaultViewMode: 'list' }); + expect(saved).toMatchObject({ ...stored, defaultLimit: 50, debugMode: true }); - // Reset puts back only the page options' defaults; the Appearance and startup-prompt keys stay. + // Reset puts back only the page options' defaults; the Appearance, startup-prompt and default-view keys stay. await openPageOptions(page); page.once('dialog', dialog => dialog.accept()); await page.locator('#resetSettingsBtn').click(); await expect(page.getByText('Page options reset to defaults')).toBeVisible(); await expect(page.locator('#defaultLimitSelect')).toHaveValue('100'); saved = await read(); - expect(saved).toMatchObject({ defaultViewMode: 'grid', imageQuality: 'high', showImageInfo: false, videoMute: false, + expect(saved).toMatchObject({ defaultViewMode: 'list', imageQuality: 'high', showImageInfo: false, videoMute: false, autoLoadMetadata: false, workspaceLayout: 'masonry', thumbnailPromptDismissed: 'sig', thumbnailsGenerated: true, defaultLimit: 100, debugMode: false, checkThumbnailsAtStartup: true, lazyLoading: true, gridColumns: 8, infiniteScroll: false, apiTimeout: 30 }); diff --git a/tests/js/gallery-settings.test.js b/tests/js/gallery-settings.test.js index 0de5fada..7f85fd9a 100644 --- a/tests/js/gallery-settings.test.js +++ b/tests/js/gallery-settings.test.js @@ -76,7 +76,7 @@ test("the workspace keys have their own defaults and validation", () => { assert.equal(normalizeGallerySettings({ defaultViewMode: "masonry" }).defaultViewMode, "grid"); }); -// #330 S13: the legacy gallery's Page options edit only the page-only keys (and its default view, see PAGE_OPTION_KEYS); System › Appearance owns the rest, so a Save +// #330 S13: the legacy gallery's Page options edit only the page-only keys (PAGE_OPTION_KEYS); System › Appearance owns the rest, so a Save // or a Reset from the legacy page keeps every other stored key. function legacyGallery(stored, controls, extra = {}) { const fs = require("node:fs"); @@ -101,7 +101,7 @@ function legacyGallery(stored, controls, extra = {}) { } const PAGE_OPTION_CONTROLS = () => ({ - checkThumbnailsAtStartup: { checked: false }, lazyLoadingToggle: { checked: false }, defaultViewModeSelect: { value: "list" }, + checkThumbnailsAtStartup: { checked: false }, lazyLoadingToggle: { checked: false }, defaultLimitSelect: { value: "200" }, gridColumnsSelect: { value: "6" }, infiniteScrollToggle: { checked: true }, debugModeToggle: { checked: true }, apiTimeoutInput: { value: "45" }, @@ -109,7 +109,8 @@ const PAGE_OPTION_CONTROLS = () => ({ test("a legacy gallery Save keeps the workspace keys and every other stored key", () => { const { manager, saved } = legacyGallery({ workspaceLayout: "masonry", workspaceDensity: "compact", someOtherTool: 1, - imageQuality: "high", showImageInfo: false, videoMute: false, thumbnailPromptDismissed: "sig" }, PAGE_OPTION_CONTROLS()); + imageQuality: "high", showImageInfo: false, videoMute: false, thumbnailPromptDismissed: "sig", defaultViewMode: "list" }, + PAGE_OPTION_CONTROLS()); manager.saveSettings(); const result = saved(); assert.equal(result.workspaceLayout, "masonry"); @@ -119,8 +120,9 @@ test("a legacy gallery Save keeps the workspace keys and every other stored key" assert.equal(result.showImageInfo, false); assert.equal(result.videoMute, false); assert.equal(result.thumbnailPromptDismissed, "sig"); - // The page-only keys come from the dialog (the default view stays a page option: System's layout is the workspace's). + // Page options no longer edit the default view (S13 G5), so a stored one stays. assert.equal(result.defaultViewMode, "list"); + // The page-only keys come from the dialog. assert.equal(result.lazyLoading, false); assert.equal(result.debugMode, true); assert.equal(result.checkThumbnailsAtStartup, false); @@ -139,10 +141,12 @@ test("a legacy gallery Reset restores only the page options and keeps every othe manager.resetSettings(); const result = saved(); const { DEFAULT_SETTINGS } = require("../../web/js/gallery-settings.js"); - for (const key of ["checkThumbnailsAtStartup", "lazyLoading", "defaultViewMode", "defaultLimit", "gridColumns", + for (const key of ["checkThumbnailsAtStartup", "lazyLoading", "defaultLimit", "gridColumns", "infiniteScroll", "debugMode", "apiTimeout"]) { assert.equal(result[key], DEFAULT_SETTINGS[key], key); } + // The default view is not a page option (S13 G5): Reset keeps a stored one. + assert.equal(result.defaultViewMode, "list"); assert.equal(result.workspaceLayout, "masonry"); assert.equal(result.imageQuality, "high"); assert.equal(result.videoMute, false); @@ -155,6 +159,12 @@ test("a legacy gallery Reset restores only the page options and keeps every othe ["success", "Page options reset to defaults"]]); }); +test("Page options no longer hold the default view; System › Appearance's Default layout is the one control", () => { + const { manager } = legacyGallery({}, {}); + assert.deepEqual([...manager.constructor.PAGE_OPTION_KEYS], ["checkThumbnailsAtStartup", "lazyLoading", "defaultLimit", + "gridColumns", "infiniteScroll", "debugMode", "apiTimeout"]); +}); + test("a viewer mute or loop click remembers only that key and never reads the Page options dialog", () => { const { manager, saved, calls } = legacyGallery({ defaultLimit: 200, lazyLoading: false, videoMute: true }, {}); manager.storeSetting("videoMute", false); diff --git a/web/gallery.html b/web/gallery.html index 6a8df0d5..7c3948f6 100644 --- a/web/gallery.html +++ b/web/gallery.html @@ -217,13 +217,6 @@

Display Settings

-
- - -