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.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -79,6 +79,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- #249 S6b: where the library (database, config.json, backups) lives and why. -->
|
||||
<p class="text-pm-secondary text-xs mt-2" id="libraryLocation" hidden></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user