create-pmos 0.395.0 → 0.397.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 +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/nine-stages.js +49 -20
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +20 -40
- package/workspace/briefing-premium-board-test.js +145 -107
- package/workspace/briefing-premium-calendar-2-test.js +5 -2
- package/workspace/briefing-premium-calendar-3-test.js +13 -8
- package/workspace/briefing-premium-calendar-test.js +16 -5
- package/workspace/briefing-premium-initiative-test.js +50 -41
- package/workspace/briefing-premium-insights-test.js +104 -85
- package/workspace/briefing-premium-metrics-test.js +11 -32
- package/workspace/briefing-premium-sources-test.js +42 -21
- package/workspace/briefing-premium-test.js +112 -98
- package/workspace/briefing-premium-work-test.js +78 -64
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/board-premium-facts.js +2 -1
- package/workspace/fixtures/board-premium-jira.js +28 -0
- package/workspace/fixtures/initiative-premium-facts.js +2 -1
- package/workspace/fixtures/initiatives-api/list.json +30 -42
- package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
- package/workspace/fixtures/initiatives-api/sheet.json +10 -14
- package/workspace/fixtures/insights-premium-facts.js +11 -2
- package/workspace/guide/briefing-premium.md +3 -1
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/lifecycle.md +51 -0
- package/workspace/home-shot.js +38 -0
- package/workspace/lib/board-premium.js +92 -1
- package/workspace/lib/engine/boards.js +15 -14
- package/workspace/lib/engine/nine-stages.js +49 -20
- package/workspace/lib/engine/signals/detectors.js +13 -11
- package/workspace/lib/insights-premium.js +78 -1
- package/workspace/lib/routes-board-premium.js +3 -2
- package/workspace/lib/routes-initiatives.js +1 -1
- package/workspace/lib/routes-insights-premium.js +8 -1
- package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-agreed-viewer-shots.js +76 -0
- package/workspace/premium-board-actions-test.js +2 -0
- package/workspace/premium-chat-chart-tab-test.js +6 -5
- package/workspace/premium-chat-context-test.js +8 -6
- package/workspace/premium-chat-goal-view-test.js +9 -7
- package/workspace/premium-chat-notes-test.js +3 -2
- package/workspace/premium-chat-report-tab-test.js +8 -2
- package/workspace/premium-chat-term-test.js +3 -1
- package/workspace/premium-chat-viewer-test.js +23 -17
- package/workspace/premium-core-doc-issue-test.js +2 -0
- package/workspace/premium-html-viewer-test.js +4 -2
- package/workspace/premium-phone-card-test.js +1 -0
- package/workspace/premium-phone-room-test.js +16 -11
- package/workspace/premium-report-read-test.js +1 -1
- package/workspace/premium-vw-backlog-test.js +2 -0
- package/workspace/premium-vw-cal-test.js +9 -4
- package/workspace/premium-vw-doc-test.js +1 -1
- package/workspace/premium-vw-item-test.js +1 -0
- package/workspace/premium-vw-jira-test.js +4 -1
- package/workspace/premium-vw-notes-test.js +2 -1
- package/workspace/premium-vw-rec-test.js +3 -2
- package/workspace/premium-vw-slides-test.js +2 -2
- package/workspace/premium-work-depth-test.js +7 -3
- package/workspace/public/pm/bd-span.js +120 -0
- package/workspace/public/pm/bd-stages.js +33 -0
- package/workspace/public/pm/cozy-board.css +373 -0
- package/workspace/public/pm/cozy-home.css +152 -0
- package/workspace/public/pm/cozy-home.js +170 -0
- package/workspace/public/pm/cozy-initiative.css +138 -0
- package/workspace/public/pm/cozy-insights.css +292 -0
- package/workspace/public/pm/cozy-nav.js +54 -0
- package/workspace/public/pm/cozy-viewer.css +143 -0
- package/workspace/public/pm/cozy.css +172 -0
- package/workspace/public/pm/lifecycle-lens-model.js +45 -27
- package/workspace/public/pm/lifecycle-lens.js +22 -11
- package/workspace/public/pm/premium-board.js +329 -67
- package/workspace/public/pm/premium-brief.js +1 -1
- package/workspace/public/pm/premium-chat.js +17 -10
- package/workspace/public/pm/premium-initiative-head.js +138 -0
- package/workspace/public/pm/premium-initiative.js +28 -4
- package/workspace/public/pm/premium-insights.js +530 -244
- package/workspace/public/pm/premium-shell.js +40 -10
- package/workspace/public/pm/premium-viewer.js +5 -0
- package/workspace/public/pm/premium-vw-jira-model.js +22 -5
- package/workspace/public/pm/premium-vw-jira.css +11 -0
- package/workspace/public/pm/premium-vw-jira.js +11 -4
- package/workspace/public/pm/premium-vw-rec.js +5 -2
- package/workspace/public/pm/premium-wide.css +30 -0
- package/workspace/public/pm/premium-work.js +18 -8
- package/workspace/public/pm/premium.js +19 -6
- package/workspace/public/premium-board.html +83 -47
- package/workspace/public/premium-chat.html +7 -32
- package/workspace/public/premium-initiative.html +16 -8
- package/workspace/public/premium-insights.html +83 -43
- package/workspace/public/premium-work.html +6 -71
- package/workspace/public/premium.html +62 -15
- package/workspace/public/vendor/nunito-var.woff2 +0 -0
- package/workspace/server.js +7 -0
- package/workspace/test-lists/premium-agreed-viewer.json +9 -0
- package/workspace/third-party/README.md +1 -0
|
@@ -1,40 +1,58 @@
|
|
|
1
|
-
/* pm/premium-board.js — the premium Board
|
|
2
|
-
* lib/board-premium.js builds from the routes the production Initiatives page reads
|
|
3
|
-
*
|
|
4
|
-
* and
|
|
5
|
-
*
|
|
1
|
+
/* pm/premium-board.js — the premium Board in the Agreed design (initiative premium-agreed-design: B1 B2 B3 N1 N2; built on briefing-premium-board).
|
|
2
|
+
* Reads GET /api/board-premium and draws the model lib/board-premium.js builds from the routes the production Initiatives page reads.
|
|
3
|
+
* · one toolbar, no page header: the product picker, the view toggle (By stage, Stage track, Timeline, List), Find, Filter, New initiative and the
|
|
4
|
+
* shell's bell and ⋯ menu; under it the Initiatives and Documents tabs and the chips (Jira read time, sprint and fix version, new asks, late,
|
|
5
|
+
* at risk, blocked, idle, This sprint).
|
|
6
|
+
* · the stage track (default): each initiative is a row across the six stages and two milestones (◆), with progress toward the output that
|
|
7
|
+
* finishes its current step; a row opens the initiative panel, a deliverable segment opens its Jira ticket.
|
|
8
|
+
* · the timeline (pm/bd-span.js): PMOS plan dates against the Jira forecast over six spans.
|
|
9
|
+
* · the Board has no chat: "Ask about this" sends the question to Home (/premium.html?ask=<initiative>&q=<question>).
|
|
10
|
+
* The presses are the ones the page had: Draft it and Issue it on a core document, Add a document, and the board's presses of pm/premium-acts.js
|
|
11
|
+
* (new asks, New initiative, a row's ⋯ menu: move, hold, cancel, archive and their Undo). The sprint, release and Metrics cards open as popovers. */
|
|
6
12
|
import { openWorkItem, recordPress } from './premium-vw-item.js';
|
|
7
13
|
import { pmPost } from './http.js';
|
|
8
14
|
import { openBacklog } from './premium-vw-backlog.js';
|
|
9
|
-
import { $, $$, esc, openDlg,
|
|
10
|
-
import { issueBody } from './premium-doc-edit.js';
|
|
15
|
+
import { $, $$, esc, openDlg, toast, loadThread, wireRail, logHtml, turnA, ptx, pillOf, store, crumbHtml, wireCrumb, chatAbout, kv, H, openAddDoc, setPageGaps, openSources } from './premium-shell.js';
|
|
11
16
|
import { mountDocSheet } from './premium-doc-sheet.js';
|
|
12
17
|
import * as MT from './premium-metric-tiles.js';
|
|
13
18
|
import { openSprint } from './premium-vw-jira.js';
|
|
14
19
|
import { dotsBtn, openMenu, closeMenu, menuKey, asksHtml, onAsks, openIniForm } from './premium-acts.js';
|
|
20
|
+
import { mountNav } from './cozy-nav.js';
|
|
21
|
+
import { stepsHelpHtml } from './bd-stages.js';
|
|
22
|
+
import { timelineHtml, SPANS } from './bd-span.js';
|
|
15
23
|
|
|
16
|
-
const MODE_KEY = 'pmos.premium.openAs';
|
|
24
|
+
const MODE_KEY = 'pmos.premium.openAs', VIEW_KEY = 'pmos.board.view', SPAN_KEY = 'pmos.board.span';
|
|
17
25
|
let M = null; // the model
|
|
18
26
|
const docSheet = mountDocSheet({ ws: () => M.board.ws, scope: () => M.docs.scope, rows: () => M.docs.rows, reload: () => load(), noteKey: (d) => 'doc:' + M.board.id + ':' + d.key, sub: () => M.board.name, again: true });
|
|
19
|
-
let view = 'list';
|
|
20
|
-
let
|
|
27
|
+
let view = ['track', 'stages', 'time', 'list'].includes(store.get(VIEW_KEY)) ? store.get(VIEW_KEY) : 'track';
|
|
28
|
+
let span = SPANS.some(([k]) => k === store.get(SPAN_KEY)) ? store.get(SPAN_KEY) : 'quarter';
|
|
29
|
+
let tab = 'ini';
|
|
30
|
+
let shown = 25; // rows on screen in the track and the list
|
|
21
31
|
let readTimer = null;
|
|
22
32
|
let showGone = false; // the cancelled and archived rows under the list
|
|
33
|
+
const F = { chips: new Set(), owners: new Set(), lanes: new Set(), q: '' }; // the filters: chips, owner and lane, and Find
|
|
34
|
+
let peek = null; // the open panel: { kind: 'ini' | 'tk', key, tk }
|
|
23
35
|
wireRail('init');
|
|
36
|
+
mountNav('board');
|
|
24
37
|
/** The context of the board presses (pm/premium-acts.js). */
|
|
25
38
|
const ctxOf = () => ({ ws: M.board.ws, board: M.board.id, boardName: M.board.name, self: M.board.self, first: (M.board.stages || [])[0] || '', reload: load });
|
|
26
39
|
const ICO = (p) => `<svg class="i" viewBox="0 0 24 24">${p}</svg>`;
|
|
40
|
+
const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
27
41
|
const DOCI = '<path d="M6 3h9l4 4v14H6z"/><path d="M14 3v5h5M9 13h6M9 17h4"/>';
|
|
28
42
|
const STATE_ICO = { Linked: '<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/>', Live: '<path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/>', 'Up to date': '<path d="M5 12.5l4.5 4.5L19 7.5"/>', Draft: '<path d="M4 20l4-1 11-11-3-3L5 16z"/>', 'Not started': '<circle cx="12" cy="12" r="9"/><path d="M12 8v5M12 16.5v.5"/>', Stale: '<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>', Due: '<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>' };
|
|
43
|
+
const plural = (n, a, b) => (n === 1 ? a : b);
|
|
44
|
+
const ago = (iso) => { const t = Date.parse(iso || ''); if (!t) return ''; const m = Math.max(0, Math.round((Date.now() - t) / 60000)); return m < 1 ? 'just now' : m < 60 ? m + ' min ago' : m < 60 * 36 ? Math.round(m / 60) + ' h ago' : Math.round(m / 1440) + ' days ago'; };
|
|
45
|
+
const wsQ = (k) => (M.board.ws ? k + 'ws=' + encodeURIComponent(M.board.ws) : '');
|
|
29
46
|
|
|
30
|
-
/* ──
|
|
47
|
+
/* ── the toolbar: picker, views, chips ──────────────────────────────────────────────────────────────────────────── */
|
|
31
48
|
let crumbed = false;
|
|
32
49
|
function drawHead() {
|
|
33
50
|
if (!crumbed) {
|
|
34
51
|
crumbed = true;
|
|
35
52
|
const boards = M.board.switcher || [];
|
|
36
|
-
$('#crumbHost').innerHTML = crumbHtml({ page: '
|
|
53
|
+
$('#crumbHost').innerHTML = crumbHtml({ page: '', board: M.board.name || 'Board', boards });
|
|
37
54
|
wireCrumb({ boards, board: M.board.id, goBoard: (ws, id) => location.assign('/premium-board.html?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(id)) });
|
|
55
|
+
$('#crBoard').setAttribute('aria-label', 'Product: ' + (M.board.name || 'Board'));
|
|
38
56
|
chatAbout('board:this-board', M.board.name ? 'the ' + M.board.name + ' board' : 'this board');
|
|
39
57
|
}
|
|
40
58
|
$('#snap').textContent = M.header.text;
|
|
@@ -42,19 +60,112 @@ function drawHead() {
|
|
|
42
60
|
$('#snap').title = 'Every figure on this page comes from a record of the board. A date, owner or progress shows only when one was set.';
|
|
43
61
|
$('#brief').textContent = '';
|
|
44
62
|
}
|
|
63
|
+
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']];
|
|
64
|
+
function drawChips() {
|
|
65
|
+
const J = M.jira || {}, C = M.chips || {}, sp = J.sprint, rel = J.release;
|
|
66
|
+
const jira = J.readAt ? 'Jira · read ' + ago(J.readAt) : 'Jira · not read';
|
|
67
|
+
const sprint = [sp ? sp.name : null, rel ? rel.name + ' ships ' + rel.at : null].filter(Boolean).join(' · ') || 'No sprint on record';
|
|
68
|
+
const asks = M.board.self ? 'New asks' : C.asks == null ? 'New asks · not read' : null;
|
|
69
|
+
$('#bdChipset').innerHTML = `<button type="button" class="cz-chip" id="chJira" title="When Jira was last read. Sources reads it again." aria-haspopup="dialog">${SV('M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7')}<span>${esc(jira)}</span></button>`
|
|
70
|
+
+ `<button type="button" class="cz-chip" id="chSprint" aria-haspopup="dialog" aria-expanded="false" aria-controls="popSpr">${SV('M4 6h16v14H4zM4 10h16M9 3v4M15 3v4')}<span>${esc(sprint)}</span></button>`
|
|
71
|
+
+ `<button type="button" class="cz-chip" id="chAsks" aria-haspopup="dialog" aria-expanded="false" aria-controls="popAsks">${asks ? esc(asks) : `<i class="cz-dot you${C.asks ? ' m-info' : ''}"></i><b>${C.asks}</b> new ${plural(C.asks, 'ask', 'asks')}`}</button>`
|
|
72
|
+
+ '<span class="cz-vr"></span>'
|
|
73
|
+
+ CHIP_F.map(([k, tone, mo, word]) => (C[k] ? `<button type="button" class="cz-chip gh${F.chips.has(k) ? ' on' : ''}" data-f="${k}" aria-pressed="${F.chips.has(k)}"><i class="cz-dot ${tone} ${mo}"></i>${esc(word(C[k]))}</button>` : '')).join('')
|
|
74
|
+
+ (sp ? `<span class="bd-sp"></span><button type="button" class="cz-chip${F.chips.has('sprint') ? ' on' : ''}" data-f="sprint" aria-pressed="${F.chips.has('sprint')}">This sprint</button>` : '');
|
|
75
|
+
}
|
|
76
|
+
$('#bdChipset').addEventListener('click', (e) => {
|
|
77
|
+
const f = e.target.closest('[data-f]');
|
|
78
|
+
if (f) { const k = f.dataset.f; if (F.chips.has(k)) F.chips.delete(k); else F.chips.add(k); shown = 25; drawChips(); drawInit(); return; }
|
|
79
|
+
if (e.target.closest('#chJira')) { openSources(); return; }
|
|
80
|
+
if (e.target.closest('#chSprint')) { togglePop('popSpr', $('#chSprint')); return; }
|
|
81
|
+
if (e.target.closest('#chAsks')) { togglePop('popAsks', $('#chAsks')); }
|
|
82
|
+
});
|
|
45
83
|
|
|
46
|
-
/* ──
|
|
47
|
-
|
|
48
|
-
function
|
|
49
|
-
|
|
84
|
+
/* ── popovers under the toolbar (new asks, sprint and release, metrics, filter, what finishes each step) ─────────────────── */
|
|
85
|
+
let popBtn = null;
|
|
86
|
+
function closePops(back) { $$('.bd-pop').forEach((p) => { p.hidden = true; }); if (popBtn) { popBtn.setAttribute('aria-expanded', 'false'); if (back) popBtn.focus(); } popBtn = null; }
|
|
87
|
+
function togglePop(id, btn, anchorOnly) {
|
|
88
|
+
const p = $('#' + id), open = p.hidden;
|
|
89
|
+
closePops();
|
|
90
|
+
if (!open) return;
|
|
91
|
+
p.hidden = false; popBtn = anchorOnly ? null : btn || null; if (popBtn) popBtn.setAttribute('aria-expanded', 'true');
|
|
92
|
+
if (btn && innerWidth > 720) { const r = btn.getBoundingClientRect(), host = $('#stage').getBoundingClientRect(); p.style.top = (r.bottom - host.top + 8) + 'px'; p.style.left = Math.max(16, Math.min(r.left - host.left, host.width - p.offsetWidth - 16)) + 'px'; }
|
|
93
|
+
else { p.style.top = ''; p.style.left = ''; }
|
|
94
|
+
const f = p.querySelector('button, input, a'); if (f) f.focus({ preventScroll: true });
|
|
95
|
+
}
|
|
96
|
+
document.addEventListener('click', (e) => {
|
|
97
|
+
if (e.target.closest('[data-pop-close]')) { closePops(true); return; }
|
|
98
|
+
if (!e.target.closest('.bd-pop, [aria-controls^="pop"], .crmenu, #moreMenu, .dlg, .bam2')) closePops();
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
/* ── the rows on screen: the filters, Find, the order ──────────────────────────────────────────────────────────────── */
|
|
102
|
+
function visible() {
|
|
103
|
+
const q = F.q.trim().toLowerCase(), sp = M.jira && M.jira.sprint;
|
|
104
|
+
return M.initiatives.list.rows.filter((r) => {
|
|
105
|
+
const t = r.track || {};
|
|
106
|
+
if (F.chips.has('late') && !r.late) return false;
|
|
107
|
+
if (F.chips.has('risk') && r.status !== 'at risk') return false;
|
|
108
|
+
if (F.chips.has('blocked') && !t.blocked) return false;
|
|
109
|
+
if (F.chips.has('idle') && t.idle == null) return false;
|
|
110
|
+
if (F.chips.has('sprint') && !(sp && (t.tickets || []).some((k) => k.sprint === sp.name))) return false;
|
|
111
|
+
if (F.owners.size && !F.owners.has(r.owner || '')) return false;
|
|
112
|
+
if (F.lanes.size && !F.lanes.has(r.lane || '')) return false;
|
|
113
|
+
if (q && !(r.title + ' ' + (r.id || '') + ' ' + (t.tickets || []).map((k) => k.key + ' ' + k.title).join(' ')).toLowerCase().includes(q)) return false;
|
|
114
|
+
return true;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
const filtered = () => F.chips.size || F.owners.size || F.lanes.size || F.q.trim();
|
|
118
|
+
/** The status line of a row: the most important of blocked, late, at risk, idle and on hold, with its dot and its motion level. */
|
|
119
|
+
function statusOf(r) {
|
|
120
|
+
const t = r.track || {};
|
|
121
|
+
if (r.acts && r.acts.life === 'hold') return { tone: 'q', mo: '', text: 'On hold' + (r.acts.back ? ' · back ' + r.acts.back : '') };
|
|
122
|
+
if (t.blocked) return { tone: 'red', mo: 'm-crit', text: t.blocked + ' blocked in Jira' + (r.late ? ' · late' : '') };
|
|
123
|
+
if (r.late) return { tone: 'late', mo: 'm-warn', text: r.overDays > 0 ? r.overDays + ' ' + plural(r.overDays, 'day', 'days') + ' over' : 'Late' };
|
|
124
|
+
if (r.status === 'at risk') return { tone: 'risk', mo: 'm-warn', text: 'At risk' + (r.owner ? '' : ' · no owner') };
|
|
125
|
+
if (t.idle != null) return { tone: 'q', mo: '', text: 'Idle ' + t.idle + ' days' };
|
|
126
|
+
if (r.status === 'on track') return { tone: 'ok', mo: '', text: 'On track' + (r.owner ? ' · ' + r.owner : '') };
|
|
127
|
+
return { tone: 'q', mo: '', text: r.statusLabel || r.sub };
|
|
128
|
+
}
|
|
129
|
+
const progText = (p) => (!p ? 'Not counted yet' : p.unit === '%' ? p.done + '%' : p.done + ' of ' + p.total + ' ' + p.unit);
|
|
130
|
+
function segHtml(r, big) {
|
|
131
|
+
const p = r.track && r.track.prog;
|
|
132
|
+
if (p && p.parts) return `<div class="seg5${big ? ' big' : ''}">${r.track.tickets.map((t) => `<button type="button" class="bt-tk ${esc(t.cls || 'td')}" data-tk="${esc(t.key)}" data-ini="${esc(r.key)}" aria-label="${esc(t.key + ': ' + t.title + ', ' + (t.blocked ? 'blocked' : t.status))}" title="${esc(t.key + ' · ' + t.title)}"></button>`).join('')}</div>`;
|
|
133
|
+
if (p) return `<div class="seg5 pc${big ? ' big' : ''}" role="img" aria-label="${p.done}%"><i><b style="width:${Math.max(0, Math.min(100, p.done))}%"></b></i></div>`;
|
|
134
|
+
return `<div class="seg5 none${big ? ' big' : ''}" aria-hidden="true"><i></i></div>`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* ── the stage track (B1) ─────────────────────────────────────────────────────────────────────────────────────── */
|
|
138
|
+
const LEGEND = '<span class="lg" aria-hidden="true"><span><i class="dn"></i>Done</span><span><i class="rv"></i>Review</span><span><i class="ip"></i>Doing</span><span><i class="bl"></i>Blocked</span></span>';
|
|
139
|
+
function trackRow(r) {
|
|
140
|
+
const t = r.track || { k: -1, label: r.stage || 'No stage', output: '', prog: null }, s = statusOf(r), k = t.k;
|
|
141
|
+
const cells = M.steps.map((st, j) => {
|
|
142
|
+
const cls = ['sc', j === 0 ? 'f0' : '', j === 7 ? 'l' : '', st.ms ? 'ms' : '', j < k ? 'p' : '', j === k ? 'c bg' : ''].filter(Boolean).join(' ');
|
|
143
|
+
return `<div class="${cls}" role="cell"${j === k ? ` title="${esc(st.label)}"` : ''}>${j === k ? `<span class="cur"><u class="cz-dot ${s.tone} ${s.mo}"></u></span>` : '<i></i>'}</div>`;
|
|
144
|
+
}).join('');
|
|
145
|
+
const nx = t.next ? `<span class="${t.next.tone === 'red' ? 's-red' : ''}">${esc(t.next.text)}</span>` : (t.prog && t.prog.unit === '%' ? 'Progress from the record' : '');
|
|
146
|
+
return `<div class="bt-r bt-l${peek && peek.key === r.key ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}">`
|
|
147
|
+
+ `<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)}</span></button>`
|
|
148
|
+
+ `<div class="bt-cells" role="presentation">${cells}</div>`
|
|
149
|
+
+ `<div class="bt-dl" role="cell"><div class="t1"><b>${esc(t.output)}</b><span>${esc(progText(t.prog))}</span></div>${segHtml(r)}<div class="t3">${nx}</div></div>`
|
|
150
|
+
+ `<div class="bt-act" role="cell">${r.acts ? dotsBtn(r) : ''}</div></div>`;
|
|
151
|
+
}
|
|
152
|
+
function drawTrack(L) {
|
|
153
|
+
const S = M.steps || [];
|
|
154
|
+
const sorted = L.slice().sort((a, b) => ((a.track ? a.track.k : -1) < 0 ? 99 : a.track.k) - ((b.track ? b.track.k : -1) < 0 ? 99 : b.track.k));
|
|
155
|
+
const head = `<div class="bt-r bt-h" role="row"><div class="bt-nmh" role="columnheader">Initiative <span>${L.length}</span><button type="button" class="bd-info" id="stHelp" aria-label="What finishes each step" title="What finishes each step" aria-haspopup="dialog" aria-controls="popSteps"><i aria-hidden="true">i</i></button></div><div class="bt-cells" role="presentation">${S.map((s) => `<div role="columnheader" class="${s.ms ? 'msh' : ''}">${s.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(s.label)}<span>${s.count}</span></div>`).join('')}</div><div class="bt-oh" role="columnheader">Output ${LEGEND}</div><div role="presentation"></div></div>`;
|
|
156
|
+
if (!L.length) return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}<p class="empty3 plain bt-empty">${filtered() ? 'No initiative matches the filters. <button type="button" class="dlink" id="fClear">Clear the filters</button>' : 'No initiatives are on this board\'s now view.'}</p>${goneHtml()}</div>`;
|
|
157
|
+
return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}${sorted.slice(0, shown).map(trackRow).join('')}`
|
|
158
|
+
+ `<div class="bt-tf">${L.length > shown ? `<button type="button" class="dlink" id="more">${SV('M7 10l5 5 5-5')}Show ${Math.min(25, L.length - shown)} more of ${L.length - shown}</button>` : '<span></span>'}<span class="bt-srt">Sorted by stage</span></div>${goneHtml()}</div>`;
|
|
50
159
|
}
|
|
160
|
+
|
|
161
|
+
/* ── the list and By stage (the earlier views, kept) ──────────────────────────────────────────────────────────────── */
|
|
162
|
+
const sub = (r) => `${esc(r.sub)}${r.statusLabel ? ` · <span class="${r.late ? 'bad' : 'warn'}">${esc(r.statusLabel)}</span>` : ''}`;
|
|
51
163
|
function listBtn(r) {
|
|
52
164
|
return `<button class="ini2 ibi${r.first ? ' first' : ''}" data-key="${esc(r.key)}"><span class="it"><b>${esc(r.title)}${r.first ? '<em class="tgf">Do this first</em>' : ''}</b><small>${sub(r)}</small></span><span class="wst"><span class="sg2" aria-hidden="true">${r.seg.map((c) => `<i class="${c}"></i>`).join('')}</span><em>${esc(r.stage || 'No stage')}${r.stageNote ? ' · ' + esc(r.stageNote) : ''}</em></span><span class="pg">${r.progress == null ? '' : `<i><b style="width:${r.progress}%"></b></i>`}</span><span class="rl${r.over ? ' over' : ''}">${esc(r.finish)}</span></button>`;
|
|
53
165
|
}
|
|
54
|
-
function drawList() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return `<div class="inih"><span>Initiative</span><span>Where it is</span><span>Progress</span><span>Planned finish</span></div><div class="inil">` + L.slice(0, shown).map(listRow).join('') + '</div>'
|
|
166
|
+
function drawList(L) {
|
|
167
|
+
if (!L.length) return `<p class="empty3 plain">${filtered() ? 'No initiative matches the filters.' : 'No initiatives are on this board\'s now view.'}</p>` + goneHtml();
|
|
168
|
+
return `<div class="inih"><span>Initiative</span><span>Where it is</span><span>Progress</span><span>Planned finish</span></div><div class="inil">` + L.slice(0, shown).map((r) => `<div class="inirw">${listBtn(r)}${r.acts ? dotsBtn(r) : ''}</div>`).join('') + '</div>'
|
|
58
169
|
+ (L.length > shown ? `<p class="note" style="margin-top:10px">${L.length - shown} more are loaded. <button class="fold alt" id="more" type="button">Show ${Math.min(25, L.length - shown)} more</button></p>` : '') + goneHtml();
|
|
59
170
|
}
|
|
60
171
|
/** The cancelled and archived rows, under a fold (initiative premium-board-actions). Their menu offers Reopen or Restore. */
|
|
@@ -66,46 +177,173 @@ function goneHtml() {
|
|
|
66
177
|
function drawStages() {
|
|
67
178
|
const S = M.initiatives.stages;
|
|
68
179
|
if (!S.length) return '<p class="empty3 plain">This board has no workflow stages on record.</p>';
|
|
69
|
-
|
|
180
|
+
const keep = new Set(visible().map((r) => r.key));
|
|
181
|
+
return `<div class="istg">${S.map((s) => { const rows = s.rows.filter((r) => !filtered() || keep.has(r.key)); return `<div class="isc"><p class="label">${esc(s.stage)} <em>${s.count}</em></p>${rows.map((r) => `<button class="icd ibi" data-key="${esc(r.key)}"><b>${esc(r.title)}</b><small>${sub(r)}</small>${r.progress == null ? '' : `<span class="pg"><i><b style="width:${r.progress}%"></b></i></span>`}<small>${esc(r.finish)}</small></button>`).join('') || '<p class="mut">None</p>'}${s.more ? `<p class="mut">${s.more} more</p>` : ''}</div>`; }).join('')}</div>`;
|
|
70
182
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
+ `</div>${T.none ? `<p class="tlnone">${T.none} ${T.none === 1 ? 'initiative has' : 'initiatives have'} no dates on record and ${T.none === 1 ? 'is' : 'are'} not drawn.</p>` : ''}<p class="note" style="margin-top:10px">Each bar runs from a start date to an end date someone set. The filled part is the time elapsed. The line is today.</p>`;
|
|
183
|
+
/* ── the timeline (B2) ───────────────────────────────────────────────────────────────────────────────────────── */
|
|
184
|
+
function drawTime(L) {
|
|
185
|
+
const T = timelineHtml(L, M, span);
|
|
186
|
+
const none = T.none.length ? `<div class="tg-none"><b>${T.none.length} ${plural(T.none.length, 'has', 'have')} no dates:</b> <span>${esc(T.none.slice(0, 4).map((r) => r.title).join(', '))}${T.none.length > 4 ? ' and ' + (T.none.length - 4) + ' more' : ''}</span><a class="cz-chip" id="askDates" href="${esc(askHref(null, 'Propose start and end dates for ' + T.none.map((r) => r.title).join(', ')))}">${SV('M4 5h16v11h-9l-5 4v-4H4z')}Ask to propose dates</a></div>` : '';
|
|
187
|
+
return T.html + none;
|
|
77
188
|
}
|
|
189
|
+
|
|
190
|
+
const PHONE = matchMedia('(max-width: 720px)');
|
|
191
|
+
PHONE.addEventListener('change', () => { if (M) drawInit(); });
|
|
78
192
|
function drawInit() {
|
|
79
193
|
const I = M.initiatives;
|
|
80
194
|
$('#iniCap').innerHTML = I.cap ? `<b>${I.cap.on} of ${I.cap.open}</b> open on track · ${I.risk} at risk · ${I.late} late${I.hold ? ' · ' + I.hold + ' on hold' : ''}` : 'no open initiatives';
|
|
81
195
|
const bar = $('#iniBar'); bar.hidden = !I.cap; if (I.cap) { bar.setAttribute('aria-valuemax', I.cap.open); bar.setAttribute('aria-valuenow', I.cap.on); $('b', bar).style.width = (I.cap.open ? I.cap.on / I.cap.open * 100 : 0) + '%'; }
|
|
82
|
-
$('#
|
|
196
|
+
$('#nIni').textContent = String(I.open || I.list.rows.length);
|
|
197
|
+
const L = visible();
|
|
198
|
+
const v = (view === 'stages' || view === 'list') && PHONE.matches ? 'track' : view; // the phone offers Track and Timeline only (AgBoardPhone)
|
|
199
|
+
$('#ibBody').dataset.view = v;
|
|
200
|
+
$('#ibBody').innerHTML = v === 'track' ? drawTrack(L) : v === 'list' ? drawList(L) : v === 'stages' ? drawStages() : drawTime(L);
|
|
83
201
|
$('#iniNote').textContent = I.note;
|
|
84
|
-
$$('#ibTabs
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
$('#
|
|
90
|
-
document.addEventListener('click', (e) => { if (!$('#ibTabs').hidden && !e.target.closest('#ibTabs, #ibF')) ibMenu(false); });
|
|
91
|
-
document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && !$('#ibTabs').hidden) { ibMenu(false); $('#ibF').focus(); } });
|
|
92
|
-
$('#ibTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-v]'); if (!b) return; ibMenu(false); view = b.dataset.v; drawInit(); $('#ibF').focus(); });
|
|
202
|
+
$$('#ibTabs [data-v]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.v === v)));
|
|
203
|
+
$('#bdSpans').hidden = v !== 'time';
|
|
204
|
+
$$('#bdSpans [data-sp]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.sp === span)));
|
|
205
|
+
}
|
|
206
|
+
$('#ibTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-v]'); if (!b || !M) return; view = b.dataset.v; store.set(VIEW_KEY, view); shown = 25; drawInit(); });
|
|
207
|
+
$('#bdSpans').addEventListener('click', (e) => { const b = e.target.closest('[data-sp]'); if (!b || !M) return; span = b.dataset.sp; store.set(SPAN_KEY, span); drawInit(); });
|
|
93
208
|
$('#ibBody').addEventListener('click', (e) => {
|
|
94
209
|
if (e.target.closest('#more')) { shown += 25; drawInit(); return; }
|
|
210
|
+
if (e.target.closest('#fClear')) { F.chips.clear(); F.owners.clear(); F.lanes.clear(); F.q = ''; $('#bdQ').value = ''; drawChips(); drawFilter(); drawInit(); return; }
|
|
211
|
+
if (e.target.closest('#stHelp')) { togglePop('popSteps', $('#stHelp')); return; }
|
|
95
212
|
if (e.target.closest('#goneT')) { showGone = !showGone; drawInit(); const g = $('#goneT'); if (g) g.focus(); return; }
|
|
96
213
|
const im = e.target.closest('[data-im]'); if (im) { const r = rowOf(im.dataset.im); if (r) openMenu(im, ctxOf(), r); return; }
|
|
97
|
-
const
|
|
214
|
+
const tk = e.target.closest('[data-tk]'); if (tk) { openTicket(tk.dataset.ini, tk.dataset.tk, tk); return; }
|
|
215
|
+
const th = e.target.closest('[data-tgtheme]'); if (th) { span = 'year'; store.set(SPAN_KEY, span); drawInit(); return; }
|
|
216
|
+
const b = e.target.closest('[data-key]'); if (b) openIni(rowOf(b.dataset.key), b);
|
|
98
217
|
});
|
|
99
|
-
/*
|
|
218
|
+
/* Page / Popup (kept from the earlier Board, in the ⋯ menu): a row opens the initiative panel; the panel's expand icon opens the initiative page
|
|
219
|
+
* (Page) or the record dialog (Popup). The choice is kept in this browser. */
|
|
100
220
|
let openMode = store.get(MODE_KEY) === 'popup' ? 'popup' : 'page';
|
|
101
221
|
function drawMode() { $$('#modeSeg button').forEach((b) => b.setAttribute('aria-pressed', b.dataset.m === openMode)); pillOf($('#modeSeg')); }
|
|
102
|
-
$('#modeSeg').addEventListener('click', (e) => { const b = e.target.closest('[data-m]'); if (!b) return; openMode = b.dataset.m; store.set(MODE_KEY, openMode); drawMode(); toast('
|
|
103
|
-
|
|
222
|
+
$('#modeSeg').addEventListener('click', (e) => { const b = e.target.closest('[data-m]'); if (!b) return; openMode = b.dataset.m; store.set(MODE_KEY, openMode); drawMode(); toast('The panel\'s expand now opens the initiative as a ' + openMode + '.'); });
|
|
223
|
+
const pageHref = (r) => '/premium-initiative.html?id=' + encodeURIComponent(r.id) + (M.board.ws ? '&ws=' + encodeURIComponent(M.board.ws) + '&board=' + encodeURIComponent(M.board.id) : '');
|
|
224
|
+
function expandIni(r) { if (!r) return; if (openMode === 'popup' || !r.id) openRow(r); else location.assign(pageHref(r)); }
|
|
225
|
+
const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || null;
|
|
226
|
+
|
|
227
|
+
/* ── "Ask about this": the Board has no chat; the question goes to Home as a quick ask in that initiative (B3) ───────────────── */
|
|
228
|
+
function askHref(r, q) {
|
|
229
|
+
const p = new URLSearchParams();
|
|
230
|
+
if (r && r.id) p.set('ask', r.id); else p.set('ask', 'board:' + (M.board.id || ''));
|
|
231
|
+
if (q) p.set('q', q);
|
|
232
|
+
if (M.board.ws) p.set('ws', M.board.ws);
|
|
233
|
+
return '/premium.html?' + p.toString();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* ── the initiative panel and the Jira ticket panel (AgBoardPanel, AgBoardTicket; a bottom sheet on a phone) ───────────────── */
|
|
237
|
+
let peekBack = null;
|
|
238
|
+
function ladderHtml(t) {
|
|
239
|
+
const k = t ? t.k : -1;
|
|
240
|
+
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' : ''].filter(Boolean).join(' ')}"><i></i>${esc(s.short)}</span>`).join('')}</div>`;
|
|
241
|
+
}
|
|
242
|
+
function askForm(r, label) {
|
|
243
|
+
const J = M.jira || {};
|
|
244
|
+
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="cz-ib solid" aria-label="Ask in Home" title="Ask in Home">${SV('M5 12h14M13 6l6 6-6 6')}</button></div><div class="ft"><span>Answer lands in Home</span><span class="sp"></span><span>${SV('M12 3l9 9-9 9-9-9z')}Jira ${J.readAt ? esc(ago(J.readAt)) : 'not read'}</span></div></form>`;
|
|
245
|
+
}
|
|
246
|
+
function iniPanel(r) {
|
|
247
|
+
const t = r.track || {}, s = statusOf(r), p = t.prog;
|
|
248
|
+
const eye = [r.lane ? r.lane.charAt(0).toUpperCase() + r.lane.slice(1) : '', r.anchor, r.owner ? 'owner ' + r.owner : 'no owner'].filter(Boolean).join(' · ');
|
|
249
|
+
const tks = (t.tickets || []).slice(0, 12).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)}${k.blocked ? ' · blocked' : ''}</span><span class="r">${esc(k.status)}</span></button>`).join('');
|
|
250
|
+
const more = (t.tickets || []).length > 12 ? `<p class="pk-mut">${t.tickets.length - 12} more tickets</p>` : '';
|
|
251
|
+
const dates = [['PMOS plan', r.start || r.end ? [r.start ? fmt(r.start) : '…', r.end ? fmt(r.end) : '…'].join(' → ') : 'No dates on record'], ['Jira forecast', t.forecastLabel ? t.forecastLabel + ' (the latest sprint with an open ticket)' : 'No open ticket in a dated sprint']];
|
|
252
|
+
return `<div class="pk-h"><div class="pk-ht"><p class="pk-eye">${esc(eye)}</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>${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label || r.stage || 'No stage')}</span>${r.end ? `<span>·</span><span>ends <b>${esc(r.finish)}</b></span>` : ''}</p></div>`
|
|
253
|
+
+ `<div class="pk-tools"><button type="button" class="cz-ib" data-pk="expand" aria-label="${openMode === 'popup' ? 'Open the record' : 'Open the initiative page'}" title="${openMode === 'popup' ? 'Open the record' : 'Open the initiative page'}">${SV('M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7')}</button>${r.acts ? dotsBtn(r).replace('class="inim"', 'class="inim cz-ib"') : ''}<button type="button" class="cz-ib" data-pk="close" aria-label="Close" title="Close">${SV('M6 6l12 12M18 6L6 18')}</button></div></div>`
|
|
254
|
+
+ `<div class="pk-b">${ladderHtml(t)}`
|
|
255
|
+
+ `<div class="pk-box"><div class="t1"><b>${esc(t.output || 'No step on record')}</b><span>${esc(progText(p))}</span></div>${segHtml(r, true)}${tks ? `<div class="pk-tks">${tks}</div>${more}` : `<p class="pk-mut">${p && p.unit === '%' ? 'Progress comes from the initiative record.' : t.key === 'build' || t.key === 'deliver' ? 'No Jira ticket of this initiative has been read yet.' : 'Nothing is counted toward it yet.'}</p>`}</div>`
|
|
256
|
+
+ (t.next && t.next.tone === 'red' ? `<div class="pk-warn red">${SV('M12 4v10M12 18v2')}<span>${esc(t.next.text)}</span></div>` : '')
|
|
257
|
+
+ `<div class="pk-sec"><p class="lbl">Dates</p><div class="pk-kv">${dates.map(([a, b]) => `<span>${esc(a)}</span><b>${esc(b)}</b>`).join('')}</div></div>`
|
|
258
|
+
+ `<div class="pk-sec"><p class="lbl">Linked</p><div class="pk-lk"><button type="button" class="cz-chip" data-pk="record">${SV('M6 3h9l4 4v14H6zM14 3v5h5')}Record</button>${r.id ? `<a class="cz-chip" href="${esc(pageHref(r))}">${SV('M14 4h6v6M20 4l-7 7M10 6H5v13h13v-5')}Initiative page</a>` : ''}${r.id ? `<button type="button" class="cz-chip" data-pk="item">${SV('M4 6h16M4 12h16M4 18h10')}Checks and tasks</button>` : ''}</div></div>`
|
|
259
|
+
+ `</div>${askForm(r, r.title)}`;
|
|
260
|
+
}
|
|
261
|
+
const fmt = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+m[2] - 1] : ''; };
|
|
262
|
+
function tkPanel(r, k) {
|
|
263
|
+
const t = r.track || {}, J = M.jira || {};
|
|
264
|
+
const meta = [k.blocked ? '<span class="cs s-red"><i class="cz-dot red m-crit"></i>Blocked</span>' : '', k.blocked && /block/i.test(k.raw || '') ? '' : esc(k.raw || k.status), k.assignee ? `<span class="pk-av" aria-hidden="true">${esc(k.assignee.charAt(0))}</span>${esc(k.assignee)}` : 'No assignee in the Jira reading', k.points != null ? esc(k.points + ' pts') : '', k.sprint ? esc(k.sprint) : ''].filter(Boolean).join('<span>·</span>');
|
|
265
|
+
return `<div class="pk-h"><div class="pk-ht"><button type="button" class="pk-back" data-pk="back">${SV('M14 6l-6 6 6 6')}${esc(r.title)} · ${esc(t.label || '')}</button><h2 id="pkTitle">${esc(k.key)} · ${esc(k.title)}</h2><p class="pk-st">${meta}</p></div>`
|
|
266
|
+
+ `<div class="pk-tools">${k.url ? `<a class="cz-ib" href="${esc(k.url)}" target="_blank" rel="noopener" aria-label="Open ${esc(k.key)} in Jira" title="Open in Jira">${SV('M14 4h6v6M20 4l-9 9M10 6H5v13h13v-5')}</a>` : ''}<button type="button" class="cz-ib" data-pk="close" aria-label="Close" title="Close">${SV('M6 6l12 12M18 6L6 18')}</button></div></div>`
|
|
267
|
+
+ `<div class="pk-b">${k.blocked ? `<div class="pk-warn red"><span><b>Blocked in Jira.</b> ${esc(k.reason || 'Jira flags it.')}</span></div>` : ''}`
|
|
268
|
+
+ `<div class="pk-sec"><p class="lbl">Counts toward</p><p class="pk-p">${esc(t.output || '')} · ${esc(progText(t.prog))}</p></div>`
|
|
269
|
+
+ `<div class="pk-sec"><p class="lbl">In Jira</p><div class="pk-kv"><span>Status</span><b>${esc(k.raw || k.status)}</b><span>Assignee</span><b>${esc(k.assignee || 'Not in the reading')}</b><span>Sprint</span><b>${esc(k.sprint || 'None')}</b><span>Read</span><b>${esc(J.readAt ? ago(J.readAt) : 'Not read')}</b></div></div>`
|
|
270
|
+
+ '<p class="pk-mut">PMOS owns the ticket text. Status, sprint and assignee change only in Jira.</p></div>'
|
|
271
|
+
+ askForm(r, k.key);
|
|
272
|
+
}
|
|
273
|
+
function showPeek(html, back) {
|
|
274
|
+
const pk = $('#peek'); pk.innerHTML = html; pk.hidden = false; document.body.classList.add('pk-on');
|
|
275
|
+
if (back) peekBack = back;
|
|
276
|
+
$$('#ibBody .bt-l').forEach((x) => x.classList.toggle('sel', !!peek && x.dataset.row === peek.key));
|
|
277
|
+
const h = $('#pkTitle'); if (h) { h.tabIndex = -1; h.focus({ preventScroll: true }); }
|
|
278
|
+
}
|
|
279
|
+
function closePeek() {
|
|
280
|
+
if ($('#peek').hidden) return;
|
|
281
|
+
const key = peek && peek.key;
|
|
282
|
+
$('#peek').hidden = true; document.body.classList.remove('pk-on'); peek = null; closeMenu();
|
|
283
|
+
$$('#ibBody .bt-l.sel').forEach((x) => x.classList.remove('sel'));
|
|
284
|
+
// a read can draw the rows again while the panel is open: then the focus goes to the same row as drawn now
|
|
285
|
+
const back = peekBack && document.contains(peekBack) ? peekBack : key ? $$('#ibBody [data-key]').find((x) => x.dataset.key === key) : null;
|
|
286
|
+
if (back) back.focus(); peekBack = null;
|
|
287
|
+
}
|
|
288
|
+
function openIni(r, from) {
|
|
104
289
|
if (!r) return;
|
|
105
|
-
if (
|
|
106
|
-
|
|
290
|
+
if (!r.track) { openRow(r); return; } // a sprint or release row of the dialog
|
|
291
|
+
peek = { kind: 'ini', key: r.key }; showPeek(iniPanel(r), from);
|
|
107
292
|
}
|
|
108
|
-
|
|
293
|
+
function openTicket(iniKey, key, from) {
|
|
294
|
+
const r = rowOf(iniKey); if (!r || !r.track) return;
|
|
295
|
+
const k = (r.track.tickets || []).find((x) => x.key === key); if (!k) return;
|
|
296
|
+
peek = { kind: 'tk', key: r.key, tk: key }; showPeek(tkPanel(r, k), from);
|
|
297
|
+
}
|
|
298
|
+
$('#peek').addEventListener('click', (e) => {
|
|
299
|
+
const r = peek && rowOf(peek.key);
|
|
300
|
+
const im = e.target.closest('[data-im]'); if (im && r) { openMenu(im, ctxOf(), r); return; }
|
|
301
|
+
const tk = e.target.closest('[data-tk]'); if (tk) { openTicket(tk.dataset.ini, tk.dataset.tk); return; }
|
|
302
|
+
const b = e.target.closest('[data-pk]'); if (!b) return;
|
|
303
|
+
const a = b.dataset.pk;
|
|
304
|
+
if (a === 'close') closePeek();
|
|
305
|
+
else if (a === 'back' && r) { peek = { kind: 'ini', key: r.key }; showPeek(iniPanel(r)); }
|
|
306
|
+
else if (a === 'expand' && r) expandIni(r);
|
|
307
|
+
else if (a === 'record' && r) openRow(r);
|
|
308
|
+
else if (a === 'item' && r) openWorkItem({ kind: 'initiative', id: r.id, title: r.title, ws: M.board.ws, board: M.board.id });
|
|
309
|
+
});
|
|
310
|
+
$('#peek').addEventListener('submit', (e) => {
|
|
311
|
+
const f = e.target.closest('[data-ask]'); if (!f) return;
|
|
312
|
+
e.preventDefault();
|
|
313
|
+
const r = rowOf(f.dataset.ask), q = f.q.value.trim();
|
|
314
|
+
if (!q) { f.q.focus(); return; }
|
|
315
|
+
location.assign(askHref(r, peek && peek.kind === 'tk' ? peek.tk + ': ' + q : q));
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
/* ── Find and Filter ───────────────────────────────────────────────────────────────────────────────────────────── */
|
|
319
|
+
$('#bdFind').addEventListener('click', () => { const row = $('#bdFindRow'), open = row.hidden; row.hidden = !open; $('#bdFind').setAttribute('aria-expanded', String(open)); if (open) $('#bdQ').focus(); else if (F.q) { F.q = ''; $('#bdQ').value = ''; drawInit(); } });
|
|
320
|
+
$('#bdQ').addEventListener('input', () => { F.q = $('#bdQ').value; shown = 25; if (M) drawInit(); });
|
|
321
|
+
$('#bdQ').addEventListener('keydown', (e) => { if (e.key === 'Escape' && $('#bdQ').value) { e.stopPropagation(); $('#bdQ').value = ''; F.q = ''; drawInit(); } });
|
|
322
|
+
function drawFilter() {
|
|
323
|
+
if (!M) return;
|
|
324
|
+
const rows = M.initiatives.list.rows, owners = [...new Set(rows.map((r) => r.owner || ''))].sort(), lanes = [...new Set(rows.map((r) => r.lane || ''))].filter(Boolean).sort();
|
|
325
|
+
const chip = (kind, v, label, on) => `<button type="button" class="cz-chip${on ? ' on' : ''}" data-fk="${kind}" data-fv="${esc(v)}" aria-pressed="${on}">${esc(label)}</button>`;
|
|
326
|
+
$('#popFilter').innerHTML = `<div class="bd-fl"><p class="lbl">Owner</p><div class="pk-lk">${owners.map((o) => chip('o', o, o || 'No owner', F.owners.has(o))).join('')}</div><p class="lbl">Lane</p><div class="pk-lk">${lanes.map((l) => chip('l', l, l.charAt(0).toUpperCase() + l.slice(1), F.lanes.has(l))).join('')}</div>${F.owners.size || F.lanes.size ? '<button type="button" class="dlink" data-fk="clear">Clear owner and lane</button>' : ''}</div>`;
|
|
327
|
+
const d = $('#bdFilter .bd-fdot'); if (d) d.hidden = !(F.owners.size || F.lanes.size);
|
|
328
|
+
}
|
|
329
|
+
$('#bdFilter').addEventListener('click', (e) => { e.stopPropagation(); drawFilter(); togglePop('popFilter', $('#bdFilter')); });
|
|
330
|
+
$('#popFilter').addEventListener('click', (e) => {
|
|
331
|
+
const b = e.target.closest('[data-fk]'); if (!b) return;
|
|
332
|
+
if (b.dataset.fk === 'clear') { F.owners.clear(); F.lanes.clear(); } else { const S = b.dataset.fk === 'o' ? F.owners : F.lanes, v = b.dataset.fv; if (S.has(v)) S.delete(v); else S.add(v); }
|
|
333
|
+
shown = 25; drawFilter(); drawInit();
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
/* ── tabs: Initiatives and Documents ─────────────────────────────────────────────────────────────────────────── */
|
|
337
|
+
function setTab(t) {
|
|
338
|
+
tab = t;
|
|
339
|
+
$('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabDocs').setAttribute('aria-selected', String(t === 'docs'));
|
|
340
|
+
$('#cIni').hidden = t !== 'ini'; $('#cDocs').hidden = t !== 'docs';
|
|
341
|
+
$('.bd-tools .bd-views').classList.toggle('off', t !== 'ini');
|
|
342
|
+
if (t === 'docs' && $('#dmF')) pillOf($('#dmF')); // the filter's pill is placed once the tab shows
|
|
343
|
+
}
|
|
344
|
+
$('#tabIni').onclick = () => setTab('ini');
|
|
345
|
+
$('#tabDocs').onclick = () => setTab('docs');
|
|
346
|
+
$('.cz-tabs').addEventListener('keydown', (e) => { if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') return; const n = tab === 'ini' ? 'docs' : 'ini'; setTab(n); $(n === 'ini' ? '#tabIni' : '#tabDocs').focus(); });
|
|
109
347
|
|
|
110
348
|
/* ── sprint, release, documents ─────────────────────────────────────────────────────────────────────────── */
|
|
111
349
|
function drawSide() {
|
|
@@ -123,11 +361,11 @@ function drawSide() {
|
|
|
123
361
|
? `${R.at ? '' : `<p class="empty3 plain">${esc(R.why)}</p>`}<div class="rels">${R.rel.map((r) => `<button type="button" class="rel" data-open="board:release" aria-haspopup="dialog"><span class="rh"><b>${esc(r.name)}</b><em class="rtag">${esc(r.tag)}</em><time>${esc(r.at)}${r.away ? ' · ' + esc(r.away) : ''}</time></span>${r.ini.map((i) => `<span class="ri"><i class="hd ${i.tone}"></i>${esc(i.title)}${i.status ? ' · ' + esc(i.status) : ''}</span>`).join('')}</button>`).join('')}</div>`
|
|
124
362
|
: `<p class="empty3 plain">${esc(R.why)}</p>`;
|
|
125
363
|
}
|
|
126
|
-
$('#cSpr').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) openRow(rowOf(b.dataset.open)); });
|
|
364
|
+
$('#cSpr').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) { closePops(); openRow(rowOf(b.dataset.open)); } });
|
|
127
365
|
$('#cSpr').addEventListener('click', (e) => { if (e.target.closest('[data-open="board:sprint"]')) backlogBtn(); }); // after openRow: the sprint dialog's own detail gets "Open the backlog" (premium-viewer R10)
|
|
128
|
-
$('#cRel').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) openRow(rowOf(b.dataset.open)); });
|
|
366
|
+
$('#cRel').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) { closePops(); openRow(rowOf(b.dataset.open)); } });
|
|
129
367
|
function docRow(d) {
|
|
130
|
-
const act = !d.act ? '' : d.act.kind === 'draft' ? `<button class="dmcta alt" data-draft="${esc(d.key)}"${d.running ? ' disabled' : ''}>${d.running ? '<span class="
|
|
368
|
+
const act = !d.act ? '' : d.act.kind === 'draft' ? `<button class="dmcta alt" data-draft="${esc(d.key)}"${d.running ? ' disabled' : ''}>${d.running ? '<span class="cz-dot m-info" aria-hidden="true"></span>' : ICO('<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>')}${esc(d.act.label)}</button>` : `<button class="dmcta alt" data-tab="${esc(d.act.tab)}">${esc(d.act.label)}</button>`;
|
|
131
369
|
return `<div class="dmr ${esc(d.st || '')}" role="listitem">${d.path ? `<button class="dmo" data-doc="${esc(d.key)}" aria-haspopup="dialog">` : '<span class="dmo">'}<span class="dmi c-Board">${ICO(DOCI)}</span><span class="dmn"><b>${esc(d.title)}</b><small>${esc(d.what)}</small><span class="dmm"><span class="s ${esc(d.st || 'live')}">${ICO(STATE_ICO[d.state] || STATE_ICO['Not started'])}${esc(d.state)}</span>${d.added ? `<span>${ICO('<rect x="3" y="5" width="18" height="16" rx="3"/><path d="M3 10h18M8 3v4M16 3v4"/>')}added ${esc(d.added)}</span>` : ''}${d.cadence ? `<span>${ICO('<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>')}${esc(d.cadence)}</span>` : ''}${d.by ? `<span>${ICO('<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>')}${esc(d.by)}</span>` : ''}</span></span>${d.path ? '</button>' : '</span>'}<span class="dmq">${act}</span></div>`;
|
|
132
370
|
}
|
|
133
371
|
let docFilter = 'all', docQuery = '';
|
|
@@ -162,14 +400,12 @@ $('#docTop').addEventListener('click', async (e) => {
|
|
|
162
400
|
await load();
|
|
163
401
|
});
|
|
164
402
|
$('#docTop').addEventListener('input', (e) => { if (e.target.id === 'dmQ') { docQuery = e.target.value; drawDocList(); } });
|
|
165
|
-
/* A document's Open stays on the premium pages (premium-rows-stay-premium): the board's own
|
|
166
|
-
const wsQ = (k) => (M.board.ws ? k + 'ws=' + encodeURIComponent(M.board.ws) : '');
|
|
167
|
-
const toCard = (id) => { const c = $(id); if (!c) return false; c.scrollIntoView({ behavior: 'smooth', block: 'start' }); const f = c.querySelector('button, a'); if (f) f.focus({ preventScroll: true }); return true; };
|
|
403
|
+
/* A document's Open stays on the premium pages (premium-rows-stay-premium): the board's own views, the release dialog, Insights for a report, Home's Horizon scan. */
|
|
168
404
|
const GOTAB = {
|
|
169
405
|
rep: () => location.assign('/premium-insights.html' + wsQ('?')),
|
|
170
|
-
init: () =>
|
|
171
|
-
asks: () =>
|
|
172
|
-
rel: () => { const r = rowOf('board:release'); if (r) openRow(r); else
|
|
406
|
+
init: () => { setTab('ini'); const f = $('#ibBody button'); if (f) f.focus(); },
|
|
407
|
+
asks: () => { setTab('ini'); togglePop('popAsks', $('#chAsks')); },
|
|
408
|
+
rel: () => { const r = rowOf('board:release'); if (r) openRow(r); else togglePop('popSpr', $('#chSprint')); },
|
|
173
409
|
scan: () => location.assign('/premium.html?around=scan' + wsQ('&')),
|
|
174
410
|
};
|
|
175
411
|
$('#docBody').addEventListener('click', async (e) => {
|
|
@@ -183,7 +419,6 @@ $('#docBody').addEventListener('click', async (e) => {
|
|
|
183
419
|
toast('The agent is drafting “' + (d ? d.title : key) + '”. It runs in the background and sends nothing.');
|
|
184
420
|
await load();
|
|
185
421
|
});
|
|
186
|
-
|
|
187
422
|
$('#addDoc').onclick = () => openAddDoc({ ws: M.board.ws, scope: M.docs.scope, sub: M.board.name, onAdded: load });
|
|
188
423
|
|
|
189
424
|
/* ── new asks and New initiative (initiative premium-board-actions) ───────────────────────────────────────── */
|
|
@@ -191,13 +426,36 @@ function drawAsks() {
|
|
|
191
426
|
$('#asksHost').innerHTML = asksHtml(ctxOf(), M.asks);
|
|
192
427
|
$('#newIni').hidden = !!M.board.self || !M.board.id;
|
|
193
428
|
}
|
|
194
|
-
$('#asksHost').addEventListener('click', (e) => { if (M) onAsks(e, ctxOf(), M.asks); });
|
|
195
|
-
$('#newIni').onclick = () => { closeMenu(); openIniForm(ctxOf(), null); };
|
|
429
|
+
$('#asksHost').addEventListener('click', (e) => { if (!M) return; if (e.target.closest('[data-ask]')) closePops(); onAsks(e, ctxOf(), M.asks); });
|
|
430
|
+
$('#newIni').onclick = () => { closeMenu(); closePops(); openIniForm(ctxOf(), null); };
|
|
431
|
+
|
|
432
|
+
/* ── the ⋯ menu's Board items: what finishes each step, the sprint and release, the metrics, the cancelled and archived ─────────── */
|
|
433
|
+
{
|
|
434
|
+
const at = $('#settingsBtn');
|
|
435
|
+
if (at) at.insertAdjacentHTML('beforebegin', '<button role="menuitem" id="miSteps" aria-haspopup="dialog">What finishes each step</button><button role="menuitem" id="miSpr" aria-haspopup="dialog">Sprint and release</button><button role="menuitem" id="miMet" aria-haspopup="dialog">Metrics</button><button role="menuitem" id="miGone">Cancelled and archived</button><button role="menuitem" id="theme2m">Switch light or dark</button>');
|
|
436
|
+
const on = (id, fn) => { const b = $(id); if (b) b.addEventListener('click', (e) => { e.stopPropagation(); fn(); }); };
|
|
437
|
+
on('#miSteps', () => togglePop('popSteps', $('#moreBtn'), true));
|
|
438
|
+
on('#miSpr', () => togglePop('popSpr', $('#chSprint')));
|
|
439
|
+
on('#miMet', () => togglePop('popMet', $('#moreBtn'), true));
|
|
440
|
+
on('#miGone', () => { setTab('ini'); if (view === 'stages' || view === 'time') view = 'track'; showGone = true; drawInit(); const g = $('#goneT'); if (g) g.focus(); else toast('No initiative of this board is cancelled or archived.'); });
|
|
441
|
+
on('#theme2m', () => $('#theme2').click());
|
|
442
|
+
// the shell's bell sits before New initiative, as the design orders the tools
|
|
443
|
+
const bell = $('#pvBell'); if (bell) $('#newIni').before(bell);
|
|
444
|
+
}
|
|
445
|
+
$('#popSteps').innerHTML = stepsHelpHtml();
|
|
446
|
+
// the Escape that closes the record dialog must not also close the panel under it: the dialog can close before this listener runs, so a close later than the key press means this press closed it
|
|
447
|
+
let dlgShut = 0, dlgOn = false;
|
|
448
|
+
new MutationObserver(() => { const on = $('#dlg').classList.contains('on'); if (dlgOn && !on) dlgShut = performance.now(); dlgOn = on; }).observe($('#dlg'), { attributes: true, attributeFilter: ['class'] });
|
|
449
|
+
window.addEventListener('keydown', (e) => {
|
|
450
|
+
if (e.key !== 'Escape' || $('#dlg').classList.contains('on') || dlgShut >= e.timeStamp || document.querySelector('.bam2') || (e.target.id === 'bdQ' && e.target.value)) return;
|
|
451
|
+
if ($$('.bd-pop').some((p) => !p.hidden)) { closePops(true); return; }
|
|
452
|
+
if (!$('#peek').hidden) closePeek();
|
|
453
|
+
}, true);
|
|
196
454
|
|
|
197
|
-
/* ── dock
|
|
198
|
-
function drawDock() { $('#dN').textContent = M.dock.needs; $('#dLab').textContent = M.dock.label; $('#dNext').innerHTML = (M.dock.next ?
|
|
455
|
+
/* ── dock (hidden in the Agreed design; its counts stay for the read-only agent) ───────────────────────────────────── */
|
|
456
|
+
function drawDock() { $('#dN').textContent = M.dock.needs; $('#dLab').textContent = M.dock.label; $('#dNext').innerHTML = (M.dock.next ? `First <b>${esc(M.dock.next)}</b>` : 'Nothing is late or at risk') + (M.dock.release ? ` · Next release <b>${esc(M.dock.release.at)}</b> ${esc(M.dock.release.name)}` : ''); }
|
|
199
457
|
|
|
200
|
-
/* ── the dialog: the initiative's record, no press, the read-only agent beside it ──────────────────────────── */
|
|
458
|
+
/* ── the record dialog: the initiative's record, no press, the read-only agent beside it ──────────────────────────── */
|
|
201
459
|
function cardHtml(r) { return `<div class="acard" id="card"><p class="ct">What this page can do</p><p class="nodef" id="holdWhy">${esc(r.dialog.hold)}</p></div>`; }
|
|
202
460
|
function paneHtml(r) {
|
|
203
461
|
const p = r.dialog.pane;
|
|
@@ -206,7 +464,7 @@ function paneHtml(r) {
|
|
|
206
464
|
function openRow(r) {
|
|
207
465
|
if (!r) return;
|
|
208
466
|
const d = r.dialog;
|
|
209
|
-
openDlg({ eye: d.eye + ' · real data', title: r.title, sub: r.sub + (r.statusLabel ? ' · ' + r.statusLabel : ''), say: d.say, stream: turnA(logHtml(d)) + turnA(ptx(d.say)) + cardHtml(r), noteKey: r.key, pane: paneHtml(r), label: d.pane.label });
|
|
467
|
+
openDlg({ eye: d.eye + ' · real data', title: r.title, sub: r.sub + (r.statusLabel ? ' · ' + r.statusLabel : ''), say: d.say, stream: turnA(logHtml(d)) + turnA(ptx(d.say)) + cardHtml(r), noteKey: r.key, pane: paneHtml(r), label: d.pane.label });
|
|
210
468
|
const vb = $('#oMain [data-vwopen]'); if (vb) vb.onclick = () => openWorkItem({ kind: 'initiative', id: r.id, title: r.title, ws: M.board.ws, board: M.board.id }); // its record, checks, tasks and links as a viewer tab (premium-viewer S7)
|
|
211
469
|
loadThread(r.key);
|
|
212
470
|
if (r.key === 'board:sprint') openSprint({ ws: M.board.ws, board: M.board.id, name: r.title }); // the sprint as a board by status, beside its facts (premium-viewer S5)
|
|
@@ -225,9 +483,11 @@ $('#dBody').addEventListener('click', (e) => { const lt = e.target.closest('#log
|
|
|
225
483
|
/* ── load: the routes derive the initiatives in the background, so the first answers are "reading" ───────────── */
|
|
226
484
|
function draw() {
|
|
227
485
|
const mk = menuKey(); closeMenu();
|
|
228
|
-
drawMode(); drawHead(); drawInit(); drawAsks(); drawSide(); drawDocs(); drawDock();
|
|
486
|
+
drawMode(); drawHead(); drawChips(); drawInit(); drawAsks(); drawSide(); drawDocs(); drawDock();
|
|
229
487
|
// a read that lands while a row's menu is open draws the row again: open its menu again, with what the row holds now
|
|
230
488
|
if (mk) { const b = $$('#ibBody [data-im]').find((x) => x.dataset.im === mk), r = rowOf(mk); if (b && r) openMenu(b, ctxOf(), r); }
|
|
489
|
+
// an open panel follows the new read, but not under an open dialog: its close gives the focus back to the panel's own button
|
|
490
|
+
if (peek && !$('#peek').contains(document.activeElement) && !$('#dlg').classList.contains('on')) { const r = rowOf(peek.key); if (!r) closePeek(); else if (peek.kind === 'ini') showPeek(iniPanel(r)); }
|
|
231
491
|
}
|
|
232
492
|
async function load() {
|
|
233
493
|
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('&');
|
|
@@ -235,7 +495,7 @@ async function load() {
|
|
|
235
495
|
try { const res = await fetch('/api/board-premium' + (q ? '?' + q : ''), { credentials: 'same-origin' }); status = res.status; r = await res.json(); } catch { r = null; }
|
|
236
496
|
clearInterval(readTimer);
|
|
237
497
|
if (r && r.state === 'reading') {
|
|
238
|
-
const t0 = Date.now(), tick = () => { $('#snap').textContent = 'Reading the board · ' + Math.round((Date.now() - t0) / 1000) + ' s so far'; };
|
|
498
|
+
const t0 = Date.now(), tick = () => { $('#snap').textContent = 'Reading the board · ' + Math.round((Date.now() - t0) / 1000) + ' s so far'; if (!M) $('#brief').textContent = $('#snap').textContent; };
|
|
239
499
|
tick(); readTimer = setInterval(tick, 1000);
|
|
240
500
|
if (!M) { $('#ibBody').innerHTML = '<p class="empty3 plain">The board derives each initiative from its records. This page shows nothing until it has read, rather than guess.</p>'; $('#docBody').innerHTML = ''; }
|
|
241
501
|
setTimeout(load, 3000);
|
|
@@ -249,16 +509,17 @@ async function load() {
|
|
|
249
509
|
}
|
|
250
510
|
$('#brief').textContent = '';
|
|
251
511
|
const first = !M; M = r.model; draw();
|
|
252
|
-
if (first && M.board.ws) startMetrics(M.board.ws); // the Metrics
|
|
253
|
-
if (M.docs.rows.some((d) => d.running) || r.stale) setTimeout(load, r.stale ? 2000 : 5000); // a core-document run is going, or a press is still being derived: ask again
|
|
512
|
+
if (first && M.board.ws) startMetrics(M.board.ws); // the Metrics of a tenant's board read apart from the board
|
|
513
|
+
if (M.docs.rows.some((d) => d.running) || r.stale) setTimeout(load, r.stale ? 2000 : 5000); // a core-document run is going, or a press is still being derived: ask again
|
|
254
514
|
}
|
|
255
515
|
$('#brief').textContent = 'Reading the board.';
|
|
516
|
+
setTab('ini');
|
|
256
517
|
load();
|
|
257
518
|
|
|
258
|
-
/* ── the Metrics
|
|
519
|
+
/* ── the Metrics of a tenant's board (initiative briefing-premium-metrics), in the ⋯ menu's Metrics popover ──────────────────
|
|
259
520
|
* Reads GET /api/board-metrics-premium?ws= apart from the board's own answer and draws lib/board-metrics-premium.js's tiles: a number and a chart only
|
|
260
521
|
* where a record counted one, "Not read" where it could not be. A tile opens the standard dialog. Nothing here writes. */
|
|
261
|
-
let MM = null, metTimer = null; // the Metrics
|
|
522
|
+
let MM = null, metTimer = null; // the Metrics' model and its re-read timer
|
|
262
523
|
|
|
263
524
|
function metDraw() {
|
|
264
525
|
const card = $('#cMet'); if (!MM) { card.hidden = true; return; }
|
|
@@ -269,12 +530,13 @@ function metDraw() {
|
|
|
269
530
|
$('#metBody').style.gridTemplateColumns = 'repeat(' + Math.min(4, MM.tiles.length) + ',minmax(0,1fr))';
|
|
270
531
|
$('#metBody').innerHTML = MM.tiles.map(MT.tileHtml).join('');
|
|
271
532
|
$('#metNote').textContent = MM.note;
|
|
272
|
-
$('#metLead').hidden = !MM.lead; $('#metLead').textContent = MM.lead || '';
|
|
533
|
+
$('#metLead').hidden = !MM.lead; $('#metLead').textContent = MM.lead || '';
|
|
273
534
|
pillOf($('#perTabs'));
|
|
274
535
|
}
|
|
275
536
|
|
|
276
537
|
function metOpenTile(i) {
|
|
277
538
|
const t = MM.tiles[i], r = MM.rows[i]; if (!t || !r) return;
|
|
539
|
+
closePops();
|
|
278
540
|
const d = r.dialog;
|
|
279
541
|
const rows = MT.factRows(t, MM.repo, MM.weeks);
|
|
280
542
|
const vals = t.ser ? H('Values') + `<div class="vtb">${t.ser.map((v, j) => `<div><span>${esc(t.wk[j])}</span><b>${v == null ? (t.since ? 'Not kept yet' : 'No runs') : esc(MT.fmt(t, v))}</b></div>`).join('')}</div>` : '';
|