fix(webui): settings-s5 review P2-1: while an organization needs a restart its Models page leaves out Stop using your models, as the org-models-restart mockup does, since buttons here have no disabled look; the shots add the model service not set up state (#1873, lane settings-s5)

This commit is contained in:
jason.woltje committed 2026-11-19 21:48:50 -06:00
1 parent 9e434c0e9c
commit 55f9652f6a
2 files changed
+7 -4

No files matched your search

+3 -2
View File
@@ -1385,8 +1385,9 @@
const change=!read?'':restartFirst?`<p class="small" id="models-wait">You can change ${whose} models after it restarts.</p>`
:on?`<p class="small muted" id="models-change">Its agents can use the models your accounts offer. To switch back, press Stop using your models. A route on one of your models then stops working until you change it.</p>`
:`<p class="small muted" id="models-change">Choose Use your models to switch. ${Whose} agents can then use the models your accounts offer. While your model service is down, a launch that needs it is refused. A running agent keeps its model until it starts again.</p>${modelsService()}`;
// P2-1: while the organization needs a restart every control here waits, Stop included.
const stop=on?`<button type="button" id="models-stop"${modelsBusy||restartFirst||out()?' disabled':''}>${modelsBusy?'<span class="settings-spinner" aria-hidden="true"></span> Saving…':'Stop using your models'}</button>`:'';
// P2-1: while the organization needs a restart every control here waits. Stop is left out, as in
// the mockup, since a disabled button here looks no different from an enabled one.
const stop=on&&!restartFirst?`<button type="button" id="models-stop"${modelsBusy||out()?' disabled':''}>${modelsBusy?'<span class="settings-spinner" aria-hidden="true"></span> Saving…':'Stop using your models'}</button>`:'';
const again=harnessSettings===false?'<button type="button" id="models-read">Read again</button>':'';
// P3-1: Use your models has no button of its own, so its write shows Saving in the status line.
const status=modelsBusy&&!on?'<span class="settings-spinner" aria-hidden="true"></span> Saving…':txt(modelsReceipt);
@@ -194,8 +194,8 @@ test('settings-s5: an organization that needs a restart shows the banner with Re
assert.equal(await b.evaluate('!!(document.querySelector("#routes-catalogue").compareDocumentPosition(document.querySelector("#models-source")) & Node.DOCUMENT_POSITION_FOLLOWING)'), true);
assert.equal(await b.evaluate('document.querySelector("#models-yours").checked && document.querySelector("#models-yours").disabled'), true);
assert.equal(await text('#models-wait'), "You can change Acme Studio's models after it restarts.");
// Review P2-1: Stop using your models waits too.
assert.equal(await b.evaluate('document.querySelector("#models-stop").disabled'), true);
// Review P2-1: Stop using your models waits too: it is not offered until the restart.
assert.equal(await b.evaluate('!!document.querySelector("#models-stop")'), false);
// One primary: the routes Save is quiet.
assert.equal(await b.evaluate('document.querySelector("#routes-form [type=submit]").classList.contains("route-save-quiet")'), true);
});
@@ -378,6 +378,8 @@ test('shots', { timeout: 900000, skip: !process.env.MOSAIC_UX_SHOTS }, async t =
{ name: 'org-models', path: '/#/settings/routing?org=acme', ready: 'document.querySelector("#models-in-force")?.textContent.includes("does not use")' },
{ name: 'org-models-riding', path: '/#/settings/routing?org=acme', ready: 'document.querySelector("#models-in-force")?.textContent.includes("does not use")',
after: async (b, wait) => { await b.evaluate('document.querySelector("#models-yours").click(); true'); await wait('/^Saved/.test(document.querySelector("#models-receipt")?.textContent ?? "")'); } },
{ name: 'org-models-not-set-up', path: '/#/settings/routing?org=acme', stub: { service: { ...SERVICE_UP, init: { initialized: false, partial: false, problem: null, files: [] } } },
ready: 'document.querySelector("#models-service") && document.querySelector("#models-in-force")?.textContent.includes("does not use")' },
{ name: 'org-models-restart', path: '/#/settings/routing?org=acme', fixture: { routes: { acme: { catalogue: { status: 'unavailable', notices: [], models: [] } } } }, stub: { plugins: pluginsRead(['fixture', 'cliproxy']) },
ready: 'document.querySelector("#routes-catalogue.banner [data-primary]") && document.querySelector("#models-in-force")?.textContent.startsWith("Now: Acme Studio uses")' },
{ name: 'account-reasons', path: '/#/settings/model-setup?step=accounts', stub: { accounts: reasons }, ready: 'document.querySelectorAll("#proxy-accounts .account-reason").length === 2' },