From 16c42b27bf18b80465ae678b80920e23d6284bfc Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Sat, 24 Oct 2026 08:19:35 -0700 Subject: [PATCH] feat(system): show the library location on the legacy admin page A line under the admin page's statistics names the database path and why it is there (ComfyUI's user folder, PROMPT_MANAGER_DATA_DIR, config.json, or the node folder with a pointer to Move library), read once from GET /prompt_manager/system/library. --- tests/browser/workflows.spec.mjs | 7 +++++++ web/admin.html | 2 ++ web/js/admin.js | 24 ++++++++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/tests/browser/workflows.spec.mjs b/tests/browser/workflows.spec.mjs index ad42f378..633c0a00 100644 --- a/tests/browser/workflows.spec.mjs +++ b/tests/browser/workflows.spec.mjs @@ -19,6 +19,13 @@ test.afterEach(async ({ page, browserName }) => { expect(page.workflowErrors).toEqual([]); }); +// #249 S6b: the legacy admin page says where the library lives (the fixture's database is configured explicitly). +test('the admin page names the library location', async ({ page }) => { + await page.goto('/prompt_manager/admin'); + await expect(page.locator('#libraryLocation')).toHaveText('Library: browser.db (set in config.json)'); + await expect(page.locator('#totalPrompts')).not.toHaveText('-'); +}); + test('actual gallery form saves a prompt that the admin page can edit and reload', async ({ page, request }) => { await page.goto('/prompt_manager/gallery'); await page.locator('#addPromptBtn').click(); diff --git a/web/admin.html b/web/admin.html index cb8a6e06..bbd32c6a 100644 --- a/web/admin.html +++ b/web/admin.html @@ -79,6 +79,8 @@ + + diff --git a/web/js/admin.js b/web/js/admin.js index e74d3478..217aa034 100644 --- a/web/js/admin.js +++ b/web/js/admin.js @@ -297,6 +297,7 @@ this.loadTags(), this.loadRecentPrompts(), this.loadSettings(), + this.loadLibraryLocation(), ]); } catch (error) { this.showNotification("Failed to load initial data", "error"); @@ -344,6 +345,29 @@ this.listRequest = ApiClient.latestOnly({ lifetime: this.pageLifetime.signal }); } + /** #249 S6b: one line under the statistics saying where the library lives and why. */ + async loadLibraryLocation() { + const { signal } = this.pageLifetime; + if (signal.aborted) return; + const line = document.getElementById("libraryLocation"); + const reasons = { + default: "ComfyUI's user folder", + environment: "set by PROMPT_MANAGER_DATA_DIR", + config: "set in config.json", + node_folder: "the node folder, where an update or reinstall can delete it; move it from the workspace's System page", + }; + try { + const response = await ApiClient.fetchUrl("/prompt_manager/system/library", { signal }); + const data = response.ok ? await response.json() : null; + const location = data && data.location; + if (!line || !location || typeof location.path !== "string") return; + line.textContent = `Library: ${location.path} (${reasons[location.source] || location.source})`; + line.hidden = false; + } catch (error) { + if (!signal.aborted) console.error("Library location error:", error); + } + } + async loadStatistics() { // A leaving page starts no read; one in flight is aborted with the page and not reported. const { signal } = this.pageLifetime;