create-pmos 0.401.0 → 0.403.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 +25 -30
- package/payload/KIT-VERSION +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/board-programs-test.js +227 -0
- package/workspace/board-shot.js +54 -0
- package/workspace/briefing-premium-adddoc-test.js +28 -22
- package/workspace/briefing-premium-board-test.js +107 -82
- package/workspace/briefing-premium-calendar-2-test.js +23 -10
- package/workspace/briefing-premium-calendar-3-test.js +23 -19
- package/workspace/briefing-premium-calendar-test.js +20 -15
- package/workspace/briefing-premium-initiative-test.js +25 -12
- package/workspace/briefing-premium-insights-test.js +31 -18
- package/workspace/briefing-premium-metrics-test.js +8 -8
- package/workspace/briefing-premium-sources-test.js +15 -10
- package/workspace/briefing-premium-test.js +39 -16
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/board-premium-facts.js +20 -3
- package/workspace/fixtures/briefing-premium-facts.js +18 -2
- package/workspace/fixtures/premium-viewer-fixtures.js +24 -2
- package/workspace/fixtures/program-ascent.js +101 -0
- package/workspace/guide/home.md +11 -7
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/jira.md +38 -6
- package/workspace/guide/programs.md +37 -0
- package/workspace/home-rows-test.js +184 -0
- package/workspace/lib/briefing-premium-products.js +4 -4
- package/workspace/lib/briefing-premium.js +2 -2
- package/workspace/lib/calendar-layers.js +8 -4
- package/workspace/lib/initiative-layout.js +4 -3
- package/workspace/lib/jira-cli.js +17 -12
- package/workspace/lib/jira-status.js +1 -1
- package/workspace/lib/jira-tickets.js +126 -24
- package/workspace/lib/meeting-files.js +58 -0
- package/workspace/lib/meeting-learn.js +139 -0
- package/workspace/lib/meeting-material.js +12 -5
- package/workspace/lib/notes.js +3 -0
- package/workspace/lib/programs.js +129 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-brief-page.js +8 -1
- package/workspace/lib/routes-briefing-premium.js +1 -1
- package/workspace/lib/routes-calendar-views.js +24 -3
- package/workspace/lib/routes-meeting-material.js +38 -0
- package/workspace/lib/routes-meeting-points.js +23 -3
- package/workspace/lib/routes-programs.js +122 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +31 -25
- package/workspace/premium-chat-context-test.js +1 -1
- package/workspace/premium-chat-goal-view-test.js +1 -1
- package/workspace/premium-chat-viewer-test.js +1 -1
- package/workspace/premium-core-doc-issue-test.js +13 -7
- package/workspace/premium-discuss-landing-test.js +83 -0
- package/workspace/premium-link-suggest-test.js +103 -0
- package/workspace/premium-report-read-test.js +86 -82
- package/workspace/premium-vw-backlog-test.js +6 -5
- package/workspace/premium-vw-cal-test.js +45 -19
- package/workspace/premium-vw-item-test.js +8 -6
- package/workspace/premium-vw-jira-test.js +3 -2
- package/workspace/premium-vw-meet-test.js +122 -66
- package/workspace/premium-vw-notes-test.js +7 -6
- package/workspace/premium-vw-rec-test.js +14 -13
- package/workspace/premium-vw-slides-test.js +11 -5
- package/workspace/program-panel-test.js +152 -0
- package/workspace/public/pm/bd-acts.js +24 -15
- package/workspace/public/pm/bd-asks.js +111 -30
- package/workspace/public/pm/bd-ini-panel.js +229 -0
- package/workspace/public/pm/bd-pop.js +2 -2
- package/workspace/public/pm/bd-prog-panel.js +436 -0
- package/workspace/public/pm/bd-prog.js +191 -0
- package/workspace/public/pm/bd-span.js +98 -15
- package/workspace/public/pm/bd-views.js +93 -29
- package/workspace/public/pm/cozy-board.css +214 -20
- package/workspace/public/pm/cozy-evui.js +4 -2
- package/workspace/public/pm/cozy-home-rows.css +54 -0
- package/workspace/public/pm/cozy-home.css +35 -0
- package/workspace/public/pm/cozy-insights.css +1 -2
- package/workspace/public/pm/cozy-mtg-present.css +160 -0
- package/workspace/public/pm/cozy-panel.css +155 -0
- package/workspace/public/pm/cozy-rec-pill.css +12 -0
- package/workspace/public/pm/cozy-rec-pill.js +46 -0
- package/workspace/public/pm/cozy-today.css +189 -0
- package/workspace/public/pm/cozy-viewer.js +307 -43
- package/workspace/public/pm/cozy-vw-mtg.css +96 -94
- package/workspace/public/pm/cozy-vw-rp.css +40 -25
- package/workspace/public/pm/cozy-vw-shell.css +127 -0
- package/workspace/public/pm/cozy-xv.css +51 -0
- package/workspace/public/pm/cozy-xv.js +34 -0
- package/workspace/public/pm/home-app.js +192 -72
- package/workspace/public/pm/home-chat.js +17 -4
- package/workspace/public/pm/home-data.js +1 -1
- package/workspace/public/pm/home-day.js +64 -0
- package/workspace/public/pm/home-ini-model.js +1 -1
- package/workspace/public/pm/home-ini.js +197 -54
- package/workspace/public/pm/home-list.js +100 -27
- package/workspace/public/pm/home-mentions.js +187 -0
- package/workspace/public/pm/home-rec-row.js +67 -0
- package/workspace/public/pm/home-review.js +20 -10
- package/workspace/public/pm/home-task.js +19 -18
- package/workspace/public/pm/home-today.js +137 -59
- package/workspace/public/pm/premium-board.js +294 -288
- package/workspace/public/pm/premium-insights.js +118 -82
- package/workspace/public/pm/premium-mtg-present.js +408 -100
- package/workspace/public/pm/premium-mtg-replay.js +70 -10
- package/workspace/public/pm/premium-report-read.js +118 -63
- package/workspace/public/pm/premium-vw-cal.js +62 -34
- package/workspace/public/pm/premium-vw-mtg.js +348 -192
- package/workspace/public/pm/program-model.js +192 -0
- package/workspace/public/pm/rec-state.js +63 -0
- package/workspace/public/pm/rp-parts.js +33 -8
- package/workspace/public/pm/tk-draft.js +107 -0
- package/workspace/public/pm/tk-model.js +134 -0
- package/workspace/public/pm/tk-send.js +124 -0
- package/workspace/public/pm/tk-tasks.css +120 -0
- package/workspace/public/premium-board.html +4 -2
- package/workspace/server.js +4 -2
- package/workspace/skills/jira-push.skill +3 -3
- package/workspace/test-lists/board-programs.json +9 -0
- package/workspace/test-lists/prd-to-jira.json +6 -0
- package/workspace/test-lists/program-hierarchy.json +11 -0
- package/workspace/test-lists/program-panel.json +9 -0
- package/workspace/test-lists/viewer-home-rows.json +9 -0
- package/workspace/test-lists/viewer-meetings.json +9 -0
- package/workspace/test-lists/viewer-shell-a.json +15 -0
- package/workspace/tk-tasks-test.js +199 -0
|
@@ -17,14 +17,21 @@
|
|
|
17
17
|
import { pmPost } from './http.js';
|
|
18
18
|
import { $, $$, esc, store, crumbHtml, wireCrumb, chatAbout, setPageGaps } from './premium-shell.js';
|
|
19
19
|
import { mountNav } from './cozy-nav.js';
|
|
20
|
+
import { mountRecPill } from './cozy-rec-pill.js';
|
|
20
21
|
import { stepsHelpHtml, rulesHelpHtml } from './bd-stages.js';
|
|
21
|
-
import { timelineHtml, SPANS, GROUPS, md } from './bd-span.js';
|
|
22
|
+
import { timelineHtml, legendHtml, SPANS, GROUPS, md } from './bd-span.js';
|
|
22
23
|
import * as Acts from './bd-acts.js';
|
|
23
24
|
import * as V from './bd-views.js';
|
|
24
25
|
import * as Asks from './bd-asks.js';
|
|
26
|
+
import * as PG from './bd-prog.js';
|
|
27
|
+
import { programOf } from './program-model.js';
|
|
25
28
|
import { open as viewerOpen } from './cozy-viewer.js';
|
|
29
|
+
import * as VW from './cozy-viewer.js';
|
|
30
|
+
import * as PP from './bd-prog-panel.js';
|
|
31
|
+
import * as BI from './bd-ini-panel.js';
|
|
32
|
+
import { setSay } from './cozy-xv.js';
|
|
26
33
|
|
|
27
|
-
const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUP_KEY = 'pmos.board.group';
|
|
34
|
+
const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUP_KEY = 'pmos.board.group', GROUPING_KEY = 'pmos.board.grouping';
|
|
28
35
|
let M = null; // the model
|
|
29
36
|
let TR = null; // the trail (GET /api/board-trail): { usual, themes, items: { [id]: item } }
|
|
30
37
|
let group = GROUPS.some(([k]) => k === store.get(GROUP_KEY)) ? store.get(GROUP_KEY) : 'theme';
|
|
@@ -37,9 +44,16 @@ let foldOpen = false; // the Monitor and Evaluate rows under the tab
|
|
|
37
44
|
let sprintSet = false; // "This sprint" starts on, once, when the board has a sprint
|
|
38
45
|
const F = { chips: new Set(), q: '', owners: new Set(), lanes: new Set(), sprints: new Set() }; // the chip filters, Find and Filter
|
|
39
46
|
let GR = {}; // the first questions still open per initiative (GET /api/board-grill?ids=): { [id]: { open, total, later } }
|
|
47
|
+
let PGS = []; // the programs (GET /api/programs): every view groups the rows a program holds under it (PgBoard)
|
|
48
|
+
let XR = {}; // the other products' rows a program here holds, read once (GET /api/board-premium?ws=): { [ws]: { name, rows } }
|
|
49
|
+
const ALL = new URLSearchParams(location.search).get('all') === '1'; // All products: every product's board on one page (PgBoard)
|
|
50
|
+
let byProduct = store.get(GROUPING_KEY) === 'product'; // the grouping: programs first (default) or By product (PgBoardProduct)
|
|
40
51
|
let DM = {}; // the documents' history (GET /api/board-docs): { [path]: { changed, by, log } }
|
|
41
|
-
let peek = null; // the
|
|
52
|
+
let peek = null; // what the Viewer shows for the Board: { kind: 'ini', key } an initiative or its ticket, { kind: 'acts' } an acts panel
|
|
42
53
|
mountNav('board');
|
|
54
|
+
mountRecPill();
|
|
55
|
+
// a product head's goal dots (PgBoard .gd) count that product's open initiatives, the way Home's product header does
|
|
56
|
+
PG.goalsFrom((name) => (M ? M.initiatives.list.rows.filter((r) => !M.board.all || r.product === name) : null));
|
|
43
57
|
const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
44
58
|
const I = {
|
|
45
59
|
x: 'M6 6l12 12M18 6L6 18', expand: 'M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7', more: 'M5 12h.01M12 12h.01M19 12h.01', go: 'M5 12h14M13 6l6 6-6 6', next: 'M9 6l6 6-6 6',
|
|
@@ -56,11 +70,49 @@ const fmt = (iso) => { const d = isoDate(iso); return d ? md(d) : ''; };
|
|
|
56
70
|
const PHONE = matchMedia('(max-width: 720px)');
|
|
57
71
|
const goneRows = () => { const G = (M && M.initiatives && M.initiatives.gone) || {}; return [...(G.cancelled || []), ...(G.archived || [])]; };
|
|
58
72
|
const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || goneRows().find((r) => r.key === key) || null;
|
|
73
|
+
/** The rows on screen grouped (pm/bd-prog.js groupsOf): programs first, then the product; or By product. null when no program holds a row here. */
|
|
74
|
+
const groups = (L) => PG.groupsOf(PGS, L, M, byProduct);
|
|
75
|
+
const progState = (p) => PG.stateOf(p, M, XR);
|
|
59
76
|
|
|
60
|
-
/** A panel of pm/bd-acts.js or pm/bd-asks.js
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
/** A panel of pm/bd-acts.js or pm/bd-asks.js (New initiative, Accept ask, the first questions, a document, a release, the backlog, Metrics,
|
|
78
|
+
* Cancelled and archived): it opens in the Viewer's shell A like the initiative, so the Board has one panel. The module's head becomes the
|
|
79
|
+
* shell's: its eyebrow is the kind, its title the title once, and its tools go under ⋯; its sub line and body go in the shell's body.
|
|
80
|
+
* The same panel drawn again (the next question, the metrics read again) changes the body in place, so its Close does not run.
|
|
81
|
+
* o.onClose runs when the shell closes it (×, Escape, or another item in its place). cls (pk-new, pk-wide, pk-doc) styles the body. */
|
|
82
|
+
let acts = null; // { id, onClose } the acts panel shown in the shell
|
|
83
|
+
function actsPanel(html, from, cls, o = {}) {
|
|
84
|
+
const t = document.createElement('div'); t.innerHTML = html;
|
|
85
|
+
const h = t.querySelector('.pk-h'), title = ((h && h.querySelector('#pkTitle')) || {}).textContent || '';
|
|
86
|
+
const eye = ((h && h.querySelector('.pk-eye')) || {}).textContent || '', sub = ((h && h.querySelector('.pk-sub')) || {}).textContent || '';
|
|
87
|
+
const tools = h ? [...h.querySelectorAll('.pk-tools > a[href]')] : [];
|
|
88
|
+
const b = t.querySelector('.pk-b'); if (h) h.remove();
|
|
89
|
+
const inner = (sub ? `<p class="pk-sub">${esc(sub)}</p>` : '') + `<div class="bd-pl">${b ? b.innerHTML : t.innerHTML}</div>`;
|
|
90
|
+
const id = 'acts:' + (title || eye), c = viewerCurrent();
|
|
91
|
+
if (acts && c && c.id === id && acts.id === id && VW.body()) {
|
|
92
|
+
acts.onClose = o.onClose || null;
|
|
93
|
+
const body = VW.body(); body.className = 'cz-vw-body bd-actsvw' + (cls ? ' ' + cls : ''); body.innerHTML = inner; return;
|
|
94
|
+
}
|
|
95
|
+
const more = tools.map((a) => ({ label: a.getAttribute('aria-label') || a.textContent.trim(), on: () => location.assign(a.getAttribute('href')) }));
|
|
96
|
+
const back = !!(from && from.closest && from.closest('#czViewer')) && VW.isOpen();
|
|
97
|
+
const me = { id, onClose: o.onClose || null };
|
|
98
|
+
VW.open({ kind: eye || 'Board', title: title || eye, icon: 'flag', id, back, more: more.length ? more : undefined,
|
|
99
|
+
render: (body) => {
|
|
100
|
+
acts = me; peek = { kind: 'acts', key: null };
|
|
101
|
+
body.classList.add('bd-actsvw'); if (cls) body.classList.add(cls);
|
|
102
|
+
body.innerHTML = inner;
|
|
103
|
+
body.onclick = (e) => {
|
|
104
|
+
const tk = e.target.closest('[data-tk]'); if (tk) { openTicket(tk.dataset.ini, tk.dataset.tk, tk); return; }
|
|
105
|
+
if (e.target.closest('[data-pk="close"]')) closePanel();
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
onClose: () => { if (acts !== me) return; acts = null; if (peek && peek.kind === 'acts') peek = null; if (typeof me.onClose === 'function') me.onClose(); } });
|
|
109
|
+
}
|
|
110
|
+
const viewerCurrent = () => (VW.current ? VW.current() : null);
|
|
111
|
+
/** Closes what shows in the shell for the Board: the initiative (or its ticket) or an acts panel. */
|
|
112
|
+
function closePanel() {
|
|
113
|
+
if (peek && peek.kind === 'ini') { BI.close(); return; }
|
|
114
|
+
const c = viewerCurrent();
|
|
115
|
+
if (acts && c && c.id === acts.id) VW.close();
|
|
64
116
|
}
|
|
65
117
|
|
|
66
118
|
/* ── the toast: the Agreed design's dark pill ─────────────────────────────────────────────────────────────────────────────── */
|
|
@@ -77,14 +129,16 @@ let crumbed = false;
|
|
|
77
129
|
function drawHead() {
|
|
78
130
|
if (!crumbed) {
|
|
79
131
|
crumbed = true;
|
|
80
|
-
|
|
132
|
+
// the picker: All products first when there is more than one product, then each product's board
|
|
133
|
+
const list = M.board.switcher || [], boards = list.length > 1 ? [{ ws: '*', id: '*', name: 'All products' }, ...list] : list;
|
|
81
134
|
$('#crumbHost').innerHTML = crumbHtml({ page: '', board: M.board.name || 'Board', boards });
|
|
82
|
-
wireCrumb({ boards, board: M.board.id, goBoard: (ws, id) => location.assign('/premium-board.html?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(id)) });
|
|
135
|
+
wireCrumb({ boards, board: ALL ? '*' : M.board.id, goBoard: (ws, id) => location.assign(id === '*' ? '/premium-board.html?all=1' : '/premium-board.html?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(id)) });
|
|
83
136
|
$('#crBoard').setAttribute('aria-label', 'Product: ' + (M.board.name || 'Board'));
|
|
84
|
-
chatAbout('board:this-board', M.board.name ? 'the ' + M.board.name + ' board' : 'this board');
|
|
137
|
+
chatAbout('board:this-board', ALL ? 'all products' : M.board.name ? 'the ' + M.board.name + ' board' : 'this board');
|
|
85
138
|
}
|
|
86
139
|
$('#snap').textContent = M.header.text;
|
|
87
|
-
|
|
140
|
+
// PMOS-self: new work starts at the pmos-router skill. All products: New asks which product the initiative is for
|
|
141
|
+
$('#newIni').hidden = ALL ? (M.board.products || []).every((p) => p.self) : !!M.board.self;
|
|
88
142
|
setPageGaps(((M.header && M.header.missing) || []).length);
|
|
89
143
|
}
|
|
90
144
|
const CHIP_F = [['late', 'late', 'm-warn', (n) => n + ' late'], ['risk', 'risk', 'm-warn', (n) => n + ' at risk'], ['blocked', 'red', 'm-crit', (n) => n + ' blocked'], ['idle', 'q', '', (n) => n + ' idle 30+ days']];
|
|
@@ -101,17 +155,20 @@ function drawChips() {
|
|
|
101
155
|
$('#bdChipset').innerHTML = `<span class="bd-grpw"><button type="button" class="bd-chip" id="chGroup" aria-haspopup="menu" aria-expanded="false">${SV(I.group)}<span>Group:</span><b>${esc(gn)}</b></button><span class="bd-grpm" id="grpMenu" role="menu" hidden>${GROUPS.map(([k, n]) => `<button type="button" role="menuitemradio" aria-checked="${k === group}" data-grp="${k}">${esc(n)}</button>`).join('')}</span></span><span class="bd-sp"></span>${flt(['late', 'risk', 'blocked'])}`;
|
|
102
156
|
return;
|
|
103
157
|
}
|
|
104
|
-
|
|
158
|
+
// All products (PgBoard): one Jira chip with the oldest read of any product, and every product's new asks; the sprint stays per product
|
|
159
|
+
const jiraChip = `<button type="button" class="bd-chip" id="chJira" title="${ALL ? 'Read Jira again for every product' : 'Read Jira again'}">${SV(I.refresh)}<span>${esc(jira)}</span></button>`;
|
|
105
160
|
const askChip = `<button type="button" class="bd-chip" id="chAsks" aria-haspopup="dialog">${asks ? esc(asks) : `<i class="cz-dot you${C.asks ? ' m-info' : ''}"></i><b>${C.asks}</b> new ${plural(C.asks, 'ask', 'asks')}`}</button>`;
|
|
106
161
|
if (phone) {
|
|
107
162
|
const docs = M.docs && M.docs.rows ? M.docs.rows.length : 0;
|
|
108
163
|
$('#bdChipset').innerHTML = thisSprint + jiraChip + askChip + flt(['late', 'risk', 'blocked', 'idle']) + `<button type="button" class="bd-chip" id="chDocs">Docs ${docs}</button>`;
|
|
109
164
|
return;
|
|
110
165
|
}
|
|
166
|
+
// the timeline's legend sits at the end of the chip row (PgTimeline), with a program milestone only where a program is drawn
|
|
167
|
+
const lgd = view === 'time' && span === 'quarter' ? '<span class="bd-sp"></span>' + legendHtml(!byProduct && !!groups(visible())) : '';
|
|
111
168
|
$('#bdChipset').innerHTML = jiraChip
|
|
112
|
-
+ `<button type="button" class="bd-chip" id="chSprint" aria-haspopup="dialog">${SV(I.cal)}<span>${esc(sprint)}</span></button>`
|
|
169
|
+
+ (ALL ? '' : `<button type="button" class="bd-chip" id="chSprint" aria-haspopup="dialog">${SV(I.cal)}<span>${esc(sprint)}</span></button>`)
|
|
113
170
|
+ askChip + '<span class="bd-vr"></span>' + flt(['late', 'risk', 'blocked', 'idle'])
|
|
114
|
-
+ (thisSprint ? '<span class="bd-sp"></span>' + thisSprint : '');
|
|
171
|
+
+ (thisSprint ? '<span class="bd-sp"></span>' + thisSprint : '') + lgd;
|
|
115
172
|
}
|
|
116
173
|
$('#bdChipset').addEventListener('click', (e) => {
|
|
117
174
|
const f = e.target.closest('[data-f]');
|
|
@@ -133,10 +190,14 @@ $('#bdChipset').addEventListener('click', (e) => {
|
|
|
133
190
|
/** Read Jira again: the Jira source's own refresh (POST /api/sources/refresh), the one the Sources list runs. It starts a read and changes no record. */
|
|
134
191
|
async function refreshJira(btn) {
|
|
135
192
|
if (btn) btn.disabled = true;
|
|
136
|
-
|
|
193
|
+
// All products: each product's own Jira source, one after the other
|
|
194
|
+
const W = ALL ? (M.board.products || []).filter((p) => !p.self).map((p) => p.ws) : [(M && M.board.ws) || ''];
|
|
195
|
+
const R = [];
|
|
196
|
+
for (const ws of W) R.push(await pmPost('/api/sources/refresh', { ws, source: 'jira' }).catch(() => null));
|
|
137
197
|
if (btn) btn.disabled = false;
|
|
138
|
-
|
|
139
|
-
|
|
198
|
+
const bad = R.filter((r) => !r || !r.ok), ok = R.length - bad.length;
|
|
199
|
+
say(!bad.length ? 'Reading Jira again. The Board shows it when the read lands.' : ok ? 'Reading Jira again for ' + ok + ' of ' + R.length + ' products. The others did not start: ' + ((bad[0] && bad[0].error) || 'the server did not answer') + '.' : 'Jira was not read again: ' + ((bad[0] && bad[0].error) || 'the server did not answer') + '.');
|
|
200
|
+
if (ok) setTimeout(load, 4000);
|
|
140
201
|
}
|
|
141
202
|
|
|
142
203
|
/* ── the popovers: what finishes each step, and the timeline's spans ───────────────────────────────────────────────────── */
|
|
@@ -217,7 +278,17 @@ function segHtml(r, big) {
|
|
|
217
278
|
? `<button type="button" class="bt-tk ${esc(s.cls || 'td')}" data-tk="${esc(s.tk)}" data-ini="${esc(r.key)}" aria-label="${esc(s.tk + ': ' + ((t.tickets.find((k) => k.key === s.tk) || {}).title || '') + ', ' + ((t.tickets.find((k) => k.key === s.tk) || {}).blocked ? 'blocked' : (t.tickets.find((k) => k.key === s.tk) || {}).status))}" title="${esc(s.tk)}"></button>`
|
|
218
279
|
: `<i class="${esc(s.cls || '')}"${fill(i)}></i>`)).join('')}</div>`;
|
|
219
280
|
}
|
|
220
|
-
|
|
281
|
+
// the next step leads (PgBoard, the nextfirst layer): "Next: <the part>" with the part in blue ink; an output is named by its noun ("BRD", not "BRD complete")
|
|
282
|
+
const lineHtml = (r) => ((r.track && r.track.line) || []).map((x) => (x.tone ? `<em class="s-${x.tone}">${esc(x.text)}</em>` : /^Next: /.test(x.text) ? `Next: <em class="nx">${esc(x.text.slice(6))}</em>` : esc(x.text))).join(' · ');
|
|
283
|
+
const outName = (s) => String(s || '').replace(/ complete$/, '');
|
|
284
|
+
/** The committed date under a milestone (PgBoard .eta): the planned end under ◆ Deliver until the initiative passes it, then under ◆ Evaluate;
|
|
285
|
+
* amber when it is past and the milestone is not reached. At the milestone itself the date replaces the days count. */
|
|
286
|
+
function etaOf(r, t) {
|
|
287
|
+
if (!r.end) return null;
|
|
288
|
+
const j = t.k <= 5 ? 5 : t.k <= 7 ? 7 : -1; if (j < 0) return null;
|
|
289
|
+
const d = isoDate(r.end), today = new Date(); today.setHours(0, 0, 0, 0);
|
|
290
|
+
return { j, text: fmt(r.end), late: !!(d && d < today), what: j === 5 ? 'Committed delivery date' : 'Committed evaluation date' };
|
|
291
|
+
}
|
|
221
292
|
|
|
222
293
|
/* ── the stage track (AgBoard, AgBoardPhone) ──────────────────────────────────────────────────────────────────────────── */
|
|
223
294
|
const LEGEND = '<span class="lg" aria-hidden="true"><span><i class="sk"></i>Skipped</span><span><i class="dn"></i>Done</span><span><i class="rv"></i>Review</span><span><i class="ip"></i>Doing</span><span><i class="yo"></i>You</span><span><i class="bl"></i>Blocked</span></span>';
|
|
@@ -226,18 +297,20 @@ const DAYS = (t) => (t.days != null ? t.days + 'd' : '—');
|
|
|
226
297
|
const usualOf = (t) => { const u = TR && TR.usual && t && TR.usual[t.key]; return u && u.n >= 3 && u.days != null ? u : null; };
|
|
227
298
|
const usualText = (u) => (u.days === 0 ? 'usually under a day' : 'usually ' + u.days + ' ' + plural(u.days, 'day', 'days'));
|
|
228
299
|
const dayTitle = (t) => t.label + ' · ' + (t.days != null ? t.days + ' ' + plural(t.days, 'day', 'days') + ' in this step' : 'days in this step are not on record') + (usualOf(t) ? ' · ' + usualText(usualOf(t)) : '');
|
|
229
|
-
function trackRow(r) {
|
|
230
|
-
const t = r.track || { k: -1, label: r.stage || 'No stage', output: '', segs: [], skipped: [] }, s = statusOf(r), k = t.k, sk = new Set(t.skipped || []);
|
|
300
|
+
function trackRow(r, cls = '') {
|
|
301
|
+
const t = r.track || { k: -1, label: r.stage || 'No stage', output: '', segs: [], skipped: [] }, s = statusOf(r), k = t.k, sk = new Set(t.skipped || []), E = k >= 0 ? etaOf(r, t) : null;
|
|
231
302
|
const cells = M.steps.map((st, j) => {
|
|
232
303
|
const cls = ['sc', j === 0 ? 'f0' : '', j === 7 ? 'l' : '', st.ms ? 'ms' : '', j < k ? 'p' : '', sk.has(j) ? 'k' : '', j === k ? 'c bg' : ''].filter(Boolean).join(' ');
|
|
233
304
|
const why = sk.has(j) && (t.skipWhy || []).find((x) => x.stage === st.key);
|
|
234
305
|
const title = j === k ? dayTitle(t) : sk.has(j) ? st.label + ' skipped' + (why && why.why ? ': ' + why.why : '') : '';
|
|
235
|
-
|
|
306
|
+
const eta = E && E.j === j ? E : null;
|
|
307
|
+
const etaH = eta ? `<small class="eta${eta.late ? ' late' : ''}" title="${esc(eta.what + (eta.late ? ', passed' : ''))}">${esc(eta.text)}</small>` : '';
|
|
308
|
+
return `<div class="${cls}" role="cell"${title ? ` title="${esc(title)}"` : ''}>${j === k ? `<span class="cur"><u class="cz-dot ${s.tone} ${s.mo}"></u>${eta ? etaH : `<small>${DAYS(t)}</small>`}</span>` : '<i></i>' + etaH}</div>`;
|
|
236
309
|
}).join('');
|
|
237
|
-
return `<div class="bt-r bt-l${peek && peek.key === r.key && peek.kind !== 'acts' ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}">`
|
|
238
|
-
+ `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${esc(r.title)}</b><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
|
|
310
|
+
return `<div class="bt-r bt-l${cls}${peek && peek.key === r.key && peek.kind !== 'acts' ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}">`
|
|
311
|
+
+ `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${esc(r.title)}</b><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
|
|
239
312
|
+ `<div class="bt-cells" role="presentation">${cells}</div>`
|
|
240
|
-
+ `<div class="bt-dl" role="cell"><div class="t1"><b>${esc(t.output)}</b><span>${esc(t.count || '')}</span></div>${segHtml(r)}<div class="t3">${lineHtml(r)}</div></div></div>`;
|
|
313
|
+
+ `<div class="bt-dl" role="cell"><div class="t1"><b>${esc(outName(t.output))}</b><span>${esc(t.count || '')}</span></div>${segHtml(r)}<div class="t3">${lineHtml(r)}</div></div></div>`;
|
|
241
314
|
}
|
|
242
315
|
const isME = (r) => r.track && r.track.k >= 6;
|
|
243
316
|
function drawTrack(L) {
|
|
@@ -252,13 +325,31 @@ function drawTrack(L) {
|
|
|
252
325
|
const tf = more > 0 && !foldOpen ? `<button type="button" class="dlink" id="fold" aria-expanded="false">${SV(I.chev)}${more} more in Monitor and Evaluate</button>`
|
|
253
326
|
: foldOpen && meTotal > 1 ? `<button type="button" class="dlink" id="fold" aria-expanded="true">${SV(I.chevUp)}Fold Monitor and Evaluate${meTotal > meShown ? ` · ${meTotal - meShown} more are not loaded` : ''}</button>` : '<span></span>';
|
|
254
327
|
if (!L.length) return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}<p class="bt-empty">${filtered() ? 'No initiative matches the chips, Find or Filter. <button type="button" class="dlink" id="fClear">Clear them</button>' : 'No initiatives are on this board\'s now view.'}</p></div>`;
|
|
255
|
-
|
|
328
|
+
// programs first, then the product (PgBoard); "By product" draws the product only, a program's rows with its layers icon (PgBoardProduct).
|
|
329
|
+
// Grouped, each product folds its own Monitor and Evaluate rows after the first of each, under "N more" (PgBoard .tf); the foot keeps
|
|
330
|
+
// only the ones this page has not loaded
|
|
331
|
+
const G = groups(sorted);
|
|
332
|
+
let inGroups = 0;
|
|
333
|
+
const meFold = (rs) => { const seen2 = new Set(), on = [], off = []; for (const r of rs) { if (isME(r) && seen2.has(r.track.k) && !foldOpen) off.push(r); else { if (isME(r)) seen2.add(r.track.k); on.push(r); } } return { on, off }; };
|
|
334
|
+
const rows = G ? G.map((g) => {
|
|
335
|
+
if (g.kind === 'program') {
|
|
336
|
+
const kids = PG.folded(g.key) ? '' : g.products.map((sub) => (g.products.length > 1 ? PG.subHtml(sub.name) : '') + sub.rows.map((r) => trackRow(r, ' bt-kid' + (r === g.rows[g.rows.length - 1] ? ' last' : ''))).join('')).join('');
|
|
337
|
+
return PG.bandHtml(g, progState(g.program), { steps: S }) + kids;
|
|
338
|
+
}
|
|
339
|
+
if (PG.folded(g.key)) return PG.prodHtml(g);
|
|
340
|
+
const f = meFold(g.rows); inGroups += f.off.length;
|
|
341
|
+
return PG.prodHtml(g) + f.on.map((r) => trackRow(r, ' bt-gr')).join('') + (f.off.length ? `<button type="button" class="dlink bt-gmore" data-mefold aria-expanded="false">${SV(I.chev)}${f.off.length} more</button>` : '');
|
|
342
|
+
}).join('') : shown.map((r) => trackRow(r)).join('');
|
|
343
|
+
const rest = G ? Math.max(0, meTotal - sorted.filter(isME).length) : more; // grouped: the ones not loaded here
|
|
344
|
+
const tf2 = !G ? tf : rest > 0 && !foldOpen && !inGroups ? `<button type="button" class="dlink" id="fold" aria-expanded="false">${SV(I.chev)}${rest} more in Monitor and Evaluate</button>` : foldOpen && meTotal > 1 ? tf : '<span></span>';
|
|
345
|
+
return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}${rows}<div class="bt-tf">${tf2}<span class="bt-srt">Sorted by stage</span></div>${PHONE.matches ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-steps aria-haspopup="dialog">What finishes each step</button><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : ''}</div>`; // the phone has no step heads: a plain entry to the steps help
|
|
256
346
|
}
|
|
257
347
|
|
|
258
348
|
/* ── the timeline (AgBoardTimeline, AgBoardTlYear, AgBoardTl5y, AgBoardTimelinePhone) ───────────────────────────────────────── */
|
|
259
349
|
function drawTime(L) {
|
|
260
350
|
const S = M.steps || [];
|
|
261
|
-
const T = timelineHtml(L, M, span, {
|
|
351
|
+
const T = timelineHtml(L, M, span, { groups: groups(L), progState, folded: PG.folded, prodHtml: (g) => PG.prodHtml(g, 'tg-prd'), subHtml: (n) => PG.subHtml(n, 'tg-psb'), progTile: () => PG.progTile(), productsOf: PG.productsOf,
|
|
352
|
+
foldBtn: (g) => PG.foldBtn(g.key, g.program.title), memberIcon: (id) => PG.memberIcon(PGS, id), sel: peek && peek.kind !== 'acts' ? peek.key : null, status: statusOf, hiddenCount: (S[6] ? S[6].count : 0) + (S[7] ? S[7].count : 0), themes: (TR && TR.themes) || [], group, avatar: (n) => V.avatar(n, 'sm'),
|
|
262
353
|
askHref: (none) => askHref(null, 'Propose start and end dates for ' + none.map((r) => r.title).join(', ')) });
|
|
263
354
|
return T.html;
|
|
264
355
|
}
|
|
@@ -279,9 +370,28 @@ function drawInit() {
|
|
|
279
370
|
$('#bdSpans').hidden = v !== 'time' || phone;
|
|
280
371
|
$$('#bdSpans [data-sp]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.sp === span)));
|
|
281
372
|
document.body.dataset.bdView = v;
|
|
373
|
+
drawGrouping();
|
|
282
374
|
}
|
|
283
375
|
PHONE.addEventListener('change', () => { if (M) { drawChips(); drawInit(); } });
|
|
284
|
-
|
|
376
|
+
/** The grouping (PgBoard, PgBoardProduct): programs first is the default and draws nothing in the toolbar (PgBoard); the choice is in Filter.
|
|
377
|
+
* "By product" shows as an on chip after the views (PgBoardProduct), whose menu switches back. Only when a program holds a row here. */
|
|
378
|
+
const groupingOn = () => !!(M && PGS.length && PG.groupsOf(PGS, M.initiatives.list.rows, M, false));
|
|
379
|
+
function setGrouping(bp) { byProduct = !!bp; store.set(GROUPING_KEY, byProduct ? 'product' : 'program'); const m = $('#bdGrpMenu'); if (m) m.hidden = true; drawChips(); drawInit(); }
|
|
380
|
+
function drawGrouping() {
|
|
381
|
+
const w = $('#bdGrpw'), on = groupingOn() && byProduct;
|
|
382
|
+
w.hidden = !on; if (!on) { w.innerHTML = ''; return; }
|
|
383
|
+
const open = !!$('#bdGrpMenu') && !$('#bdGrpMenu').hidden;
|
|
384
|
+
const btn = `<button type="button" class="bd-chip bd-grp on" id="bdGroup" aria-haspopup="menu" aria-expanded="${open}" aria-label="Grouped by product. Change grouping">By product${SV(I.chev)}</button>`;
|
|
385
|
+
w.innerHTML = btn + `<span class="bd-grpm" id="bdGrpMenu" role="menu"${open ? '' : ' hidden'}>${[['program', 'Programs first'], ['product', 'By product']].map(([k, n]) => `<button type="button" role="menuitemradio" aria-checked="${(k === 'product') === byProduct}" data-grping="${k}">${n}</button>`).join('')}</span>`;
|
|
386
|
+
}
|
|
387
|
+
$('#bdGrpw').addEventListener('click', (e) => {
|
|
388
|
+
const g = e.target.closest('[data-grping]');
|
|
389
|
+
if (g) { setGrouping(g.dataset.grping === 'product'); const b = $('#bdGroup') || $('#bdFilter'); b.focus(); return; }
|
|
390
|
+
if (e.target.closest('#bdGroup')) { const m = $('#bdGrpMenu'), o = m.hidden; m.hidden = !o; $('#bdGroup').setAttribute('aria-expanded', String(o)); if (o) m.querySelector('[aria-checked="true"]').focus(); }
|
|
391
|
+
});
|
|
392
|
+
document.addEventListener('click', (e) => { if (!e.target.closest('#bdGrpw')) { const m = $('#bdGrpMenu'); if (m && !m.hidden) { m.hidden = true; $('#bdGroup').setAttribute('aria-expanded', 'false'); } } });
|
|
393
|
+
$('#bdGrpw').addEventListener('keydown', (e) => { if (e.key === 'Escape') { const m = $('#bdGrpMenu'); if (m && !m.hidden) { e.stopPropagation(); m.hidden = true; $('#bdGroup').setAttribute('aria-expanded', 'false'); $('#bdGroup').focus(); } } });
|
|
394
|
+
function setView(v) { if (PHONE.matches) { pview = v; store.set(PVIEW_KEY, v); } else { view = v; store.set(VIEW_KEY, view); } closePanel(); drawChips(); drawInit(); }
|
|
285
395
|
$('#ibTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-v]'); if (!b || !M) return; setTab('ini'); setView(b.dataset.v); });
|
|
286
396
|
$('#bdView').addEventListener('click', () => { if (M) setView(PHONE.matches ? (pview === 'list' ? 'stages' : pview === 'stages' ? 'track' : 'list') : view === 'time' ? 'track' : 'time'); });
|
|
287
397
|
$('#bdShowing').addEventListener('click', (e) => {
|
|
@@ -291,12 +401,13 @@ $('#bdShowing').addEventListener('click', (e) => {
|
|
|
291
401
|
});
|
|
292
402
|
$('#bdSpans').addEventListener('click', (e) => { const b = e.target.closest('[data-sp]'); if (!b || !M) return; span = b.dataset.sp; store.set(SPAN_KEY, span); drawChips(); drawInit(); });
|
|
293
403
|
$('#ibBody').addEventListener('click', (e) => {
|
|
294
|
-
if (e.target.closest('#fold')) { foldOpen = !foldOpen; drawInit(); const f = $('#fold'); if (f) f.focus(); return; }
|
|
404
|
+
if (e.target.closest('#fold, [data-mefold]')) { foldOpen = !foldOpen; drawInit(); const f = $('#fold') || $('#ibBody [data-mefold]'); if (f) f.focus(); return; }
|
|
405
|
+
const gf = e.target.closest('[data-fold]'); if (gf) { const k = gf.dataset.fold; PG.fold(k); drawInit(); const b = $$('#ibBody [data-fold]').find((x) => x.dataset.fold === k); if (b) b.focus(); return; }
|
|
406
|
+
const cf = e.target.closest('[data-colfold]'); if (cf) { const k = cf.dataset.colfold; V.toggleCol(k); drawInit(); const b = $$('#ibBody [data-colfold]').find((x) => x.dataset.colfold === k); if (b) b.focus(); return; }
|
|
295
407
|
if (e.target.closest('#fClear')) { clearFilters(); drawChips(); drawInit(); return; }
|
|
296
408
|
const pv = e.target.closest('[data-pv]'); if (pv) { setView(pv.dataset.pv); const b = $(`#ibBody [data-pv="${pv.dataset.pv}"]`); if (b) b.focus(); return; }
|
|
297
409
|
const so = e.target.closest('[data-sort]'); if (so) { V.setSort(so.dataset.sort); drawInit(); const b = $(`#ibBody [data-sort="${so.dataset.sort}"]`); if (b) b.focus(); return; }
|
|
298
410
|
if (e.target.closest('[data-me]')) { V.toggleME(); drawInit(); const b = $('#ibBody [data-me]'); if (b) b.focus(); return; }
|
|
299
|
-
const sr = e.target.closest('[data-strip]'); if (sr) { V.toggleStrip(sr.dataset.strip); drawInit(); const b = $(`#ibBody [data-strip="${sr.dataset.strip}"]`); if (b) b.focus(); return; }
|
|
300
411
|
const rm = e.target.closest('[data-rowmenu]'); if (rm) { const r = rowOf(rm.dataset.rowmenu); if (r) Acts.open.row(r, rm); return; }
|
|
301
412
|
if (e.target.closest('[data-backlog]')) return; // pm/bd-acts.js opens the backlog
|
|
302
413
|
const op = e.target.closest('[data-open]'); if (op) { Acts.open[op.dataset.open](op); return; }
|
|
@@ -306,6 +417,7 @@ $('#ibBody').addEventListener('click', (e) => {
|
|
|
306
417
|
const tk = e.target.closest('[data-tk]'); if (tk) { openTicket(tk.dataset.ini, tk.dataset.tk, tk); return; }
|
|
307
418
|
const th = e.target.closest('[data-tgtheme]'); if (th) { span = 'year'; store.set(SPAN_KEY, span); drawChips(); drawInit(); return; }
|
|
308
419
|
if (e.target.closest('[data-act]')) return; // pm/bd-acts.js handles its own presses
|
|
420
|
+
const pg = e.target.closest('[data-prog]'); if (pg) { PG.openProgram(pg.dataset.prog, pg); return; }
|
|
309
421
|
const b = e.target.closest('[data-key]'); if (b) openIni(rowOf(b.dataset.key), b, view === 'time' ? 'time' : 'track');
|
|
310
422
|
});
|
|
311
423
|
$('#ibBody').addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches('[data-steps]')) { e.preventDefault(); togglePop('popSteps', e.target); } });
|
|
@@ -314,15 +426,15 @@ $('#ibBody').addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.ke
|
|
|
314
426
|
let dragKey = null;
|
|
315
427
|
$('#ibBody').addEventListener('dragstart', (e) => { const c = e.target.closest('.bd-bc[draggable]'); if (!c) return; dragKey = c.dataset.key; e.dataTransfer.effectAllowed = 'move'; try { e.dataTransfer.setData('text/plain', dragKey); } catch { /* some browsers refuse */ } c.classList.add('drag'); });
|
|
316
428
|
$('#ibBody').addEventListener('dragend', () => { dragKey = null; $$('#ibBody .drag, #ibBody .drop').forEach((x) => x.classList.remove('drag', 'drop')); });
|
|
317
|
-
$('#ibBody').addEventListener('dragover', (e) => { const col = dragKey && e.target.closest('.bd-scol[data-step]'); if (!col) return; e.preventDefault(); $$('#ibBody .
|
|
429
|
+
$('#ibBody').addEventListener('dragover', (e) => { const col = dragKey && e.target.closest('.bd-scol[data-step], .bd-kc[data-step]'); if (!col) return; e.preventDefault(); $$('#ibBody .drop').forEach((x) => { if (x !== col) x.classList.remove('drop'); }); col.classList.add('drop'); });
|
|
318
430
|
$('#ibBody').addEventListener('drop', async (e) => {
|
|
319
|
-
const col = e.target.closest('.bd-scol[data-step]'); if (!col || !dragKey) return;
|
|
431
|
+
const col = e.target.closest('.bd-scol[data-step], .bd-kc[data-step]'); if (!col || !dragKey) return;
|
|
320
432
|
e.preventDefault();
|
|
321
433
|
const r = rowOf(dragKey), j = +col.dataset.step; dragKey = null; col.classList.remove('drop');
|
|
322
434
|
if (!r || !r.track || r.track.k === j || !r.acts) return;
|
|
323
435
|
const step = M.steps[j], to = (r.acts.stages || []).find((n) => stepOfName(n) === step.key);
|
|
324
436
|
if (!to) { say(step.label + ' is not one of this board\'s stages, so it did not move.'); return; }
|
|
325
|
-
const from = r.acts.stage, body = { ws: M.board.ws, board: M.board.id, id: r.id };
|
|
437
|
+
const from = r.acts.stage, body = { ws: r.ws || M.board.ws, board: r.boardId || M.board.id, id: r.id };
|
|
326
438
|
const res = await pmPost('/api/boards/move', { ...body, to }).catch(() => null);
|
|
327
439
|
if (!res || !res.ok) { say((res && res.error) || 'It did not move. The server did not say why.'); return; }
|
|
328
440
|
say('Moved to ' + to + ' · ' + r.title + '.', async () => { const u = await pmPost('/api/boards/move', { ...body, to: from, why: 'Undo' }).catch(() => null); say(u && u.ok ? 'Back in ' + from + '.' : (u && u.error) || 'The undo did not land.'); load(); });
|
|
@@ -337,245 +449,88 @@ function askHref(r, q) {
|
|
|
337
449
|
const p = new URLSearchParams();
|
|
338
450
|
if (r && r.id) p.set('ask', r.id); else p.set('ask', 'board:' + (M.board.id || ''));
|
|
339
451
|
if (q) p.set('q', q);
|
|
340
|
-
|
|
452
|
+
const ws = (r && r.ws) || M.board.ws; if (ws) p.set('ws', ws);
|
|
341
453
|
return '/premium.html?' + p.toString();
|
|
342
454
|
}
|
|
343
|
-
const pageHref = (r) => '/premium-initiative.html?id=' + encodeURIComponent(r.id) + (
|
|
455
|
+
const pageHref = (r) => { const ws = r.ws || M.board.ws, b = r.boardId || M.board.id; return '/premium-initiative.html?id=' + encodeURIComponent(r.id) + (ws ? '&ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(b) : ''); };
|
|
344
456
|
|
|
345
|
-
/* ── the
|
|
346
|
-
|
|
347
|
-
function ladderHtml(t) {
|
|
348
|
-
const k = t ? t.k : -1, sk = new Set((t && t.skipped) || []);
|
|
349
|
-
return `<div class="pk-lad" role="img" aria-label="${esc(k >= 0 ? 'Step ' + (k + 1) + ' of 8: ' + t.label : 'No step on record')}"><i class="ln"></i><i class="lp" style="width:${k > 0 ? (k / 7) * 87.5 : 0}%"></i>${M.steps.map((s, j) => `<span class="${[j < k ? 'p' : '', j === k ? 'c' : '', s.ms ? 'm' : '', sk.has(j) ? 'k' : ''].filter(Boolean).join(' ')}"><i></i>${esc(s.short)}</span>`).join('')}</div>`;
|
|
350
|
-
}
|
|
351
|
-
function askForm(r, label, o = {}) {
|
|
352
|
-
const J = M.jira || {};
|
|
353
|
-
const ft = o.inside ? `<span>The answer lands in Home, inside ${esc(r.title)}.</span>`
|
|
354
|
-
: `<span>Answer lands in Home</span><span class="sp"></span><span class="jr">${SV(I.jira)}Jira ${J.readAt ? esc(ago(J.readAt)) : 'not read'}</span><button type="button" class="bd-ib sm" data-pk="jira" aria-label="Read Jira again" title="Read Jira again">${SV(I.refresh)}</button>`;
|
|
355
|
-
return `<form class="pk-ask" data-ask="${esc(r.key)}"><div class="in"><input type="text" name="q" maxlength="2000" autocomplete="off" placeholder="Ask about ${esc(label)}…" aria-label="Ask about ${esc(label)}"><button type="submit" class="bd-ib solid" aria-label="Ask in Home" title="Ask in Home">${SV(I.go)}</button></div><div class="ft">${ft}</div></form>`;
|
|
356
|
-
}
|
|
357
|
-
const eyeOf = (r, lower) => [r.lane ? (lower ? r.lane : r.lane.charAt(0).toUpperCase() + r.lane.slice(1)) : '', r.kr, ...(lower ? [] : [r.owner ? 'owner ' + r.owner : 'no owner'])].filter(Boolean);
|
|
358
|
-
const tkState = (k) => (k.blocked ? 'blocked' + (k.reason ? ' by ' + k.reason.replace(/^Waiting on /i, '') : '') : k.status === 'In review' ? 'in review' : k.status === 'In progress' ? 'in progress' : k.status === 'Done' ? 'done' : 'to do');
|
|
359
|
-
/** The output box: the open tickets (blocked first) with their state and assignee, the done ones folded into one line, and Deliver's two
|
|
360
|
-
* parts that are not tickets; for the other steps, the parts of the output, each counted only where a record holds it. */
|
|
361
|
-
function outRows(r) {
|
|
362
|
-
const t = r.track || {};
|
|
363
|
-
if (t.tickets && t.tickets.length && (t.key === 'build' || t.key === 'deliver')) {
|
|
364
|
-
const open = t.tickets.filter((k) => k.status !== 'Done').sort((a, b) => (b.blocked ? 1 : 0) - (a.blocked ? 1 : 0)), done = t.tickets.filter((k) => k.status === 'Done');
|
|
365
|
-
const rows = open.slice(0, 10).map((k) => `<button type="button" class="gi" data-tk="${esc(k.key)}" data-ini="${esc(r.key)}"><i class="k ${esc(k.cls || 'td')}"></i><span class="n"><em>${esc(k.key)}</em>${esc(k.title)} · ${esc(tkState(k))}</span>${k.assignee || k.age != null ? `<span class="r">${esc([k.assignee, k.age != null ? k.age + 'd' : ''].filter(Boolean).join(' · '))}</span>` : ''}</button>`);
|
|
366
|
-
if (open.length > 10) rows.push(`<p class="gi gm"><i class="k"></i><span class="n">${open.length - 10} more open tickets</span></p>`);
|
|
367
|
-
if (done.length) rows.push(`<p class="gi gm"><i class="k dn"></i><span class="n">${done.length} ${plural(done.length, 'ticket', 'tickets')} done · ${esc(done.slice(0, 3).map((k) => k.title.toLowerCase()).join(', '))}${done.length > 3 ? ', …' : ''}</span></p>`);
|
|
368
|
-
if (t.key === 'deliver') rows.push('<p class="gi gm"><i class="k"></i><span class="n">Release notes</span><span class="r">not on record</span></p>', `<p class="gi gm"><i class="k${t.you ? ' yo' : ''}"></i><span class="n">Your sign-off</span><span class="r">${t.you ? 'waiting' : 'after the tickets'}</span></p>`);
|
|
369
|
-
return rows.join('');
|
|
370
|
-
}
|
|
371
|
-
if (t.key === 'build' || t.key === 'deliver') return '<p class="gi gm"><i class="k na"></i><span class="n">No Jira ticket has been read for it yet</span></p>';
|
|
372
|
-
return (t.segs || []).map((s) => `<p class="gi gm"><i class="k ${esc(s.cls || '')}"></i><span class="n">${esc(s.name || '')}</span><span class="r">${esc(s.st || '')}</span></p>`).join('');
|
|
373
|
-
}
|
|
457
|
+
/* ── the initiative and its Jira ticket open in the Viewer's shell A, floating over the page (pm/bd-ini-panel.js; canvas XvABoard, XvOptAJira).
|
|
458
|
+
* The panels of pm/bd-acts.js and pm/bd-asks.js open in the same shell (actsPanel): the Board has one panel. ── */
|
|
374
459
|
const TI = (r) => (r && r.trail) || null;
|
|
375
|
-
/** The
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
460
|
+
/** The programs (GET /api/programs), then the rows of their initiatives in this board's other products, read once each, so a program's
|
|
461
|
+
* readiness and its products count every product (its other products' initiatives are not drawn here: PRD decision 5). */
|
|
462
|
+
async function loadPrograms() {
|
|
463
|
+
let r = null; try { r = await (await fetch('/api/programs', { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
464
|
+
if (!r || !r.ok) return;
|
|
465
|
+
PGS = r.programs || [];
|
|
466
|
+
if (M) { drawChips(); drawInit(); programOnce(); loadOthers(); }
|
|
467
|
+
readMe();
|
|
468
|
+
}
|
|
469
|
+
/** The PM's first name (GET /api/brief-page `me`, as Home reads it), once, and only when a program holds tasks: the program row's blue count
|
|
470
|
+
* (PgBoard .yc) counts the program tasks that are the PM's. Without it, only the tasks with no owner or "pm" count. */
|
|
471
|
+
let meRead = false;
|
|
472
|
+
async function readMe() {
|
|
473
|
+
if (meRead || !PGS.some((p) => (p.tasks || []).length)) return;
|
|
474
|
+
meRead = true;
|
|
475
|
+
let r = null; try { r = await (await fetch('/api/brief-page' + (M && M.board.ws ? '?ws=' + encodeURIComponent(M.board.ws) : ''), { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
476
|
+
if (r && r.ok && r.me) { PG.setMe(r.me); if (M) drawInit(); }
|
|
477
|
+
}
|
|
478
|
+
let othersRead = false;
|
|
479
|
+
async function loadOthers() {
|
|
480
|
+
if (othersRead || !M || !PGS.length || ALL) return; // All products has every product's rows already
|
|
481
|
+
othersRead = true;
|
|
482
|
+
const here = M.board.ws || '', boards = M.board.switcher || [];
|
|
483
|
+
const want = [...new Set(PGS.filter((p) => !p.archived && (p.members || []).some((m) => m.ws === here)).flatMap((p) => (p.members || []).map((m) => m.ws)).filter((w) => w && w !== here))];
|
|
484
|
+
for (const w of want.slice(0, 6)) {
|
|
485
|
+
const b = boards.find((x) => x.ws === w); if (!b) continue;
|
|
486
|
+
let a = null; try { a = await (await fetch('/api/board-premium?ws=' + encodeURIComponent(w) + '&board=' + encodeURIComponent(b.id), { credentials: 'same-origin' })).json(); } catch { a = null; }
|
|
487
|
+
const m = a && a.ok && a.model; if (!m) continue; // still reading, or not read: the member stays "missing", never guessed
|
|
488
|
+
const st = m.steps || [];
|
|
489
|
+
XR[w] = { name: (m.board && (m.board.product || m.board.name)) || b.name, rows: (m.rows || []).filter((x) => x.id).map((x) => ({ id: x.id, title: x.title, stage: x.track && x.track.k >= 0 && st[x.track.k] ? st[x.track.k].key : x.stage })) };
|
|
390
490
|
}
|
|
391
|
-
if (
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
function
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
function
|
|
404
|
-
const it = TI(r);
|
|
405
|
-
const keys = ((it && it.drift) || []).filter((k) => !one || k === one);
|
|
406
|
-
if (!keys.length) return '';
|
|
407
|
-
const q = 'What changed in the PRD after ' + keys.join(', ') + ' ' + (keys.length === 1 ? 'was' : 'were') + ' pushed?';
|
|
408
|
-
const btn = `<button type="button" class="bd-ib sm" data-pk="drift" data-q="${esc(q)}" aria-label="Ask about the PRD change" title="Ask about the PRD change">${SV(one ? I.spark : I.note)}</button>`;
|
|
409
|
-
return one
|
|
410
|
-
? `<div class="pk-wt">${SV(I.flag)}<span><b>The PRD changed after the push.</b> ${esc(keys[0])} was pushed from an older PRD. Review it before the next push.</span>${btn}</div>`
|
|
411
|
-
: `<div class="pk-wt">${SV(I.flag)}<span><b>Jira differs from the PRD</b> · ${esc(keys.join(', '))} ${keys.length === 1 ? 'was' : 'were'} pushed from an older PRD. Review ${keys.length === 1 ? 'it' : 'them'} before the next push.</span>${btn}</div>`;
|
|
412
|
-
}
|
|
413
|
-
const DEP_ST = (d) => (!d.known ? 'not on this repository' : d.done ? 'done' : d.stage || 'open');
|
|
414
|
-
function linkedHtml(r) {
|
|
415
|
-
const it = TI(r), L = (it && it.links) || {}, epic = L.epic || (r.epics || [])[0];
|
|
416
|
-
// AgBoardPanel: PRD v3 · Rubric · Release notes · Blocks <initiative> · Epic <key>. A chip shows only where something is linked.
|
|
417
|
-
const doc = (label, path) => (path ? `<button type="button" class="bd-chip" data-doc="${esc(path)}" title="${esc(path)}">${SV(I.doc)}${esc(label)}</button>` : '');
|
|
418
|
-
const D = (it && it.deps) || [];
|
|
419
|
-
const chips = doc(L.prdVersion ? 'PRD v' + String(L.prdVersion).replace(/^v/i, '') : 'PRD', L.prd) + doc('Rubric', L.rubric) + doc('Evaluation', L.evaluation) + doc('Release notes', L.notes)
|
|
420
|
-
+ D.map((d) => `<span class="bd-chip" title="${esc((d.title || d.id) + ': ' + DEP_ST(d))}">${SV(I.link)}${esc('Waits on ' + (d.title || d.id))}</span>`).join('')
|
|
421
|
-
+ (epic ? `<span class="bd-chip">${SV(I.jira)}${esc('Epic ' + epic)}</span>` : '');
|
|
422
|
-
return chips ? `<div class="pk-sec"><p class="lbl">Linked</p><div class="pk-lk">${chips}</div></div>` : '';
|
|
423
|
-
}
|
|
424
|
-
/** Dates (BdPanel): when the step started (days in the step, from the trail), the planned end (yours) and the end Jira's pace expects. */
|
|
425
|
-
function datesHtml(r) {
|
|
426
|
-
const t = r.track || {};
|
|
427
|
-
const st = t.days != null ? md(new Date(Date.now() - t.days * 86400000)) : null, end = r.end ? fmt(r.end) : null, exp = t.forecast ? fmt(t.forecast) : null;
|
|
428
|
-
if (!st && !end && !exp) return '';
|
|
429
|
-
const late = !!(r.end && t.forecast && t.forecast.slice(0, 10) > r.end.slice(0, 10));
|
|
430
|
-
const box = (label, v, cls) => `<div class="bd-box${cls ? ' ' + cls : ''}"><span class="bd-amut">${esc(label)}</span><b>${esc(v || '—')}</b></div>`;
|
|
431
|
-
return `<div class="pk-sec"><p class="lbl">Dates</p><div class="pk-dg">${box('Started ' + (t.label || 'the step'), st)}${box('Planned end', end)}${box('Now expected', exp, late ? 'late' : '')}</div><p class="pk-mut">Planned end is yours. Expected comes from Jira pace, and moves when tickets move.</p></div>`;
|
|
432
|
-
}
|
|
433
|
-
/** In Jira (BdPanel): the step's tickets as a table, each opening its ticket panel. */
|
|
434
|
-
function jiraHtml(r) {
|
|
435
|
-
const t = r.track || {}, tk = (t.tickets || []).slice().sort((a, b) => (b.blocked ? 1 : 0) - (a.blocked ? 1 : 0)), sp = [...new Set(tk.map((k) => k.sprint).filter(Boolean))];
|
|
436
|
-
const st = (k) => (k.blocked ? 'Blocked' : k.status === 'In progress' ? 'Doing' : k.status) + (k.age != null && k.status !== 'Done' ? ' · ' + k.age + 'd' : '');
|
|
437
|
-
const rows = tk.slice(0, 12).map((k) => `<button type="button" class="pk-jt" data-tk="${esc(k.key)}" data-ini="${esc(r.key)}"><span class="bd-pill">${esc(k.key)}</span><span class="bd-ell">${esc(k.title)}</span><span class="${k.blocked ? 's-red' : k.status === 'Done' || k.status === 'To do' ? 'bd-amut' : ''}">${esc(st(k))}</span>${k.assignee ? V.avatar(k.assignee, 'sm') : '<span class="bd-amut">—</span>'}</button>`).join('');
|
|
438
|
-
// Deliver's two parts that are not tickets: the release notes and your sign-off
|
|
439
|
-
const dl = t.key === 'deliver' ? `<div class="pk-tks">${'<p class="gi gm"><i class="k"></i><span class="n">Release notes</span><span class="r">not on record</span></p>'}<p class="gi gm"><i class="k${t.you ? ' yo' : ''}"></i><span class="n">Your sign-off</span><span class="r">${t.you ? 'waiting' : 'after the tickets'}</span></p></div>` : '';
|
|
440
|
-
return `<div class="pk-sec"><p class="lbl">In Jira${sp.length === 1 ? ' · ' + esc(sp[0]) : ''}</p><div class="pk-jtw"><div class="pk-jt h"><span>Key</span><span>Work-item</span><span>Status</span><span>Who</span></div>${rows}${tk.length > 12 ? `<p class="pk-mut">${tk.length - 12} more in Jira</p>` : ''}</div>${dl}</div>`;
|
|
441
|
-
}
|
|
442
|
-
/** Progress (BdPanel): points done of the total; where Jira has no points, the work-items done by count, striped so a count never reads as points. */
|
|
443
|
-
function progHtml(r) {
|
|
444
|
-
const p = (r.track || {}).prog; if (!p || !p.total) return '';
|
|
445
|
-
const pct = Math.round((p.done / p.total) * 100), count = p.unit === 'tickets';
|
|
446
|
-
const what = p.unit === 'pts' ? p.done + ' of ' + p.total + ' points' : count ? p.done + ' of ' + p.total + ' work-items done' : p.done + '% on record';
|
|
447
|
-
return `<div class="pk-sec"><p class="lbl">Progress</p><div class="bd-box"><div class="bd-boxh"><b>${esc(what)}</b><span class="bd-amut">${pct}%${count ? ' · by count' : ''}</span></div>${V.barHtml({ pct, count, label: what })}${count ? '<p class="pk-mut">The bar is striped so a count never reads as points.</p>' : ''}</div></div>`;
|
|
448
|
-
}
|
|
449
|
-
/** The first questions before the BRD (BdGrill), while some are open: the count and a button that opens them. */
|
|
450
|
-
function grillHtml(r) {
|
|
451
|
-
const g = r.id && GR[r.id]; if (!g || !g.open) return '';
|
|
452
|
-
return `<div class="pk-nb"><div class="t"><b>${g.open} ${plural(g.open, 'question', 'questions')} before the BRD</b><div>${g.later ? 'You chose to answer later. ' : ''}PMOS asks what the BRD needs that the Why does not say yet.</div></div><button type="button" class="bd-ib solid" data-pk="grill" aria-label="Answer the questions" title="Answer the questions">${SV(I.next)}</button></div>`;
|
|
453
|
-
}
|
|
454
|
-
function iniPanel(r) {
|
|
455
|
-
const t = r.track || {}, s0 = statusOf(r);
|
|
456
|
-
const s = r.release && /^Ships /.test(s0.text) ? { ...s0, text: 'On track' } : s0; // the line already says when it ships
|
|
457
|
-
const when = r.release ? `<span>·</span><span>ships <b>${esc(fmt(r.release.iso))}</b> with ${esc(r.release.name)}</span>` : r.end ? `<span>·</span><span>plan ends <b>${esc(fmt(r.end))}</b></span>` : '';
|
|
458
|
-
// the status line is one line, as AgBoardPanel draws it; "usually N days" stays in the step's tooltip
|
|
459
|
-
return `<div class="pk-h"><div class="pk-ht"><p class="pk-eye">${esc(eyeOf(r).join(' · '))}</p><h2 id="pkTitle">${esc(r.title)}</h2><p class="pk-st"><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone} ${s.mo}"></i>${esc(s.text)}</span><span>·</span><span title="${esc(dayTitle(t))}">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}<b>${esc(t.label || r.stage || 'No stage')}</b>${t.days != null ? ' day ' + t.days : ''}</span>${when}</p></div>`
|
|
460
|
-
+ `<div class="pk-tools">${r.id ? `<a class="bd-ib" data-pk="expand" href="${esc(pageHref(r))}" aria-label="Open the initiative page" title="Open the initiative page">${SV(I.expand)}</a>` : ''}<button type="button" class="bd-ib" data-pk="acts" aria-label="Initiative actions" title="Initiative actions">${SV(I.more)}</button><button type="button" class="bd-ib" data-pk="close" aria-label="Close" title="Close">${SV(I.x)}</button></div></div>`
|
|
461
|
-
+ `<div class="pk-b">${ladderHtml(t)}${skipHtml(t)}`
|
|
462
|
-
+ nextHtml(r)
|
|
463
|
-
+ grillHtml(r)
|
|
464
|
-
+ ((t.key === 'build' || t.key === 'deliver') && (t.tickets || []).length ? jiraHtml(r)
|
|
465
|
-
: `<div class="pk-box"><div class="t1"><b>${esc(t.output || 'No step on record')}</b><span>${esc(t.count || '')}</span></div>${segHtml(r, true)}<div class="pk-tks">${outRows(r)}</div>${typeof t.next === 'string' && t.next && !(t.tickets || []).length ? `<p class="pk-nx">Next: <b>${esc(t.next)}</b></p>` : ''}</div>`)
|
|
466
|
-
+ datesHtml(r) + progHtml(r)
|
|
467
|
-
+ draftedHtml(r) + driftHtml(r) + linkedHtml(r) // the dependencies are Linked chips, as AgBoardPanel draws them
|
|
468
|
-
+ `</div>${askForm(r, r.title)}`;
|
|
469
|
-
}
|
|
470
|
-
function timePanel(r) {
|
|
471
|
-
const t = r.track || {}, k = t.k, epic = (r.epics || [])[0];
|
|
472
|
-
const eye = eyeOf(r, true).concat(epic ? ['epic ' + epic] : ['no Jira epic yet']);
|
|
473
|
-
const lad = `<div class="pk-seg" aria-hidden="true">${M.steps.map((_, j) => `<i class="${j < k ? 'p' : j === k ? 'c' : ''}"></i>`).join('')}</div>`;
|
|
474
|
-
const need = t.you
|
|
475
|
-
? `<div class="pk-need"><i class="cz-dot you m-info"></i><div class="t"><b>${esc(t.you)}</b><div>${esc(t.youKind ? t.youWhy || '' : 'Every release ticket is done.')}</div></div>${r.id ? `<a class="bd-ib" href="${esc(pageHref(r))}" aria-label="Open the initiative page" title="Open the initiative page">${SV(I.ext)}</a>` : ''}</div>`
|
|
476
|
-
: ''; // AgBoardTimelinePanel draws the card only when something waits on you
|
|
477
|
-
const tks = (t.tickets || []).slice(0, 8).map((x) => `<button type="button" class="wi" data-tk="${esc(x.key)}" data-ini="${esc(r.key)}"><span class="wk">${esc(x.key)}</span><span class="wt2">${esc(x.title)}</span><span class="st${x.blocked ? ' r' : x.status === 'Done' ? '' : ' y'}">${esc(x.blocked ? 'Blocked' : x.status)}</span></button>`).join('');
|
|
478
|
-
// AgBoardTimelinePanel: change the plan dates, move, hold, archive. Dates go through Home (no route writes plan dates from the Board).
|
|
479
|
-
const acts = `<a class="bd-ib" href="${esc(askHref(r, 'Propose new start and end dates for ' + r.title))}" aria-label="Change the plan dates" title="Change the plan dates">${SV(I.cal)}</a>`
|
|
480
|
-
+ [['move', 'Move to another stage'], ['hold', 'Put on hold'], ['archive', 'Archive']].map(([i, n]) => `<button type="button" class="bd-ib" data-pk="acts" aria-label="${n}" title="${n}">${SV(I[i])}</button>`).join('');
|
|
481
|
-
const D = (TI(r) && TI(r).deps) || [], open = D.filter((d) => d.known && !d.done);
|
|
482
|
-
const dep = D.length ? `<div class="pk-dep">${SV(I.link)}<div><b>Waits on ${esc(D.map((d) => d.title || d.id).join(', '))}</b><div>${esc(D.map((d) => (d.title || d.id) + ': ' + DEP_ST(d)).join(' · '))}.${open.length ? ' Its own dates hold only once ' + (open.length === 1 ? 'that one is' : 'those are') + ' done.' : ''}</div></div></div>`
|
|
483
|
-
: ''; // no card when nothing is on record
|
|
484
|
-
return `<div class="pk-h"><div class="pk-ht"><p class="pk-eye">${esc(eye.join(' · '))}</p><h2 id="pkTitle">${esc(r.title)}</h2></div><div class="pk-tools">${r.id ? `<a class="bd-ib" data-pk="expand" href="${esc(pageHref(r))}" aria-label="Open the initiative page" title="Open the initiative page">${SV(I.ext)}</a>` : ''}<button type="button" class="bd-ib" data-pk="close" aria-label="Close" title="Close">${SV(I.x)}</button></div></div>`
|
|
485
|
-
+ `<div class="pk-b"><div><p class="pk-stp"><b>${esc(t.label || 'No step')}</b>${k >= 0 ? ' · step ' + (k + 1) + ' of 8' : ''}</p>${lad}</div>${need}`
|
|
486
|
-
+ `<div class="pk-sec"><p class="lbl">Dates</p><div class="pk-kv"><span>PMOS plan</span><b>${esc(r.start || r.end ? [r.start ? fmt(r.start) : '…', r.end ? fmt(r.end) : '…'].join(' → ') : 'No dates on record')}</b><span>Jira forecast</span><b>${esc(t.forecastLabel ? fmt(t.forecast) : 'No open ticket in a dated sprint')}</b></div></div>`
|
|
487
|
-
+ dep
|
|
488
|
-
+ `<div class="pk-sec"><p class="lbl">Tickets · ${(t.tickets || []).length} in Jira</p>${tks ? `<div class="pk-wis">${tks}</div>` : '<p class="pk-mut">No ticket of this initiative is in a Jira reading.</p>'}</div>`
|
|
489
|
-
+ `<div class="pk-sec"><p class="lbl">Initiative</p><div class="pk-acts">${acts}</div></div></div>${askForm(r, r.title, { inside: true })}`;
|
|
490
|
-
}
|
|
491
|
-
/** The blocker's own summary, where its key (in the reason) is a ticket of a row on this board. */
|
|
492
|
-
function blockerTitle(reason) {
|
|
493
|
-
const m = /\b([A-Z][A-Z0-9]+-\d+)\b/.exec(String(reason || '')); if (!m) return '';
|
|
494
|
-
for (const r of (M && M.rows) || []) { const x = ((r.track && r.track.tickets) || []).find((y) => y.key === m[1]); if (x && x.title && x.title !== x.key) return x.title; }
|
|
495
|
-
return '';
|
|
496
|
-
}
|
|
497
|
-
function tkPanel(r, k) {
|
|
498
|
-
const t = r.track || {}, x = TI(r) && TI(r).tickets ? TI(r).tickets[k.key] : null, sub = x && x.subtasks;
|
|
499
|
-
// what a blocker delays: the sprint it sits in ends, and the release the initiative rides on
|
|
500
|
-
const slip = k.sprintEnd ? 'If it is not fixed by ' + fmt(k.sprintEnd) + ', the end of ' + (k.sprint || 'its sprint') + ', ' + (r.release ? r.release.name + ' on ' + fmt(r.release.iso) + ' slips.' : 'it carries into the next sprint.') : r.release ? 'It holds up ' + r.release.name + ' on ' + fmt(r.release.iso) + '.' : '';
|
|
501
|
-
// AgBoardTicket: Blocked 2 days · In review · (M) Mei · 5 pts · Sprint 24, each field only where the Jira reading holds it
|
|
502
|
-
const bd = k.blockedDays != null ? ' ' + k.blockedDays + ' ' + plural(k.blockedDays, 'day', 'days') : '';
|
|
503
|
-
const meta = [k.blocked ? `<span class="cs s-red"><i class="cz-dot red m-crit"></i>Blocked${esc(bd)}</span>` : '', esc(k.raw && !(k.blocked && /block/i.test(k.raw)) ? k.raw : k.blocked ? '' : k.status), k.assignee ? `<span class="pk-who"><span class="pk-av" aria-hidden="true">${esc(k.assignee.charAt(0))}</span>${esc(k.assignee)}</span>` : '', k.points != null ? esc(k.points + ' pts') : '', k.sprint ? esc(k.sprint) : ''].filter(Boolean).join('<span>·</span>');
|
|
504
|
-
const reason = k.reason || (x && x.reason) || 'Flagged as blocked in Jira', bt = blockerTitle(reason);
|
|
505
|
-
// the subtasks: one row each where the reading lists them; else the reading's two counts as rows (done, open)
|
|
506
|
-
const items = sub && Array.isArray(sub.items) ? sub.items : null;
|
|
507
|
-
const subRows = items && items.length ? items.map((y) => `<p class="gi gm"><i class="k${y.done ? ' dn' : ''}"></i><span class="n">${esc(y.name || y.summary || '')}</span><span class="r">${y.done ? 'done' : 'open'}</span></p>`).join('')
|
|
508
|
-
: sub && sub.total ? [[sub.done, 'done', ' dn'], [sub.total - sub.done, 'open', '']].filter(([n]) => n > 0).map(([n, w, c]) => `<p class="gi gm"><i class="k${c}"></i><span class="n">${n} ${plural(n, 'subtask', 'subtasks')}</span><span class="r">${w}</span></p>`).join('')
|
|
509
|
-
: '<p class="gi gm"><i class="k"></i><span class="n">No subtasks are in the Jira reading</span></p>';
|
|
510
|
-
return `<div class="pk-h"><div class="pk-ht"><button type="button" class="pk-back" data-pk="back">${SV(I.next)}${esc(r.title)} · ${esc(t.label || '')}</button><h2 id="pkTitle">${esc(k.key)} · ${esc(k.title)}</h2><p class="pk-st">${meta}</p></div>`
|
|
511
|
-
+ `<div class="pk-tools">${k.url ? `<a class="bd-ib" href="${esc(k.url)}" target="_blank" rel="noopener" aria-label="Open ${esc(k.key)} in Jira" title="Open in Jira">${SV(I.ext)}</a>` : ''}<button type="button" class="bd-ib" data-pk="close" aria-label="Close" title="Close">${SV(I.x)}</button></div></div>`
|
|
512
|
-
+ `<div class="pk-b">${k.blocked ? `<div class="pk-nb red"><div class="t"><b>${esc(reason)}</b>${bt ? `<span class="pk-bt"> · ${esc(bt)}</span>` : ''}${slip ? `<div>${esc(slip)}</div>` : ''}</div>${k.url ? `<a class="bd-ib" href="${esc(k.url)}" target="_blank" rel="noopener" aria-label="Comment in Jira" title="Comment in Jira">${SV(I.note)}</a>` : ''}</div>` : ''}`
|
|
513
|
-
+ driftHtml(r, k.key)
|
|
514
|
-
+ `<div class="pk-box"><div class="t1"><b>Subtasks</b><span>${sub && sub.total ? sub.done + ' of ' + sub.total : ''}</span></div><div class="pk-tks">${subRows}</div></div>`
|
|
515
|
-
+ `<div class="pk-sec"><p class="lbl">Counts toward</p><p class="pk-p">${esc(t.output || '')} · ${esc(t.count || '')}</p></div>`
|
|
516
|
-
+ '<p class="pk-mut">PMOS owns the ticket text. Status, sprint and assignee change only in Jira.</p></div>'
|
|
517
|
-
+ askForm(r, k.key);
|
|
518
|
-
}
|
|
519
|
-
function showPeek(html, back) {
|
|
520
|
-
const pk = $('#peek'); pk.innerHTML = html; pk.hidden = false; document.body.classList.add('pk-on');
|
|
521
|
-
pk.classList.toggle('pk-tl', !!peek && peek.kind === 'ini' && peek.from === 'time'); // AgBoardTimelinePanel is 420 px wide
|
|
522
|
-
if (back && !$('#peek').contains(back)) peekBack = back; // a press inside the panel keeps the row the panel was opened from
|
|
523
|
-
$$('#ibBody [data-row]').forEach((x) => x.classList.toggle('sel', !!peek && peek.kind !== 'acts' && x.dataset.row === peek.key));
|
|
524
|
-
$$('#ibBody .tgp-r').forEach((x) => x.classList.toggle('sel', !!peek && peek.kind !== 'acts' && x.dataset.key === peek.key));
|
|
525
|
-
const h = $('#pkTitle'); if (h) { h.tabIndex = -1; h.focus({ preventScroll: true }); }
|
|
526
|
-
}
|
|
527
|
-
function closePeek() {
|
|
528
|
-
if ($('#peek').hidden) return;
|
|
529
|
-
const key = peek && peek.key;
|
|
530
|
-
$('#peek').hidden = true; document.body.classList.remove('pk-on'); peek = null;
|
|
531
|
-
$$('#ibBody .sel').forEach((x) => x.classList.remove('sel'));
|
|
532
|
-
// a read can draw the rows again while the panel is open: then the focus goes to the same row as drawn now
|
|
533
|
-
const back = peekBack && document.contains(peekBack) ? peekBack : key ? $$('#ibBody [data-key]').find((x) => x.dataset.key === key) : null;
|
|
534
|
-
if (back) back.focus(); peekBack = null;
|
|
535
|
-
}
|
|
536
|
-
function openIni(r, from, where) {
|
|
537
|
-
if (!r || !r.track) return;
|
|
538
|
-
peek = { kind: 'ini', key: r.key, from: where || 'track' }; showPeek(peek.from === 'time' ? timePanel(r) : iniPanel(r), from);
|
|
539
|
-
}
|
|
491
|
+
if (Object.keys(XR).length) drawInit();
|
|
492
|
+
}
|
|
493
|
+
/** ?program=<id> (Home links here): open that program once, its group unfolded, when the programs and the board are both read. */
|
|
494
|
+
let programDone = false;
|
|
495
|
+
function programOnce() {
|
|
496
|
+
if (programDone || !M || !PGS.length) return;
|
|
497
|
+
programDone = true;
|
|
498
|
+
const id = new URLSearchParams(location.search).get('program'); if (!id || !PGS.some((p) => p.id === id)) return;
|
|
499
|
+
PG.fold('g:' + id, false); drawInit();
|
|
500
|
+
const b = $$('#ibBody [data-prog]').find((x) => x.dataset.prog === id); if (b) b.scrollIntoView({ block: 'center' });
|
|
501
|
+
PG.openProgram(id, b);
|
|
502
|
+
}
|
|
503
|
+
function openIni(r, from) { if (r && r.track) BI.openIni(r, from); }
|
|
540
504
|
function openTicket(iniKey, key, from) {
|
|
541
505
|
const r = rowOf(iniKey); if (!r || !r.track) return;
|
|
542
|
-
const k = (r.track.tickets || []).find((x) => x.key === key); if (
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
else if (a === 'acts' && r) Acts.open.row(r, b);
|
|
555
|
-
else if (a === 'grill' && r) Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b);
|
|
556
|
-
});
|
|
506
|
+
const k = (r.track.tickets || []).find((x) => x.key === key); if (k) BI.openTicket(r, k, from);
|
|
507
|
+
}
|
|
508
|
+
/** The Viewer shows an initiative of this board: its row is marked. */
|
|
509
|
+
function iniShown(key) {
|
|
510
|
+
peek = { kind: 'ini', key };
|
|
511
|
+
$$('#ibBody [data-row]').forEach((x) => x.classList.toggle('sel', x.dataset.row === key));
|
|
512
|
+
$$('#ibBody .tgp-r').forEach((x) => x.classList.toggle('sel', x.dataset.key === key));
|
|
513
|
+
}
|
|
514
|
+
function iniHidden() {
|
|
515
|
+
if (!peek || peek.kind !== 'ini') return;
|
|
516
|
+
peek = null; $$('#ibBody .sel').forEach((x) => x.classList.remove('sel'));
|
|
517
|
+
}
|
|
557
518
|
/** A linked document opens in the Viewer: GET /api/doc, shown as its text. */
|
|
558
519
|
document.addEventListener('click', (e) => {
|
|
559
520
|
const d = e.target.closest('[data-doc]'); if (!d || !M) return;
|
|
560
|
-
const path = d.dataset.doc, ws = M.board.ws || '';
|
|
561
|
-
viewerOpen({ kind: 'Document', title: path.split('/').pop(), icon: 'doc', id: 'doc:' + path, render: async (body) => {
|
|
521
|
+
const path = d.dataset.doc, ws = M.board.ws || '', inVw = !!d.closest('#czViewer');
|
|
522
|
+
viewerOpen({ kind: 'Document', title: path.split('/').pop(), icon: 'doc', id: 'doc:' + path, back: inVw, render: async (body) => {
|
|
562
523
|
body.innerHTML = '<p class="bd-amut">Reading the document…</p>';
|
|
563
524
|
let text = null; try { const res = await fetch('/api/doc?ws=' + encodeURIComponent(ws) + '&path=' + encodeURIComponent(path), { credentials: 'same-origin' }); text = res.ok ? await res.text() : null; } catch { text = null; }
|
|
564
525
|
body.innerHTML = text == null ? `<p class="bd-amut">${esc(path)} could not be read.</p>` : `<p class="bd-amut">${esc(path)}</p><pre class="bd-doc">${esc(text)}</pre>`;
|
|
565
526
|
} });
|
|
566
527
|
});
|
|
567
|
-
$('#peek').addEventListener('submit', (e) => {
|
|
568
|
-
const f = e.target.closest('form.pk-ask[data-ask]'); if (!f) return;
|
|
569
|
-
e.preventDefault();
|
|
570
|
-
const r = rowOf(f.dataset.ask), q = f.q.value.trim();
|
|
571
|
-
if (!q) { f.q.focus(); return; }
|
|
572
|
-
location.assign(askHref(r, peek && peek.kind === 'tk' ? peek.tk + ': ' + q : q));
|
|
573
|
-
});
|
|
574
|
-
|
|
575
528
|
/* ── the tools the Agreed design draws but has no frame for: plain versions with a "Waiting for design" tag (pm/bd-acts.js) ─────────── */
|
|
576
529
|
$('#bdFind').addEventListener('click', (e) => Acts.open.find(e.currentTarget));
|
|
577
530
|
$('#bdFilter').addEventListener('click', (e) => Acts.open.filter(e.currentTarget));
|
|
578
|
-
|
|
531
|
+
// New (PgBoard: "New program or initiative"): a menu of the two. The program panel's own "New initiative" presses this button from code,
|
|
532
|
+
// and that press opens New initiative at once.
|
|
533
|
+
$('#newIni').addEventListener('click', (e) => { if (e.isTrusted) Asks.openNewMenu(e.currentTarget); else Acts.open.new(e.currentTarget); });
|
|
579
534
|
$('#bdBell').addEventListener('click', (e) => { if (M) Acts.open.bell(e.currentTarget); });
|
|
580
535
|
|
|
581
536
|
/* ── tabs: Initiatives and Documents (Documents has no frame yet: a plain list) ──────────────────────────────────────────────────────── */
|
|
@@ -583,7 +538,7 @@ function setTab(t) {
|
|
|
583
538
|
tab = t;
|
|
584
539
|
$('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabDocs').setAttribute('aria-selected', String(t === 'docs'));
|
|
585
540
|
$('#cIni').hidden = t !== 'ini'; $('#cDocs').hidden = t !== 'docs';
|
|
586
|
-
if (t === 'docs') {
|
|
541
|
+
if (t === 'docs') { closePanel(); drawDocs(); loadDocMeta(); }
|
|
587
542
|
}
|
|
588
543
|
$('#tabIni').onclick = () => setTab('ini');
|
|
589
544
|
$('#tabDocs').onclick = () => setTab('docs');
|
|
@@ -593,16 +548,22 @@ $('.bd-tabs').addEventListener('keydown', (e) => { if (e.key !== 'ArrowRight' &&
|
|
|
593
548
|
function drawDocs() { if (M) $('#docBody').innerHTML = V.docsHtml(); }
|
|
594
549
|
$('#docBody').addEventListener('click', (e) => { const k = e.target.closest('[data-dkind]'); if (k) { V.setDocKind(k.dataset.dkind); drawDocs(); const b = $(`#docBody [data-dkind="${k.dataset.dkind}"]`); if (b) b.focus(); } });
|
|
595
550
|
/** The history of the documents on screen (GET /api/board-docs): when each last changed, by whom, its last commits. Read-only. */
|
|
596
|
-
async function loadDocMeta(
|
|
551
|
+
async function loadDocMeta(list) {
|
|
597
552
|
if (!M) return;
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
if (!
|
|
602
|
-
|
|
603
|
-
|
|
553
|
+
// each document is read from its own product's workspace (All products lists every product's documents)
|
|
554
|
+
const here = M.board.ws || '', want = (list || V.docRows()).map((x) => ({ path: x.path, ws: x.ws || here })).filter((x) => x.path && !DM[x.ws + ':' + x.path]).slice(0, 40);
|
|
555
|
+
if (!want.length) return;
|
|
556
|
+
const by = new Map(); for (const x of want) { if (!by.has(x.ws)) by.set(x.ws, []); by.get(x.ws).push(x.path); }
|
|
557
|
+
let got = false;
|
|
558
|
+
for (const [ws, P] of by) {
|
|
559
|
+
let r = null; try { r = await (await fetch('/api/board-docs?ws=' + encodeURIComponent(ws) + '&paths=' + P.map(encodeURIComponent).join(','), { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
560
|
+
if (!r || !r.ok) continue;
|
|
561
|
+
for (const p of P) DM[ws + ':' + p] = r.docs[p] || { none: true };
|
|
562
|
+
got = true;
|
|
563
|
+
}
|
|
564
|
+
if (got && tab === 'docs') drawDocs();
|
|
604
565
|
}
|
|
605
|
-
const docMeta = (p) => { const d = DM[p]; return d && !d.none ? d : null; };
|
|
566
|
+
const docMeta = (p, ws) => { const d = DM[(ws || (M && M.board.ws) || '') + ':' + p]; return d && !d.none ? d : null; };
|
|
606
567
|
|
|
607
568
|
/* ── the shell's bell sits before New initiative, as the design orders the tools; Escape closes a popover, then the panel ──────── */
|
|
608
569
|
/* the ⋯ menu ("More: sources, archived, export" in AgBoard and BdHead): the Board adds Metrics and Cancelled and archived */
|
|
@@ -613,9 +574,8 @@ const docMeta = (p) => { const d = DM[p]; return d && !d.none ? d : null; };
|
|
|
613
574
|
$$('#moreMenu [data-open]').forEach((b) => { b.onclick = () => { if (M) Acts.open[b.dataset.open]($('#moreBtn')); }; });
|
|
614
575
|
}
|
|
615
576
|
window.addEventListener('keydown', (e) => {
|
|
616
|
-
if (e.key !== 'Escape' || document.querySelector('.pv-ov:not([hidden]), #moreMenu:not([hidden]), #crMenu:not([hidden]), #czMenu:not([hidden]), #bdPop:not([hidden])')) return;
|
|
617
|
-
if ($$('.bd-pop').some((p) => !p.hidden))
|
|
618
|
-
if (!$('#peek').hidden) closePeek();
|
|
577
|
+
if (e.key !== 'Escape' || document.querySelector('.pv-ov:not([hidden]), #moreMenu:not([hidden]), #crMenu:not([hidden]), #czMenu:not([hidden]), #bdPop:not([hidden]), #bdGrpMenu:not([hidden])')) return;
|
|
578
|
+
if ($$('.bd-pop').some((p) => !p.hidden)) closePops(true); // the shell closes itself on Escape (cozy-viewer.js)
|
|
619
579
|
}, true);
|
|
620
580
|
|
|
621
581
|
/* ── load: the routes derive the initiatives in the background, so the first answers are "reading" ───────────── */
|
|
@@ -643,21 +603,41 @@ function mergeTrail() {
|
|
|
643
603
|
if (!t.you && it.you) { t.you = it.you.text; t.youWhy = it.you.why || ''; t.youKind = it.you.kind || 'you'; }
|
|
644
604
|
}
|
|
645
605
|
}
|
|
606
|
+
/** The boards the rows on screen come from: this one, or with All products every product's board, each with its rows' ids. */
|
|
607
|
+
function boardsRead(keep) {
|
|
608
|
+
const by = new Map();
|
|
609
|
+
for (const r of M.rows || []) {
|
|
610
|
+
if (!r.id || !r.track || !keep(r)) continue;
|
|
611
|
+
const ws = r.ws || M.board.ws || '', b = by.get(ws) || { ws, id: r.boardId || M.board.id, ids: [] };
|
|
612
|
+
if (!b.ids.includes(r.id)) b.ids.push(r.id);
|
|
613
|
+
by.set(ws, b);
|
|
614
|
+
}
|
|
615
|
+
return [...by.values()].map((b) => ({ ...b, ids: b.ids.slice(0, 150) }));
|
|
616
|
+
}
|
|
646
617
|
async function loadTrail() {
|
|
647
|
-
const
|
|
648
|
-
if (!
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
618
|
+
const B = boardsRead(() => true);
|
|
619
|
+
if (!B.length) return;
|
|
620
|
+
let T = null;
|
|
621
|
+
for (const b of B) {
|
|
622
|
+
const q = 'ws=' + encodeURIComponent(b.ws) + (b.id ? '&board=' + encodeURIComponent(b.id) : '') + '&ids=' + b.ids.map(encodeURIComponent).join(',');
|
|
623
|
+
let r = null; try { r = await (await fetch('/api/board-trail?' + q, { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
624
|
+
if (!r || !r.ok) continue;
|
|
625
|
+
T = T ? { ...T, items: { ...T.items, ...r.items } } : r; // the usual days come from the first board read
|
|
626
|
+
}
|
|
627
|
+
if (!T) { TR = TR || { usual: {}, themes: [], items: {}, failed: true }; return; }
|
|
628
|
+
TR = T; mergeTrail(); draw();
|
|
653
629
|
}
|
|
654
630
|
/** The first questions still open (GET /api/board-grill?ids=): an initiative started on the Board shows "N questions before the BRD". */
|
|
655
631
|
async function loadGrill() {
|
|
656
|
-
const
|
|
657
|
-
if (!
|
|
658
|
-
let
|
|
659
|
-
|
|
660
|
-
|
|
632
|
+
const B = boardsRead((r) => r.track.k <= 1);
|
|
633
|
+
if (!B.length) return;
|
|
634
|
+
let items = null;
|
|
635
|
+
for (const b of B) {
|
|
636
|
+
let r = null; try { r = await (await fetch('/api/board-grill?ws=' + encodeURIComponent(b.ws) + '&ids=' + b.ids.map(encodeURIComponent).join(','), { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
637
|
+
if (r && r.ok) items = { ...(items || {}), ...(r.items || {}) };
|
|
638
|
+
}
|
|
639
|
+
if (!items) return;
|
|
640
|
+
GR = items; draw();
|
|
661
641
|
}
|
|
662
642
|
|
|
663
643
|
function draw() {
|
|
@@ -669,10 +649,7 @@ function draw() {
|
|
|
669
649
|
if (tab === 'docs') drawDocs();
|
|
670
650
|
$('#docCap').textContent = String(V.docRows().length);
|
|
671
651
|
// an open panel follows the new read
|
|
672
|
-
if (peek && peek.kind
|
|
673
|
-
const r = (M.rows || []).find((x) => x.key === peek.key); // a row that left the Board (cancelled, archived) closes its panel
|
|
674
|
-
if (!r) closePeek(); else if (peek.kind === 'ini') showPeek(peek.from === 'time' ? timePanel(r) : iniPanel(r));
|
|
675
|
-
}
|
|
652
|
+
if (peek && peek.kind === 'ini') BI.refresh(); // a row that left the Board (cancelled, archived) closes it
|
|
676
653
|
}
|
|
677
654
|
/** ?focus=<initiative id> (Insights links here): open that initiative's panel once, on the first read that has it. */
|
|
678
655
|
let focusDone = false;
|
|
@@ -684,10 +661,30 @@ function focusOnce() {
|
|
|
684
661
|
const b = $$('#ibBody [data-key]').find((x) => x.dataset.key === r.key);
|
|
685
662
|
openIni(r, b || null, 'track');
|
|
686
663
|
}
|
|
687
|
-
|
|
688
|
-
|
|
664
|
+
/** One board's model (GET /api/board-premium); { r, status }. */
|
|
665
|
+
async function readBoard(q) {
|
|
689
666
|
let r = null, status = 0;
|
|
690
667
|
try { const res = await fetch('/api/board-premium' + (q ? '?' + q : ''), { credentials: 'same-origin' }); status = res.status; r = await res.json(); } catch { r = null; }
|
|
668
|
+
return { r, status };
|
|
669
|
+
}
|
|
670
|
+
/** All products: this board first, then every other product's board, merged into one model (pm/bd-prog.js mergeBoards). While any board
|
|
671
|
+
* is still reading, the answer is "reading"; a board that cannot be read is left out and named in the header, never guessed. */
|
|
672
|
+
async function readAll(q) {
|
|
673
|
+
const h = await readBoard(q);
|
|
674
|
+
if (!h.r || !h.r.ok || h.r.state === 'reading') return h;
|
|
675
|
+
const home = h.r.model, list = (home.board.switcher || []).filter((b) => !(b.ws === home.board.ws && b.id === home.board.id));
|
|
676
|
+
const got = await Promise.all(list.map((b) => readBoard('ws=' + encodeURIComponent(b.ws) + '&board=' + encodeURIComponent(b.id))));
|
|
677
|
+
if (got.some((g) => g.r && g.r.state === 'reading')) return { r: { state: 'reading' }, status: 200 };
|
|
678
|
+
const B = [{ ws: home.board.ws || '', id: home.board.id, name: home.board.name, model: home }];
|
|
679
|
+
const lost = [];
|
|
680
|
+
got.forEach((g, i) => { if (g.r && g.r.ok && g.r.model) B.push({ ...list[i], model: g.r.model }); else lost.push(list[i].name + ' board'); });
|
|
681
|
+
const model = PG.mergeBoards(B);
|
|
682
|
+
if (lost.length) { model.header.missing = [...model.header.missing, ...lost]; model.header.text += (/not read: /.test(model.header.text) ? ', ' : ' · not read: ') + lost.join(', '); }
|
|
683
|
+
return { r: { ok: true, model, stale: got.some((g) => g.r && g.r.stale) || h.r.stale }, status: 200 };
|
|
684
|
+
}
|
|
685
|
+
async function load() {
|
|
686
|
+
const p = new URLSearchParams(location.search), q = [p.get('ws') ? 'ws=' + encodeURIComponent(p.get('ws')) : '', p.get('board') ? 'board=' + encodeURIComponent(p.get('board')) : ''].filter(Boolean).join('&');
|
|
687
|
+
const { r, status } = ALL ? await readAll(q) : await readBoard(q);
|
|
691
688
|
clearInterval(readTimer);
|
|
692
689
|
if (r && r.state === 'reading') {
|
|
693
690
|
const t0 = Date.now(), tick = () => { const s = 'Reading the board · ' + Math.round((Date.now() - t0) / 1000) + ' s so far'; $('#snap').textContent = s; if (!M) $('#ibBody').innerHTML = `<p class="bd-msg"><b>${esc(s)}</b> The board derives each initiative from its records. This page shows nothing until it has read, rather than guess.</p>`; };
|
|
@@ -702,16 +699,25 @@ async function load() {
|
|
|
702
699
|
return;
|
|
703
700
|
}
|
|
704
701
|
M = r.model; draw();
|
|
705
|
-
focusOnce();
|
|
702
|
+
focusOnce(); programOnce(); loadOthers();
|
|
706
703
|
if (r.stale) setTimeout(load, 2000); // a press is still being derived: ask again
|
|
707
704
|
else { loadTrail(); loadGrill(); }
|
|
708
705
|
}
|
|
709
706
|
const viewDoc = (path) => { const a = document.createElement('button'); a.dataset.doc = path; a.hidden = true; document.body.appendChild(a); a.click(); a.remove(); };
|
|
710
|
-
const anchors = async () => { try { const r = await (await fetch('/api/boards/anchors?ws=' + encodeURIComponent(M.board.ws || '') + '&board=' + encodeURIComponent(M.board.id || ''), { credentials: 'same-origin' })).json(); return r && r.ok ? r.anchors || [] : []; } catch { return []; } };
|
|
707
|
+
const anchors = async (ws, board) => { try { const r = await (await fetch('/api/boards/anchors?ws=' + encodeURIComponent(ws || M.board.ws || '') + '&board=' + encodeURIComponent(board || M.board.id || ''), { credentials: 'same-origin' })).json(); return r && r.ok ? r.anchors || [] : []; } catch { return []; } };
|
|
711
708
|
const openIniAny = (r) => openIni(r, $('#bdBell'), 'track');
|
|
712
|
-
V.init({ M: () => M, statusOf, usual: usualOf, trail: TI, docMeta, sel: () => (peek && peek.kind !== 'acts' ? peek.key : null), docSel: () => Acts.docSel()
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
709
|
+
V.init({ M: () => M, statusOf, usual: usualOf, trail: TI, docMeta, sel: () => (peek && peek.kind !== 'acts' ? peek.key : null), docSel: () => Acts.docSel(),
|
|
710
|
+
groups: (L) => groups(L), folded: PG.folded, laneHead: (g) => PG.laneHtml(g, g.kind === 'program' ? progState(g.program) : null), subTile: (n) => PG.tileHtml(n, 'bd-ti s'),
|
|
711
|
+
memberIcon: (id) => PG.memberIcon(PGS, id), product: () => (M.board.product || M.board.name || ''), programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), tileHtml: PG.tileHtml, progTile: PG.progTile });
|
|
712
|
+
Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, rowOf, openIni: openIniAny, openDoc: viewDoc, anchors, programs: () => PGS, reloadPrograms: loadPrograms });
|
|
713
|
+
Acts.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, redraw: () => { drawChips(); drawInit(); if (tab === 'docs') drawDocs(); }, F, rowOf, statusOf, openIni: openIniAny,
|
|
714
|
+
openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, docMeta, loadDocMeta, viewDoc,
|
|
715
|
+
grouping: () => ({ on: groupingOn(), byProduct }), setGrouping });
|
|
716
|
+
BI.mount({ M: () => M, statusOf, dayTitle, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
|
|
717
|
+
send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
|
|
718
|
+
acts: (r, b) => Acts.open.row(r, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden });
|
|
719
|
+
setSay(say);
|
|
720
|
+
PP.mount({ M: () => M, programs: () => PGS, openIni: (id, from) => openIni((M.rows || []).find((x) => x.id === id && x.track), from), close: closePanel, reload: loadPrograms, say }); // the program panel (PgProgram)
|
|
716
721
|
setTab('ini');
|
|
717
722
|
load();
|
|
723
|
+
loadPrograms();
|