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
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/* pm/bd-ini-panel.js — the Board's initiative and Jira ticket in the Viewer's shell A (initiative viewer-shell-a, V9; canvas XvABoard, XvOptAJira).
|
|
2
|
+
* It replaces the first kit's 60 % side panel with its Ask box (XnAgBoardPanel) and the timeline's 420 px panel (AgBoardTimelinePanel): both
|
|
3
|
+
* views open the same item now. The shell floats at 560 px over the page's right edge, with its grip, and does not push the page.
|
|
4
|
+
*
|
|
5
|
+
* mount(o) once, from premium-board.js. o: { M() the model, statusOf(r), fmt(iso), md(date), ago(iso), segHtml(r), barHtml(o),
|
|
6
|
+
* grill(id) the open first questions, dayTitle(track) the current step's tooltip, rowOf(key), pageHref(r), askHref(r, q), refreshJira(), send(r) the Send to Jira sheet, acts(r, btn) the row
|
|
7
|
+
* actions popover, grillOpen(r, btn), onShow(key, from) / onHide() so the page marks the row the item came from,
|
|
8
|
+
* programOf(r) the program it is in or null, turnProgram(r) "Turn into a program" (POST /api/programs/turn) }
|
|
9
|
+
* openIni(r, from) the initiative: the shell's header (icon, the title once, Discuss in chat, ⋯, open wide, close), the summary card with
|
|
10
|
+
* its one primary, the stage bar, then the folding rows: the current output, drafted tickets, Jira against the PRD,
|
|
11
|
+
* linked, and dates and trend
|
|
12
|
+
* openTicket(r, k) the ticket as a drill-in: ← goes back to the initiative; the summary says what blocks it and what that delays
|
|
13
|
+
* refresh() draws the shown item again after a new read, in place · close() · shown() → the key of the initiative shown, or null
|
|
14
|
+
*
|
|
15
|
+
* Every part shows only when a record holds something for it (zero is silence). What used to sit on the panel and has no place on the frames
|
|
16
|
+
* is under ⋯ in the shell's order: change it (move, hold, cancel or archive; the plan dates), look back (read Jira again), then link and copy.
|
|
17
|
+
* "Open in full" (the initiative page) is the shell's own ⋯ item. The Ask box is gone: Discuss in chat takes the question to Home. */
|
|
18
|
+
import * as VW from './cozy-viewer.js';
|
|
19
|
+
import { esc } from './premium-shell.js';
|
|
20
|
+
import { lr, stageBar, chips, copyText } from './cozy-xv.js';
|
|
21
|
+
|
|
22
|
+
let O = null;
|
|
23
|
+
let cur = null; // { key, tk } the initiative shown, and its ticket while the drill-in is shown
|
|
24
|
+
const plural = (n, a, b) => (n === 1 ? a : b);
|
|
25
|
+
const TI = (r) => (r && r.trail) || null;
|
|
26
|
+
const DEP_ST = (d) => (!d.known ? 'not on this repository' : d.done ? 'done' : d.stage || 'open');
|
|
27
|
+
const tkState = (k) => (k.blocked ? 'Blocked' + (k.reason ? ' by ' + k.reason.replace(/^Waiting on /i, '') : '') : k.status || 'To do');
|
|
28
|
+
const isJiraStep = (t) => (t.key === 'build' || t.key === 'deliver') && (t.tickets || []).length > 0;
|
|
29
|
+
const jiraAt = () => { const J = (O.M() && O.M().jira) || {}; return J.readAt ? 'Jira · ' + O.ago(J.readAt) : ''; };
|
|
30
|
+
|
|
31
|
+
/* ── the initiative (XvABoard) ── */
|
|
32
|
+
/** The summary card: what waits on you leads, with its one primary; otherwise the state, quiet. */
|
|
33
|
+
export function iniSummary(r) {
|
|
34
|
+
const t = r.track || {}, s = O.statusOf(r), it = TI(r), g = r.id && O.grill(r.id);
|
|
35
|
+
const when = r.release && !/^Ships /.test(s.text) ? 'ships ' + O.fmt(r.release.iso) : !r.release && r.end ? 'plan ends ' + O.fmt(r.end) : ''; // say it once
|
|
36
|
+
const meta = [(t.label || r.stage || 'No stage') + (t.days != null ? ' · day ' + t.days : ''), when, r.owner ? 'owner ' + r.owner : 'no owner'].filter(Boolean).join(' · ');
|
|
37
|
+
const right = isJiraStep(t) ? jiraAt() : '';
|
|
38
|
+
if (t.you && t.youKind) {
|
|
39
|
+
const prd = t.youKind === 'drift' && it && it.links && it.links.prd;
|
|
40
|
+
return { line: t.you, tone: 'you', text: t.youWhy || '', meta, right, primary: prd ? { label: 'Open the PRD', act: 'doc:' + prd } : t.youKind === 'commit' && r.id ? { label: 'Send to Jira', act: 'commit' } : r.id ? { label: t.you, href: O.pageHref(r) } : null };
|
|
41
|
+
}
|
|
42
|
+
if (t.you) {
|
|
43
|
+
const rel = r.release ? r.release.name : t.output, open = (t.tickets || []).filter((k) => k.status !== 'Done').length;
|
|
44
|
+
return { line: 'Your sign-off' + (rel ? ' · ' + rel : ''), tone: 'you', meta, right,
|
|
45
|
+
text: open ? open + ' ' + plural(open, 'ticket is', 'tickets are') + ' still open, so the sign-off can wait until they close.' : 'Every release ticket is done. Release notes are not on record in PMOS.',
|
|
46
|
+
primary: r.id ? { label: 'Sign off ' + (rel || 'the release'), href: O.pageHref(r) } : null };
|
|
47
|
+
}
|
|
48
|
+
if (g && g.open) return { line: g.open + ' ' + plural(g.open, 'question', 'questions') + ' before the BRD', tone: 'you', meta, text: (g.later ? 'You chose to answer later. ' : '') + 'PMOS asks what the BRD needs that the Why does not say yet.', primary: { label: 'Answer the questions', act: 'grill' } };
|
|
49
|
+
const tone = s.tone === 'late' || s.tone === 'risk' || s.tone === 'red' ? 'warn' : '';
|
|
50
|
+
return { line: s.text, tone, meta, right, text: typeof t.next === 'string' && t.next && !(t.tickets || []).length ? 'Next: ' + t.next + '.' : '' };
|
|
51
|
+
}
|
|
52
|
+
/** The skipped steps, each with its reason (lib/board-trail.js), under the stage bar. */
|
|
53
|
+
function skipText(t) {
|
|
54
|
+
const M = O.M(), sk = (t.skipped || []).map((j) => M.steps[j]).filter(Boolean);
|
|
55
|
+
if (!sk.length) return '';
|
|
56
|
+
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; });
|
|
57
|
+
if (why.every(Boolean)) return why.join(' ');
|
|
58
|
+
return sk.map((s) => s.label).join(', ') + ' skipped: it was moved past ' + (sk.length === 1 ? 'that step' : 'those steps') + '. No reason is on record.';
|
|
59
|
+
}
|
|
60
|
+
/** The current output: the open tickets, blocked first, the done ones in one line, Deliver's two parts; or the parts of the output. */
|
|
61
|
+
function outputHtml(r) {
|
|
62
|
+
const t = r.track || {};
|
|
63
|
+
if (isJiraStep(t)) {
|
|
64
|
+
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');
|
|
65
|
+
const sp = [...new Set(t.tickets.map((k) => k.sprint).filter(Boolean))];
|
|
66
|
+
let h = sp.length === 1 ? `<p class="xv-q">${esc(sp[0])}</p>` : '';
|
|
67
|
+
h += open.slice(0, 12).map((k) => lr({ tk: k.key, mk: k.blocked ? 'warn' : '', title: `<em>${esc(k.key)}</em> ${esc(k.title)}`, sub: [tkState(k), k.assignee, k.age != null ? k.age + 'd' : ''].filter(Boolean).join(' · ') })).join('');
|
|
68
|
+
if (open.length > 12) h += lr({ title: esc(open.length - 12 + ' more open tickets') });
|
|
69
|
+
if (done.length) h += lr({ mk: 'done', title: esc(done.length + ' ' + plural(done.length, 'ticket', 'tickets') + ' done'), sub: done.slice(0, 3).map((k) => k.title.toLowerCase()).join(', ') + (done.length > 3 ? ', …' : '') });
|
|
70
|
+
if (t.key === 'deliver') h += lr({ title: 'Release notes', sub: 'not on record' }) + lr({ mk: t.you ? 'you' : '', title: 'Your sign-off', sub: t.you ? 'waiting' : 'after the tickets' });
|
|
71
|
+
return h;
|
|
72
|
+
}
|
|
73
|
+
if (t.key === 'build' || t.key === 'deliver') return '<p class="xv-q">No Jira ticket has been read for it yet.</p>';
|
|
74
|
+
const parts = (t.segs || []).map((s) => lr({ mk: s.cls === 'dn' ? 'done' : s.cls === 'yo' ? 'you' : '', title: esc(s.name || ''), sub: s.st || '' })).join('');
|
|
75
|
+
return `<div class="xv-seg">${O.segHtml(r)}</div>${parts}${typeof t.next === 'string' && t.next ? `<p class="xv-q">Next: <b>${esc(t.next)}</b></p>` : ''}`;
|
|
76
|
+
}
|
|
77
|
+
function draftedHtml(d, g) {
|
|
78
|
+
return d.slice(0, 8).map((x) => lr({ mk: x.waiting ? 'you' : '', title: (x.id ? `<em>${esc(x.id)}</em> ` : '') + esc(x.summary || ''), sub: 'not in Jira' })).join('')
|
|
79
|
+
+ (d.length > 8 ? lr({ title: esc(d.length - 8 + ' more drafted') }) : '')
|
|
80
|
+
+ `<p class="xv-q">They go to Jira only through your Commit${g.open === false && g.why ? '. The Commit is closed: ' + esc(g.why) : ''}.</p>`;
|
|
81
|
+
}
|
|
82
|
+
const driftQ = (keys) => 'What changed in the PRD after ' + keys.join(', ') + ' ' + (keys.length === 1 ? 'was' : 'were') + ' pushed?';
|
|
83
|
+
const driftHtml = (keys) => `<p>${esc(keys.join(', '))} ${keys.length === 1 ? 'was' : 'were'} pushed from an older PRD. Review ${keys.length === 1 ? 'it' : 'them'} before the next push.</p>`
|
|
84
|
+
+ `<div><button type="button" class="xv-mini" data-xb="drift" data-q="${esc(driftQ(keys))}">Discuss the change in chat</button></div>`;
|
|
85
|
+
function linkedChips(r) {
|
|
86
|
+
const it = TI(r), L = (it && it.links) || {}, epic = L.epic || (r.epics || [])[0], D = (it && it.deps) || [];
|
|
87
|
+
const doc = (label, path) => (path ? [`<button type="button" class="xv-chip" data-doc="${esc(path)}" title="${esc(path)}">${esc(label)}</button>`] : []);
|
|
88
|
+
return [].concat(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),
|
|
89
|
+
D.map((d) => `<span class="xv-chip" title="${esc((d.title || d.id) + ': ' + DEP_ST(d))}">${esc('Waits on ' + (d.title || d.id))}</span>`),
|
|
90
|
+
epic ? [`<span class="xv-chip">${esc('Epic ' + epic)}</span>`] : []);
|
|
91
|
+
}
|
|
92
|
+
/** Dates and trend: when the step started, the planned end (yours), the end Jira's pace expects, the progress, and what it waits on. */
|
|
93
|
+
function datesHtml(r) {
|
|
94
|
+
const t = r.track || {}, it = TI(r);
|
|
95
|
+
const st = t.days != null ? O.md(new Date(Date.now() - t.days * 86400000)) : null, end = r.end ? O.fmt(r.end) : null, exp = t.forecast ? O.fmt(t.forecast) : null;
|
|
96
|
+
const late = !!(r.end && t.forecast && t.forecast.slice(0, 10) > r.end.slice(0, 10));
|
|
97
|
+
const box = (label, v, cls) => `<div class="xv-box${cls ? ' ' + cls : ''}"><span>${esc(label)}</span><b>${esc(v || '—')}</b></div>`;
|
|
98
|
+
let h = '';
|
|
99
|
+
if (st || end || exp) h += `<div class="xv-dg">${box('Started ' + (t.label || 'the step'), st)}${box('Planned end', end)}${box('Now expected', exp, late ? 'late' : '')}</div>`
|
|
100
|
+
+ `<p class="xv-q">${r.start ? 'PMOS plan ' + esc(O.fmt(r.start) + ' → ' + (end || '…')) + '. ' : ''}Planned end is yours. Expected comes from Jira pace, and moves when tickets move.</p>`;
|
|
101
|
+
const p = t.prog;
|
|
102
|
+
if (p && p.total) {
|
|
103
|
+
const pct = Math.round((p.done / p.total) * 100), count = p.unit === 'tickets';
|
|
104
|
+
const what = p.unit === 'pts' ? p.done + ' of ' + p.total + ' points' : count ? p.done + ' of ' + p.total + ' work-items done' : p.done + '% on record';
|
|
105
|
+
h += `<div class="xv-box"><div class="xv-bh"><b>${esc(what)}</b><span>${pct}%${count ? ' · by count' : ''}</span></div>${O.barHtml({ pct, count, label: what })}</div>`;
|
|
106
|
+
}
|
|
107
|
+
const D = (it && it.deps) || [], open = D.filter((d) => d.known && !d.done);
|
|
108
|
+
if (D.length) h += `<p><b>Waits on ${esc(D.map((d) => d.title || d.id).join(', '))}.</b> ${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.' : ''}</p>`;
|
|
109
|
+
return h;
|
|
110
|
+
}
|
|
111
|
+
function iniSections(r) {
|
|
112
|
+
const t = r.track || {}, it = TI(r), S = [];
|
|
113
|
+
S.push({ id: 'out', title: t.output || 'No step on record', count: t.count || '', open: true, render: () => outputHtml(r) });
|
|
114
|
+
const d = ((it && it.drafted) || []).filter((x) => !x.key);
|
|
115
|
+
if (d.length) S.push({ id: 'drafted', title: 'Drafted in PMOS', count: d.length, render: () => draftedHtml(d, (it && it.gate) || {}) });
|
|
116
|
+
const dr = (it && it.drift) || [];
|
|
117
|
+
if (dr.length) S.push({ id: 'drift', title: 'Jira differs from the PRD', count: dr.length, render: () => driftHtml(dr) });
|
|
118
|
+
const L = linkedChips(r);
|
|
119
|
+
if (L.length) S.push({ id: 'linked', title: 'Linked', count: L.length, render: () => chips(L) });
|
|
120
|
+
const dates = datesHtml(r);
|
|
121
|
+
if (dates) S.push({ id: 'dates', title: 'Dates and trend', render: () => dates });
|
|
122
|
+
return S;
|
|
123
|
+
}
|
|
124
|
+
/** ⋯ in the shell's order: change it, look back, then link and copy. Archive and cancel stay in the row actions, with their Undo. */
|
|
125
|
+
function iniMore(r) {
|
|
126
|
+
const more = [];
|
|
127
|
+
if (r.acts) more.push({ label: 'Move, hold, cancel or archive', on: (b) => O.acts(r, b) });
|
|
128
|
+
if (r.id) more.push({ label: 'Change the plan dates', on: () => location.assign(O.askHref(r, 'Propose new start and end dates for ' + r.title)) });
|
|
129
|
+
// P7 (program-hierarchy PRD): an initiative in no program can become one; the chat cannot, because every program write is a page press
|
|
130
|
+
if (r.id && O.turnProgram && !(O.programOf && O.programOf(r))) more.push({ label: 'Turn into a program', on: () => O.turnProgram(r) });
|
|
131
|
+
if ((O.M() || {}).jira) more.push({ sep: true }, { label: 'Read Jira again', on: () => O.refreshJira() });
|
|
132
|
+
more.push({ sep: true });
|
|
133
|
+
if (r.id) more.push({ label: 'Copy link', on: () => copyText(new URL(O.pageHref(r), location.href).href, 'Link copied.') });
|
|
134
|
+
more.push({ label: 'Copy as text', on: () => copyText(iniText(r), 'Copied as text.') });
|
|
135
|
+
return more;
|
|
136
|
+
}
|
|
137
|
+
/** The initiative as plain text, for Copy as text: the summary, the output and the open tickets. */
|
|
138
|
+
function iniText(r) {
|
|
139
|
+
const s = iniSummary(r), t = r.track || {};
|
|
140
|
+
const lines = [r.title, [s.line, s.meta].filter(Boolean).join(' · ')];
|
|
141
|
+
if (s.text) lines.push(s.text);
|
|
142
|
+
if (t.output) lines.push('', t.output + (t.count ? ' · ' + t.count : ''));
|
|
143
|
+
for (const k of (t.tickets || []).filter((x) => x.status !== 'Done')) lines.push('- ' + k.key + ' ' + k.title + ' · ' + tkState(k) + (k.assignee ? ' · ' + k.assignee : ''));
|
|
144
|
+
return lines.join('\n');
|
|
145
|
+
}
|
|
146
|
+
function iniBody(r) {
|
|
147
|
+
const t = r.track || {}, sk = skipText(t);
|
|
148
|
+
return VW.czSummary(iniSummary(r)) + stageBar(O.M().steps || [], t.k, t.skipped, O.dayTitle ? O.dayTitle(t) : '') + (sk ? `<p class="xv-q xv-skip">${esc(sk)}</p>` : '') + VW.czSections(iniSections(r), { key: 'board' });
|
|
149
|
+
}
|
|
150
|
+
/** Presses inside the shown item: a ticket opens its drill-in; the primary; the PRD-change question. A [data-doc] goes to the page's handler. */
|
|
151
|
+
function wire(body, key) {
|
|
152
|
+
body.onclick = (e) => {
|
|
153
|
+
const r = O.rowOf(key); if (!r) return;
|
|
154
|
+
const tk = e.target.closest('[data-tk]'); if (tk) { const k = ((r.track && r.track.tickets) || []).find((x) => x.key === tk.dataset.tk); if (k) openTicket(r, k); return; }
|
|
155
|
+
const a = e.target.closest('[data-czs-act], [data-xb]'); if (!a) return;
|
|
156
|
+
const act = a.dataset.czsAct || a.dataset.xb;
|
|
157
|
+
if (act === 'grill') O.grillOpen(r, a);
|
|
158
|
+
else if (act === 'commit') O.send(r); // the Commit of drafted tickets opens the Send sheet (tk-send.js), the one path to Jira
|
|
159
|
+
else if (act === 'drift') location.assign(O.askHref(r, a.dataset.q || ''));
|
|
160
|
+
else if (act.startsWith('doc:')) O.viewDoc(act.slice(4));
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** The shell's id of an initiative: its record id, so Discuss in chat names it (?about=init:<id>&vid=<id>) and Home reopens it beside the chat. */
|
|
164
|
+
const vidOf = (r) => (r.id ? String(r.id) : 'bd:' + r.key);
|
|
165
|
+
export function openIni(r, from) {
|
|
166
|
+
if (!O || !r || !r.track) return;
|
|
167
|
+
// a row with no record id has no chat of its own: its question goes to the board's chat
|
|
168
|
+
VW.open({ kind: 'Initiative', title: r.title, icon: 'flag', id: vidOf(r), url: r.id ? O.pageHref(r) : '', full: true,
|
|
169
|
+
discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: iniMore(r),
|
|
170
|
+
render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); },
|
|
171
|
+
onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* ── the Jira ticket, as a drill-in (XvOptAJira) ── */
|
|
175
|
+
/** The blocker's own summary, where its key (in the reason) is a ticket of a row on this board. */
|
|
176
|
+
function blockerTitle(key) {
|
|
177
|
+
for (const r of (O.M() && O.M().rows) || []) { const x = ((r.track && r.track.tickets) || []).find((y) => y.key === key); if (x && x.title && x.title !== x.key) return x.title; }
|
|
178
|
+
return '';
|
|
179
|
+
}
|
|
180
|
+
export function tkSummary(r, k) {
|
|
181
|
+
const x = TI(r) && TI(r).tickets ? TI(r).tickets[k.key] : null, pts = k.points != null ? k.points + ' ' + plural(k.points, 'point', 'points') : '';
|
|
182
|
+
const right = jiraAt(), primary = k.url ? { label: k.blocked ? 'Comment in Jira' : 'Open in Jira', href: k.url, blank: true } : null;
|
|
183
|
+
if (!k.blocked) return { line: k.raw || k.status || 'To do', right, meta: [k.assignee, k.sprint, pts].filter(Boolean).join(' · '), primary };
|
|
184
|
+
const reason = k.reason || (x && x.reason) || 'Flagged as blocked in Jira', on = /\b([A-Z][A-Z0-9]+-\d+)\b/.exec(reason), bt = on ? blockerTitle(on[1]) : '';
|
|
185
|
+
const days = k.blockedDays != null ? ' ' + k.blockedDays + ' ' + plural(k.blockedDays, 'day', 'days') : '';
|
|
186
|
+
const slip = k.sprintEnd ? 'If it is not fixed by ' + O.fmt(k.sprintEnd) + ', the end of ' + (k.sprint || 'its sprint') + ', ' + (r.release ? r.release.name + ' on ' + O.fmt(r.release.iso) + ' slips.' : 'it carries into the next sprint.') : r.release ? 'It holds up ' + r.release.name + ' on ' + O.fmt(r.release.iso) + '.' : '';
|
|
187
|
+
const status = k.raw && !/block/i.test(k.raw) ? k.raw : '';
|
|
188
|
+
return { line: 'Blocked' + days + (on ? ' on ' + on[1] : ''), tone: 'warn', right, text: [reason.replace(/\.$/, '') + (bt ? ' (' + bt + ')' : '') + '.', slip].filter(Boolean).join(' '),
|
|
189
|
+
meta: [k.assignee, k.sprint, pts, status].filter(Boolean).join(' · '), primary };
|
|
190
|
+
}
|
|
191
|
+
function tkSections(r, k) {
|
|
192
|
+
const t = r.track || {}, it = TI(r), x = it && it.tickets ? it.tickets[k.key] : null, sub = x && x.subtasks, S = [];
|
|
193
|
+
if (((it && it.drift) || []).includes(k.key)) S.push({ id: 'tdrift', title: 'The PRD changed after the push', count: 1, open: true, render: () => driftHtml([k.key]) });
|
|
194
|
+
const items = sub && Array.isArray(sub.items) ? sub.items : null;
|
|
195
|
+
S.push({ id: 'sub', title: 'Subtasks', count: sub && sub.total ? sub.done + ' of ' + sub.total : '', render: () => (items && items.length
|
|
196
|
+
? items.map((y) => lr({ mk: y.done ? 'done' : '', title: esc(y.name || y.summary || ''), sub: y.done ? 'done' : 'open' })).join('')
|
|
197
|
+
: sub && sub.total ? [[sub.done, 'done', 'done'], [sub.total - sub.done, 'open', '']].filter(([n]) => n > 0).map(([n, w, c]) => lr({ mk: c, title: esc(n + ' ' + plural(n, 'subtask', 'subtasks')), sub: w })).join('')
|
|
198
|
+
: '<p class="xv-q">No subtasks are in the Jira reading.</p>') });
|
|
199
|
+
if (t.output) S.push({ id: 'counts', title: 'Counts toward', count: t.output, render: () => `<p>${esc(t.output)}${t.count ? ' · ' + esc(t.count) : ''}</p>` });
|
|
200
|
+
return S;
|
|
201
|
+
}
|
|
202
|
+
const tkBody = (r, k) => VW.czSummary(tkSummary(r, k)) + VW.czSections(tkSections(r, k), { key: 'board-ticket' }) + '<p class="xv-q">PMOS owns the ticket text. Status, sprint and assignee change only in Jira.</p>';
|
|
203
|
+
export function openTicket(r, k, from) {
|
|
204
|
+
if (!O || !r || !k) return;
|
|
205
|
+
const c = VW.current && VW.current(), back = !!(c && c.id === vidOf(r));
|
|
206
|
+
const more = [{ label: 'Discuss in chat', on: () => location.assign(O.askHref(r, k.key + ': ')) }];
|
|
207
|
+
if ((O.M() || {}).jira) more.push({ label: 'Read Jira again', on: () => O.refreshJira() });
|
|
208
|
+
more.push({ sep: true });
|
|
209
|
+
if (k.url) more.push({ label: 'Copy link', on: () => copyText(k.url, 'Link copied.') });
|
|
210
|
+
more.push({ label: 'Copy as text', on: () => copyText([k.key + ' · ' + k.title, tkSummary(r, k).meta].filter(Boolean).join('\n'), 'Copied as text.') });
|
|
211
|
+
VW.open({ kind: 'Jira ticket', title: k.key + ' · ' + k.title, icon: 'jira', id: 'tk:' + vidOf(r) + ':' + k.key, url: k.url || '', back, more,
|
|
212
|
+
render: (body) => {
|
|
213
|
+
const x = O.rowOf(r.key) || r, kk = ((x.track && x.track.tickets) || []).find((y) => y.key === k.key) || k;
|
|
214
|
+
cur = { key: x.key, tk: kk.key }; O.onShow(x.key, back ? null : from);
|
|
215
|
+
body.innerHTML = tkBody(x, kk); wire(body, x.key);
|
|
216
|
+
},
|
|
217
|
+
onClose: () => { if (cur && cur.tk === k.key) { cur = null; O.onHide(); } } });
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** The shown item drawn again from the new read, in place. A row that left the Board closes it. */
|
|
221
|
+
export function refresh() {
|
|
222
|
+
if (!cur || !VW.isOpen()) return;
|
|
223
|
+
const r = O.rowOf(cur.key); if (!r || !r.track) { close(); return; }
|
|
224
|
+
const b = VW.body(); if (!b || (document.activeElement && b.contains(document.activeElement))) return;
|
|
225
|
+
const k = cur.tk && (r.track.tickets || []).find((x) => x.key === cur.tk);
|
|
226
|
+
const top = b.scrollTop;
|
|
227
|
+
b.innerHTML = cur.tk && k ? tkBody(r, k) : iniBody(r);
|
|
228
|
+
b.scrollTop = top;
|
|
229
|
+
}
|
|
230
|
+
export function close() { if (cur) { cur = null; VW.close(); } }
|
|
231
|
+
export const shown = () => (cur ? cur.key : null);
|
|
232
|
+
export function mount(o) { O = o; }
|
|
@@ -40,7 +40,7 @@ export function open(html, btn, o = {}) {
|
|
|
40
40
|
host.setAttribute('aria-label', o.label || 'Board');
|
|
41
41
|
host.setAttribute('role', o.role || 'dialog');
|
|
42
42
|
host.innerHTML = (PHONE.matches ? '<div class="bd-grab" aria-hidden="true"></div>' : '') + html;
|
|
43
|
-
host.hidden = false; from = btn || null; onClose = o.onClose || null;
|
|
43
|
+
host.hidden = false; host.dataset.escLayer = '1'; from = btn || null; onClose = o.onClose || null; // a layer over the Viewer: Escape closes it first
|
|
44
44
|
if (from) from.setAttribute('aria-expanded', 'true');
|
|
45
45
|
place();
|
|
46
46
|
const f = (o.focus && host.querySelector(o.focus)) || host.querySelector('input, button, [tabindex="0"]');
|
|
@@ -51,7 +51,7 @@ export function open(html, btn, o = {}) {
|
|
|
51
51
|
export function redraw(html) { if (!host || host.hidden) return; host.innerHTML = (PHONE.matches ? '<div class="bd-grab" aria-hidden="true"></div>' : '') + html; place(); }
|
|
52
52
|
export function close(back) {
|
|
53
53
|
if (!host || host.hidden) return;
|
|
54
|
-
host.hidden = true; scrim.hidden = true;
|
|
54
|
+
host.hidden = true; scrim.hidden = true; delete host.dataset.escLayer;
|
|
55
55
|
if (from) { from.setAttribute('aria-expanded', 'false'); if (back && document.contains(from)) from.focus({ preventScroll: true }); }
|
|
56
56
|
const cb = onClose; from = null; onClose = null; if (cb) cb();
|
|
57
57
|
}
|