X4 first, because the brief asks for it explicitly.
IMPLEMENTATION.md sequences CR-006 after B7 on the grounds that the toggles must
suppress sections inside the creator, which is an iframe child until T7.1. The
wave file puts it in wave 5 anyway, and its last done-when is written to
accommodate exactly that: "toggle state propagates into the creator, OR the PR
documents exactly where it does not and why".
It propagates. Both ways, by two separate paths, because they fail differently:
ON THE CREATOR'S OWN BOOT the flags ride on the SOP, which the creator already
reads - ProjectData.pullProject hydrates it from the server. Nothing crosses
the frame boundary at all, so this path is unaffected by B7 either way. It
covers a reload, a fresh tab, the standalone creator page, and a colleague
opening the project on another machine.
WHILE THE FRAME IS OPEN the wizard hands the change straight across
(pushSectionsToCreator -> cw.applySopSections), the same shape T5.3 used for
the dashboard filter. Without it, flipping a toggle would appear to do nothing
until a reload.
T7.1 removes the second path, not the first. That is the whole of the X4
exposure and it is one function, commented as such. Building CR-006 after B7
would not have made the SOP-borne path any different; it would only have saved
writing the hand-off.
What it does
Ten sections, one shared list (html/wp-sections.js) read by the wizard, the
creator's form and the creator's rendered document. Three surfaces meant three
chances to drift, which is how "Assets is off, except in the export" happens.
Off means NOT RENDERED - form, detail view and PDF export. It never means
deleted. renderPackage() was rebuilt from one long string into a list of
(section, html) blocks so a suppressed section leaves no empty heading and the
survivors renumber 1.0, 2.0, 3.0 instead of leaving a hole. The print window
reuses that same HTML, so the export needed no separate change.
Absent means ON. A SOP saved before today mentions no sections, and reading
that as "all off" would blank every project in the estate the moment this
shipped. WPSections.normalize is the one place that decision lives.
html/wp-sections.js new - the shared list, defaults, normalize
html/work-package-suite.html step 12, a 12th rail button
html/work-package-suite-app.js the toggles, state.sections, the hand-off
html/work-package-suite-styles.css the toggle rows
html/wp-creation-index.html stable ids on the five unnamed cards
html/wp-creation-app.js WP_SECTION_NODES, applySopSections,
renderPackage rebuilt as blocks
tests/sections_check.py new - 53 checks
Done when
[x] all 10 sections are toggleable - each one driven off and back on
[x] a section toggled off is absent from the form, the detail view and the
PDF export - checked by content marker, not by heading, so "the section
is gone" and "the section was empty" cannot be confused
[x] toggling off then on restores prior data with no loss - and the sharper
version: a package EDITED while Assets is off still carries its assets
through collectPackage(), which is what Save uses
[x] new SOPs default to all sections on
[x] toggle state propagates into the creator - both paths, separately
Two things worth arguing with
General Information is toggleable, because CR-006 enumerates it. Turning it
off leaves nothing to identify a package by. The row says so in its own note
rather than being quietly excluded from the list.
Location has no card of its own - it is a field inside General Information's
grid, and its toggle governs that one row. CR-004 gives it structured
building/floor/sector fields in wave 6, at which point one line of
WP_SECTION_NODES changes. Written down because "the toggle does nothing" and
"the toggle governs one row" look identical from outside.
Approvals & Sign-offs is NOT toggleable and is not one of the ten. A package
nobody signed is not a shorter package.
Verified one at a time
sections_check 53/53 new
stepper_check 70/70 (STEP_COUNT 11 -> 12)
locations_check 58/58 (its "step 11 is last" check now asserts the thing that
is actually invariant - the wizard's navigation follows)
browser_check 71/71
a11y 22/22
url_state 23/23
autosave 34/34
aggregates 16/16
pipeline 43/43
launcher 58/58
f_items F1-F5 FIXED, F6 REPRODUCES (T7.2)
No colour literal added: still 0 across all page sheets and inline blocks. Each
toggle says its state three ways - the checkbox, the words "In use" / "Not used",
and the rule down its left edge (C1).
Question for the PR, per CLAUDE.md: the toggles are SOP-wide, so a project
cannot use Kitting on install packages and not on BIM ones. BL-000b already
records the field-level version of this question; the per-WP-type version is the
same shape and is not recorded anywhere yet.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
95 lines
4.3 KiB
JavaScript
95 lines
4.3 KiB
JavaScript
/* Work package section toggles — CR-006 / T5.5.
|
||
---------------------------------------------------------------------------
|
||
The structural fix behind most of the removal requests in the plan. Rather
|
||
than deleting fields globally, each project turns on only the sections it
|
||
uses: it is what lets Micron drop Kitting and Assets while another project
|
||
keeps them, and it is why CR-002 and CR-016 are toggles rather than deletions.
|
||
|
||
THE ONE RULE: toggling a section OFF never deletes anything. It stops the
|
||
section rendering — in the creation form, in the detail view and in the PDF
|
||
export — and that is all. Whatever was captured stays on the package, and
|
||
toggling back on shows it again, intact. Everything in this file is about
|
||
what is DISPLAYED; nothing here writes to a package.
|
||
|
||
This list lives in its own file because three surfaces read it and they must
|
||
not drift: the SOP wizard renders the toggles, the creator applies them to
|
||
its form and its printed output, and a work package's detail view honours
|
||
them. A fourth copy is how "Assets is off" and "Assets is off, except in the
|
||
export" happen.
|
||
|
||
IDS ARE PERMANENT. They are written into every SOP that has ever been saved,
|
||
so renaming one silently turns that section back on for every existing
|
||
project. Change `label` freely; never change `id`.
|
||
*/
|
||
(function (window) {
|
||
'use strict';
|
||
|
||
var LIST = [
|
||
{ id: 'general', label: 'General Information',
|
||
note: 'Holds the WP number, subject and type. Turning this off leaves nothing to identify a package by — it is listed for completeness, not as a suggestion.' },
|
||
{ id: 'location', label: 'Location',
|
||
note: 'Where the work happens. CR-004 gives this its own structured fields; today it is the location field inside General Information.' },
|
||
{ id: 'scope', label: 'Scope of Work',
|
||
note: 'The ordered steps the crew performs, and the labour estimate.' },
|
||
{ id: 'assets', label: 'Assets',
|
||
note: 'Asset tags and controls.dev links. Off for Micron EUV — the content duplicates the database Clinton’s team maintains (CR-016).' },
|
||
{ id: 'materials', label: 'Materials',
|
||
note: 'The bill of materials that feeds kitting.' },
|
||
{ id: 'kitting', label: 'Kitting',
|
||
note: 'Kitting status, warehouse owner and MIMO. Off for Micron EUV, which is not kitting today (CR-009).' },
|
||
{ id: 'drawings', label: 'Drawings and Attachments',
|
||
note: 'Drawing references and attachment links.' },
|
||
{ id: 'constraints', label: 'Constraints',
|
||
note: 'Release-readiness items. A package cannot be issued while one is open.' },
|
||
{ id: 'qaqc', label: 'QA/QC',
|
||
note: 'Quality requirements, photo standard and hold points.' },
|
||
{ id: 'closeout', label: 'Closeout',
|
||
note: 'Actual hours, installed quantity, redlines and lessons learned. Actual Hours stays here — its removal was proposed and rejected (CR-017).' },
|
||
];
|
||
|
||
var IDS = LIST.map(function (s) { return s.id; });
|
||
|
||
function defaults() {
|
||
// A new SOP has everything on. A project opts OUT of what it does not use;
|
||
// it does not have to discover and opt in to what it does.
|
||
var out = {};
|
||
IDS.forEach(function (id) { out[id] = true; });
|
||
return out;
|
||
}
|
||
|
||
/* Fill in anything a stored SOP does not mention.
|
||
|
||
This is what makes adding an eleventh section safe: every SOP saved before
|
||
it existed says nothing about it, and "says nothing" has to mean ON. The
|
||
alternative — absent meaning off — would switch a brand-new section off for
|
||
every project in the estate the moment it shipped. */
|
||
function normalize(stored) {
|
||
var out = defaults();
|
||
if (stored && typeof stored === 'object') {
|
||
IDS.forEach(function (id) {
|
||
if (Object.prototype.hasOwnProperty.call(stored, id)) out[id] = stored[id] !== false;
|
||
});
|
||
}
|
||
return out;
|
||
}
|
||
|
||
function isOn(stored, id) {
|
||
if (IDS.indexOf(id) < 0) return true; // not a section we govern
|
||
return normalize(stored)[id];
|
||
}
|
||
|
||
function offList(stored) {
|
||
var s = normalize(stored);
|
||
return LIST.filter(function (x) { return !s[x.id]; }).map(function (x) { return x.label; });
|
||
}
|
||
|
||
window.WPSections = {
|
||
LIST: LIST,
|
||
IDS: IDS,
|
||
defaults: defaults,
|
||
normalize: normalize,
|
||
isOn: isOn,
|
||
offList: offList,
|
||
};
|
||
})(window);
|