* feat(cutover): every entry point opens the workspace; legacy pages stay reachable The top-bar PM button, the nodes' Web UI buttons and /prompt_manager/web now open the workspace Library. Overview's cards open their native pages. The legacy pages stay at their URLs, with no route changed. Classic Web UI no longer navigates the canvas away when a popup is blocked; it shows a notification, as the focused node does. Closes #525 * feat(cutover): link the legacy pages from System and when the workspace fails to load System's Overview section ends with one small Legacy pages line (D165). If a workspace module fails to load or throws while starting, the page shows a static message with the same links instead of an empty shell. Part of #525 * test(cutover): prove the Pair node's Web UI on the real host Part of #525 * test(cutover): count the new real-host cases in the stock matrix pin The PM button test and three renderer-and-reload tests, in 2 projects, take the stock matrix from 110 to 118. Part of #525
35 lines
1.9 KiB
JavaScript
35 lines
1.9 KiB
JavaScript
// #525: where the canvas buttons open PromptManager (web/js/workspace-entry.js).
|
|
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const source = import('../../web/js/workspace-entry.js');
|
|
const state = import('../../web/js/workspace/state.mjs');
|
|
|
|
test('the canvas entry route is the workspace Library, a native route', async () => {
|
|
const { WORKSPACE_ENTRY_ROUTE } = await source;
|
|
const { resolveRoute } = await state;
|
|
assert.equal(WORKSPACE_ENTRY_ROUTE, '/prompt_manager/workspace#/library');
|
|
const [pathname, hash] = WORKSPACE_ENTRY_ROUTE.split('#');
|
|
assert.equal(pathname, '/prompt_manager/workspace');
|
|
assert.equal(resolveRoute(`#${hash}`).id, 'library');
|
|
});
|
|
|
|
test('/prompt_manager/web redirects to the same route, under any mount prefix', async () => {
|
|
const { WORKSPACE_ENTRY_ROUTE } = await source;
|
|
const html = fs.readFileSync(path.join(__dirname, '../../web/index.html'), 'utf8');
|
|
const [, pattern, flags, replacement] = html.match(/location\.replace\(\s*window\.location\.pathname\.replace\(\/(.+)\/([a-z]*), '([^']+)'\)/);
|
|
const redirect = pathname => pathname.replace(new RegExp(pattern, flags), replacement);
|
|
assert.equal(redirect('/prompt_manager/web'), WORKSPACE_ENTRY_ROUTE);
|
|
assert.equal(redirect('/prompt_manager/web/'), WORKSPACE_ENTRY_ROUTE);
|
|
assert.equal(redirect('/prompt_manager/index.html'), WORKSPACE_ENTRY_ROUTE);
|
|
assert.equal(redirect('/sub/prompt_manager/web'), `/sub${WORKSPACE_ENTRY_ROUTE}`);
|
|
});
|
|
|
|
test('no canvas entry point still names a legacy page', () => {
|
|
for (const file of ['web/comfy/prompt_manager.js', 'web/js/focused-node.js', 'web/js/classic-node.js']) {
|
|
const code = fs.readFileSync(path.join(__dirname, '../..', file), 'utf8');
|
|
assert.doesNotMatch(code, /\/prompt_manager\/(?:admin|gallery|web)\b/, file);
|
|
}
|
|
});
|