create-pmos 0.442.0 → 0.444.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 -25
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-board-test.js +8 -2
- package/workspace/briefing-premium-insights-test.js +40 -38
- package/workspace/briefing-premium-test.js +2 -1
- package/workspace/changelog.json +24 -0
- package/workspace/goals-clear-ui-test.js +263 -0
- package/workspace/guide/home.md +12 -2
- package/workspace/guide/metric-drafts.md +8 -2
- package/workspace/home-railcard-test.js +193 -0
- package/workspace/intel-report-ui-test.js +1 -1
- package/workspace/intelligence-gaps-ui-test.js +16 -14
- package/workspace/lib/board-premium.js +1 -1
- package/workspace/lib/engine/boards.js +9 -2
- package/workspace/lib/engine/records/index.js +9 -2
- package/workspace/lib/initiative-layout.js +3 -1
- package/workspace/lib/insights-premium.js +22 -1
- package/workspace/lib/metric-drafts.js +37 -10
- package/workspace/lib/metric-read-runs.js +20 -13
- package/workspace/lib/metric-reads.js +208 -23
- package/workspace/lib/metrics-cli.js +62 -5
- package/workspace/lib/routes-boards.js +40 -1
- package/workspace/lib/routes-goal-status.js +89 -6
- package/workspace/lib/routes-insights-premium.js +1 -1
- package/workspace/lib/routes-metric-drafts.js +26 -3
- package/workspace/live-pill-round-test.js +178 -0
- package/workspace/metric-drafts-ui-test.js +5 -2
- package/workspace/okr-goals-ui-test.js +27 -23
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/panels-test.js +231 -0
- package/workspace/premium-board-actions-test.js +2 -2
- package/workspace/premium-rec-tab-test.js +2 -1
- package/workspace/premium-vw-item-test.js +10 -2
- package/workspace/premium-vw-jira-test.js +3 -0
- package/workspace/public/pm/bd-ini-panel.js +3 -2
- package/workspace/public/pm/cozy-adler.js +21 -0
- package/workspace/public/pm/cozy-divider.css +32 -0
- package/workspace/public/pm/cozy-divider.js +45 -0
- package/workspace/public/pm/cozy-insights.css +96 -0
- package/workspace/public/pm/cozy-live-pill.css +16 -17
- package/workspace/public/pm/cozy-live-pill.js +28 -17
- package/workspace/public/pm/cozy-panels.css +59 -0
- package/workspace/public/pm/cozy-panels.js +524 -0
- package/workspace/public/pm/cozy-today.css +15 -0
- package/workspace/public/pm/cozy-viewer.js +173 -69
- package/workspace/public/pm/cozy-vw-shell.css +4 -0
- package/workspace/public/pm/goals-clear.js +265 -0
- package/workspace/public/pm/home-app.js +73 -14
- package/workspace/public/pm/home-ini.js +9 -3
- package/workspace/public/pm/home-today.js +55 -12
- package/workspace/public/pm/ini-edit.js +401 -0
- package/workspace/public/pm/ini-groups.js +14 -8
- package/workspace/public/pm/ini-tasks.js +84 -26
- package/workspace/public/pm/ini-versions.js +18 -4
- package/workspace/public/pm/ini-view-model.js +45 -18
- package/workspace/public/pm/ini-view.css +117 -5
- package/workspace/public/pm/ini-view.js +51 -17
- package/workspace/public/pm/metric-drafts.js +4 -1
- package/workspace/public/pm/mission.js +11 -7
- package/workspace/public/pm/premium-board.js +8 -6
- package/workspace/public/pm/premium-insights.js +375 -59
- package/workspace/public/pm/task-card.css +2 -0
- package/workspace/public/pm/task-card.js +4 -1
- package/workspace/server.js +6 -2
- package/workspace/skills/metric-read.skill +7 -5
- package/workspace/stage-card-tasks-test.js +396 -0
- package/workspace/stage-card-test.js +12 -4
- package/workspace/task-delete-test.js +9 -1
- package/workspace/task-milestones-test.js +3 -3
- package/workspace/task-press-test.js +12 -4
- package/workspace/task-views-test.js +198 -5
- package/workspace/test-lists/batch18-live-pill-round.json +10 -0
- package/workspace/test-lists/batch18-panels.json +9 -0
- package/workspace/test-lists/goals-clear.json +15 -0
- package/workspace/test-lists/home-railcard.json +9 -0
- package/workspace/test-lists/stage-card-tasks.json +6 -0
- package/workspace/tk-tasks-test.js +2 -2
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* viewMode() / setViewMode(m) 'list' | 'timeline' | 'kanban': the last view, remembered for the PM across initiatives; first time List
|
|
7
7
|
* switchHtml(m) the icon-only segment List / Timeline / Kanban (Kanban is the Board's "By stage" icon)
|
|
8
8
|
* viewBtnHtml(m) the Tasks header's one view button (batch 18 item 1, XvpA4Sheet); its press opens the view sheet
|
|
9
|
+
* fullBtnHtml(m) Full width, beside the view button: a desktop's Timeline at Weeks or Months (0.442.0 hotfix)
|
|
9
10
|
* sheetHtml(m, g, z) the sheet: View, Group by (Stage, Owner, Status, ⋯ for Epic and Your groups) and the Timeline's Zoom
|
|
10
11
|
* (Weeks, Months, All); a bottom sheet on a phone, a popover under the button on a desktop
|
|
11
12
|
* kanbanPickHtml(v) Kanban's stage picker, at the top of the Kanban
|
|
@@ -86,9 +87,9 @@ export const setKanbanStage = (id, key) => { if (id && key != null) STAGE.set(id
|
|
|
86
87
|
|
|
87
88
|
/* ── days, as whole numbers (UTC, so a summer-time night never moves a bar) ── */
|
|
88
89
|
const DAY = /^(\d{4})-(\d{2})-(\d{2})/;
|
|
89
|
-
const dn = (iso) => { const m = DAY.exec(String(iso || '')); return m ? Math.round(Date.UTC(+m[1], +m[2] - 1, +m[3]) / 864e5) : null; };
|
|
90
|
+
export const dn = (iso) => { const m = DAY.exec(String(iso || '')); return m ? Math.round(Date.UTC(+m[1], +m[2] - 1, +m[3]) / 864e5) : null; };
|
|
90
91
|
export const isoN = (n) => new Date(n * 864e5).toISOString().slice(0, 10);
|
|
91
|
-
const md = (n) => { const d = new Date(n * 864e5); return MON[d.getUTCMonth()] + ' ' + d.getUTCDate(); };
|
|
92
|
+
export const md = (n) => { const d = new Date(n * 864e5); return MON[d.getUTCMonth()] + ' ' + d.getUTCDate(); };
|
|
92
93
|
/** "Nov 4 → 13", "Nov 28 → Dec 3", "Nov 4": the tip while a bar drags, in the List's words. */
|
|
93
94
|
export function spanText(s, e) {
|
|
94
95
|
if (s == null && e == null) return '';
|
|
@@ -128,9 +129,10 @@ export function kanbanPickHtml(v) {
|
|
|
128
129
|
const what = v.tasks.by && v.tasks.by !== 'stage' ? 'Group' : 'Stage';
|
|
129
130
|
return `<button type="button" class="ivx-pick on" data-iv-kstage aria-haspopup="menu" aria-label="${what}: ${esc(x.label)}. Change">${esc(x.label)}${SVG(P.down, 14, 2)}</button>`;
|
|
130
131
|
}
|
|
131
|
-
/** Full width: a desktop's Weeks and Months
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
/** Full width: a desktop's Timeline at Weeks and Months (All fits the panel), in the Tasks header beside the view button (0.442.0 hotfix:
|
|
133
|
+
* at the Timeline's foot it went unseen). Once on it stays there at All too, so the way back is where it was. */
|
|
134
|
+
export function fullBtnHtml(m) {
|
|
135
|
+
if (m !== 'timeline' || PHONE() || (zoomOf() === 'all' && !fullOn())) return '';
|
|
134
136
|
const f = fullOn(), fl = f ? 'Back to the panel' : 'Full width';
|
|
135
137
|
return `<button type="button" class="iv-ib ivt-fl" data-iv-full aria-pressed="${f}" aria-label="${fl}" title="${fl}">${SVG(f ? P.unfull : P.full, 16)}</button>`;
|
|
136
138
|
}
|
|
@@ -172,7 +174,18 @@ const tkOf = (sec) => (sec.stages ? sec.stages.flatMap((s) => tkOf(s)) : sec.tk
|
|
|
172
174
|
const tkMark = (t) => (t.inJira ? `<span class="ig-sq ${esc(t.cat || 'todo')}" role="img" aria-label="${esc('In Jira: ' + (t.status || 'To do'))}"></span>`
|
|
173
175
|
: `<span class="ig-tkd" role="img" aria-label="Jira ticket drafted, not sent" title="Drafted, not in Jira">${SVG(P.jira, 14, 2)}</span>`);
|
|
174
176
|
const tkTitle = (t) => `<button type="button" class="iv-tt" data-ig-tk="${esc(t.id)}">${t.inJira && t.key ? `<em>${esc(t.key)}</em> ` : ''}${esc(t.title)}</button>`;
|
|
177
|
+
/** A task linked to a Jira ticket it names (ini-view-model.js linkOf): the key once, in blue, then the rest of its title, the same in the List,
|
|
178
|
+
* the Timeline and the Kanban (class lk). A key PMOS has not read stays plain text in the title (0.442.0 hotfix). */
|
|
179
|
+
export function keyName(x) {
|
|
180
|
+
if (!x.jkey) return esc(x.title);
|
|
181
|
+
const rest = String(x.title || '').replace(new RegExp('[\\[(]?\\b' + x.jkey + '\\b[\\])]?\\s*[:\u2013\u2014-]?\\s*'), '').trim();
|
|
182
|
+
return `<em class="lk">${esc(x.jkey)}</em>${rest ? ' ' + esc(rest) : ''}`;
|
|
183
|
+
}
|
|
184
|
+
/** The Jira mark of a linked task, in place of its box: the status square the ticket rows draw (To do, In progress, Done). Jira owns the
|
|
185
|
+
* status, so it marks nothing here. */
|
|
186
|
+
export const jqMark = (x) => `<span class="iv-jq ig-sq ${x.closed ? 'done' : x.prog ? 'doing' : 'todo'}" role="img" aria-label="${esc('Jira ' + x.jkey + ': ' + (x.jst || x.status))}" title="${esc('Jira · ' + (x.jst || x.status))}"></span>`;
|
|
175
187
|
const box = (x, o) => {
|
|
188
|
+
if (x.jkey && !x.dr) return `<span class="iv-bxw">${jqMark(x)}</span>`;
|
|
176
189
|
// a draft's task (batch 11 item 8) is an assumption: a dashed box that marks nothing; its caret still changes the status in the draft
|
|
177
190
|
if (x.dr) return `<span class="iv-bxw"><span class="iv-cb dr" aria-hidden="true"></span>` + (o.quick ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" aria-haspopup="dialog" aria-label="${esc('Change the status in the draft: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '') + '</span>';
|
|
178
191
|
const cls = ['iv-cb', x.done ? 'on' : '', x.prog ? 'pr' : '', x.wont ? 'wo' : ''].filter(Boolean).join(' ');
|
|
@@ -180,7 +193,8 @@ const box = (x, o) => {
|
|
|
180
193
|
+ (o.quick ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" data-ms="${x.ms ? 1 : 0}" aria-haspopup="dialog" aria-label="${esc('Change the status: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '') + '</span>';
|
|
181
194
|
};
|
|
182
195
|
const jmark = (k) => `<span class="iv-jm" role="img" aria-label="${esc('Jira ticket, ' + (k.status || 'To do') + '. Status and dates come from Jira')}" title="${esc('Jira · ' + (k.status || 'To do'))}">${SVG(P.jira, 14, 2)}</span>`;
|
|
183
|
-
|
|
196
|
+
// noMs: the row already leads with its ◇ (Timeline at All), so the title does not repeat it
|
|
197
|
+
const title = (x, o, noMs = false) => (o.openTask && x.uid && !x.dr ? `<button type="button" class="iv-tt" data-iv-task="${esc(x.uid)}">${keyName(x)}</button>` : `<b class="iv-tt">${keyName(x)}</b>`) + (noMs ? '' : msGlyph(x)) + addedMark(x);
|
|
184
198
|
/* ── planned versus actual (batch 11 item 8; canvas PvaAC1Live): ⊕ after a title added after the compared version, the slip after a date ── */
|
|
185
199
|
const ADDED = 'M12 8v8M8 12h8M12 3a9 9 0 1 0 0 18 9 9 0 1 0 0-18';
|
|
186
200
|
export const addedMark = (x) => (x.added ? `<span class="vs-add" role="img" aria-label="Added after the plan" title="Added after the plan">${SVG(ADDED, 14, 1.8)}</span>` : '');
|
|
@@ -196,14 +210,25 @@ export const jiraRow = (k) => ({ uid: k.key, start: k.start || '', end: k.due ||
|
|
|
196
210
|
const ttitle = (k) => `<button type="button" class="iv-tt" data-iv-ticket="${esc(k.key)}"><em>${esc(k.key)}</em> ${esc(k.title)}</button>`;
|
|
197
211
|
/** The date press: the task card's start and due picker opens right under it. No dates: a calendar icon, shown on hover. */
|
|
198
212
|
export function dateBtn(x, o) {
|
|
199
|
-
if (!o.quick || !x.uid) return x.days ? `<span class="${x.late ? 'w' : ''}">${
|
|
200
|
-
const
|
|
213
|
+
if (!o.quick || !x.uid) return x.days ? `<span class="${x.late ? 'w' : ''}">${daysHtml(x)}</span>` : '';
|
|
214
|
+
const one = x.ms && !x.jira ? ' data-one="1"' : '';
|
|
215
|
+
const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" data-t="${esc(x.title)}"${one} title="${one ? 'The milestone\'s date' : x.jira || x.jkey ? 'Start and due, kept in PMOS. Jira is not changed' : 'Start and due'}"`;
|
|
201
216
|
// a milestone with no due date: a dashed chip asks for it, shown always (canvas XmlA6Suggest)
|
|
202
217
|
if (msNoDate(x)) return `<button type="button" class="iv-dc ms" ${a} aria-label="${esc('Set the due date: ' + x.title)}">${SVG(P.cal, 13)}Set the due date</button>`;
|
|
203
|
-
return x.days ? `<button type="button" class="iv-dc${x.late ? ' w' : ''}" ${a} aria-label="${esc('Dates: ' + x.days + '. Change')}">${
|
|
218
|
+
return x.days ? `<button type="button" class="iv-dc${x.late ? ' w' : ''}" ${a} aria-label="${esc((one ? 'Milestone date: ' : 'Dates: ') + x.days + '. Change')}">${daysHtml(x)}</button>`
|
|
204
219
|
: `<button type="button" class="iv-dc none" ${a} aria-label="${esc('Add dates: ' + x.title)}">${SVG(P.cal, 14)}</button>`;
|
|
205
220
|
}
|
|
206
221
|
|
|
222
|
+
/** A row's days (batch 18 item 16, StA1Rows): a milestone's one day after its ◇ ("◇ Nov 14"); start – due with the start in its own span,
|
|
223
|
+
* which a phone hides (it shows the due day only). */
|
|
224
|
+
export function daysHtml(x) {
|
|
225
|
+
if (x.ms && x.dueText) return `<span class="iv-dms">${SVG(P.dia, 11, 2.4)}</span>${esc(x.dueText)}`;
|
|
226
|
+
if (x.startText && x.dueText && x.start !== x.end) return `<span class="iv-dst">${esc(x.startText)} – </span>${esc(x.dueText)}`;
|
|
227
|
+
return esc(x.days);
|
|
228
|
+
}
|
|
229
|
+
/** A milestone with its day shows ◇ in its date ("◇ Nov 14"), so its title does not repeat the ◇ (say it once). */
|
|
230
|
+
export const msInDate = (x) => !!(x && x.ms && x.dueText && !x.wont);
|
|
231
|
+
|
|
207
232
|
/* ── Timeline ── */
|
|
208
233
|
// Year, 2 years and 5 years show a fixed span: it fills the width the Timeline has (the panel, or the window in full width), never narrower
|
|
209
234
|
// than the zoom's own scale; the name column is the css --nw, clamp(150px, 36cqw, 320px)
|
|
@@ -259,7 +284,12 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
259
284
|
const lw = LK.barWords(x, o.lk);
|
|
260
285
|
const at = `data-ivt-bar="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}"${o.quick && !x.closed ? drag : ''} aria-label="${esc(lbl + (lw ? ', ' + lw : '') + '. Change the dates')}"`;
|
|
261
286
|
if (a == null && b == null) return x.closed || !o.quick ? '' : `<button type="button" class="ivt-g" data-iv-date="${esc(x.uid)}" data-s="" data-e="" data-tlx="${X(today) - 18}" aria-label="${esc('No dates yet. Set dates: ' + x.title)}" title="Set dates">${SVG(P.cal, 13)}</button>`;
|
|
262
|
-
|
|
287
|
+
// a milestone is its ◇ on its date, with no bar (batch 18 item 16, StA9Timeline): dragging the ◇ moves the date; its press opens the
|
|
288
|
+
// one-date picker
|
|
289
|
+
if (x.ms && b != null && !x.wont) return `<button type="button" class="ivt-d ${cls} ms" ${at} data-only="due" data-one="1" data-t="${esc(x.title)}" data-tlx="${X(b + 1)}"></button>`
|
|
290
|
+
+ `<span class="ivt-ms lb${x.done ? ' dn' : x.late ? ' lt' : ''}" data-tlx="${X(b + 1)}" aria-hidden="true"><b>${esc(md(b))}</b></span>`;
|
|
291
|
+
// a milestone with a due day only is its ◇ (the guide drops through it), not the due-only circle
|
|
292
|
+
if (a == null) return `<button type="button" class="ivt-d ${cls}${x.ms && !x.wont ? ' ms' : ''}" ${at} data-only="due" data-tlx="${x.ms && !x.wont ? X(b + 1) : X(b) + Math.round(px / 2)}"></button>`;
|
|
263
293
|
const e = b == null ? a : Math.max(a, b);
|
|
264
294
|
return `<button type="button" class="ivt-b ${cls}" ${at} data-tlx="${X(a)}" data-tlw="${Math.max(10, X(e + 1) - X(a))}">`
|
|
265
295
|
+ (o.quick && !x.closed ? '<span class="ivt-gp l" data-grip="start" aria-hidden="true"></span><span class="ivt-gp r" data-grip="end" aria-hidden="true"></span>' : '') + av + LK.barExtra(x, o.lk, o.quick) + '</button>' + msEnd(x);
|
|
@@ -303,7 +333,8 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
303
333
|
const head = `<button type="button" class="ivt-gh${sec.kind === 'past' || sec.kind === 'later' || sec.status === 'skip' ? ' mut' : ''}" ${has ? `data-iv-fold="${esc(key)}" aria-expanded="${op}"` : 'disabled'}>${o.mark(sec)}<b>${esc(sec.label || sec.name)}</b>${sec.count ? `<span class="n${sec.warn ? ' w' : ''}">${esc(sec.count)}</span>` : ''}${has ? `<span class="iv-cv" aria-hidden="true">${SVG(op ? P.down : P.right, 15, 2)}</span>` : ''}</button>`;
|
|
304
334
|
h += row(head, sec.status === 'skip' && !has ? skipLine(si) : band(rs.concat(dn_)), ' g');
|
|
305
335
|
if (!op || !has) continue;
|
|
306
|
-
|
|
336
|
+
// a ticket in Jira whose task is linked to it (By epic) draws that task's bar: its dates are the task's, kept in PMOS
|
|
337
|
+
for (const t of tk) h += row(`${tkMark(t)}${tkTitle(t)}`, t.x ? barOf(t.x) : '', ' k', t.x ? nx(dn(t.x.start), dn(t.x.end)) : null);
|
|
307
338
|
for (const k of jr) h += row(`${jmark(k)}${ttitle(k)}${k.days ? `<span class="ivt-wn">· ${esc(k.days)}</span>` : ''}`, jbar(k), ' k', nx(dn(k.start), dn(k.due)));
|
|
308
339
|
for (const x of rs) h += trow(x);
|
|
309
340
|
// a stage with nothing open lists its done tasks straight away, as the List does: no "Done" fold inside the stage's own fold
|
|
@@ -321,7 +352,7 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
321
352
|
const vk = v.vs ? (v.vs.lines && v.vs.cmp ? `<span><i class="pl"></i>${esc((v.vs.cmp.kind === 'plan' ? 'Plan · ' : 'Draft · ') + v.vs.cmp.name)}</span>` : '') + (v.vs.draft ? '<span><i class="dr"></i>Draft</span>' : '') : '';
|
|
322
353
|
const legend = `<div class="ivt-lg">${v.vs && v.vs.draft ? '' : '<span><i class="to"></i>To do</span><span><i class="pr"></i>In progress</span><span><i class="lt"></i>Late</span>'}<span><i class="dd"></i>Due only</span>${vk}`
|
|
323
354
|
+ (/class="ivt-ng"/.test(h) ? '<span><i class="ng"></i>No activity</span>' : '') + (/class="ivt-sk"/.test(h) ? `<span>${SVG(P.skip, 12, 2)}Skipped</span>` : '')
|
|
324
|
-
+ `${guides ? `<span>${SVG(P.dia, 11, 2.4)}Milestone</span>` : ''}<span>${SVG(P.jira, 12, 2)}Jira</span>${LK.legendHtml(o.lk)}${o.quick ? `<span class="h">${o.lk && o.lk.links.length ? 'Drag a bar to move it, an end to change dates, a dot to link it' : 'Drag a bar to move it; drag an end to change start or due'}</span>` : ''}
|
|
355
|
+
+ `${guides ? `<span>${SVG(P.dia, 11, 2.4)}Milestone</span>` : ''}<span>${SVG(P.jira, 12, 2)}Jira</span>${LK.legendHtml(o.lk)}${o.quick ? `<span class="h">${o.lk && o.lk.links.length ? 'Drag a bar to move it, an end to change dates, a dot to link it' : 'Drag a bar to move it; drag an end to change start or due'}</span>` : ''}</div>`;
|
|
325
356
|
// it opens on today, moved left as far as the earliest open task's start, so a late bar is in view
|
|
326
357
|
const firstOpen = S.flatMap(flat).flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null);
|
|
327
358
|
const first = firstOpen.length ? X(Math.min(...firstOpen)) : X(today);
|
|
@@ -400,7 +431,7 @@ export function allHtml(v, o, isOpen) {
|
|
|
400
431
|
// its tasks: tickets drafted, Jira, the open tasks, then the done ones (quieter)
|
|
401
432
|
const trow = (lc, ttl, bar, p0, cls = '') => `<div class="iva-r k${cls}"><span class="iva-n">${lc}</span><span class="iva-l" data-tlp="${p0}">${ttl}</span><span class="iva-c">${bar}</span></div>`;
|
|
402
433
|
// the words after a title: a phone says the dates and the late days; a desktop the late days or "you" only (XvpD3Timeline)
|
|
403
|
-
const tline = (x) => title(x, o)
|
|
434
|
+
const tline = (x) => title(x, o, true)
|
|
404
435
|
+ (x.days ? `<span class="ivt-wn">· ${esc(x.days)}${x.lateText ? `<b>, ${esc(x.lateText)}</b>` : ''}</span>` : '')
|
|
405
436
|
+ (x.lateText && !x.closed ? `<span class="iva-nt lt">${esc(x.lateText)}</span>` : x.owner === 'You' && !x.closed ? '<span class="iva-nt you">you</span>' : '')
|
|
406
437
|
+ (!x.days && o.quick && x.uid && !x.closed ? ' ' + dateBtn(x, o) : '');
|
|
@@ -410,12 +441,12 @@ export function allHtml(v, o, isOpen) {
|
|
|
410
441
|
const lb = esc((x.days || '') + (o.quick && x.uid && !x.closed ? '. Change the dates' : ''));
|
|
411
442
|
const at = o.quick && x.uid && !x.closed ? `data-ivt-bar="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}"` : '';
|
|
412
443
|
const tag = at ? 'button' : 'span', open0 = at ? 'button type="button"' : 'span';
|
|
413
|
-
if (x.ms && b != null) return `<${open0} class="iva-md${x.done ? ' dn' : x.late ? ' lt' : ''}" ${at} data-tlx="${pc(b)}" aria-label="${lb}"></${tag}>`;
|
|
444
|
+
if (x.ms && b != null) return `<${open0} class="iva-md${x.done ? ' dn' : x.late ? ' lt' : ''}" ${at}${at ? ` data-one="1" data-t="${esc(x.title)}"` : ''} data-tlx="${pc(b)}" aria-label="${lb}"></${tag}>`;
|
|
414
445
|
const s0 = a == null ? b : a, e0 = b == null ? a : Math.max(a, b);
|
|
415
446
|
return `<${open0} class="iva-tb ${cls}" ${at} data-tlx="${pc(s0)}" data-tlw="${pw(s0, e0)}" aria-label="${lb}"></${tag}>`;
|
|
416
447
|
};
|
|
417
448
|
const p0 = (x) => { const n = dn(x.start) != null ? dn(x.start) : dn(x.end); return n == null ? 0 : fr(n).toFixed(4); };
|
|
418
|
-
for (const t of tk) h += trow(tkMark(t), tkTitle(t), '', 0);
|
|
449
|
+
for (const t of tk) h += trow(tkMark(t), tkTitle(t), t.x ? tbar(t.x) : '', t.x ? p0(t.x) : 0);
|
|
419
450
|
for (const k of jr) { const r = jiraRow(k); h += trow(jmark(k), ttitle(k) + (k.days ? `<span class="ivt-wn">· ${esc(k.days)}</span>` : ''), tbar({ ...r, title: k.title }), p0(r)); }
|
|
420
451
|
for (const x of rs) h += trow(x.ms ? dia : box(x, o), tline(x), tbar(x), p0(x));
|
|
421
452
|
for (const x of dn_) h += trow(x.ms ? dia : box(x, o), tline(x), tbar(x), p0(x), ' x' + (x.wont ? ' wo' : ''));
|
|
@@ -461,7 +492,7 @@ export function kanbanHtml(v, o, isOpen) {
|
|
|
461
492
|
return `<div class="ivk-d jr">${jmark(t)}<div class="w">${ttitle(t)}<div class="ivk-m">${d != null ? `<span>${esc(md(d))}</span>` : ''}${t.av ? `<span class="ivt-av" aria-hidden="true">${esc(t.av)}</span>` : ''}</div></div></div>`;
|
|
462
493
|
}
|
|
463
494
|
const x = c.x;
|
|
464
|
-
return `<div class="ivk-d${x.closed ? ' x' : ''}${x.wont ? ' wo' : ''}${x.dr ? ' dr' : ''}"${o.quick && x.uid ? ` draggable="true" data-ivk-card="${esc(x.uid)}" data-st="${esc(x.status)}"` : ''}>${box(x, o)}<div class="w">${title(x, o)}`
|
|
495
|
+
return `<div class="ivk-d${x.closed ? ' x' : ''}${x.wont ? ' wo' : ''}${x.dr ? ' dr' : ''}${x.jkey ? ' jr' : ''}"${o.quick && x.uid && !x.jkey ? ` draggable="true" data-ivk-card="${esc(x.uid)}" data-st="${esc(x.status)}"` : ''}>${box(x, o)}<div class="w">${title(x, o, msInDate(x))}`
|
|
465
496
|
+ `<div class="ivk-m">${dateBtn(x, o)}${LK.metaHtml(x, o.lk, o.quick)}${x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : ''}</div></div></div>`;
|
|
466
497
|
};
|
|
467
498
|
const wop = isOpen('kb:wont', false), nW = by["Won't do"].length;
|
|
@@ -475,9 +506,9 @@ export function kanbanHtml(v, o, isOpen) {
|
|
|
475
506
|
|
|
476
507
|
/* ── the popovers: the task card's own status segment and date picker, opened right under the press ── */
|
|
477
508
|
let POP = null;
|
|
478
|
-
function closePop() { if (!POP) return; const { el, anchor, scrim } = POP; POP = null; el.remove(); if (scrim) scrim.remove(); if (anchor && anchor.isConnected) anchor.setAttribute('aria-expanded', 'false'); }
|
|
509
|
+
export function closePop() { if (!POP) return; const { el, anchor, scrim } = POP; POP = null; el.remove(); if (scrim) scrim.remove(); if (anchor && anchor.isConnected) anchor.setAttribute('aria-expanded', 'false'); }
|
|
479
510
|
/** o.sheet: a bottom sheet over a scrim (a phone); o.right: the popover's right edge under the press's right edge. */
|
|
480
|
-
function openPop(anchor, html, onPress, o = {}) {
|
|
511
|
+
export function openPop(anchor, html, onPress, o = {}) {
|
|
481
512
|
closePop(); cardStyle();
|
|
482
513
|
const el = document.createElement('div');
|
|
483
514
|
el.className = 'tkc ivq' + (o.sheet != null ? ' vs-pop' : '') + (o.sheet ? ' sheet' : ''); el.dataset.escLayer = ''; el.innerHTML = html; // data-esc-layer: Escape closes this first, not the Viewer
|
|
@@ -526,19 +557,28 @@ export function msToggleHtml(on, attr) {
|
|
|
526
557
|
const tip = on ? 'A milestone. Press to make it a plain task' : 'Make it a milestone: its due date shows as ◇ on the Board and the timeline';
|
|
527
558
|
return `<button type="button" class="ivq-ms${on ? ' on' : ''}" ${attr} aria-pressed="${!!on}" aria-label="${esc(on ? 'Milestone' : 'Make it a milestone')}" title="${esc(tip)}">${SVG(P.dia, 15, 2)}${on ? 'Milestone' : ''}</button>`;
|
|
528
559
|
}
|
|
529
|
-
function statusPop(anchor, uid, status, H) {
|
|
530
|
-
|
|
531
|
-
|
|
560
|
+
export function statusPop(anchor, uid, status, H) {
|
|
561
|
+
// the open row's status chip (batch 18 item 16, StA2cStatus) is the five icons only: its ⋯ holds the ◇ and Delete
|
|
562
|
+
const plain = anchor.dataset.plain === '1';
|
|
563
|
+
const ms = !plain && H.milestone && anchor.dataset.ms != null ? anchor.dataset.ms === '1' : null;
|
|
564
|
+
openPop(anchor, statusPopHtml(status, ms, !plain && !!H.remove && deletable(uid)), (b) => {
|
|
532
565
|
if ('ivqMs' in b.dataset) { closePop(); H.milestone(uid, !ms); return; }
|
|
533
566
|
if ('ivqDel' in b.dataset) { closePop(); H.remove(uid); return; }
|
|
534
567
|
const s = b.dataset.ivqState; if (!s) return; closePop(); if (s !== status && H.status) H.status(uid, s);
|
|
535
568
|
});
|
|
536
569
|
}
|
|
537
|
-
|
|
538
|
-
|
|
570
|
+
/** The date picker under a date press (a bottom sheet on a phone, batch 18 item 16 StA3Dates). The press says where it starts: data-f
|
|
571
|
+
* 'start' opens on the start (the open row's Start chip); data-one: a milestone's one day, "◇ Date" with no Start and Due tabs (StA4Milestone). */
|
|
572
|
+
export function datePop(anchor, uid, H) {
|
|
573
|
+
const one = anchor.dataset.one === '1', sheet = PHONE();
|
|
574
|
+
const t = { start: one ? '' : anchor.dataset.s || '', due: anchor.dataset.e || '' }, st = { field: !one && anchor.dataset.f === 'start' ? 'start' : 'due', month: '', one };
|
|
575
|
+
const nm = anchor.dataset.t || '';
|
|
576
|
+
if (sheet) st.head = `<div class="ivd-h">${one ? SVG(P.dia, 15, 2.2) : SVG(P.cal, 15, 2)}<b>${one ? 'Date' : 'Dates'}</b><button type="button" class="iv-ib" data-ivd-x aria-label="Close" title="Close">${SVG('M6 6l12 12M18 6L6 18', 16, 2)}</button></div>`
|
|
577
|
+
+ (nm ? `<p class="ivd-s">${esc(nm + (one ? ' · one date: the milestone' : ''))}</p>` : '');
|
|
539
578
|
const draw = () => { if (!POP || POP.anchor !== anchor) return; POP.el.innerHTML = datePickerHtml(t, st); };
|
|
540
579
|
openPop(anchor, datePickerHtml(t, st), (b) => {
|
|
541
580
|
const d = b.dataset;
|
|
581
|
+
if ('ivdX' in d) { closePop(); return; }
|
|
542
582
|
if (d.tkcField) { st.field = d.tkcField; st.month = ''; draw(); return; }
|
|
543
583
|
if (d.tkcMonth) { st.month = d.tkcMonth; draw(); return; }
|
|
544
584
|
if (d.tkcDay == null) return;
|
|
@@ -549,7 +589,7 @@ function datePop(anchor, uid, H) {
|
|
|
549
589
|
if (H.dates) H.dates(uid, p);
|
|
550
590
|
// after the start, the next tap is the due day; after the due day the picker closes
|
|
551
591
|
if (f === 'start' && iso) { st.field = 'due'; st.month = ''; draw(); } else closePop();
|
|
552
|
-
});
|
|
592
|
+
}, sheet ? { sheet: true } : {});
|
|
553
593
|
}
|
|
554
594
|
function menuPop(anchor, label, items, go) {
|
|
555
595
|
const html = `<div class="tkc-pop ivq-m" role="menu" aria-label="${esc(label)}">${items.map((x, i) => `<button type="button" role="menuitemradio" class="o${x.on ? ' hl' : ''}" aria-checked="${!!x.on}" data-ivq-i="${i}"><span class="ck" aria-hidden="true">${x.on ? SVG(P.check, 14, 2.4) : ''}</span><span>${esc(x.label)}</span>${x.count ? `<span class="k">${esc(x.count)}</span>` : ''}</button>`).join('')}</div>`;
|
|
@@ -612,8 +652,26 @@ export function wireDrag(body, after) {
|
|
|
612
652
|
sc.scrollLeft = SCROLL.has(k) ? SCROLL.get(k) : Math.max(0, Math.min((+T.dataset.today || 0) - Math.max(0, sc.clientWidth - nw) * 0.25, (+T.dataset.first || 0) - 16));
|
|
613
653
|
// an earlier start fades in at the left edge once the Timeline is scrolled from its start (XvpA3bMonths)
|
|
614
654
|
const fade = () => T.classList.toggle('scl', sc.scrollLeft > 2);
|
|
615
|
-
|
|
616
|
-
|
|
655
|
+
// an axis label cut by the left edge (or the name column) or under the Today chip is hidden, not half drawn (0.442.0 hotfix: "5", "9")
|
|
656
|
+
const cut = () => {
|
|
657
|
+
const c = sc.getBoundingClientRect(), ch = T.querySelector('.ivt-today i'), t = ch ? ch.getBoundingClientRect() : null;
|
|
658
|
+
for (const e of T.querySelectorAll('.ivt-r.ax .ivt-c span')) {
|
|
659
|
+
const r = e.getBoundingClientRect(), x0 = r.left + 4;
|
|
660
|
+
e.classList.toggle('cut', x0 < c.left + nw - 1 || r.right > c.right + 1 || (!!t && r.right > t.left - 4 && x0 < t.right + 4));
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
// a phone: each title starts at its bar's start, but slides back from the right edge so it is whole on the screen (0.442.0 hotfix)
|
|
664
|
+
const fit = () => {
|
|
665
|
+
if (T.offsetWidth >= 520) return;
|
|
666
|
+
const L = sc.scrollLeft, vw = sc.clientWidth;
|
|
667
|
+
for (const n of T.querySelectorAll('.ivt-r.k .ivt-n[data-tln]')) {
|
|
668
|
+
const kids = [...n.children], w = kids.reduce((a, c) => a + (c.classList.contains('iv-tt') ? c.scrollWidth : c.offsetWidth), 0) + 8 * Math.max(0, kids.length - 1) + 12;
|
|
669
|
+
n.style.setProperty('--tl-fw', (vw - 24) + 'px'); // its content: the padding takes the other 12
|
|
670
|
+
n.style.setProperty('--tl-fl', Math.max(0, Math.min(+n.dataset.tln || 0, L + vw - Math.min(w, vw - 12) - 4)) + 'px');
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
fade(); cut(); fit();
|
|
674
|
+
sc.addEventListener('scroll', () => { SCROLL.set(k, sc.scrollLeft); fade(); cut(); fit(); }, { passive: true });
|
|
617
675
|
}
|
|
618
676
|
if (after) after();
|
|
619
677
|
};
|
|
@@ -178,7 +178,7 @@ const draftTask = (id, uid) => { const R = ROWS.get(id); return R && R.d ? R.d.t
|
|
|
178
178
|
const iniOfUid = (uid) => { for (const [id, R] of ROWS) if (R.d && R.d.tasks.some((x) => x.uid === uid)) return id; return null; };
|
|
179
179
|
async function draftDates(H, uid, patch) {
|
|
180
180
|
const id = iniOfUid(uid), x = id && draftTask(id, uid);
|
|
181
|
-
const set = {}; if ('start' in patch) set.start = patch.start || ''; if ('due' in patch) set.due = patch.due || '';
|
|
181
|
+
const set = {}; if ('start' in patch) set.start = patch.start || ''; if ('due' in patch) set.due = patch.due || ''; if ('milestone' in patch) set.milestone = !!patch.milestone;
|
|
182
182
|
const res = await write(H, '/task', { task: uid, set });
|
|
183
183
|
if (!res || res.ok === false) return failed(H, res);
|
|
184
184
|
took(id, res); if (H.redraw) H.redraw();
|
|
@@ -186,6 +186,16 @@ async function draftDates(H, uid, patch) {
|
|
|
186
186
|
say(H, 'Dates saved in ' + name + (x ? ': ' + x.title : '') + '.', res.from ? async () => { const u = await write(H, '/task', { task: uid, set: res.from }); if (u && u.ok) { took(id, u); if (H.redraw) H.redraw(); } else failed(H, u, 'The undo did not land.'); } : undefined);
|
|
187
187
|
return true;
|
|
188
188
|
}
|
|
189
|
+
/** One change to a draft's task (its name or its stage), with Undo. */
|
|
190
|
+
async function draftSet(H, uid, set, words) {
|
|
191
|
+
const id = iniOfUid(uid), x = id && draftTask(id, uid);
|
|
192
|
+
const res = await write(H, '/task', { task: uid, set });
|
|
193
|
+
if (!res || res.ok === false) return failed(H, res);
|
|
194
|
+
took(id, res); if (H.redraw) H.redraw();
|
|
195
|
+
const R = ROWS.get(id), name = R && R.vs ? R.vs.show.name : 'the draft';
|
|
196
|
+
say(H, words + name + (x ? ': ' + x.title : '') + '.', res.from ? async () => { const u = await write(H, '/task', { task: uid, set: res.from }); if (u && u.ok) { took(id, u); if (H.redraw) H.redraw(); } else failed(H, u, 'The undo did not land.'); } : undefined);
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
189
199
|
async function draftStatus(H, uid, state) {
|
|
190
200
|
const id = iniOfUid(uid), x = id && draftTask(id, uid);
|
|
191
201
|
const R = ROWS.get(id), name = R && R.vs ? R.vs.show.name : 'the draft';
|
|
@@ -338,11 +348,15 @@ export function wrap(h, body, shown) {
|
|
|
338
348
|
W.dates = (uid, patch) => (isDraft(uid) ? draftDates(W, uid, patch) : h.dates && h.dates(uid, patch));
|
|
339
349
|
if (h.remove) W.remove = (uid) => (isDraft(uid) ? draftDrop(W, uid) : h.remove(uid));
|
|
340
350
|
W.openTask = (uid, b) => (isDraft(uid) ? undefined : h.openTask && h.openTask(uid, b));
|
|
341
|
-
|
|
351
|
+
// opt (batch 18 item 16): the stage whose + took the task ({ section, name, start?, due? }); without it, the stage now
|
|
352
|
+
W.addTask = async (title, inp, opt) => {
|
|
342
353
|
const id = idOf(), v = id && shown ? shown(id) : null;
|
|
343
354
|
const now = v && v.tasks ? v.tasks.sections.find((s) => s.kind === 'stage' && s.status === 'now') : null;
|
|
344
|
-
if (id && await draftAdd(W, id, title, inp, now ? now.key : '')) return;
|
|
345
|
-
return h.addTask && h.addTask(title, inp);
|
|
355
|
+
if (id && await draftAdd(W, id, title, inp, opt && opt.section != null ? opt.section : now ? now.key : '')) return;
|
|
356
|
+
return h.addTask && h.addTask(title, inp, opt);
|
|
346
357
|
};
|
|
358
|
+
// a draft's task renamed or moved in place (batch 18 item 16): the draft changes, Live is not touched
|
|
359
|
+
W.rename = (uid, title) => (isDraft(uid) ? draftSet(W, uid, { title }, 'Renamed in ') : h.rename && h.rename(uid, title));
|
|
360
|
+
W.move = (uid, m) => (isDraft(uid) ? draftSet(W, uid, { section: m.to }, 'Moved in ') : h.move && h.move(uid, m));
|
|
347
361
|
return W;
|
|
348
362
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* iniView(r, ctx) → { summary, stage, tasks, vs } the whole view, as data (vs: what pm/ini-versions.js rowFor put on the row, or null)
|
|
8
8
|
* ctx: { steps (Product feature's eight, the model's), today (YYYY-MM-DD, the model's day), usual ({ days } | null, the usual days in the
|
|
9
|
-
* current stage), grill ({ open, later } | null), program ({ id, title } | null), jiraAt ('Jira · 2h ago' | ''), ask ({ title } | null: a
|
|
9
|
+
* current stage), grill ({ open, later } | null), program ({ id, title } | null), jiraAt ('Jira · 2h ago' | ''), jiraReadAt (the ISO time of the last Jira read: an open Jira row says "read 4 min ago"), ask ({ title } | null: a
|
|
10
10
|
* session that waits on the PM, Home's; n: how many wait on this initiative), docs (count | null), linked (count | null), claude (Claude's
|
|
11
11
|
* line while a session works on it, Home's), people ([{ name }]: the stakeholders) }
|
|
12
12
|
* stagesOf(r, steps) → { list: [{ key, name, ms, status: done | now | next | skip, why }], cur } the initiative's OWN workflow (D99)
|
|
@@ -113,7 +113,12 @@ export function statusOf(r, grill, fmt) {
|
|
|
113
113
|
/* a Jira ticket's dates as words (batch 11 item 23): the start and due the PM keeps in PMOS, else the sprint's end */
|
|
114
114
|
const jDays = (k, today) => { const e = k.due || k.sprintEnd || ''; return k.start && e ? span(k.start, e, today) : k.start ? 'from ' + dateY(k.start, today) : e ? dateY(e, today) : ''; };
|
|
115
115
|
/* ── one task row ── */
|
|
116
|
-
|
|
116
|
+
/** The PMOS status a Jira status reads as: Done, In progress (review and test count as work under way), else To do. */
|
|
117
|
+
const jiraBucket = (st) => (/^(done|closed|resolved|released)$/i.test(String(st || '')) ? 'Done' : /progress|review|test|\bqa\b|doing|started|block/i.test(String(st || '')) ? 'In progress' : 'To do');
|
|
118
|
+
/** k: the task as stored; J: the Jira ticket its title names, when PMOS read that ticket (0.442.0 hotfix, Wawan 13:02 and 13:03). A linked task's
|
|
119
|
+
* status is the ticket's; its start and due stay the PM's, kept in PMOS: Jira's start and due show only while the task has none of its own. */
|
|
120
|
+
function rowOf(k0, today, J = null) {
|
|
121
|
+
const k = J ? { ...k0, status: jiraBucket(J.status), start: k0.start || J.start || '', end: k0.end || J.due || J.sprintEnd || '' } : k0;
|
|
117
122
|
const closed = CLOSED.has(k.status), d = dayOf(k.end), late = !closed && !!d && d < today;
|
|
118
123
|
// start and end both (batch 7 item 6): "Oct 15 – Oct 28", one day once, "from Oct 15" with no end
|
|
119
124
|
const days = k.start && k.end ? span(k.start, k.end, today) : k.start ? 'from ' + dateY(k.start, today) : d ? dateY(k.end, today) : '';
|
|
@@ -123,20 +128,36 @@ function rowOf(k, today) {
|
|
|
123
128
|
return { uid: k.uid, title: k.title, status: k.status || 'To do', closed, done: k.status === 'Done', wont: k.status === "Won't do", prog: k.status === 'In progress', late, due,
|
|
124
129
|
days, lateText: late ? plural(between(d, today), 'day', 'days') + ' late' : '', item: !!k.item, ms: !!k.milestone, // ms: the ◇ flag (batch 11 item 3)
|
|
125
130
|
start: k.start || '', end: k.end || '', owner: who, av: initials(k.owner),
|
|
126
|
-
|
|
131
|
+
// the open row's date chips (batch 18 item 16): each day alone; rank: the PM's order inside its stage (a task-order line)
|
|
132
|
+
startText: k.start ? dateY(k.start, today) : '', dueText: d ? dateY(k.end, today) : '', rank: Number.isFinite(k.rank) ? k.rank : null,
|
|
133
|
+
sub: [k.status === 'In progress' ? 'In progress' : '', due, who && who !== 'You' ? who : ''].filter(Boolean).join(' · '), wbs: wbsOf(k.title), canCheck: !!k.uid && !k.draft && !J, order: k.order,
|
|
127
134
|
// planned versus actual (batch 11 item 8, pm/ini-versions.js): the compared version's days where they differ, ⊕ added after it, a draft's task
|
|
128
|
-
cmp: k.cmp || null, added: !!k.added, dr: !!k.draft,
|
|
135
|
+
cmp: k.cmp || null, added: !!k.added, dr: !!k.draft,
|
|
136
|
+
// jkey: the key of the Jira ticket the task is linked to, only when PMOS read that ticket; jst: its own Jira status (it owns the status)
|
|
137
|
+
jkey: J ? J.key : '', jst: J ? String(J.raw || J.status || '') : '', _k: k0, _t: today };
|
|
138
|
+
}
|
|
139
|
+
/** The Jira keys a task's title holds ("MSD-4376 Navigation tabs" → ['MSD-4376']). A task whose title names a ticket PMOS read IS that ticket
|
|
140
|
+
* (linkOf): it shows the Jira mark and the key once, its status is Jira's, and the ticket's own row does not show again (batch 11 item 4,
|
|
141
|
+
* batch 14 item 6). A key PMOS has not read stays text in a plain task: it looks like a ticket only when it is one (0.442.0 hotfix). */
|
|
142
|
+
const KEY_RE = /\b([A-Z][A-Z0-9]+-\d+)\b/g;
|
|
143
|
+
export const jiraKeysOf = (title) => [...String(title || '').matchAll(KEY_RE)].map((m) => m[1]);
|
|
144
|
+
export const jiraKeyOf = (title) => jiraKeysOf(title)[0] || '';
|
|
145
|
+
/** The read ticket a title names, from a Map key → ticket, or null. */
|
|
146
|
+
export const linkOf = (title, byKey) => { for (const k of jiraKeysOf(title)) if (byKey && byKey.has(k)) return byKey.get(k); return null; };
|
|
147
|
+
/** The rows of a view linked again with more tickets (the drafted tickets that are in Jira, read by pm/ini-groups.js): a row not linked yet
|
|
148
|
+
* whose title names one of them becomes that ticket. tickets: [{ key, status }]. */
|
|
149
|
+
export function linkRows(rows, tickets) {
|
|
150
|
+
const by = new Map((tickets || []).filter((t) => t && t.key).map((t) => [t.key, t]));
|
|
151
|
+
if (!by.size) return rows;
|
|
152
|
+
return rows.map((x) => { if (x.jkey || !x._k) return x; const J = linkOf(x.title, by); return J ? { ...rowOf(x._k, x._t, J), sec: x.sec } : x; });
|
|
129
153
|
}
|
|
130
|
-
/** The Jira key a task's title starts with ("MSD-4376 Navigation tabs" → 'MSD-4376'), or ''. A task named for a ticket IS that ticket:
|
|
131
|
-
* Build's section shows it once, as the task (it carries the dates and the owner), not again as a Jira row (batch 11 item 4), and it looks
|
|
132
|
-
* like a ticket: the Jira square and the key in blue (batch 14 item 6). */
|
|
133
|
-
const KEY_RE = /^\s*([A-Z][A-Z0-9]+-\d+)\b/;
|
|
134
|
-
export const jiraKeyOf = (title) => { const m = KEY_RE.exec(String(title || '')); return m ? m[1] : ''; };
|
|
135
154
|
const urgent = (a, b) => (b.late - a.late) || (a.end || '9999').localeCompare(b.end || '9999') || (a.order != null && b.order != null ? a.order - b.order : 0);
|
|
155
|
+
/* the PM's own order inside a stage (batch 18 item 16, a drag in the List) leads: the ranked tasks top to bottom, then the rest by urgency */
|
|
156
|
+
const ranked = (a, b) => (a.rank != null && b.rank != null ? a.rank - b.rank : a.rank != null ? -1 : b.rank != null ? 1 : urgent(a, b));
|
|
136
157
|
/** A section's rows: open ones first by urgency; past 5 open, the 3 most urgent then the rest folded by the next WBS level; done fold last
|
|
137
158
|
* (Won't do joins it), then the archived ones, which only the List draws, folded after Done (batch 9 item 5b). */
|
|
138
|
-
function bodyOf(rows, archived = []) {
|
|
139
|
-
const open = rows.filter((x) => !x.closed).sort(
|
|
159
|
+
export function bodyOf(rows, archived = []) {
|
|
160
|
+
const open = rows.filter((x) => !x.closed).sort(ranked), done = rows.filter((x) => x.closed);
|
|
140
161
|
if (open.length <= 5) return { top: open, groups: [], done, archived };
|
|
141
162
|
const top = open.slice(0, 3), rest = open.slice(3), by = new Map();
|
|
142
163
|
for (const x of rest) { const k = x.wbs ? x.wbs.top : ''; if (!by.has(k)) by.set(k, []); by.get(k).push(x); }
|
|
@@ -144,7 +165,7 @@ function bodyOf(rows, archived = []) {
|
|
|
144
165
|
const groups = [...by.entries()].map(([k, xs]) => {
|
|
145
166
|
const codes = xs.map((x) => x.wbs && x.wbs.code).filter(Boolean).sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
|
|
146
167
|
const label = !k ? 'Other open tasks' : heads.get(k) ? k + ' ' + heads.get(k) : codes.length > 1 ? codes[0] + ' to ' + codes[codes.length - 1] : codes[0] || k;
|
|
147
|
-
return { key: k || '-', label, rows: xs.sort(
|
|
168
|
+
return { key: k || '-', label, rows: xs.sort(ranked), n: xs.length };
|
|
148
169
|
});
|
|
149
170
|
// one group only says nothing the count does not: then it is "N more open"
|
|
150
171
|
if (groups.length === 1) groups[0].label = plural(rest.length, 'more open', 'more open');
|
|
@@ -157,14 +178,16 @@ export function iniView(r, ctx = {}) {
|
|
|
157
178
|
const today = todayOf(ctx), t = r.track || {}, tr = r.trail || {};
|
|
158
179
|
const { list, cur } = stagesOf(r, ctx.steps);
|
|
159
180
|
const T = (r.tasks || []).filter((k) => k.status !== 'Archived');
|
|
160
|
-
|
|
181
|
+
// the Jira tickets PMOS read for this initiative: a task whose title names one is linked to it
|
|
182
|
+
const byKey = new Map((t.tickets || []).filter((k) => k && k.key).map((k) => [k.key, k]));
|
|
183
|
+
const rows = T.map((k) => ({ ...rowOf(k, today, linkOf(k.title, byKey)), sec: sectionOf(k, list) }));
|
|
161
184
|
// archived tasks count nowhere and show in no view but the List's Archived fold (batch 9 item 5b)
|
|
162
|
-
const arch = (r.tasks || []).filter((k) => k.status === 'Archived').map((k) => ({ ...rowOf(k, today), sec: sectionOf(k, list) }));
|
|
185
|
+
const arch = (r.tasks || []).filter((k) => k.status === 'Archived').map((k) => ({ ...rowOf(k, today, linkOf(k.title, byKey)), sec: sectionOf(k, list) }));
|
|
163
186
|
const archOf = (keys) => arch.filter((x) => keys.includes(x.sec));
|
|
164
187
|
const open = rows.filter((x) => !x.closed), late = open.filter((x) => x.late);
|
|
165
188
|
const jira = !ownWf(r) && (t.key === 'build' || t.key === 'deliver') && (t.tickets || []).length > 0;
|
|
166
189
|
// a ticket a task is named for shows once, as the task: it is not drawn or counted again as a Jira row
|
|
167
|
-
const named = new Set(
|
|
190
|
+
const named = new Set(rows.concat(arch).map((x) => x.jkey).filter(Boolean));
|
|
168
191
|
const tkOwn = (t.tickets || []).filter((k) => !named.has(k.key));
|
|
169
192
|
|
|
170
193
|
// the dates each stage ran: its board moves, oldest first; the first stage starts with the plan
|
|
@@ -273,7 +296,7 @@ export function iniView(r, ctx = {}) {
|
|
|
273
296
|
summary.wf = r.wf || { id: PF_ID, name: 'Product feature', icon: 'feature' };
|
|
274
297
|
summary.program = ctx.program || null;
|
|
275
298
|
const today2 = (n) => String(n).padStart(2, '0');
|
|
276
|
-
return { vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jira ? ctx.jiraAt || '' : '',
|
|
299
|
+
return { vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jira ? ctx.jiraAt || '' : '', jiraRead: ctx.jiraReadAt || '',
|
|
277
300
|
// split or merge (batch 11 item 14): Claude's suggestion for it, and where its work went when it was merged
|
|
278
301
|
suggest: r.suggest || null, merged: mergedOf(r),
|
|
279
302
|
// what Claude proposes under the one blue ✦, and what a ✓ kept from elsewhere (batch 12 items 2, 3 and 4; pm/ini-props.js)
|
|
@@ -341,15 +364,19 @@ export function groupSections(tasks, by, L, T) {
|
|
|
341
364
|
if (arch.length) out.push(sec('group', 's:Archived', 'Archived', [], { archived: arch, open: false }));
|
|
342
365
|
} else if (by === 'epic') {
|
|
343
366
|
const G = ticketGroups(T), pushed = new Set(((T && T.tickets) || []).map((t) => t.key).filter(Boolean));
|
|
367
|
+
// a task linked to a ticket in Jira shows once: as that ticket, in its epic, carrying the task's dates (its bar on the Timeline)
|
|
368
|
+
const linked = new Map(all.concat(arch).filter((x) => x.jkey && pushed.has(x.jkey)).map((x) => [x.jkey, x]));
|
|
344
369
|
G.forEach((g, i) => out.push({ kind: 'epic', key: 'ep:' + g.id, label: g.name, sub: '', epicKey: g.key || '', gid: g.id, send: T.pushing ? 0 : g.send,
|
|
345
|
-
count: g.inJira === g.n ? g.n + ' in Jira' : (g.n - g.inJira) + ' drafted', warn: false, open: i === 0, top: [], groups: [], done: [], archived: [], jira: null,
|
|
370
|
+
count: g.inJira === g.n ? g.n + ' in Jira' : (g.n - g.inJira) + ' drafted', warn: false, open: i === 0, top: [], groups: [], done: [], archived: [], jira: null,
|
|
371
|
+
tk: g.rows.map((r) => (r.inJira && r.key && linked.has(r.key) ? { ...r, x: linked.get(r.key) } : r)) }));
|
|
346
372
|
// "Jira read at 9:02", said once, under the last epic that has a ticket in Jira
|
|
347
373
|
const lastJ = out.filter((x) => x.kind === 'epic' && x.tk.some((r) => r.inJira)).pop(); if (lastJ && T.checkedAt) lastJ.tkRead = T.checkedAt;
|
|
348
374
|
// nothing drafted: By epic says what comes next (every gap has its next action): Draft the tickets, or why there is nothing to draft
|
|
349
375
|
if (!G.length) out.push({ kind: 'epic', key: 'ep:', label: 'Jira tickets', sub: '', count: '', open: true, top: [], groups: [], done: [], archived: [], jira: null,
|
|
350
376
|
tkEmpty: !T ? { reading: true } : T.ok !== true ? { error: T.error || 'The tickets could not be read.' } : T.items ? { items: T.items } : { none: true } });
|
|
351
377
|
for (let i = jr.length - 1; i >= 0; i--) if (pushed.has(jr[i].key)) jr.splice(i, 1);
|
|
352
|
-
|
|
378
|
+
const own = (x) => !(x.jkey && linked.has(x.jkey));
|
|
379
|
+
out.push(sec('group', 'yours', 'Your tasks', all.filter(own), { archived: arch.filter(own), open: !G.length }));
|
|
353
380
|
const send = G.reduce((a, g) => a + g.send, 0), open = tasks.open || 0, meta = [open ? open + ' open' : '', 'grouped by epic'].filter(Boolean).join(' · ');
|
|
354
381
|
if (T && T.ok === true && T.pushing) sum = { line: 'Sending to Jira', tone: 'live', text: 'Claude is creating the tickets with your Atlassian connection. Each task shows its Jira key when it is done.', meta };
|
|
355
382
|
else if (send) sum = { line: plural(send, 'ticket is', 'tickets are') + ' drafted, not in Jira', tone: 'you', text: 'Each PRD story is a task with its Jira ticket drafted. Nothing reaches Jira until you send it.', meta, primary: { act: 'sendall', label: 'Send to Jira' } };
|