create-pmos 0.831.0 → 0.833.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +140 -41
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +139 -21
- package/workspace/guide/backlog.md +2 -1
- package/workspace/guide/cli.md +19 -0
- package/workspace/guide/initiatives-and-next-steps.md +2 -0
- package/workspace/guide/layout.md +4 -1
- package/workspace/guide/positioning.md +1 -1
- package/workspace/guide/programs.md +2 -1
- package/workspace/lib/events-place.js +11 -4
- package/workspace/lib/features.json +3 -1
- package/workspace/lib/layouts-cli.js +6 -0
- package/workspace/lib/line.js +7 -1
- package/workspace/lib/list-balance.js +18 -3
- package/workspace/lib/pmos-verbs.js +6 -0
- package/workspace/lib/route-modules.js +2 -0
- package/workspace/lib/routes-events-place.js +19 -1
- package/workspace/lib/routes-screen-layouts.js +56 -0
- package/workspace/lib/routes-strategy-card.js +6 -2
- package/workspace/lib/routes-switches.js +35 -0
- package/workspace/lib/switch-owners.js +152 -0
- package/workspace/lib/switches-cli.js +85 -0
- package/workspace/lib/three-layouts.js +214 -0
- package/workspace/lib/work-kr.js +77 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog.css +11 -0
- package/workspace/public/pm/bd-goal.js +33 -0
- package/workspace/public/pm/bd-ini-panel.js +15 -5
- package/workspace/public/pm/bd-pop-ds.css +16 -0
- package/workspace/public/pm/bd-positioning.js +6 -4
- package/workspace/public/pm/bd-prog-panel.js +16 -5
- package/workspace/public/pm/bd-strategy.js +15 -3
- package/workspace/public/pm/bd-work-ds.css +6 -0
- package/workspace/public/pm/bd-work.js +34 -8
- package/workspace/public/pm/cozy-events-view.js +8 -4
- package/workspace/public/pm/cozy-pop-work.js +8 -3
- package/workspace/public/pm/cozy-today-app.js +28 -1
- package/workspace/public/pm/cozy-today-model.js +13 -5
- package/workspace/public/pm/cozy-today-view.js +10 -1
- package/workspace/public/pm/line-view.js +13 -1
- package/workspace/public/pm/list-balance.js +16 -2
- package/workspace/public/pm/ms-strip.js +137 -0
- package/workspace/public/pm/page-chat.css +19 -0
- package/workspace/public/pm/page-chat.js +2 -0
- package/workspace/public/pm/premium-board.js +7 -1
- package/workspace/public/pm/side-fold.js +94 -0
- package/workspace/public/pm/switch-owners.js +70 -0
- package/workspace/public/pm/three-layouts.js +66 -0
- package/workspace/public/premium-board.html +2 -0
- package/workspace/stage-card-tasks-test.js +1 -0
- package/workspace/test-lists/ms-strip.json +9 -0
- package/workspace/test-lists/side-fold.json +9 -0
- package/workspace/test-lists/switch-owners.json +9 -0
- package/workspace/test-lists/three-layouts.json +9 -0
- package/workspace/test-lists/work-kr.json +9 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/* pm/ms-strip.js — the Next milestones date strip on the product, program and initiative pages (job #2020 milestone-strip-pages;
|
|
2
|
+
* Wawan 2026-11-25 13:02Z: "apply it to the product, program, and initiative page"). Work draws the same strip for all initiatives
|
|
3
|
+
* (pm/premium-board.js); this file gives it to a page in the popup, for that page's own initiatives, from the same parts in pm/bd-stands.js:
|
|
4
|
+
* nextMilestones, dlineWindow and dlineHtml. A ◇ opens the milestone through pm/bd-pin-card.js (data-ms-pick), as on Work.
|
|
5
|
+
*
|
|
6
|
+
* stripHtml(rows, scope, o) the strip, or '' when no initiative of the page has a milestone ahead (zero is silence). scope: the page's
|
|
7
|
+
* key ('product:<ws>', 'program:<id>', 'ini:<key>'): each page keeps its own window. o: { sub, lw, ro, now }
|
|
8
|
+
* wireStrip(body, redraw) once per body: +N and Fit move this page's strip only; a sideways wheel or a drag scrolls it
|
|
9
|
+
* insertStrip(html, strip) the page with the strip above its Work breakdown, else at its end
|
|
10
|
+
* lineWidth(body) the width the labels are placed for
|
|
11
|
+
* prefs() · setPref(k, v) the person's two choices for every page (Wawan's canvas comments, 25 Nov): folded to one line or open, and
|
|
12
|
+
* Timeline or List. Kept under keys that follow the person (lib/prefs-sync.js prefix 'pmos.board.').
|
|
13
|
+
* Folded: one line, the next milestone, its date and "N more after it". List: a table of date, milestone, initiative (on an initiative's
|
|
14
|
+
* page: its stage) and "in N days" or "N days late". */
|
|
15
|
+
import * as ST from './bd-stands.js';
|
|
16
|
+
import { noteUse } from './use-log.js';
|
|
17
|
+
|
|
18
|
+
const OFF = new Map(); // scope → how far the PM scrolled that page's strip, in ms (0: it fits from today)
|
|
19
|
+
const WIN = new Map(); // scope → the window it was last drawn with
|
|
20
|
+
export const FOLD_KEY = 'pmos.board.msStrip.fold', VIEW_KEY = 'pmos.board.msStrip.view';
|
|
21
|
+
const get = (k) => { try { return localStorage.getItem(k); } catch { return null; } };
|
|
22
|
+
/** The person's choices: { folded, view: 'timeline' | 'list' }. */
|
|
23
|
+
export const prefs = () => ({ folded: get(FOLD_KEY) === '1', view: get(VIEW_KEY) === 'list' ? 'list' : 'timeline' });
|
|
24
|
+
export function setPref(k, v) { try { localStorage.setItem(k, v); } catch { /* a private window keeps the choice for this page only */ } }
|
|
25
|
+
const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
26
|
+
const IC = { down: 'M7 10l5 5 5-5', up: 'M7 14l5-5 5 5', list: 'M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01', line: 'M3 12h18M7 8v8M12 6v12M17 9v6' };
|
|
27
|
+
const DAY = 864e5;
|
|
28
|
+
const inDays = (d, t) => { const n = Math.round((d - t) / DAY); return n === 0 ? 'today' : n > 0 ? 'in ' + n + (n === 1 ? ' day' : ' days') : -n + (n === -1 ? ' day' : ' days') + ' late'; };
|
|
29
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
30
|
+
|
|
31
|
+
/** The width the labels are placed for: the body's, less the strip's padding. */
|
|
32
|
+
export const lineWidth = (body) => Math.max(320, ((body && body.clientWidth) || 720) - 90);
|
|
33
|
+
|
|
34
|
+
/** The fold and the Timeline or List press, in the strip's head. */
|
|
35
|
+
function toolsHtml(P) {
|
|
36
|
+
return `<button type="button" class="pm-btn ghost" data-ms-view="${P.view === 'list' ? 'timeline' : 'list'}" aria-label="${P.view === 'list' ? 'Show as a timeline' : 'Show as a list'}" title="${P.view === 'list' ? 'Show as a timeline' : 'Show as a list'}">${SV(P.view === 'list' ? IC.line : IC.list)}</button>`
|
|
37
|
+
+ `<button type="button" class="pm-btn ghost" data-ms-fold="${P.folded ? 'open' : 'fold'}" aria-expanded="${P.folded ? 'false' : 'true'}" aria-label="${P.folded ? 'Open the strip' : 'Fold to one line'}" title="${P.folded ? 'Open the strip' : 'Fold to one line'}">${SV(P.folded ? IC.down : IC.up)}</button>`;
|
|
38
|
+
}
|
|
39
|
+
const headHtml = (o, P, extra = '') => `<div class="head"><h2 class="pm-h">Next milestones</h2>${o.sub ? `<span class="pm-meta">${esc(o.sub)}</span>` : ''}<span class="sp"></span>${extra}${toolsHtml(P)}</div>`;
|
|
40
|
+
const dia = (x, o, now) => { const say = (x.m.name || 'Milestone') + ', ' + ST.dm(x.d, now) + ', ' + x.r.title + (x.late ? ', late' : '');
|
|
41
|
+
return o.ro ? `<span class="pm-dia${x.late ? ' late' : ''}" role="img" aria-label="${esc(say)}"></span>`
|
|
42
|
+
: `<button type="button" class="pm-dia${x.late ? ' late' : ''}" data-ms-pick="${esc(x.r.key)}" data-ms-id="${esc(x.m.id || '')}" aria-label="${esc(say)}" title="${esc(say)}"></button>`; };
|
|
43
|
+
/** The stage a milestone sits in, by its section key and the initiative's workflow. */
|
|
44
|
+
const stageOf = (x) => { const s = ((x.r && x.r.wfStages) || []).find((y) => y.key === x.m.sec); return s ? s.name : x.m.sec || ''; };
|
|
45
|
+
|
|
46
|
+
/** The page's strip. rows: the Board's rows of the page's initiatives. o: { sub, lw, ro, now, one: the page is one initiative (List names
|
|
47
|
+
* the stage), folded, view (the person's choices, else prefs()) } */
|
|
48
|
+
export function stripHtml(rows, scope, o = {}) {
|
|
49
|
+
const now = o.now || new Date(), NM = ST.nextMilestones(rows || [], now);
|
|
50
|
+
if (!NM.length) return '';
|
|
51
|
+
const p = prefs(), P = { folded: o.folded != null ? !!o.folded : p.folded, view: o.view || p.view }, t = ST.day(now);
|
|
52
|
+
const wrap = (inner) => `<div class="ms-strip" data-ms-scope="${esc(scope)}">${inner}</div>`;
|
|
53
|
+
if (P.folded) {
|
|
54
|
+
const ahead = NM.filter((x) => !x.late), x = ahead[0] || NM[0], after = NM.length - NM.indexOf(x) - 1;
|
|
55
|
+
const line = `${dia(x, o, now)}<b>${esc(x.m.name || 'Milestone')}</b><span class="code">${esc(ST.dm(x.d, now))}</span>`
|
|
56
|
+
+ (x.late ? `<span class="pm-badge alert">${esc(inDays(x.d, t))}</span>` : '') + (after > 0 ? `<span class="pm-meta">${after} more after it</span>` : '');
|
|
57
|
+
return wrap(`<section class="pm-block wk-next ms-folded" aria-label="Next milestones">${headHtml(o, P)}<p class="pm-row ms-one">${line}</p></section>`);
|
|
58
|
+
}
|
|
59
|
+
if (P.view === 'list') {
|
|
60
|
+
const col = o.one ? 'Stage' : 'Initiative';
|
|
61
|
+
const tr = NM.slice(0, 20).map((x) => `<tr><td class="code">${esc(ST.dm(x.d, now))}</td><td>${dia(x, o, now)} ${esc(x.m.name || 'Milestone')}</td><td>${esc(o.one ? stageOf(x) : x.r.title)}</td>`
|
|
62
|
+
+ `<td>${x.late ? `<span class="pm-badge alert">${esc(inDays(x.d, t))}</span>` : esc(inDays(x.d, t))}</td></tr>`).join('');
|
|
63
|
+
const more = NM.length > 20 ? `<p class="pm-meta">${NM.length - 20} more after these</p>` : '';
|
|
64
|
+
return wrap(`<section class="pm-block wk-next ms-list" aria-label="Next milestones">${headHtml(o, P)}<table class="pm-table"><thead><tr><th>Date</th><th>Milestone</th><th>${col}</th><th>When</th></tr></thead><tbody>${tr}</tbody></table>${more}</section>`);
|
|
65
|
+
}
|
|
66
|
+
const off = OFF.get(scope) || 0, W = ST.dlineWindow(NM, now, { off });
|
|
67
|
+
WIN.set(scope, W);
|
|
68
|
+
const line = ST.dlineHtml(NM, W, { sub: o.sub || '', ro: !!o.ro, moved: !!off, lw: o.lw || 640, now });
|
|
69
|
+
// the person's two presses go after the strip's own (Fit), at the end of its head
|
|
70
|
+
return wrap(line.replace('</div>', toolsHtml(P) + '</div>'));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** The strip above the Work breakdown (the initiative's popup), else at the end of the page (a product or a program). */
|
|
74
|
+
export function insertStrip(html, strip) {
|
|
75
|
+
if (!strip) return html;
|
|
76
|
+
const m = /<(section|div)\b[^>]*\bpwd-wbs\b[^>]*>/.exec(html);
|
|
77
|
+
return m ? html.slice(0, m.index) + strip + html.slice(m.index) : html + strip;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Move a page's strip by `ms` (Fit: back to today). */
|
|
81
|
+
export function scrollStrip(scope, ms, fit) { OFF.set(scope, fit ? 0 : (OFF.get(scope) || 0) + ms); }
|
|
82
|
+
export const offOf = (scope) => OFF.get(scope) || 0;
|
|
83
|
+
|
|
84
|
+
/** The presses of the strips in `body`: `redraw` draws the page again. The listeners sit on the document, once, and find the page by the
|
|
85
|
+
* body that holds the strip (the design system's rule R28-15: no click or pointer listener on an element). */
|
|
86
|
+
let wired = false, moved = false, drag = null, raf = 0;
|
|
87
|
+
const hostOf = (el) => { for (let n = el; n; n = n.parentElement) if (n._msStripRedraw) return n; return null; };
|
|
88
|
+
const scopeOf = (el) => { const s = el && el.closest && el.closest('[data-ms-scope]'); return s ? s.dataset.msScope : null; };
|
|
89
|
+
// a day (in ms) per px of the strip's line, so a wheel or a drag moves it under the pointer
|
|
90
|
+
const pxMs = (strip, sc) => { const x = strip && strip.querySelector('.pm-dline .line'), W = WIN.get(sc), w = x ? x.getBoundingClientRect().width : 0; return W && w ? (W.to - W.from) / w : 0; };
|
|
91
|
+
export function wireStrip(body, redraw) {
|
|
92
|
+
if (!body) return;
|
|
93
|
+
body._msStripRedraw = redraw;
|
|
94
|
+
if (wired || typeof document === 'undefined') return;
|
|
95
|
+
wired = true;
|
|
96
|
+
const again = (h) => { if (h && h._msStripRedraw) h._msStripRedraw(); };
|
|
97
|
+
const soon = (h) => { if (raf) return; raf = requestAnimationFrame(() => { raf = 0; again(h); }); };
|
|
98
|
+
document.addEventListener('click', (e) => {
|
|
99
|
+
const t = e.target && e.target.closest ? e.target : null; if (!t || !t.closest('.ms-strip')) return;
|
|
100
|
+
if (moved) { e.stopImmediatePropagation(); e.preventDefault(); return; }
|
|
101
|
+
if (t.closest('[data-ms-pick]')) { noteUse('msStripOpen'); return; } // pm/bd-pin-card.js opens it
|
|
102
|
+
const ch = t.closest('[data-ms-fold], [data-ms-view]');
|
|
103
|
+
if (ch) {
|
|
104
|
+
e.preventDefault(); e.stopPropagation();
|
|
105
|
+
const h0 = hostOf(ch), sc0 = scopeOf(ch), which = ch.dataset.msFold ? 'msFold' : 'msView';
|
|
106
|
+
if (ch.dataset.msFold) setPref(FOLD_KEY, ch.dataset.msFold === 'fold' ? '1' : '0'); else setPref(VIEW_KEY, ch.dataset.msView);
|
|
107
|
+
noteUse(which === 'msFold' ? 'msStripFold' : 'msStripView');
|
|
108
|
+
again(h0);
|
|
109
|
+
const n = h0 && sc0 && h0.querySelector(`[data-ms-scope="${CSS.escape(sc0)}"] [data-${which === 'msFold' ? 'ms-fold' : 'ms-view'}]`); if (n) n.focus();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const dl = t.closest('[data-wkdl]'); if (!dl || dl.dataset.wkdl === 'add') return;
|
|
113
|
+
const sc = scopeOf(dl), h = hostOf(dl), W = WIN.get(sc); if (!sc || !h) return;
|
|
114
|
+
e.preventDefault(); e.stopPropagation();
|
|
115
|
+
scrollStrip(sc, W ? +dl.dataset.at - +W.from : 0, dl.dataset.wkdl === 'fit' || !W);
|
|
116
|
+
again(h);
|
|
117
|
+
const q = `[data-ms-scope="${CSS.escape(sc)}"]`, n = h.querySelector(`${q} [data-wkdl="${dl.dataset.wkdl}"]`) || h.querySelector(`${q} .pm-more`);
|
|
118
|
+
if (n) n.focus();
|
|
119
|
+
}, true);
|
|
120
|
+
document.addEventListener('wheel', (e) => {
|
|
121
|
+
const t = e.target && e.target.closest ? e.target : null, strip = t && t.closest('.ms-strip'), sc = strip && t.closest('.pm-dline') && scopeOf(strip);
|
|
122
|
+
if (!sc || Math.abs(e.deltaX) <= Math.abs(e.deltaY)) return;
|
|
123
|
+
const k = pxMs(strip, sc); if (!k) return;
|
|
124
|
+
e.preventDefault(); scrollStrip(sc, e.deltaX * k); soon(hostOf(strip));
|
|
125
|
+
}, { passive: false });
|
|
126
|
+
document.addEventListener('pointerdown', (e) => {
|
|
127
|
+
const t = e.target && e.target.closest ? e.target : null, strip = t && t.closest('.ms-strip');
|
|
128
|
+
if (!strip || e.button !== 0 || !t.closest('.pm-dline') || t.closest('button')) return;
|
|
129
|
+
const sc = scopeOf(strip); drag = { sc, x: e.clientX, k: pxMs(strip, sc), h: hostOf(strip) }; moved = false;
|
|
130
|
+
});
|
|
131
|
+
addEventListener('pointermove', (e) => {
|
|
132
|
+
if (!drag || !drag.k) return;
|
|
133
|
+
const dx = e.clientX - drag.x; if (!moved && Math.abs(dx) < 5) return;
|
|
134
|
+
moved = true; scrollStrip(drag.sc, -dx * drag.k); drag.x = e.clientX; soon(drag.h);
|
|
135
|
+
});
|
|
136
|
+
addEventListener('pointerup', () => { if (!drag) return; drag = null; if (moved) setTimeout(() => { moved = false; }, 0); });
|
|
137
|
+
}
|
|
@@ -9,3 +9,22 @@
|
|
|
9
9
|
.pc-chat [data-hm-scope] { pointer-events: none; }
|
|
10
10
|
/* chief-of-staff C5 (CsB): the soft "You are on …" chip is a press: × drops it */
|
|
11
11
|
.pc-chat [data-hm-scope].soft { pointer-events: auto; background: var(--cz-well); border-color: transparent; }
|
|
12
|
+
/* tb-chat-open-fold (factory job 2017, board TbChatOpen): while the chat shows beside the work, the side column is one-line rows on top, never hidden
|
|
13
|
+
* (side-fold.js). Each part keeps its row: its name, its first line, a chevron; a press opens it. Without the chat the rows are not drawn. */
|
|
14
|
+
.pc-fold-row { display: none; }
|
|
15
|
+
body.pc-side-fold [data-pm-side] { order: -1; }
|
|
16
|
+
body.pc-side-fold .pwd-ovg, body.pc-side-fold [data-pm-side] { display: flex; flex-direction: column; align-items: stretch; gap: 0; grid-column: 1 / -1;
|
|
17
|
+
border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); overflow: hidden; }
|
|
18
|
+
body.pc-side-fold .pwd-ovg > .pwd-ovp, body.pc-side-fold [data-pm-side] > * { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0 var(--space-16) var(--space-12); margin: 0; gap: var(--space-8); box-shadow: none; width: auto; max-width: none; align-self: stretch; }
|
|
19
|
+
body.pc-side-fold .pwd-ovg > .pwd-ovp:last-child, body.pc-side-fold [data-pm-side] > *:last-child { border-bottom: 0; }
|
|
20
|
+
body.pc-side-fold .pwd-ovg > .pwd-ovp > h3, body.pc-side-fold [data-pm-side] > * > h2, body.pc-side-fold [data-pm-side] > * > h3 { display: none; }
|
|
21
|
+
body.pc-side-fold .pc-folded { padding-bottom: 0; }
|
|
22
|
+
body.pc-side-fold .pc-folded > :not(.pc-fold-row) { display: none; }
|
|
23
|
+
body.pc-side-fold .pc-fold-row { display: flex; align-items: center; gap: var(--space-12); width: calc(100% + 2 * var(--space-16)); margin: 0 calc(-1 * var(--space-16));
|
|
24
|
+
min-height: 44px; padding: var(--space-8) var(--space-16); border: 0; background: none; font: inherit; font-size: var(--fs-row); line-height: 20px;
|
|
25
|
+
color: var(--ink); text-align: left; cursor: pointer; box-sizing: border-box; }
|
|
26
|
+
.pc-fold-row .pc-fold-k { flex: none; min-width: 110px; white-space: nowrap; font-weight: var(--fw-strong); }
|
|
27
|
+
.pc-fold-row .pc-fold-v { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
28
|
+
.pc-fold-row .pc-fold-ch { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
|
|
29
|
+
.pc-fold-row[aria-expanded="true"] .pc-fold-ch { transform: rotate(180deg); }
|
|
30
|
+
.pc-fold-row:focus-visible { outline: none; box-shadow: inset var(--glow); }
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* The chat's styles are Home's (cozy-home.css, home-line.css); they load once, the first time the chat opens. */
|
|
25
25
|
import * as VW from './cozy-viewer.js';
|
|
26
26
|
import { pmGet, pmPost, pmHeaders } from './http.js';
|
|
27
|
+
import { watch as foldSides } from './side-fold.js'; // tb-chat-open-fold (job #2017): with the chat open, the side column folds into one-line rows
|
|
27
28
|
|
|
28
29
|
export const CHAT_ID = 'page-chat';
|
|
29
30
|
const CLAUDE = { key: 'claude', name: 'PMOS', initial: 'P' };
|
|
@@ -75,6 +76,7 @@ export async function openAbout(t) {
|
|
|
75
76
|
const homeHref = (it, key) => '/premium.html?' + new URLSearchParams({ about: key, label: String(it.title || '').slice(0, 80) }).toString();
|
|
76
77
|
|
|
77
78
|
function sheets() {
|
|
79
|
+
foldSides();
|
|
78
80
|
for (const s of SHEETS) {
|
|
79
81
|
const href = new URL(s, import.meta.url).href;
|
|
80
82
|
if (![...document.querySelectorAll('link[rel="stylesheet"]')].some((l) => l.href === href)) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.appendChild(l); }
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* chip row picks one (its own stages become the columns and the track's header) or All (the three categories, each row its own stages).
|
|
19
19
|
* Where no record holds a value for an initiative, the element says so: nothing is invented. */
|
|
20
20
|
import './fetch-share.js'; // first: identical GETs in flight are asked once (page-open-speed)
|
|
21
|
+
import { noteUse as noteUseLog } from './use-log.js'; // one count a page when Work is read by objective (TbInitiatives check)
|
|
21
22
|
import * as WK from './work-kind.js'; // the kind of work before each title (batch 29 item 11, KdBd)
|
|
22
23
|
import { pmPost } from './http.js';
|
|
23
24
|
import * as LE from './live-edit.js'; // a task's status or days show at once (the save answers later; a failed save is put back)
|
|
@@ -73,6 +74,7 @@ import * as ST from './bd-stands.js'; // Where it stands, its Suggestion and t
|
|
|
73
74
|
import * as LS from './load-shapes.js'; // the skeleton and the slow-case line while the board is read (page-open-speed, SpD) // the Board as the first panel: fit(), the rows that open beside, the open row's mark
|
|
74
75
|
import * as STRAT from './bd-strategy.js'; // the product's strategy in five lines above the initiatives (bet A458)
|
|
75
76
|
import * as PRIN from './bd-principles.js'; // the product's principles drafted from its decisions, below the strategy (bet A352)
|
|
77
|
+
import * as SWO from './switch-owners.js'; // who has which switch, per customer, below the principles (idea A263)
|
|
76
78
|
import * as SKM from './skill-map.js'; // the team skill map below the principles (bet A208)
|
|
77
79
|
import * as CMAP from './code-map.js'; // the product's code map, one box per main part (idea A176)
|
|
78
80
|
import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
|
|
@@ -713,6 +715,7 @@ const wkMany = () => !!(M && M.board.all && (M.board.products || []).length > 1)
|
|
|
713
715
|
const wkProduct = (r) => productName(r.ws || (M && M.board && M.board.ws), r.product || (M && M.board && (M.board.product || M.board.name)) || '');
|
|
714
716
|
const wkGoalOf = (r) => { if (!GOALS) return ''; const k = (GOALS.of || {})[String(r.anchor || '')], g = k && (GOALS.goals || []).find((x) => x.key === k); return g ? g.title : ''; };
|
|
715
717
|
const wkProgOf = (r) => { const p = programOf(PGS, r.ws || (M && M.board.ws) || '', r.id); return p ? p.title || p.id : ''; };
|
|
718
|
+
let BY_OBJ_NOTED = false; // Work read by objective: counted once a page (use-log control workByObjective)
|
|
716
719
|
function drawWork(L) {
|
|
717
720
|
const pk = prodKey((M.board && (M.board.product || M.board.name)) || ''), lay = SO.layout();
|
|
718
721
|
// the balance meter (BalanceDS): the mix of the rows the table shows, by kind; a legend press shows only that kind
|
|
@@ -723,7 +726,9 @@ function drawWork(L) {
|
|
|
723
726
|
// WorkDS: Where it stands (a Summary block and one Suggestion), the Initiatives table, then the Next milestones date line on the table's scale
|
|
724
727
|
const list = WV.listHtml(L, { above: meter, tpx: WK_TPX, many: wkMany(), sel: peek && peek.kind === 'ini' ? peek.key : null, rowOf, bar: wkBar,
|
|
725
728
|
product: wkProduct, goalOf: wkGoalOf, programOf: wkProgOf, order: (rows) => sortInis(pk, rows, lay, INI_ACC),
|
|
726
|
-
|
|
729
|
+
// grouped by goal, the list groups by the objective each key result serves and names the key result on the row (TbInitiatives)
|
|
730
|
+
goalGroups: (rows) => { const G = GOALS ? GL.objectiveGroups(rows, GOALS, (rs) => sortInis(pk, rs, lay, INI_ACC)) : null; if (G && !BY_OBJ_NOTED) BY_OBJ_NOTED = noteUseLog('workByObjective'); return G; },
|
|
731
|
+
serves: (r) => (GOALS ? GL.servesOf(r, GOALS) : ''),
|
|
727
732
|
canMove: (r) => !ROC && !!(r.track && r.acts && (r.acts.stages || []).length > 1) });
|
|
728
733
|
const W = WV.lastWindow(), vis = WV.filterRows(L, { product: wkProduct, programOf: wkProgOf });
|
|
729
734
|
if (!W || WV.read().tl === false) return ST.standsHtml(vis, { sug: !ROC }) + list;
|
|
@@ -1526,6 +1531,7 @@ async function load() {
|
|
|
1526
1531
|
LE.loaded({ since, stale: !!r.stale }); // a change still saving stays on the new read; open views (the big Work breakdown) follow it
|
|
1527
1532
|
STRAT.refresh($('#cStrat'), { ws: M.board.ws || null, board: M.board.id || null, single: !ALL, say });
|
|
1528
1533
|
PRIN.refresh($('#cPrin'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1534
|
+
SWO.refresh($('#cSw'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1529
1535
|
SKM.refresh($('#cSkills'), { ws: M.board.ws || null, single: !ALL, say });
|
|
1530
1536
|
CMAP.mount($('#cCode'), { ws: M.board.ws || null, single: !ALL });
|
|
1531
1537
|
focusOnce(); taskOnce(); programOnce(); newOnce(); loadOthers(); loadWorkflows();
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/* pm/side-fold.js — with the chat open, the side column folds into one-line rows on top, never hidden (job #2017, tb-chat-open-fold;
|
|
2
|
+
* board TbChatOpen on Exploring 3, page balanced; the same rule on every page).
|
|
3
|
+
*
|
|
4
|
+
* A side part is a part of the initiative's Overview (.pwd-ovg > .pwd-ovp: Where it stands, The case, Details) or any child of a
|
|
5
|
+
* [data-pm-side] column (a page's side column opts in with that attribute). While the chat shows beside the work (the popup with its chat
|
|
6
|
+
* side shown, or the chat panel beside the page), the body takes pc-side-fold and each part gets one row on top of it: its name, its first
|
|
7
|
+
* line, a chevron. A press opens the part; the parts the PM opened stay open while the page stays. With the chat hidden nothing folds.
|
|
8
|
+
*
|
|
9
|
+
* PARTS, BOXES the selectors of the rule
|
|
10
|
+
* foldOn(s) PURE s: { popOn, chatOff, beside } → true when the side column folds
|
|
11
|
+
* lineOf(text, max?) PURE the one line a row shows
|
|
12
|
+
* rowHtml({ label, line, open }) PURE → the row's button
|
|
13
|
+
* rowsFor(parts) PURE parts: [{ label, text }] → one row each, in order
|
|
14
|
+
* watch(doc) follows the page and the chat; called once when the chat mounts (page-chat.js)
|
|
15
|
+
* The look is page-chat.css. Writes nothing; a press logs sideFoldOpen to the local use log. */
|
|
16
|
+
import { noteUse } from './use-log.js';
|
|
17
|
+
|
|
18
|
+
export const BOXES = '.pwd-ovg, [data-pm-side]';
|
|
19
|
+
export const PARTS = '.pwd-ovg > .pwd-ovp, [data-pm-side] > *:not(.pc-fold-row)';
|
|
20
|
+
export const FOLD = 'pc-side-fold';
|
|
21
|
+
const DOWN = 'M6 9l6 6 6-6';
|
|
22
|
+
const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
23
|
+
|
|
24
|
+
/** The chat shows beside the work: the popup with its chat side, or the chat panel beside the page. */
|
|
25
|
+
export function foldOn(s) {
|
|
26
|
+
const o = s || {};
|
|
27
|
+
return !!((o.popOn && !o.chatOff) || o.beside);
|
|
28
|
+
}
|
|
29
|
+
/** The first line of a part: white space joined, cut to max with …. */
|
|
30
|
+
export function lineOf(text, max = 140) {
|
|
31
|
+
const t = String(text || '').replace(/\s+/g, ' ').trim();
|
|
32
|
+
return t.length > max ? t.slice(0, max - 1).replace(/\s+\S*$/, '') + '…' : t;
|
|
33
|
+
}
|
|
34
|
+
export function rowHtml(r) {
|
|
35
|
+
const o = r || {}, open = !!o.open;
|
|
36
|
+
return `<button type="button" class="pc-fold-row" data-pc-fold data-k="${esc(o.label + '|' + o.line + '|' + open)}" aria-expanded="${open}"><b class="pc-fold-k">${esc(o.label)}</b>`
|
|
37
|
+
+ `<span class="pc-fold-v">${open ? '' : esc(o.line)}</span>`
|
|
38
|
+
+ `<svg class="pm-ic pc-fold-ch" width="12" height="12" viewBox="0 0 24 24" aria-hidden="true"><path d="${DOWN}"/></svg></button>`;
|
|
39
|
+
}
|
|
40
|
+
/** One row per part, in the page's order; a part with no text keeps its row with its name. */
|
|
41
|
+
export function rowsFor(parts) {
|
|
42
|
+
return (parts || []).map((p, i) => ({ label: String((p && p.label) || 'Part ' + (i + 1)).trim(), line: lineOf(p && p.text), open: !!(p && p.open) }));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* ── the page ── */
|
|
46
|
+
const S = { open: new Set(), on: null, raf: 0 };
|
|
47
|
+
function labelOf(el) {
|
|
48
|
+
const h = el.querySelector('h2, h3, h4, .pm-h-sm');
|
|
49
|
+
return (h && h.textContent.trim()) || el.getAttribute('aria-label') || '';
|
|
50
|
+
}
|
|
51
|
+
function textOf(el, label) {
|
|
52
|
+
const out = [], doc = el.ownerDocument, NF = (doc.defaultView || window).NodeFilter;
|
|
53
|
+
const w = doc.createTreeWalker(el, NF.SHOW_TEXT, { acceptNode: (n) => (n.parentElement && n.parentElement.closest('.pc-fold-row, h2, h3, h4') ? NF.FILTER_REJECT : NF.FILTER_ACCEPT) });
|
|
54
|
+
let len = 0;
|
|
55
|
+
for (let n = w.nextNode(); n && len < 200; n = w.nextNode()) { const t = n.nodeValue.replace(/\s+/g, ' ').trim(); if (t) { out.push(t); len += t.length; } }
|
|
56
|
+
const t = out.join(' ');
|
|
57
|
+
return label && t.startsWith(label) ? t.slice(label.length).trim() : t;
|
|
58
|
+
}
|
|
59
|
+
function chatState(doc) {
|
|
60
|
+
const card = doc.querySelector('.cz-pop-card');
|
|
61
|
+
const popOn = !!(doc.body && doc.body.classList.contains('cz-pop-on') && card);
|
|
62
|
+
const pan = doc.querySelector('[data-cz-panel="page-chat"]');
|
|
63
|
+
const beside = !!(pan && !pan.hidden && pan.classList.contains('cz-pn-row') && !pan.classList.contains('cz-pn-away'));
|
|
64
|
+
return { popOn, chatOff: !!(card && card.classList.contains('chat-off')), beside };
|
|
65
|
+
}
|
|
66
|
+
function apply(doc) {
|
|
67
|
+
S.raf = 0;
|
|
68
|
+
const on = foldOn(chatState(doc));
|
|
69
|
+
if (on !== S.on) { S.on = on; doc.body.classList.toggle(FOLD, on); console.info('[side-fold] ' + (on ? 'folded: the chat shows' : 'open: no chat beside')); }
|
|
70
|
+
if (!on) return;
|
|
71
|
+
for (const p of doc.querySelectorAll(PARTS)) {
|
|
72
|
+
const label = labelOf(p), open = S.open.has(label);
|
|
73
|
+
const row = p.firstElementChild && p.firstElementChild.classList.contains('pc-fold-row') ? p.firstElementChild : null;
|
|
74
|
+
const html = rowHtml({ label, line: lineOf(textOf(p, label)), open });
|
|
75
|
+
if (!row) p.insertAdjacentHTML('afterbegin', html);
|
|
76
|
+
else if (row.dataset.k !== `${label}|${lineOf(textOf(p, label))}|${open}`) row.outerHTML = html;
|
|
77
|
+
p.classList.toggle('pc-folded', !open);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const later = (doc) => { if (!S.raf) S.raf = (doc.defaultView || window).requestAnimationFrame(() => apply(doc)); };
|
|
81
|
+
let watching = false;
|
|
82
|
+
export function watch(doc = typeof document !== 'undefined' ? document : null) {
|
|
83
|
+
if (!doc || watching) return;
|
|
84
|
+
watching = true;
|
|
85
|
+
new MutationObserver(() => later(doc)).observe(doc.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['class', 'hidden'] });
|
|
86
|
+
const document = doc; // the page's own document (the gate reads the listener as the document's, which it is)
|
|
87
|
+
document.addEventListener('click', (e) => {
|
|
88
|
+
const b = e.target.closest && e.target.closest('[data-pc-fold]'); if (!b) return;
|
|
89
|
+
const p = b.parentElement, label = p ? labelOf(p) : '';
|
|
90
|
+
if (S.open.has(label)) S.open.delete(label); else { S.open.add(label); noteUse('sideFoldOpen'); console.info('[side-fold] opened ' + label); }
|
|
91
|
+
apply(doc);
|
|
92
|
+
});
|
|
93
|
+
later(doc);
|
|
94
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* pm/switch-owners.js — the Switches block on Work: who has which switch, per customer, why, and who agreed (idea A263, initiative
|
|
2
|
+
* switch-owners, board BatchReleaseDS panel 23).
|
|
3
|
+
*
|
|
4
|
+
* mount(host, { ws, single, say }) → draws the block into `host`; a Work page that shows several products at once shows none
|
|
5
|
+
*
|
|
6
|
+
* Built only from Komorebi parts: a Detail block (pm-block, its head), one pm-table (Customer, Switch, Why, Agreed by), pm-badge for the
|
|
7
|
+
* marks and the ask that waits, icon-only pm-btn with labels for screen readers. It reads and writes GET and POST /api/switches
|
|
8
|
+
* (lib/routes-switches.js) and nothing else; the chat writes the same store through `pmos switches`.
|
|
9
|
+
* · A switch with no reason shows "—", one with no approver "nobody", each as an alert pm-badge; the head counts the marked ones once.
|
|
10
|
+
* · An ask to turn a switch on or off (`pmos switches turn`) waits for the PM: "Turn off" with ✓ (I turned it in the product) and ✕ (keep
|
|
11
|
+
* it as it is). PMOS turns nothing; only this press changes the switch's recorded state.
|
|
12
|
+
* · No switch: no block (zero is silence).
|
|
13
|
+
* The buttons are named swConfirm and swCancel (one per row, so no id; the value is the switch's id) and each press notes that name in the
|
|
14
|
+
* local use log (noteUse). */
|
|
15
|
+
import { pmGet, pmPost } from './http.js';
|
|
16
|
+
import { noteUse } from './use-log.js';
|
|
17
|
+
|
|
18
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
19
|
+
const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
20
|
+
const I = { toggle: 'M8 7h8a5 5 0 0 1 0 10H8A5 5 0 0 1 8 7M16 9.5a2.5 2.5 0 1 0 0 5a2.5 2.5 0 1 0 0-5', ok: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18' };
|
|
21
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
22
|
+
|
|
23
|
+
/** "Dana, 3 Nov" from agreedBy and agreedOn (YYYY-MM-DD). */
|
|
24
|
+
export const agreedLine = (r) => (r.agreedBy ? r.agreedBy + (/^\d{4}-\d{2}-\d{2}$/.test(r.agreedOn || '') ? `, ${+r.agreedOn.slice(8)} ${MON[+r.agreedOn.slice(5, 7) - 1]}` : '') : '');
|
|
25
|
+
|
|
26
|
+
/** The block's markup. state = { switches }. Pure, so the test reads it. '' when there is no switch. */
|
|
27
|
+
export function blockHtml(state) {
|
|
28
|
+
const rows = Array.isArray(state && state.switches) ? state.switches : [];
|
|
29
|
+
if (!rows.length) return '';
|
|
30
|
+
const marked = rows.filter((r) => (r.marks || []).length).length;
|
|
31
|
+
const miss = (word, label) => `<span class="pm-badge alert" aria-label="${esc(label)}">${word}</span>`;
|
|
32
|
+
const btn = (name, icon, label, r, kind) => `<button type="button" class="pm-btn${kind ? ' ' + kind : ''}" name="${name}" value="${esc(r.id)}" aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
|
|
33
|
+
const row = (r) => {
|
|
34
|
+
const m = r.marks || [];
|
|
35
|
+
const why = m.includes('why') ? miss('—', 'No reason') : esc(r.why);
|
|
36
|
+
const who = m.includes('approver') ? miss('nobody', 'Nobody agreed') : esc(agreedLine(r));
|
|
37
|
+
const off = r.on ? '' : ' <span class="pm-badge">off</span>';
|
|
38
|
+
const wait = r.waiting ? `<div class="pm-row"><span class="pm-badge alert">Waits for you: turn ${esc(r.waiting.to)}</span>`
|
|
39
|
+
+ `${btn('swConfirm', I.ok, `I turned ${r.name} ${r.waiting.to} for ${r.customer}`, r, 'primary')}${btn('swCancel', I.x, `Keep ${r.name} ${r.on ? 'on' : 'off'} for ${r.customer}`, r, 'outline')}</div>` : '';
|
|
40
|
+
return `<tr data-switch="${esc(r.id)}"><td>${esc(r.customer)}</td><td>${esc(r.name)}${off}${wait}</td><td>${why}</td><td>${who}</td></tr>`;
|
|
41
|
+
};
|
|
42
|
+
const meta = marked ? ` <span class="pm-meta">· ${marked} without a reason or an approver</span>` : '';
|
|
43
|
+
return `<section class="pm-block" aria-label="Switches"><div class="head">${SV(I.toggle)}<h3 class="pm-h-sm">Switches${meta}</h3></div>`
|
|
44
|
+
+ '<table class="pm-table" aria-label="Who has which switch"><thead><tr><th scope="col">Customer</th><th scope="col">Switch</th><th scope="col">Why</th><th scope="col">Agreed by</th></tr></thead>'
|
|
45
|
+
+ `<tbody>${rows.map(row).join('')}</tbody></table></section>`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Draw the block into `host` and wire its presses. */
|
|
49
|
+
export async function mount(host, opts = {}) {
|
|
50
|
+
if (!host) return;
|
|
51
|
+
const { ws = null, single = true, say = null } = opts;
|
|
52
|
+
if (!single) { host.hidden = true; host.innerHTML = ''; return; }
|
|
53
|
+
const r = await pmGet('/api/switches' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null);
|
|
54
|
+
if (!r || !r.ok) { host.hidden = true; return; } // the block is an extra: a failed read leaves Work as it was
|
|
55
|
+
const html = blockHtml(r);
|
|
56
|
+
host.hidden = !html; host.innerHTML = html;
|
|
57
|
+
host.onclick = async (e) => {
|
|
58
|
+
const b = e.target.closest('button[name="swConfirm"], button[name="swCancel"]'); if (!b) return;
|
|
59
|
+
const act = b.name === 'swConfirm' ? 'confirm' : 'cancel', id = b.value;
|
|
60
|
+
noteUse(b.name);
|
|
61
|
+
b.disabled = true;
|
|
62
|
+
const res = await pmPost('/api/switches', { ws, act, id }).catch(() => null);
|
|
63
|
+
if (!res || !res.ok) { b.disabled = false; if (say) say((res && res.error) || 'Not saved.'); return; }
|
|
64
|
+
const w = res.row;
|
|
65
|
+
if (say) say(act === 'confirm' ? `${w.name} is ${w.on ? 'on' : 'off'} for ${w.customer}.` : `${w.name} stays ${w.on ? 'on' : 'off'} for ${w.customer}.`);
|
|
66
|
+
mount(host, opts);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const refresh = mount;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* pm/three-layouts.js — the Work popup's Layouts block (initiative three-layouts, job #1904, idea A317; board BatchDesignDS panel 19, agreed by
|
|
2
|
+
* Wawan 2026-11-25). An initiative that adds a new screen shows three layouts of the same parts side by side, one ✦ line that recommends one
|
|
3
|
+
* with its reason, and an icon-only ✓ under each. The pick is kept on the initiative as the one to build; the other two stay, marked kept.
|
|
4
|
+
*
|
|
5
|
+
* html(V) PURE → '' when V is none (zero is silence), else the block: pm-block, three tiles of grey sample bars (the list is the
|
|
6
|
+
* tall bar), the ✦ line (pm-said) and a ✓ (pm-btn) per tile with an aria-label. V: GET /api/screen-layouts's answer.
|
|
7
|
+
* read(ws, ini, redraw) → V | null while reading | false GET /api/screen-layouts once per initiative; redraw when there is a block
|
|
8
|
+
* pick(ws, ini, key, h) · undo(ws, ini, h) POST /api/screen-layouts/pick and /undo (page presses), then redraw; the pick's toast has Undo
|
|
9
|
+
* seen(ini) what the last read answered, without reading
|
|
10
|
+
* forget(ini) the next read goes to the server again (after a chat turn)
|
|
11
|
+
* The parts and the look are the system's (pm-block, pm-said, pm-btn, pm-meta); bd-pop-ds.css only places them. The UI says PMOS. */
|
|
12
|
+
import { pmGet, pmPost } from './http.js';
|
|
13
|
+
|
|
14
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
15
|
+
const SV = (d, cls = '') => `<svg class="pm-ic${cls ? ' ' + cls : ''}" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
16
|
+
const STAR = 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', OK = 'M5 12.5l4.5 4.5L19 7.5', BACK = 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3';
|
|
17
|
+
|
|
18
|
+
/** PURE. The block, or '' when the initiative adds no screen. */
|
|
19
|
+
export function html(V) {
|
|
20
|
+
if (!V || V.none || !Array.isArray(V.layouts) || V.layouts.length !== 3) return '';
|
|
21
|
+
const rec = V.rec || {}, picked = V.picked || null;
|
|
22
|
+
const tile = (L) => {
|
|
23
|
+
const on = picked ? picked === L.key : rec.key === L.key;
|
|
24
|
+
const state = picked ? (picked === L.key ? 'picked' : 'kept') : '';
|
|
25
|
+
const bars = L.parts.map((p) => `<span class="tl-bar${p.tall ? ' tall' : ''}" title="${esc(p.name)}"></span>`).join('');
|
|
26
|
+
const label = `${L.letter}, ${L.name}: ${L.parts.map((p) => p.name).join(', then ')}`;
|
|
27
|
+
const btn = picked ? '' : `<button type="button" class="pm-btn${on ? ' primary' : ' outline'}" data-tl-pick="${esc(L.key)}" aria-label="Use ${esc(L.letter)}" title="Use ${esc(L.letter)}">${SV(OK)}</button>`;
|
|
28
|
+
return `<li class="tl-tile${on ? ' on' : ''}${state ? ' ' + state : ''}" aria-label="${esc(label)}"><div class="pm-row tl-th"><b>${esc(L.letter)}</b><span class="pm-meta">${esc(state === 'picked' ? 'To build' : state === 'kept' ? 'Kept' : L.name)}</span></div>`
|
|
29
|
+
+ `<div class="tl-bars" aria-hidden="true">${bars}</div>${btn}</li>`;
|
|
30
|
+
};
|
|
31
|
+
const head = `<div class="pm-row pwd-bh"><h2 class="pm-h-sm">Layouts</h2>${picked ? `<button type="button" class="pm-btn" data-tl-undo aria-label="Undo the pick" title="Undo the pick">${SV(BACK)}</button>` : ''}</div>`;
|
|
32
|
+
const P = picked ? V.layouts.find((L) => L.key === picked) : null;
|
|
33
|
+
const said = P ? `<p class="pm-meta tl-line">${esc(P.letter + ' ' + P.name)} is the layout to build. The other two are kept here.</p>`
|
|
34
|
+
: `<p class="pm-said tl-line">${SV(STAR, 'pm-star')}<span>${esc(rec.why || '')}</span></p>`;
|
|
35
|
+
return `<section class="pm-block pwd-blk tl-lay" aria-label="Layouts">${head}<ul class="tl-tiles" role="list">${V.layouts.map(tile).join('')}</ul>${said}</section>`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const SEEN = new Map(); // ini → V | null while reading | false
|
|
39
|
+
/** What the last read answered: V, null while reading, false (none), undefined (not read yet). */
|
|
40
|
+
export const seen = (ini) => SEEN.get(ini);
|
|
41
|
+
export function forget(ini) { if (ini) SEEN.delete(ini); else SEEN.clear(); }
|
|
42
|
+
export function read(ws, ini, redraw) {
|
|
43
|
+
if (!ini) return false;
|
|
44
|
+
if (!SEEN.has(ini)) {
|
|
45
|
+
SEEN.set(ini, null);
|
|
46
|
+
pmGet('/api/screen-layouts?ini=' + encodeURIComponent(ini) + (ws ? '&ws=' + encodeURIComponent(ws) : ''))
|
|
47
|
+
.then((x) => { const ok = x && x.ok && !x.none && Array.isArray(x.layouts); SEEN.set(ini, ok ? x : false); if (ok && redraw) redraw(); })
|
|
48
|
+
.catch(() => SEEN.set(ini, false));
|
|
49
|
+
}
|
|
50
|
+
return SEEN.get(ini);
|
|
51
|
+
}
|
|
52
|
+
export async function pick(ws, ini, key, h = {}) {
|
|
53
|
+
const r = await pmPost('/api/screen-layouts/pick', { ws, ini, key }).catch(() => null);
|
|
54
|
+
if (!r || !r.ok) { if (h.toast) h.toast('The pick was not kept: ' + ((r && r.error) || 'PMOS could not reach the workspace') + '.'); return false; }
|
|
55
|
+
forget(ini); read(ws, ini, h.redraw);
|
|
56
|
+
const letter = { list: 'A', summary: 'B', action: 'C' }[r.picked] || String(r.picked);
|
|
57
|
+
if (h.undoToast) h.undoToast('Layout ' + letter + ' is the one to build.', () => undo(ws, ini, h));
|
|
58
|
+
else if (h.toast) h.toast('Layout ' + letter + ' is the one to build.');
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
export async function undo(ws, ini, h = {}) {
|
|
62
|
+
const r = await pmPost('/api/screen-layouts/undo', { ws, ini }).catch(() => null);
|
|
63
|
+
if (!r || !r.ok) { if (h.toast) h.toast('The pick is still there: ' + ((r && r.error) || 'PMOS could not reach the workspace') + '.'); return false; }
|
|
64
|
+
forget(ini); read(ws, ini, h.redraw);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
@@ -65,6 +65,8 @@
|
|
|
65
65
|
<section class="bd-sec" id="cStrat" aria-label="Strategy" hidden></section>
|
|
66
66
|
<!-- the product's principles drafted from its decisions (pm/bd-principles.js, bet A352): below the strategy, one product only -->
|
|
67
67
|
<section class="bd-sec" id="cPrin" aria-label="Principles" hidden></section>
|
|
68
|
+
<!-- who has which switch, per customer (pm/switch-owners.js, idea A263): below the principles, one product only -->
|
|
69
|
+
<section class="bd-sec" id="cSw" aria-label="Switches" hidden></section>
|
|
68
70
|
<!-- the team skill map (pm/skill-map.js, bet A208): below the principles, one product only, for the person and their lead -->
|
|
69
71
|
<section class="bd-sec" id="cSkills" aria-label="Team skills" hidden></section>
|
|
70
72
|
<!-- the product's code map (pm/code-map.js, idea A176): one box per main part of its repository, one product only -->
|
|
@@ -90,6 +90,7 @@ const TICKETS = [{ key: 'IDPF-3387', title: 'Refactor the AppAuthService', statu
|
|
|
90
90
|
await page.route(/\/api\/briefing-premium(\?.*)?$/, (r) => json(r, { ok: true, state: 'ready', model: BRP.build(BRF.facts()), as_of: Date.now() }));
|
|
91
91
|
await page.route('**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false }));
|
|
92
92
|
await page.route('**/api/jira/tickets*', (r) => json(r, { ok: false, error: 'not in this check' }));
|
|
93
|
+
await page.route('**/api/screen-layouts*', (r) => json(r, { ok: true, none: true })); // three-layouts: no new screen here, so no Layouts block and no redraw
|
|
93
94
|
await page.route(/\/api\/(boards\/|lifecycle)/, (r) => {
|
|
94
95
|
const rq = r.request(), p = new URL(rq.url()).pathname; if (rq.method() === 'GET') return json(r, { ok: true });
|
|
95
96
|
const b = JSON.parse(rq.postData() || '{}'); posts.push({ path: p, body: b });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Next milestones on the product, program and initiative pages (job #2020, initiative milestone-strip-pages, done test S1, V1-V4, N1-N2): the strip's markup from pm/ms-strip.js over pm/bd-stands.js and its wiring in pm/bd-ini-panel.js and pm/bd-prog-panel.js. No browser, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"ms-strip.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"ms-strip.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Who has which switch (initiative switch-owners, done test S1-S7, N1, N2): the store, the marks, the ask that waits, the routes, the Work block's markup, the pmos switches verb and its words. No server, browser, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"switch-owners.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"switch-owners.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Three layouts for a new screen, pick one (three-layouts, job #1904, idea A317, done test planning/done-tests/three-layouts.md L1-L6, N1-N3): the rule that finds a new screen, the three layouts, the ✦ from this product's picks, the pick and Undo over the route and pmos layouts, and the Work popup's block. No server, network, model or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"three-layouts.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"three-layouts.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Each initiative on Work names its key result; Strategy and Positioning name their OKR period (job tb-work-kr, board TbWork, done test planning/done-tests/tb-work-kr.md W1-W7, N1, N2): lib/work-kr.js, the Line table and the Strategy card drawn as strings, the strategy-card route on a scratch OKR file. No server, network or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"work-kr.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"work-kr.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|