fix(webui): sp17 review 2, a new step typed in the add form is not dropped by Save: the bar's Save with a typed new step says it is not added yet, keeps the form and puts the caret in its title, and an add form with nothing typed is closed and the rest saved; test types a new step and presses the bar's Save, sees the words and no write, then adds the step and sees all three in the write (red before: Save wrote without the new step and said Saved); the pack apply test waits for the autonomy read as well as the workflows read, as it answered later on a loaded host (#1873, lane sp17-workflow-clicks)

This commit was merged in pull request #1982.
This commit is contained in:
jason.woltje committed 2026-11-16 12:36:33 -06:00
1 parent 24551c9eea
commit 6fe3625fae
3 files changed
+34 -1

No files matched your search

+10
View File
@@ -547,6 +547,7 @@
// dropped when the answer redraws the form. Drawn off when busy; a held form (data-live-hold) is set here.
const lockForms = off => document.querySelectorAll('#bus-view [data-wfg-page] :is([data-wfg-step-form],[data-wfg-meta-form])').forEach(f =>
f.querySelectorAll('input[name="title"],textarea,select,[data-wfg-roles-pick]').forEach(c => { c.disabled = off; }));
const toAddTitle = () => document.querySelector('#bus-view [data-wfg-page] [data-wfg-add-form] input[name="title"]')?.focus();
// Put focus back in the step form's title after a refusal (the form may be a held node).
const toTitle = () => { const f = stepFormEl()?.elements.title; if (f) { f.focus(); f.setSelectionRange(f.value.length, f.value.length); } };
@@ -618,6 +619,15 @@
async function save({ org, name, scope, s, key }) {
const d = drafts.get(key);
if (!d || d.busy) return;
// SP17 review: a new step typed in the add form is not saved over or dropped: Save says so and keeps the
// form. An add form with nothing typed in it is closed and the rest is saved.
if (d.edit?.mode === 'add') {
if (d.edit.title.trim() || d.edit.roles.length) {
d.atBar = false; d.status = `Not saved: new step ${d.edit.i + 1} is not added yet. Press Add step, or Cancel to drop it.`;
say(d.status); paint(); return toAddTitle();
}
d.edit = null;
}
// SP17: the open step's edit goes in with the save; one the save check refuses stays in its form.
const unfit = carry(d);
d.atBar = false;