create-pmos 0.402.0 → 0.404.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/AGENTS.md +2 -0
- package/payload/KIT-VERSION +1 -1
- package/payload/mods/pmos-cockpit/hooks/lib/session-facts.mjs +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-programs-test.js +32 -5
- package/workspace/briefing-premium-adddoc-test.js +28 -22
- package/workspace/briefing-premium-board-test.js +91 -73
- 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 +19 -17
- 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-test.js +4 -3
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/premium-viewer-fixtures.js +24 -2
- package/workspace/guide/jira.md +38 -6
- package/workspace/guide/programs.md +2 -0
- package/workspace/home-rows-test.js +184 -0
- package/workspace/lib/briefing-premium-agent.js +3 -0
- 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/program-chat.js +32 -0
- package/workspace/lib/routes-brief-page.js +8 -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/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +30 -24
- 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 +46 -23
- 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 +64 -55
- package/workspace/public/pm/bd-acts.js +1 -1
- package/workspace/public/pm/bd-asks.js +22 -7
- package/workspace/public/pm/bd-ini-panel.js +232 -0
- package/workspace/public/pm/bd-pop.js +2 -2
- package/workspace/public/pm/bd-prog-panel.js +176 -191
- package/workspace/public/pm/cozy-board.css +5 -28
- 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 +9 -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 +11 -34
- 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-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/goal-chat.js +1 -1
- package/workspace/public/pm/home-app.js +122 -58
- package/workspace/public/pm/home-chat.js +11 -2
- 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 +6 -14
- 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 +3 -3
- package/workspace/public/pm/premium-board.js +83 -235
- 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/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 +0 -1
- package/workspace/server.js +4 -2
- package/workspace/skills/jira-push.skill +3 -3
- package/workspace/test-lists/prd-to-jira.json +6 -0
- package/workspace/test-lists/program-chat.json +6 -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,6 +17,7 @@
|
|
|
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
22
|
import { timelineHtml, legendHtml, SPANS, GROUPS, md } from './bd-span.js';
|
|
22
23
|
import * as Acts from './bd-acts.js';
|
|
@@ -25,7 +26,10 @@ import * as Asks from './bd-asks.js';
|
|
|
25
26
|
import * as PG from './bd-prog.js';
|
|
26
27
|
import { programOf } from './program-model.js';
|
|
27
28
|
import { open as viewerOpen } from './cozy-viewer.js';
|
|
29
|
+
import * as VW from './cozy-viewer.js';
|
|
28
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';
|
|
29
33
|
|
|
30
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';
|
|
31
35
|
let M = null; // the model
|
|
@@ -45,8 +49,9 @@ let XR = {}; // the other products' rows a program here hol
|
|
|
45
49
|
const ALL = new URLSearchParams(location.search).get('all') === '1'; // All products: every product's board on one page (PgBoard)
|
|
46
50
|
let byProduct = store.get(GROUPING_KEY) === 'product'; // the grouping: programs first (default) or By product (PgBoardProduct)
|
|
47
51
|
let DM = {}; // the documents' history (GET /api/board-docs): { [path]: { changed, by, log } }
|
|
48
|
-
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
|
|
49
53
|
mountNav('board');
|
|
54
|
+
mountRecPill();
|
|
50
55
|
// a product head's goal dots (PgBoard .gd) count that product's open initiatives, the way Home's product header does
|
|
51
56
|
PG.goalsFrom((name) => (M ? M.initiatives.list.rows.filter((r) => !M.board.all || r.product === name) : null));
|
|
52
57
|
const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
@@ -69,10 +74,45 @@ const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || goneRow
|
|
|
69
74
|
const groups = (L) => PG.groupsOf(PGS, L, M, byProduct);
|
|
70
75
|
const progState = (p) => PG.stateOf(p, M, XR);
|
|
71
76
|
|
|
72
|
-
/** A panel of pm/bd-acts.js or pm/bd-asks.js
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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();
|
|
76
116
|
}
|
|
77
117
|
|
|
78
118
|
/* ── the toast: the Agreed design's dark pill ─────────────────────────────────────────────────────────────────────────────── */
|
|
@@ -351,7 +391,7 @@ $('#bdGrpw').addEventListener('click', (e) => {
|
|
|
351
391
|
});
|
|
352
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'); } } });
|
|
353
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(); } } });
|
|
354
|
-
function setView(v) { if (PHONE.matches) { pview = v; store.set(PVIEW_KEY, v); } else { view = v; store.set(VIEW_KEY, view); }
|
|
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(); }
|
|
355
395
|
$('#ibTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-v]'); if (!b || !M) return; setTab('ini'); setView(b.dataset.v); });
|
|
356
396
|
$('#bdView').addEventListener('click', () => { if (M) setView(PHONE.matches ? (pview === 'list' ? 'stages' : pview === 'stages' ? 'track' : 'list') : view === 'time' ? 'track' : 'time'); });
|
|
357
397
|
$('#bdShowing').addEventListener('click', (e) => {
|
|
@@ -414,199 +454,20 @@ function askHref(r, q) {
|
|
|
414
454
|
}
|
|
415
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) : ''); };
|
|
416
456
|
|
|
417
|
-
/* ── the
|
|
418
|
-
|
|
419
|
-
function ladderHtml(t) {
|
|
420
|
-
const k = t ? t.k : -1, sk = new Set((t && t.skipped) || []);
|
|
421
|
-
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(PHONE.matches ? s.short : s.label)}</span>`).join('')}</div>`; // 60 % wide on desktop (XnAgBoardPanel): the steps' full names
|
|
422
|
-
}
|
|
423
|
-
function askForm(r, label, o = {}) {
|
|
424
|
-
const J = M.jira || {};
|
|
425
|
-
const ft = o.inside ? `<span>The answer lands in Home, inside ${esc(r.title)}.</span>`
|
|
426
|
-
: `<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>`;
|
|
427
|
-
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>`;
|
|
428
|
-
}
|
|
429
|
-
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);
|
|
430
|
-
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');
|
|
431
|
-
/** The output box: the open tickets (blocked first) with their state and assignee, the done ones folded into one line, and Deliver's two
|
|
432
|
-
* parts that are not tickets; for the other steps, the parts of the output, each counted only where a record holds it. */
|
|
433
|
-
function outRows(r) {
|
|
434
|
-
const t = r.track || {};
|
|
435
|
-
if (t.tickets && t.tickets.length && (t.key === 'build' || t.key === 'deliver')) {
|
|
436
|
-
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');
|
|
437
|
-
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>`);
|
|
438
|
-
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>`);
|
|
439
|
-
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>`);
|
|
440
|
-
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>`);
|
|
441
|
-
return rows.join('');
|
|
442
|
-
}
|
|
443
|
-
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>';
|
|
444
|
-
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('');
|
|
445
|
-
}
|
|
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. ── */
|
|
446
459
|
const TI = (r) => (r && r.trail) || null;
|
|
447
|
-
/** The skipped steps, each with its reason: the lane's own ladder or the board move's why (lib/board-trail.js). */
|
|
448
|
-
function skipHtml(t) {
|
|
449
|
-
const sk = (t.skipped || []).map((j) => M.steps[j]).filter(Boolean);
|
|
450
|
-
if (!sk.length) return '';
|
|
451
|
-
const why = sk.map((s) => { const w = (t.skipWhy || []).find((x) => x.stage === s.key); return w && w.why ? s.label + ' skipped. ' + w.why : null; });
|
|
452
|
-
if (why.every(Boolean)) return `<p class="pk-skip">${esc(why.join(' '))}</p>`;
|
|
453
|
-
return `<p class="pk-skip">${esc(sk.map((s) => s.label).join(', '))} skipped: it was moved past ${sk.length === 1 ? 'that step' : 'those steps'}. No reason is on record.</p>`;
|
|
454
|
-
}
|
|
455
|
-
/** What waits on you: the release sign-off (the model), else the trail's next action (the Commit of drafted tickets, a PRD change, the verdict). */
|
|
456
|
-
function nextHtml(r) {
|
|
457
|
-
const t = r.track || {};
|
|
458
|
-
if (t.you && t.youKind) {
|
|
459
|
-
const go = t.youKind === 'drift' && TI(r) && TI(r).links.prd ? `<button type="button" class="bd-ib solid" data-doc="${esc(TI(r).links.prd)}" aria-label="Open the PRD" title="Open the PRD">${SV(I.next)}</button>`
|
|
460
|
-
: r.id ? `<a class="bd-ib solid" href="${esc(pageHref(r))}" aria-label="${esc(t.you)}: open the initiative page" title="Open the initiative page">${SV(I.next)}</a>` : '';
|
|
461
|
-
return `<div class="pk-nb"><div class="t"><b>${esc(t.you)}</b><div>${esc(t.youWhy || '')}</div></div>${go}</div>`;
|
|
462
|
-
}
|
|
463
|
-
if (t.you) return `<div class="pk-nb"><div class="t"><b>Sign off ${esc(r.release ? r.release.name : t.output)}</b><div>Every release ticket is done. Release notes are not on record in PMOS.</div></div>${r.id ? `<a class="bd-ib solid" href="${esc(pageHref(r))}" aria-label="Review the release" title="Review the release">${SV(I.next)}</a>` : ''}</div>`;
|
|
464
|
-
return ''; // nothing waits on you: AgBoardPanel draws the card only when something does
|
|
465
|
-
}
|
|
466
|
-
/** Tickets drafted in PMOS and not yet in Jira: they go to Jira only through your Commit. */
|
|
467
|
-
function draftedHtml(r) {
|
|
468
|
-
const it = TI(r); if (!it) return '';
|
|
469
|
-
const d = (it.drafted || []).filter((x) => !x.key); if (!d.length) return '';
|
|
470
|
-
const g = it.gate || {};
|
|
471
|
-
return `<div class="pk-sec"><p class="lbl">Drafted in PMOS · ${d.length}</p><div class="pk-tks">${d.slice(0, 8).map((x) => `<p class="gi gm"><i class="k${x.waiting ? ' yo' : ''}"></i><span class="n">${x.id ? `<em>${esc(x.id)}</em>` : ''}${esc(x.summary || '')}</span><span class="r">not in Jira</span></p>`).join('')}${d.length > 8 ? `<p class="gi gm"><i class="k"></i><span class="n">${d.length - 8} more drafted</span></p>` : ''}</div><p class="pk-mut">They go to Jira only through your Commit${g.open === false && g.why ? '. The Commit is closed: ' + esc(g.why) : ''}.</p></div>`;
|
|
472
|
-
}
|
|
473
|
-
/** The PRD against what was pushed: tickets whose text came from a PRD that changed after the push. AgBoardPanel and AgBoardTicket draw only the
|
|
474
|
-
* amber card, so nothing shows when Jira and the PRD agree (or nothing is pushed yet). Its button puts a question about the change in the ask box. */
|
|
475
|
-
function driftHtml(r, one) {
|
|
476
|
-
const it = TI(r);
|
|
477
|
-
const keys = ((it && it.drift) || []).filter((k) => !one || k === one);
|
|
478
|
-
if (!keys.length) return '';
|
|
479
|
-
const q = 'What changed in the PRD after ' + keys.join(', ') + ' ' + (keys.length === 1 ? 'was' : 'were') + ' pushed?';
|
|
480
|
-
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>`;
|
|
481
|
-
return one
|
|
482
|
-
? `<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>`
|
|
483
|
-
: `<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>`;
|
|
484
|
-
}
|
|
485
|
-
const DEP_ST = (d) => (!d.known ? 'not on this repository' : d.done ? 'done' : d.stage || 'open');
|
|
486
|
-
function linkedHtml(r) {
|
|
487
|
-
const it = TI(r), L = (it && it.links) || {}, epic = L.epic || (r.epics || [])[0];
|
|
488
|
-
// AgBoardPanel: PRD v3 · Rubric · Release notes · Blocks <initiative> · Epic <key>. A chip shows only where something is linked.
|
|
489
|
-
const doc = (label, path) => (path ? `<button type="button" class="bd-chip" data-doc="${esc(path)}" title="${esc(path)}">${SV(I.doc)}${esc(label)}</button>` : '');
|
|
490
|
-
const D = (it && it.deps) || [];
|
|
491
|
-
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)
|
|
492
|
-
+ 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('')
|
|
493
|
-
+ (epic ? `<span class="bd-chip">${SV(I.jira)}${esc('Epic ' + epic)}</span>` : '');
|
|
494
|
-
return chips ? `<div class="pk-sec"><p class="lbl">Linked</p><div class="pk-lk">${chips}</div></div>` : '';
|
|
495
|
-
}
|
|
496
|
-
/** Dates (BdPanel): when the step started (days in the step, from the trail), the planned end (yours) and the end Jira's pace expects. */
|
|
497
|
-
function datesHtml(r) {
|
|
498
|
-
const t = r.track || {};
|
|
499
|
-
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;
|
|
500
|
-
if (!st && !end && !exp) return '';
|
|
501
|
-
const late = !!(r.end && t.forecast && t.forecast.slice(0, 10) > r.end.slice(0, 10));
|
|
502
|
-
const box = (label, v, cls) => `<div class="bd-box${cls ? ' ' + cls : ''}"><span class="bd-amut">${esc(label)}</span><b>${esc(v || '—')}</b></div>`;
|
|
503
|
-
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>`;
|
|
504
|
-
}
|
|
505
|
-
/** In Jira (BdPanel): the step's tickets as a table, each opening its ticket panel. */
|
|
506
|
-
function jiraHtml(r) {
|
|
507
|
-
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))];
|
|
508
|
-
const st = (k) => (k.blocked ? 'Blocked' : k.status === 'In progress' ? 'Doing' : k.status) + (k.age != null && k.status !== 'Done' ? ' · ' + k.age + 'd' : '');
|
|
509
|
-
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('');
|
|
510
|
-
// Deliver's two parts that are not tickets: the release notes and your sign-off
|
|
511
|
-
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>` : '';
|
|
512
|
-
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>`;
|
|
513
|
-
}
|
|
514
|
-
/** 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. */
|
|
515
|
-
function progHtml(r) {
|
|
516
|
-
const p = (r.track || {}).prog; if (!p || !p.total) return '';
|
|
517
|
-
const pct = Math.round((p.done / p.total) * 100), count = p.unit === 'tickets';
|
|
518
|
-
const what = p.unit === 'pts' ? p.done + ' of ' + p.total + ' points' : count ? p.done + ' of ' + p.total + ' work-items done' : p.done + '% on record';
|
|
519
|
-
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>`;
|
|
520
|
-
}
|
|
521
|
-
/** The first questions before the BRD (BdGrill), while some are open: the count and a button that opens them. */
|
|
522
|
-
function grillHtml(r) {
|
|
523
|
-
const g = r.id && GR[r.id]; if (!g || !g.open) return '';
|
|
524
|
-
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>`;
|
|
525
|
-
}
|
|
526
|
-
function iniPanel(r) {
|
|
527
|
-
const t = r.track || {}, s0 = statusOf(r);
|
|
528
|
-
const s = r.release && /^Ships /.test(s0.text) ? { ...s0, text: 'On track' } : s0; // the line already says when it ships
|
|
529
|
-
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>` : '';
|
|
530
|
-
// the status line is one line, as AgBoardPanel draws it; "usually N days" stays in the step's tooltip
|
|
531
|
-
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>`
|
|
532
|
-
+ `<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>`
|
|
533
|
-
+ `<div class="pk-b">${ladderHtml(t)}${skipHtml(t)}`
|
|
534
|
-
+ nextHtml(r)
|
|
535
|
-
+ grillHtml(r)
|
|
536
|
-
+ ((t.key === 'build' || t.key === 'deliver') && (t.tickets || []).length ? jiraHtml(r)
|
|
537
|
-
: `<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>`)
|
|
538
|
-
+ datesHtml(r) + progHtml(r)
|
|
539
|
-
+ draftedHtml(r) + driftHtml(r) + linkedHtml(r) // the dependencies are Linked chips, as AgBoardPanel draws them
|
|
540
|
-
+ `</div>${askForm(r, r.title)}`;
|
|
541
|
-
}
|
|
542
|
-
function timePanel(r) {
|
|
543
|
-
const t = r.track || {}, k = t.k, epic = (r.epics || [])[0];
|
|
544
|
-
const eye = eyeOf(r, true).concat(epic ? ['epic ' + epic] : ['no Jira epic yet']);
|
|
545
|
-
const lad = `<div class="pk-seg" aria-hidden="true">${M.steps.map((_, j) => `<i class="${j < k ? 'p' : j === k ? 'c' : ''}"></i>`).join('')}</div>`;
|
|
546
|
-
const need = t.you
|
|
547
|
-
? `<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>`
|
|
548
|
-
: ''; // AgBoardTimelinePanel draws the card only when something waits on you
|
|
549
|
-
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('');
|
|
550
|
-
// AgBoardTimelinePanel: change the plan dates, move, hold, archive. Dates go through Home (no route writes plan dates from the Board).
|
|
551
|
-
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>`
|
|
552
|
-
+ [['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('');
|
|
553
|
-
const D = (TI(r) && TI(r).deps) || [], open = D.filter((d) => d.known && !d.done);
|
|
554
|
-
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>`
|
|
555
|
-
: ''; // no card when nothing is on record
|
|
556
|
-
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>`
|
|
557
|
-
+ `<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}`
|
|
558
|
-
+ `<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>`
|
|
559
|
-
+ dep
|
|
560
|
-
+ `<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>`
|
|
561
|
-
+ `<div class="pk-sec"><p class="lbl">Initiative</p><div class="pk-acts">${acts}</div></div></div>${askForm(r, r.title, { inside: true })}`;
|
|
562
|
-
}
|
|
563
|
-
/** The blocker's own summary, where its key (in the reason) is a ticket of a row on this board. */
|
|
564
|
-
function blockerTitle(reason) {
|
|
565
|
-
const m = /\b([A-Z][A-Z0-9]+-\d+)\b/.exec(String(reason || '')); if (!m) return '';
|
|
566
|
-
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; }
|
|
567
|
-
return '';
|
|
568
|
-
}
|
|
569
|
-
function tkPanel(r, k) {
|
|
570
|
-
const t = r.track || {}, x = TI(r) && TI(r).tickets ? TI(r).tickets[k.key] : null, sub = x && x.subtasks;
|
|
571
|
-
// what a blocker delays: the sprint it sits in ends, and the release the initiative rides on
|
|
572
|
-
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) + '.' : '';
|
|
573
|
-
// AgBoardTicket: Blocked 2 days · In review · (M) Mei · 5 pts · Sprint 24, each field only where the Jira reading holds it
|
|
574
|
-
const bd = k.blockedDays != null ? ' ' + k.blockedDays + ' ' + plural(k.blockedDays, 'day', 'days') : '';
|
|
575
|
-
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>');
|
|
576
|
-
const reason = k.reason || (x && x.reason) || 'Flagged as blocked in Jira', bt = blockerTitle(reason);
|
|
577
|
-
// the subtasks: one row each where the reading lists them; else the reading's two counts as rows (done, open)
|
|
578
|
-
const items = sub && Array.isArray(sub.items) ? sub.items : null;
|
|
579
|
-
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('')
|
|
580
|
-
: 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('')
|
|
581
|
-
: '<p class="gi gm"><i class="k"></i><span class="n">No subtasks are in the Jira reading</span></p>';
|
|
582
|
-
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>`
|
|
583
|
-
+ `<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>`
|
|
584
|
-
+ `<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>` : ''}`
|
|
585
|
-
+ driftHtml(r, k.key)
|
|
586
|
-
+ `<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>`
|
|
587
|
-
+ `<div class="pk-sec"><p class="lbl">Counts toward</p><p class="pk-p">${esc(t.output || '')} · ${esc(t.count || '')}</p></div>`
|
|
588
|
-
+ '<p class="pk-mut">PMOS owns the ticket text. Status, sprint and assignee change only in Jira.</p></div>'
|
|
589
|
-
+ askForm(r, k.key);
|
|
590
|
-
}
|
|
591
|
-
function showPeek(html, back) {
|
|
592
|
-
const pk = $('#peek'); pk.innerHTML = html; pk.hidden = false; document.body.classList.add('pk-on');
|
|
593
|
-
pk.classList.toggle('pk-tl', !!peek && peek.kind === 'ini' && peek.from === 'time'); // AgBoardTimelinePanel is 420 px wide
|
|
594
|
-
if (back && !$('#peek').contains(back)) peekBack = back; // a press inside the panel keeps the row the panel was opened from
|
|
595
|
-
$$('#ibBody [data-row]').forEach((x) => x.classList.toggle('sel', !!peek && peek.kind !== 'acts' && x.dataset.row === peek.key));
|
|
596
|
-
$$('#ibBody .tgp-r').forEach((x) => x.classList.toggle('sel', !!peek && peek.kind !== 'acts' && x.dataset.key === peek.key));
|
|
597
|
-
const h = $('#pkTitle'); if (h) { h.tabIndex = -1; h.focus({ preventScroll: true }); }
|
|
598
|
-
}
|
|
599
|
-
function closePeek() {
|
|
600
|
-
if ($('#peek').hidden) return;
|
|
601
|
-
const key = peek && peek.key;
|
|
602
|
-
$('#peek').hidden = true; document.body.classList.remove('pk-on'); peek = null;
|
|
603
|
-
$$('#ibBody .sel').forEach((x) => x.classList.remove('sel'));
|
|
604
|
-
// a read can draw the rows again while the panel is open: then the focus goes to the same row as drawn now
|
|
605
|
-
const back = peekBack && document.contains(peekBack) ? peekBack : key ? $$('#ibBody [data-key]').find((x) => x.dataset.key === key) : null;
|
|
606
|
-
if (back) back.focus(); peekBack = null;
|
|
607
|
-
}
|
|
608
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
|
|
609
461
|
* readiness and its products count every product (its other products' initiatives are not drawn here: PRD decision 5). */
|
|
462
|
+
/** "Turn into a program" (P7): a charter named after the initiative, which joins it; then the program's panel opens, with its sort card. */
|
|
463
|
+
async function turnProgram(r) {
|
|
464
|
+
const res = await pmPost('/api/programs/turn', { ws: r.ws || M.board.ws || null, initiative: r.id, title: r.title }).catch(() => null);
|
|
465
|
+
if (!res || !res.ok || !res.program) { say((res && res.error) || 'The program was not made. Try again.'); return; }
|
|
466
|
+
closePanel();
|
|
467
|
+
await loadPrograms();
|
|
468
|
+
say('Now a program · ' + r.title + '.');
|
|
469
|
+
PG.openProgram(res.program.id);
|
|
470
|
+
}
|
|
610
471
|
async function loadPrograms() {
|
|
611
472
|
let r = null; try { r = await (await fetch('/api/programs', { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
612
473
|
if (!r || !r.ok) return;
|
|
@@ -648,45 +509,31 @@ function programOnce() {
|
|
|
648
509
|
const b = $$('#ibBody [data-prog]').find((x) => x.dataset.prog === id); if (b) b.scrollIntoView({ block: 'center' });
|
|
649
510
|
PG.openProgram(id, b);
|
|
650
511
|
}
|
|
651
|
-
function openIni(r, from,
|
|
652
|
-
if (!r || !r.track) return;
|
|
653
|
-
peek = { kind: 'ini', key: r.key, from: where || 'track' }; showPeek(peek.from === 'time' ? timePanel(r) : iniPanel(r), from);
|
|
654
|
-
}
|
|
512
|
+
function openIni(r, from) { if (r && r.track) BI.openIni(r, from); }
|
|
655
513
|
function openTicket(iniKey, key, from) {
|
|
656
514
|
const r = rowOf(iniKey); if (!r || !r.track) return;
|
|
657
|
-
const k = (r.track.tickets || []).find((x) => x.key === key); if (
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
else if (a === 'acts' && r) Acts.open.row(r, b);
|
|
670
|
-
else if (a === 'grill' && r) Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b);
|
|
671
|
-
});
|
|
515
|
+
const k = (r.track.tickets || []).find((x) => x.key === key); if (k) BI.openTicket(r, k, from);
|
|
516
|
+
}
|
|
517
|
+
/** The Viewer shows an initiative of this board: its row is marked. */
|
|
518
|
+
function iniShown(key) {
|
|
519
|
+
peek = { kind: 'ini', key };
|
|
520
|
+
$$('#ibBody [data-row]').forEach((x) => x.classList.toggle('sel', x.dataset.row === key));
|
|
521
|
+
$$('#ibBody .tgp-r').forEach((x) => x.classList.toggle('sel', x.dataset.key === key));
|
|
522
|
+
}
|
|
523
|
+
function iniHidden() {
|
|
524
|
+
if (!peek || peek.kind !== 'ini') return;
|
|
525
|
+
peek = null; $$('#ibBody .sel').forEach((x) => x.classList.remove('sel'));
|
|
526
|
+
}
|
|
672
527
|
/** A linked document opens in the Viewer: GET /api/doc, shown as its text. */
|
|
673
528
|
document.addEventListener('click', (e) => {
|
|
674
529
|
const d = e.target.closest('[data-doc]'); if (!d || !M) return;
|
|
675
|
-
const path = d.dataset.doc, ws = M.board.ws || '';
|
|
676
|
-
viewerOpen({ kind: 'Document', title: path.split('/').pop(), icon: 'doc', id: 'doc:' + path, render: async (body) => {
|
|
530
|
+
const path = d.dataset.doc, ws = M.board.ws || '', inVw = !!d.closest('#czViewer');
|
|
531
|
+
viewerOpen({ kind: 'Document', title: path.split('/').pop(), icon: 'doc', id: 'doc:' + path, back: inVw, render: async (body) => {
|
|
677
532
|
body.innerHTML = '<p class="bd-amut">Reading the document…</p>';
|
|
678
533
|
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; }
|
|
679
534
|
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>`;
|
|
680
535
|
} });
|
|
681
536
|
});
|
|
682
|
-
$('#peek').addEventListener('submit', (e) => {
|
|
683
|
-
const f = e.target.closest('form.pk-ask[data-ask]'); if (!f) return;
|
|
684
|
-
e.preventDefault();
|
|
685
|
-
const r = rowOf(f.dataset.ask), q = f.q.value.trim();
|
|
686
|
-
if (!q) { f.q.focus(); return; }
|
|
687
|
-
location.assign(askHref(r, peek && peek.kind === 'tk' ? peek.tk + ': ' + q : q));
|
|
688
|
-
});
|
|
689
|
-
|
|
690
537
|
/* ── the tools the Agreed design draws but has no frame for: plain versions with a "Waiting for design" tag (pm/bd-acts.js) ─────────── */
|
|
691
538
|
$('#bdFind').addEventListener('click', (e) => Acts.open.find(e.currentTarget));
|
|
692
539
|
$('#bdFilter').addEventListener('click', (e) => Acts.open.filter(e.currentTarget));
|
|
@@ -700,7 +547,7 @@ function setTab(t) {
|
|
|
700
547
|
tab = t;
|
|
701
548
|
$('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabDocs').setAttribute('aria-selected', String(t === 'docs'));
|
|
702
549
|
$('#cIni').hidden = t !== 'ini'; $('#cDocs').hidden = t !== 'docs';
|
|
703
|
-
if (t === 'docs') {
|
|
550
|
+
if (t === 'docs') { closePanel(); drawDocs(); loadDocMeta(); }
|
|
704
551
|
}
|
|
705
552
|
$('#tabIni').onclick = () => setTab('ini');
|
|
706
553
|
$('#tabDocs').onclick = () => setTab('docs');
|
|
@@ -737,8 +584,7 @@ const docMeta = (p, ws) => { const d = DM[(ws || (M && M.board.ws) || '') + ':'
|
|
|
737
584
|
}
|
|
738
585
|
window.addEventListener('keydown', (e) => {
|
|
739
586
|
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;
|
|
740
|
-
if ($$('.bd-pop').some((p) => !p.hidden))
|
|
741
|
-
if (!$('#peek').hidden) closePeek();
|
|
587
|
+
if ($$('.bd-pop').some((p) => !p.hidden)) closePops(true); // the shell closes itself on Escape (cozy-viewer.js)
|
|
742
588
|
}, true);
|
|
743
589
|
|
|
744
590
|
/* ── load: the routes derive the initiatives in the background, so the first answers are "reading" ───────────── */
|
|
@@ -812,10 +658,7 @@ function draw() {
|
|
|
812
658
|
if (tab === 'docs') drawDocs();
|
|
813
659
|
$('#docCap').textContent = String(V.docRows().length);
|
|
814
660
|
// an open panel follows the new read
|
|
815
|
-
if (peek && peek.kind
|
|
816
|
-
const r = (M.rows || []).find((x) => x.key === peek.key); // a row that left the Board (cancelled, archived) closes its panel
|
|
817
|
-
if (!r) closePeek(); else if (peek.kind === 'ini') showPeek(peek.from === 'time' ? timePanel(r) : iniPanel(r));
|
|
818
|
-
}
|
|
661
|
+
if (peek && peek.kind === 'ini') BI.refresh(); // a row that left the Board (cancelled, archived) closes it
|
|
819
662
|
}
|
|
820
663
|
/** ?focus=<initiative id> (Insights links here): open that initiative's panel once, on the first read that has it. */
|
|
821
664
|
let focusDone = false;
|
|
@@ -875,11 +718,16 @@ const openIniAny = (r) => openIni(r, $('#bdBell'), 'track');
|
|
|
875
718
|
V.init({ M: () => M, statusOf, usual: usualOf, trail: TI, docMeta, sel: () => (peek && peek.kind !== 'acts' ? peek.key : null), docSel: () => Acts.docSel(),
|
|
876
719
|
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'),
|
|
877
720
|
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 });
|
|
878
|
-
Asks.init({ M: () => M, load, say, panel: actsPanel, close:
|
|
879
|
-
Acts.init({ M: () => M, load, say, panel: actsPanel, close:
|
|
721
|
+
Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, rowOf, openIni: openIniAny, openDoc: viewDoc, anchors, programs: () => PGS, reloadPrograms: loadPrograms });
|
|
722
|
+
Acts.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, redraw: () => { drawChips(); drawInit(); if (tab === 'docs') drawDocs(); }, F, rowOf, statusOf, openIni: openIniAny,
|
|
880
723
|
openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, docMeta, loadDocMeta, viewDoc,
|
|
881
724
|
grouping: () => ({ on: groupingOn(), byProduct }), setGrouping });
|
|
882
|
-
|
|
725
|
+
BI.mount({ M: () => M, statusOf, dayTitle, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
|
|
726
|
+
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 })),
|
|
727
|
+
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,
|
|
728
|
+
programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), turnProgram });
|
|
729
|
+
setSay(say);
|
|
730
|
+
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)
|
|
883
731
|
setTab('ini');
|
|
884
732
|
load();
|
|
885
733
|
loadPrograms();
|