create-pmos 0.422.0 → 0.423.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 +13 -13
- 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/board-programs-test.js +28 -0
- package/workspace/briefing-premium-adddoc-test.js +1 -1
- package/workspace/briefing-premium-board-test.js +12 -10
- package/workspace/briefing-premium-initiative-test.js +30 -38
- package/workspace/changelog.json +12 -0
- package/workspace/guide/briefing-premium.md +1 -1
- package/workspace/guide/home.md +9 -2
- package/workspace/guide/programs.md +1 -0
- package/workspace/guide/workflows.md +5 -1
- package/workspace/ini-workflow-test.js +4 -4
- package/workspace/lib/board-premium.js +3 -2
- package/workspace/lib/custom-docs.js +65 -3
- package/workspace/lib/engine/boards.js +25 -2
- package/workspace/lib/initiative-writer.js +63 -1
- package/workspace/lib/plan-items.js +36 -5
- package/workspace/lib/programs.js +11 -3
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-board-premium.js +22 -0
- package/workspace/lib/routes-boards.js +50 -10
- package/workspace/lib/routes-initiatives.js +12 -0
- package/workspace/lib/routes-task-links.js +329 -0
- package/workspace/lib/split-merge-suggest.js +162 -0
- package/workspace/lib/split-merge.js +379 -0
- package/workspace/lib/task-cli.js +58 -5
- package/workspace/lib/task-items.js +14 -2
- package/workspace/lib/task-links.js +422 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +2 -2
- package/workspace/premium-core-doc-issue-test.js +2 -2
- package/workspace/premium-vw-backlog-test.js +3 -3
- package/workspace/premium-vw-item-test.js +3 -3
- package/workspace/premium-vw-jira-test.js +6 -6
- package/workspace/product-lane-test.js +165 -0
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +16 -6
- package/workspace/public/pm/bd-prog.js +6 -1
- package/workspace/public/pm/bd-span.js +69 -15
- package/workspace/public/pm/bd-views.js +3 -2
- package/workspace/public/pm/cozy-board.css +10 -0
- package/workspace/public/pm/home-app.js +25 -8
- package/workspace/public/pm/home-ini-model.js +0 -34
- package/workspace/public/pm/home-ini.js +72 -204
- package/workspace/public/pm/ini-groups.js +228 -0
- package/workspace/public/pm/ini-links.js +561 -0
- package/workspace/public/pm/ini-tasks.js +58 -22
- package/workspace/public/pm/ini-versions.js +14 -9
- package/workspace/public/pm/ini-view-model.js +88 -4
- package/workspace/public/pm/ini-view.css +259 -18
- package/workspace/public/pm/ini-view.js +140 -32
- package/workspace/public/pm/premium-board.js +54 -6
- package/workspace/public/pm/split-merge.css +77 -0
- package/workspace/public/pm/split-merge.js +265 -0
- package/workspace/public/pm/stage-line.js +414 -0
- package/workspace/public/pm/task-card.js +5 -3
- package/workspace/public/pm/wf-page.css +2 -0
- package/workspace/public/pm/wf-page.js +2 -0
- package/workspace/public/pm/wf-stage.js +2 -1
- package/workspace/server.js +15 -1
- package/workspace/split-merge-ui-test.js +175 -0
- package/workspace/stage-card-test.js +12 -11
- package/workspace/task-card-test.js +3 -2
- package/workspace/task-delete-test.js +126 -0
- package/workspace/task-links-test.js +227 -0
- package/workspace/task-milestones-test.js +1 -1
- package/workspace/task-plans-test.js +6 -0
- package/workspace/task-views-test.js +1 -1
- package/workspace/test-lists/bd-ini-panel.json +8 -2
- package/workspace/test-lists/product-lane.json +6 -0
- package/workspace/test-lists/split-merge.json +15 -0
- package/workspace/test-lists/task-delete.json +5 -0
- package/workspace/test-lists/task-links.json +6 -0
- package/workspace/tk-tasks-test.js +173 -57
- package/workspace/workflows-setup-test.js +4 -3
|
@@ -13,16 +13,17 @@
|
|
|
13
13
|
* wireDrag(body) once per body: drag a bar (move, or an end), drag a card between columns, long-press a box on a phone
|
|
14
14
|
*
|
|
15
15
|
* The host's handlers (wireView's h): h.check(uid) the box's one-press Done (Undo in the host's toast), h.status(uid, state) and
|
|
16
|
-
* h.dates(uid, { start?, due? }) the quick changes (each with Undo), h.redraw(). A Jira ticket is read-only: the Jira mark, a plain date, no
|
|
16
|
+
* h.dates(uid, { start?, due? }) the quick changes (each with Undo), h.remove(uid) the picker's trash (batch 11 item 16: Delete, Undo in the toast), h.redraw(). A Jira ticket is read-only: the Jira mark, a plain date, no
|
|
17
17
|
* picker and no drag. Archived tasks show in no view here (the List folds them after Done). */
|
|
18
18
|
import { STATES, stateIcon, stateKey, datePickerHtml, cardStyle } from './task-card.js';
|
|
19
|
+
import * as LK from './ini-links.js'; // the links' marks on bars and cards (batch 11 item 15)
|
|
19
20
|
|
|
20
21
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
21
22
|
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
22
23
|
export const P = {
|
|
23
24
|
list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01', time: 'M4 6h9M8 12h11M6 18h7', kanban: 'M4 4h4v16H4zM10 4h4v10h-4zM16 4h4v13h-4z',
|
|
24
25
|
down: 'M7 10l5 5 5-5', right: 'M10 7l5 5-5 5', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', jira: 'M12 3l9 9-9 9-9-9z', check: 'M5 12l5 5 9-10',
|
|
25
|
-
dia: 'M12 4l8 8-8 8-8-8z', skip: 'M6 7l5 5-5 5M13 7l5 5-5 5',
|
|
26
|
+
dia: 'M12 4l8 8-8 8-8-8z', skip: 'M6 7l5 5-5 5M13 7l5 5-5 5', bin: 'M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13',
|
|
26
27
|
};
|
|
27
28
|
/** The small grey ◇ after a milestone task's title (batch 11 item 3), on every task row: List, Kanban, Timeline. The Jira mark is another
|
|
28
29
|
* shape (blue, nested) and stays as it is. */
|
|
@@ -44,6 +45,8 @@ export function setViewMode(m) { VIEW = m === 'timeline' || m === 'kanban' ? m :
|
|
|
44
45
|
const zoomOf = () => { if (!ZOOM) { const z = store.get('pmos.tasks.zoom'); ZOOM = ZOOMS.some((x) => x[0] === z) ? z : 'week'; } return ZOOM; };
|
|
45
46
|
/** For the tests: forget the PM's picks. */
|
|
46
47
|
export const resetViews = () => { VIEW = null; ZOOM = null; STAGE.clear(); SCROLL.clear(); };
|
|
48
|
+
/** The stage card's press on a stage (batch 11 item 21): the Kanban turns to that stage. */
|
|
49
|
+
export const setKanbanStage = (id, key) => { if (id && key != null) STAGE.set(id, key); };
|
|
47
50
|
|
|
48
51
|
/* ── days, as whole numbers (UTC, so a summer-time night never moves a bar) ── */
|
|
49
52
|
const DAY = /^(\d{4})-(\d{2})-(\d{2})/;
|
|
@@ -62,9 +65,15 @@ export function spanText(s, e) {
|
|
|
62
65
|
export function switchHtml(m) {
|
|
63
66
|
return `<div class="ivx-seg" role="group" aria-label="Tasks view">${VIEWS.map(([k, l, d]) => `<button type="button" class="ivx-sb" data-iv-view="${k}" aria-pressed="${m === k}" aria-label="${l}" title="${l}">${SVG(d, 17)}</button>`).join('')}</div>`;
|
|
64
67
|
}
|
|
65
|
-
/** The Kanban's stage choices: the current stage first, All stages, then the rest of the List's groups in their order, each with its count.
|
|
68
|
+
/** The Kanban's stage choices: the current stage first, All stages, then the rest of the List's groups in their order, each with its count.
|
|
69
|
+
* Grouped another way (batch 11 item 20) it is the group picker: All, then each group; By status has only All (its groups are the columns). */
|
|
66
70
|
export function stagesOf(v) {
|
|
67
|
-
const S = v.tasks.sections
|
|
71
|
+
const S = v.tasks.sections;
|
|
72
|
+
if (v.tasks.by && v.tasks.by !== 'stage') {
|
|
73
|
+
const all = { key: 'all', label: 'All', count: v.tasks.open ? v.tasks.open + ' open' : v.tasks.count };
|
|
74
|
+
return v.tasks.by === 'status' ? [all] : [all, ...S.map((s) => ({ key: s.key || '-', label: s.label || s.name, count: s.count }))];
|
|
75
|
+
}
|
|
76
|
+
const now = S.find((s) => s.kind === 'stage' && s.status === 'now');
|
|
68
77
|
const name = (s) => (s.kind === 'later' ? 'Later stages' : s.kind === 'none' ? 'Not in a stage' : s.label || s.name);
|
|
69
78
|
const all = { key: 'all', label: 'All stages', count: v.tasks.open ? v.tasks.open + ' open' : v.tasks.count };
|
|
70
79
|
const rest = S.filter((s) => s !== now).map((s) => ({ key: s.key || '-', label: name(s), count: s.count }));
|
|
@@ -78,7 +87,8 @@ export function headExtraHtml(v, m) {
|
|
|
78
87
|
}
|
|
79
88
|
if (m === 'kanban') {
|
|
80
89
|
const L = stagesOf(v), k = stageKeyOf(v), x = L.find((y) => y.key === k);
|
|
81
|
-
|
|
90
|
+
const what = v.tasks.by && v.tasks.by !== 'stage' ? 'Group' : 'Stage';
|
|
91
|
+
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>`;
|
|
82
92
|
}
|
|
83
93
|
return '';
|
|
84
94
|
}
|
|
@@ -87,6 +97,11 @@ export function headExtraHtml(v, m) {
|
|
|
87
97
|
const flat = (sec) => (sec.stages ? sec.stages.flatMap((s) => flat(s)) : [...sec.top, ...sec.groups.flatMap((g) => g.rows)]);
|
|
88
98
|
const flatDone = (sec) => (sec.stages ? sec.stages.flatMap((s) => flatDone(s)) : sec.done);
|
|
89
99
|
const jiraOf = (sec) => (sec.stages ? sec.stages.flatMap((s) => jiraOf(s)) : sec.jira ? sec.jira.open : []);
|
|
100
|
+
const tkOf = (sec) => (sec.stages ? sec.stages.flatMap((s) => tkOf(s)) : sec.tk || []); // By epic's tickets (batch 11 item 20)
|
|
101
|
+
/** A drafted or sent ticket of By epic: no box; a press opens the draft, or the ticket once it is in Jira (pm/ini-groups.js). */
|
|
102
|
+
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>`
|
|
103
|
+
: `<span class="ig-tkd" role="img" aria-label="Jira ticket drafted, not sent" title="Drafted, not in Jira">${SVG(P.jira, 14, 2)}</span>`);
|
|
104
|
+
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>`;
|
|
90
105
|
const box = (x, o) => {
|
|
91
106
|
// 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
|
|
92
107
|
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>';
|
|
@@ -105,11 +120,14 @@ export function slipHtml(x) {
|
|
|
105
120
|
const n = slipOf(x); if (!n) return '';
|
|
106
121
|
return ` <span class="vs-sl${n > 0 ? ' late' : ''}" role="img" aria-label="${esc((n > 0 ? n + ' days late' : -n + ' days early') + ' against the plan')}">${n > 0 ? '+' + n : '\u2212' + -n}d</span>`;
|
|
107
122
|
}
|
|
123
|
+
/** A Jira ticket as a row the date press and the bar drag know (batch 11 item 23): its key is the uid; the start and due are kept in PMOS,
|
|
124
|
+
* never sent to Jira. Status and title stay Jira's. */
|
|
125
|
+
export const jiraRow = (k) => ({ uid: k.key, start: k.start || '', end: k.due || '', title: k.key + ' ' + k.title, days: k.days || '', jira: true });
|
|
108
126
|
const ttitle = (k) => `<button type="button" class="iv-tt" data-iv-ticket="${esc(k.key)}"><em>${esc(k.key)}</em> ${esc(k.title)}</button>`;
|
|
109
127
|
/** The date press: the task card's start and due picker opens right under it. No dates: a calendar icon, shown on hover. */
|
|
110
128
|
export function dateBtn(x, o) {
|
|
111
129
|
if (!o.quick || !x.uid) return x.days ? `<span class="${x.late ? 'w' : ''}">${esc(x.days)}</span>` : '';
|
|
112
|
-
const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" title="Start and due"`;
|
|
130
|
+
const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" title="${x.jira ? 'Start and due, kept in PMOS. Jira is not changed' : 'Start and due'}"`;
|
|
113
131
|
// a milestone with no due date: a dashed chip asks for it, shown always (canvas XmlA6Suggest)
|
|
114
132
|
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>`;
|
|
115
133
|
return x.days ? `<button type="button" class="iv-dc${x.late ? ' w' : ''}" ${a} aria-label="${esc('Dates: ' + x.days + '. Change')}">${esc(x.days)}</button>`
|
|
@@ -148,12 +166,13 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
148
166
|
const barOf0 = (x) => {
|
|
149
167
|
const a = dn(x.start), b = dn(x.end), cls = tone(x) + (x.dr ? ' dr' : ''), lbl = [x.days || 'No dates', x.owner && x.owner !== 'You' ? x.owner : '', x.closed ? x.status.toLowerCase() : x.late ? 'late' : x.prog ? 'in progress' : ''].filter(Boolean).join(', ');
|
|
150
168
|
const av = x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : '';
|
|
151
|
-
const
|
|
169
|
+
const lw = LK.barWords(x, o.lk);
|
|
170
|
+
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')}"`;
|
|
152
171
|
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>`;
|
|
153
172
|
if (a == null) return `<button type="button" class="ivt-d ${cls}" ${at} data-only="due" data-tlx="${X(b) + Math.round(px / 2)}"></button>`;
|
|
154
173
|
const e = b == null ? a : Math.max(a, b);
|
|
155
174
|
return `<button type="button" class="ivt-b ${cls}" ${at} data-tlx="${X(a)}" data-tlw="${Math.max(10, X(e + 1) - X(a))}">`
|
|
156
|
-
+ (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 + '</button>' + msEnd(x);
|
|
175
|
+
+ (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);
|
|
157
176
|
};
|
|
158
177
|
// a milestone task's bar ends in its ◇ with the date beside it (canvas XmlA3Viewer); a faint dashed guide drops through the grid there.
|
|
159
178
|
// Won't do and Archived draw none; no due date draws none (the List asks for it). Dragging the bar's end moves the due date as before.
|
|
@@ -161,7 +180,9 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
161
180
|
return `<span class="ivt-ms${x.done ? ' dn' : x.late ? ' lt' : ''}" data-tlx="${X(b + 1)}" role="img" aria-label="${esc('Milestone ' + x.title + ', ' + md(b) + (x.done ? ', done' : x.late ? ', late' : ''))}" title="${esc(x.title + ' · ' + md(b))}"><i></i><b>${esc(md(b))}</b></span>`; };
|
|
162
181
|
const guides = [...new Set(S.flatMap((s) => flat(s).concat(flatDone(s))).filter((x) => x.ms && !x.wont && x.status !== 'Archived' && dn(x.end) != null).map((x) => X(dn(x.end) + 1)))]
|
|
163
182
|
.map((gx) => `<i class="ms" data-tlx="${gx}"></i>`).join('');
|
|
164
|
-
|
|
183
|
+
// a Jira ticket's bar drags and its ends change the dates kept in PMOS, as a task's do (batch 11 item 23); read-only views draw the due dot
|
|
184
|
+
const jbar = (k) => { if (o.quick) return barOf0(jiraRow(k)).replace(/class="ivt-(b|d|g) /, 'class="ivt-$1 jr ').replace('class="ivt-g"', 'class="ivt-g jr"');
|
|
185
|
+
const b = dn(k.due); return b == null ? '' : `<span class="ivt-d jr" role="img" data-ivt-jr="${esc(k.key)}" data-tlx="${X(b) + Math.round(px / 2)}" aria-label="${esc('Due ' + md(b) + ' in Jira')}" title="${esc('Jira · ' + md(b))}"></span>`; };
|
|
165
186
|
const row = (n, c, cls = '') => `<div class="ivt-r${cls}"><div class="ivt-n">${n}</div><div class="ivt-c">${c}</div></div>`;
|
|
166
187
|
const band = (rs) => { const ds = rs.flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null); if (!ds.length) return ''; const a = Math.min(...ds), b = Math.max(...ds); return `<span class="ivt-band" data-tlx="${X(a)}" data-tlw="${Math.max(8, X(b + 1) - X(a))}"></span>`; };
|
|
167
188
|
// a skipped stage keeps its group row: a hairline from the band before it to the band after it, with » on it (batch 11 item 13, XgapA2Tasks);
|
|
@@ -183,11 +204,12 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
183
204
|
};
|
|
184
205
|
let h = '';
|
|
185
206
|
for (const [si, sec] of S.entries()) {
|
|
186
|
-
const key = 'sec:' + (sec.key || 'none'), op = isOpen(key, sec.open), rs = flat(sec), dn_ = flatDone(sec), jr = jiraOf(sec);
|
|
187
|
-
const has = rs.length || dn_.length || jr.length;
|
|
188
|
-
const head = `<button type="button" class="ivt-gh${sec.kind
|
|
207
|
+
const key = 'sec:' + (sec.key || 'none'), op = isOpen(key, sec.open), rs = flat(sec), dn_ = flatDone(sec), jr = jiraOf(sec), tk = tkOf(sec);
|
|
208
|
+
const has = rs.length || dn_.length || jr.length || tk.length;
|
|
209
|
+
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>`;
|
|
189
210
|
h += row(head, sec.status === 'skip' && !has ? skipLine(si) : band(rs.concat(dn_)), ' g');
|
|
190
211
|
if (!op || !has) continue;
|
|
212
|
+
for (const t of tk) h += row(`${tkMark(t)}${tkTitle(t)}`, '', ' k');
|
|
191
213
|
for (const k of jr) h += row(`${jmark(k)}${ttitle(k)}`, jbar(k), ' k');
|
|
192
214
|
for (const x of rs) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k');
|
|
193
215
|
if (dn_.length) {
|
|
@@ -202,11 +224,11 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
202
224
|
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>' : '') : '';
|
|
203
225
|
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}`
|
|
204
226
|
+ (/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>` : '')
|
|
205
|
-
+ `${guides ? `<span>${SVG(P.dia, 11, 2.4)}Milestone</span>` : ''}<span>${SVG(P.jira, 12, 2)}Jira
|
|
227
|
+
+ `${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>`;
|
|
206
228
|
// it opens on today, moved left as far as the earliest open task's start, so a late bar is in view
|
|
207
229
|
const firstOpen = S.flatMap(flat).flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null);
|
|
208
230
|
const first = firstOpen.length ? X(Math.min(...firstOpen)) : X(today);
|
|
209
|
-
return `<div class="ivt" data-ivt="${esc((v.id || v.key) + '|' + z[0])}" data-px="${px}" data-today="${X(today)}" data-first="${first}"><div class="ivt-sc"><div class="ivt-in" data-tlw="${W}">`
|
|
231
|
+
return `<div class="ivt"${LK.dataOf(o.lk)} data-ivt="${esc((v.id || v.key) + '|' + z[0])}" data-px="${px}" data-today="${X(today)}" data-first="${first}"><div class="ivt-sc"><div class="ivt-in" data-tlw="${W}">`
|
|
210
232
|
+ `<div class="ivt-grid" aria-hidden="true">${grid}</div>${axis}${h}<span class="ivt-today" data-tlx="${X(today) + Math.round(px / 2)}" aria-hidden="true"><i>Today</i></span></div></div></div>${legend}`;
|
|
211
233
|
}
|
|
212
234
|
|
|
@@ -227,18 +249,20 @@ const colOf = (status) => (status === 'Done' ? 'Done' : status === "Won't do" ?
|
|
|
227
249
|
export function kanbanHtml(v, o, isOpen) {
|
|
228
250
|
const S = v.tasks.sections, k = stageKeyOf(v);
|
|
229
251
|
const secs = k === 'all' ? S : S.filter((s) => (s.key || '-') === k);
|
|
230
|
-
const rs = secs.flatMap((s) => flat(s).concat(flatDone(s))), jr = secs.flatMap(jiraOf);
|
|
252
|
+
const rs = secs.flatMap((s) => flat(s).concat(flatDone(s))), jr = secs.flatMap(jiraOf), tk = secs.flatMap(tkOf);
|
|
231
253
|
const by = { 'To do': [], 'In progress': [], Done: [], "Won't do": [] };
|
|
232
254
|
for (const x of rs) by[colOf(x.status)].push({ x });
|
|
233
255
|
for (const t of jr) by[colOf(t.status)].push({ t });
|
|
256
|
+
for (const d of tk) by[d.cat === 'done' ? 'Done' : d.cat === 'doing' ? 'In progress' : 'To do'].push({ d });
|
|
234
257
|
const card = (c) => {
|
|
258
|
+
if (c.d) return `<div class="ivk-d jr">${tkMark(c.d)}<div class="w">${tkTitle(c.d)}${c.d.av ? `<div class="ivk-m"><span class="ivt-av" aria-hidden="true">${esc(c.d.av)}</span></div>` : ''}</div></div>`;
|
|
235
259
|
if (c.t) {
|
|
236
260
|
const t = c.t, d = dn(t.due);
|
|
237
261
|
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>`;
|
|
238
262
|
}
|
|
239
263
|
const x = c.x;
|
|
240
264
|
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)}`
|
|
241
|
-
+ `<div class="ivk-m">${dateBtn(x, o)}${x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : ''}</div></div></div>`;
|
|
265
|
+
+ `<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>`;
|
|
242
266
|
};
|
|
243
267
|
const wop = isOpen('kb:wont', false), nW = by["Won't do"].length;
|
|
244
268
|
const col = ([st, lbl]) => `<section class="ivk-c" data-ivk-col="${esc(st)}" aria-label="${esc(lbl + ', ' + by[st].length)}"><h4>${esc(lbl)}${by[st].length ? `<span class="n">${by[st].length}</span>` : ''}</h4>${by[st].map(card).join('')}</section>`;
|
|
@@ -279,13 +303,17 @@ if (typeof document !== 'undefined' && document.head) {
|
|
|
279
303
|
document.addEventListener('scroll', (e) => { if (POP && !POP.el.contains(e.target)) closePop(); }, true);
|
|
280
304
|
}
|
|
281
305
|
/** The five icons (To do, In progress, Done, Won't do | Archive), only the current one named: the task card's segment. */
|
|
282
|
-
/** ms: the task's ◇ flag, or null where the flag cannot change here: after a second divider, the ◇ toggle (batch 11 item 3).
|
|
283
|
-
|
|
306
|
+
/** ms: the task's ◇ flag, or null where the flag cannot change here: after a second divider, the ◇ toggle (batch 11 item 3).
|
|
307
|
+
* del: the task can be deleted here: last, after its own divider, the trash (batch 11 item 16; never on a Jira ticket, which has no picker). */
|
|
308
|
+
export function statusPopHtml(status, ms = null, del = false) {
|
|
284
309
|
const b = (s) => { const k = stateKey(s), on = s === status;
|
|
285
310
|
return `<button type="button" class="i-${k}${on ? ' on' : ''}" role="radio" aria-checked="${on}" data-ivq-state="${esc(s)}"${on ? '' : ` aria-label="${esc(s === 'Archived' ? 'Archive' : s)}"`} title="${esc(s === 'Archived' ? 'Archive' : s)}">${stateIcon(s)}${on ? esc(s) : ''}</button>`; };
|
|
286
311
|
return `<div class="tkc-pop ivq-st" role="dialog" aria-label="Status"><div class="seg" role="radiogroup" aria-label="Status">${STATES.slice(0, 4).map(b).join('')}<span class="vr" aria-hidden="true"></span>${b('Archived')}</div>`
|
|
287
|
-
+ (ms == null ? '' : `<span class="vr" aria-hidden="true"></span>${msToggleHtml(ms, 'data-ivq-ms')}`)
|
|
312
|
+
+ (ms == null ? '' : `<span class="vr" aria-hidden="true"></span>${msToggleHtml(ms, 'data-ivq-ms')}`)
|
|
313
|
+
+ (del ? `<span class="vr" aria-hidden="true"></span><button type="button" class="ivq-del" data-ivq-del aria-label="Delete task" title="Delete task">${SVG(P.bin, 15, 2)}</button>` : '') + '</div>';
|
|
288
314
|
}
|
|
315
|
+
/** A task this picker can delete: a Board task, a breakdown item or a draft's task. A Jira ticket draws no picker at all. */
|
|
316
|
+
export const deletable = (uid) => /^(?:task-|dt:)/.test(String(uid || '')) || /^[a-z0-9][a-z0-9-]*\.[0-9a-z]{10}$/.test(String(uid || ''));
|
|
289
317
|
/** The ◇ toggle: icon only, "◇ Milestone" while pressed; its tooltip says what it does. attr: the press's data attribute. */
|
|
290
318
|
export function msToggleHtml(on, attr) {
|
|
291
319
|
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';
|
|
@@ -293,8 +321,9 @@ export function msToggleHtml(on, attr) {
|
|
|
293
321
|
}
|
|
294
322
|
function statusPop(anchor, uid, status, H) {
|
|
295
323
|
const ms = H.milestone && anchor.dataset.ms != null ? anchor.dataset.ms === '1' : null;
|
|
296
|
-
openPop(anchor, statusPopHtml(status, ms), (b) => {
|
|
324
|
+
openPop(anchor, statusPopHtml(status, ms, !!H.remove && deletable(uid)), (b) => {
|
|
297
325
|
if ('ivqMs' in b.dataset) { closePop(); H.milestone(uid, !ms); return; }
|
|
326
|
+
if ('ivqDel' in b.dataset) { closePop(); H.remove(uid); return; }
|
|
298
327
|
const s = b.dataset.ivqState; if (!s) return; closePop(); if (s !== status && H.status) H.status(uid, s);
|
|
299
328
|
});
|
|
300
329
|
}
|
|
@@ -325,7 +354,13 @@ let LONG = 0; // a long press opened the status picker: the click that follows
|
|
|
325
354
|
/** A press inside the Tasks section that this file owns. → true when handled. */
|
|
326
355
|
export function press(b, d, root, H, e) {
|
|
327
356
|
const id = root.dataset.iv;
|
|
328
|
-
if (d.ivView) {
|
|
357
|
+
if (d.ivView) {
|
|
358
|
+
// a narrow header shows only the view in use (batch 11 item 20, XtaA5Phone: the group icon, the view, + and Make live fit at 390 px);
|
|
359
|
+
// its press opens the three as a menu
|
|
360
|
+
const hidden = [...b.parentElement.querySelectorAll('[data-iv-view]')].some((x) => x !== b && !x.offsetParent);
|
|
361
|
+
if (hidden && d.ivView === viewMode()) { menuPop(b, 'Tasks view', VIEWS.map(([k, l]) => ({ k, label: l, on: k === viewMode() })), (x) => { setViewMode(x.k); if (H.redraw) H.redraw(); }); return true; }
|
|
362
|
+
setViewMode(d.ivView); closePop(); if (H.redraw) H.redraw(); return true;
|
|
363
|
+
}
|
|
329
364
|
if ('ivZoom' in d) { menuPop(b, 'Zoom', ZOOMS.map(([k, l]) => ({ k, label: l, on: k === zoomOf() })), (x) => { ZOOM = x.k; store.set('pmos.tasks.zoom', x.k); if (H.redraw) H.redraw(); }); return true; }
|
|
330
365
|
if ('ivKstage' in d) {
|
|
331
366
|
const v = H.__v; if (!v) return true;
|
|
@@ -344,7 +379,7 @@ export function press(b, d, root, H, e) {
|
|
|
344
379
|
/* ── the drags, and the long press ── */
|
|
345
380
|
let DRAGGED = false;
|
|
346
381
|
const coarse = () => typeof matchMedia === 'function' && matchMedia('(pointer: coarse)').matches;
|
|
347
|
-
export function wireDrag(body) {
|
|
382
|
+
export function wireDrag(body, after) {
|
|
348
383
|
if (!body || body.__ivtDrag) return;
|
|
349
384
|
body.__ivtDrag = true;
|
|
350
385
|
body.addEventListener('contextmenu', (e) => { if (e.target.closest && e.target.closest('[data-iv-check]') && coarse()) e.preventDefault(); });
|
|
@@ -369,6 +404,7 @@ export function wireDrag(body) {
|
|
|
369
404
|
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));
|
|
370
405
|
sc.addEventListener('scroll', () => SCROLL.set(k, sc.scrollLeft), { passive: true });
|
|
371
406
|
}
|
|
407
|
+
if (after) after();
|
|
372
408
|
};
|
|
373
409
|
if (typeof MutationObserver === 'function') new MutationObserver(settle).observe(body, { childList: true, subtree: true });
|
|
374
410
|
settle();
|
|
@@ -189,21 +189,25 @@ async function draftDates(H, uid, patch) {
|
|
|
189
189
|
async function draftStatus(H, uid, state) {
|
|
190
190
|
const id = iniOfUid(uid), x = id && draftTask(id, uid);
|
|
191
191
|
const R = ROWS.get(id), name = R && R.vs ? R.vs.show.name : 'the draft';
|
|
192
|
-
if (state === "Won't do" || state === 'Archived')
|
|
193
|
-
const res = await write(H, '/task', { task: uid, drop: true });
|
|
194
|
-
if (!res || res.ok === false) return failed(H, res);
|
|
195
|
-
took(id, res); if (H.redraw) H.redraw();
|
|
196
|
-
// a task copied from Live comes back with Undo; a task the draft added is gone, so Undo adds it again
|
|
197
|
-
const back = res.gone ? () => write(H, '/task', { draft: uid.split(':')[1], add: { title: x.title, start: x.start, due: x.end, owner: x.owner, ...(x.section ? { section: x.section } : {}) } }) : () => write(H, '/task', { task: uid, undrop: true });
|
|
198
|
-
say(H, 'Dropped from ' + name + (x ? ': ' + x.title : '') + '.', async () => { const u = await back(); if (u && u.ok) { took(id, u); if (H.redraw) H.redraw(); } else failed(H, u, 'The undo did not land.'); });
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
192
|
+
if (state === "Won't do" || state === 'Archived') return draftDrop(H, uid);
|
|
201
193
|
const res = await write(H, '/task', { task: uid, set: { status: state } });
|
|
202
194
|
if (!res || res.ok === false) return failed(H, res);
|
|
203
195
|
took(id, res); if (H.redraw) H.redraw();
|
|
204
196
|
say(H, state + ' 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(); } } : undefined);
|
|
205
197
|
return true;
|
|
206
198
|
}
|
|
199
|
+
/** Won't do, Archive or Delete on a draft's task: a draft change only, the task leaves the draft (batch 11 items 8 and 16). Live is not touched. */
|
|
200
|
+
async function draftDrop(H, uid) {
|
|
201
|
+
const id = iniOfUid(uid), x = id && draftTask(id, uid);
|
|
202
|
+
const R = ROWS.get(id), name = R && R.vs ? R.vs.show.name : 'the draft';
|
|
203
|
+
const res = await write(H, '/task', { task: uid, drop: true });
|
|
204
|
+
if (!res || res.ok === false) return failed(H, res);
|
|
205
|
+
took(id, res); if (H.redraw) H.redraw();
|
|
206
|
+
// a task copied from Live comes back with Undo; a task the draft added is gone, so Undo adds it again
|
|
207
|
+
const back = res.gone ? () => write(H, '/task', { draft: uid.split(':')[1], add: { title: x.title, start: x.start, due: x.end, owner: x.owner, ...(x.section ? { section: x.section } : {}) } }) : () => write(H, '/task', { task: uid, undrop: true });
|
|
208
|
+
say(H, 'Dropped from ' + name + (x ? ': ' + x.title : '') + '.', async () => { const u = await back(); if (u && u.ok) { took(id, u); if (H.redraw) H.redraw(); } else failed(H, u, 'The undo did not land.'); });
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
207
211
|
/** + in the Tasks header: into the draft shown; the first task of an initiative with no Live task and no plan goes to "Proposal". → true when handled here. */
|
|
208
212
|
async function draftAdd(H, id, title, inp, section) {
|
|
209
213
|
const R = ROWS.get(id), vs = R && R.vs, live = R ? (R.r.tasks || []).filter(counts) : [];
|
|
@@ -332,6 +336,7 @@ export function wrap(h, body, shown) {
|
|
|
332
336
|
W.check = (uid, btn) => (isDraft(uid) ? undefined : h.check && h.check(uid, btn));
|
|
333
337
|
W.status = (uid, state) => (isDraft(uid) ? draftStatus(W, uid, state) : h.status && h.status(uid, state));
|
|
334
338
|
W.dates = (uid, patch) => (isDraft(uid) ? draftDates(W, uid, patch) : h.dates && h.dates(uid, patch));
|
|
339
|
+
if (h.remove) W.remove = (uid) => (isDraft(uid) ? draftDrop(W, uid) : h.remove(uid));
|
|
335
340
|
W.openTask = (uid, b) => (isDraft(uid) ? undefined : h.openTask && h.openTask(uid, b));
|
|
336
341
|
W.addTask = async (title, inp) => {
|
|
337
342
|
const id = idOf(), v = id && shown ? shown(id) : null;
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
* wbsOf(title) → { code, top } | null "10.5 TC to review" → { code: '10.5', top: '10' }; "WP-03 Token exchange" → { code: 'WP-03', top: 'WP' }
|
|
14
14
|
* statusOf(r, grill, fmt) → { tone, text } the status the row and the view both say
|
|
15
15
|
* linkedOf(r) → [{ kind: doc | dep | epic, label, path?, title? }] the Linked fold, from the trail
|
|
16
|
+
* groupBy(L, T) → 'stage' | 'epic' | 'mine' | 'owner' | 'status' how Tasks groups (batch 11 item 20): the PM's pick, else Epic
|
|
17
|
+
* once the PRD's tickets are drafted, else Stage
|
|
18
|
+
* groupSections(tasks, by, L, T) → { sections, sum } the same tasks in the other groupings, each group a section the List, Timeline
|
|
19
|
+
* and Kanban draw as they draw a stage; sum: the By epic card ("N tickets are drafted, not in Jira") or null
|
|
16
20
|
*
|
|
17
21
|
* THE RULES (OvGrill):
|
|
18
22
|
* 1 the ladder says where the stage is ("5 of 7"); the card says how much of its section is done ("0 of 3 done"). Never one number for both.
|
|
@@ -27,6 +31,9 @@
|
|
|
27
31
|
* 12 over the plan: the dates line turns amber with the days over; a skipped stage keeps its place, with its reason.
|
|
28
32
|
* 18 each section carries its dates: done stages when they ran, now from when to the plan end, later ones "Plan <date>", amber when missed.
|
|
29
33
|
* 19 a big section shows the 3 most urgent first, then folds the rest by the next WBS level, each with its count; done folds last. */
|
|
34
|
+
import { ticketGroups } from './tk-model.js'; // the drafted Jira tickets by epic (kit 2, T1): By epic's groups
|
|
35
|
+
|
|
36
|
+
import { lineOf } from './stage-line.js'; // the stage card's one line (batch 11 item 21)
|
|
30
37
|
|
|
31
38
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
32
39
|
const CLOSED = new Set(['Done', "Won't do", 'Archived']);
|
|
@@ -102,6 +109,8 @@ export function statusOf(r, grill, fmt) {
|
|
|
102
109
|
return { tone: 'q', text: r.statusLabel || '' };
|
|
103
110
|
}
|
|
104
111
|
|
|
112
|
+
/* 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 */
|
|
113
|
+
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) : ''; };
|
|
105
114
|
/* ── one task row ── */
|
|
106
115
|
function rowOf(k, today) {
|
|
107
116
|
const closed = CLOSED.has(k.status), d = dayOf(k.end), late = !closed && !!d && d < today;
|
|
@@ -182,10 +191,14 @@ export function iniView(r, ctx = {}) {
|
|
|
182
191
|
} : null;
|
|
183
192
|
let nx = null;
|
|
184
193
|
// Won't do and Archived hold their stage (D99 wfRules): no next stage to move to
|
|
185
|
-
if (cur >= 0 && !r.ended) { const n = list.slice(cur + 1).find((s) => s.status !== 'skip'); if (n) nx = { key: n.key, name: n.name, ms: n.ms, moves: n.ms && r.kr ? r.kr : '' }; }
|
|
194
|
+
if (cur >= 0 && !r.ended && r.status !== 'done' && r.status !== 'cancelled') { const n = list.slice(cur + 1).find((s) => s.status !== 'skip'); if (n) nx = { key: n.key, name: n.name, ms: n.ms, moves: n.ms && r.kr ? r.kr : '' }; }
|
|
195
|
+
// the stage card is one line (batch 11 item 21, agreed A): each stage on its own dates, the milestone tasks as ◇, the Board's states
|
|
196
|
+
const line = lineOf(r, { list, cur, ran, rows, today, deps: tr.deps || [] });
|
|
197
|
+
const ready = !!nx && curRows.length > 0 && curRows.every((x) => x.closed); // every task of the stage done: the → turns blue (state 1)
|
|
186
198
|
const stage = {
|
|
187
|
-
n: cur >= 0 ? cur + 1 : null, of: list.length, name: st ? st.name : (t.label || r.stage || 'No stage on record'), ms: !!(st && st.ms),
|
|
199
|
+
n: cur >= 0 ? cur + 1 : null, of: list.length, name: st ? st.name : (t.label || r.stage || 'No stage on record'), ms: !!(st && st.ms), key: st ? st.key : '',
|
|
188
200
|
doneOf, day: days != null ? 'day ' + days + (usual != null ? ' of ~' + usual : '') : '', dayOver: days != null && usual != null && days > usual,
|
|
201
|
+
clock: days != null && !line.chip ? (usual != null ? days + ' of ~' + usual + ' days' : plural(days, 'day', 'days')) : '', line, ready,
|
|
189
202
|
ladder: list.map((s) => ({ name: s.name, ms: s.ms, cls: s.status })), dates, next: nx,
|
|
190
203
|
aria: cur >= 0 ? 'Stage ' + (cur + 1) + ' of ' + list.length + ' of ' + ((r.wf && r.wf.name) || 'Product feature') + ': ' + st.name + '.' + (nx ? ' Next stage: ' + nx.name + '.' : '') : 'No stage on record.',
|
|
191
204
|
};
|
|
@@ -212,7 +225,7 @@ export function iniView(r, ctx = {}) {
|
|
|
212
225
|
const x = one(s, i);
|
|
213
226
|
if (i === cur && jira && tkOwn.length) {
|
|
214
227
|
const opn = tkOwn.filter((k) => k.status !== 'Done').sort((a, b) => (b.blocked ? 1 : 0) - (a.blocked ? 1 : 0));
|
|
215
|
-
x.jira = { open: opn.map((k) => ({ key: k.key, title: k.title, epic: k.epic || '', status: k.status || 'To do', due: k.due || k.sprintEnd || '', av: initials(k.assignee), sub: [k.blocked ? 'Blocked' + (k.reason ? ' by ' + String(k.reason).replace(/^Waiting on /i, '') : '') : k.status || 'To do', k.assignee || ''].filter(Boolean).join(' · '), warn: !!k.blocked })),
|
|
228
|
+
x.jira = { open: opn.map((k) => ({ key: k.key, title: k.title, epic: k.epic || '', status: k.status || 'To do', start: k.start || '', due: k.due || k.sprintEnd || '', here: !!k.datesHere, days: jDays(k, today), av: initials(k.assignee), sub: [k.blocked ? 'Blocked' + (k.reason ? ' by ' + String(k.reason).replace(/^Waiting on /i, '') : '') : k.status || 'To do', k.assignee || ''].filter(Boolean).join(' · '), warn: !!k.blocked })),
|
|
216
229
|
done: tkOwn.length - opn.length, total: tkOwn.length, at: ctx.jiraAt || '' };
|
|
217
230
|
x.count = countOf(opn.length + x.top.length + x.groups.reduce((n, g) => n + g.n, 0), x.top.filter((y) => y.late).length, 0);
|
|
218
231
|
x.sub = x.sub + (x.sub ? ' · ' : '') + 'Jira tickets, by epic';
|
|
@@ -250,7 +263,15 @@ export function iniView(r, ctx = {}) {
|
|
|
250
263
|
summary.wf = r.wf || { id: PF_ID, name: 'Product feature', icon: 'feature' };
|
|
251
264
|
summary.program = ctx.program || null;
|
|
252
265
|
const today2 = (n) => String(n).padStart(2, '0');
|
|
253
|
-
return { vs: r.__vs || 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)
|
|
266
|
+
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),
|
|
267
|
+
// split or merge (batch 11 item 14): Claude's suggestion for it, and where its work went when it was merged
|
|
268
|
+
suggest: r.suggest || null, merged: mergedOf(r) };
|
|
269
|
+
}
|
|
270
|
+
/** A merged initiative's closing line (XsmA7Closed): the one that stays and the day. null for every other row. */
|
|
271
|
+
export function mergedOf(r) {
|
|
272
|
+
const a = (r && r.acts && r.acts.archived) || (r && r.archived) || null;
|
|
273
|
+
if (!a || !a.intoId || !/^Merged into /.test(a.reason || '')) return null;
|
|
274
|
+
return { intoId: a.intoId, into: a.into || a.intoId, at: a.at || '' };
|
|
254
275
|
}
|
|
255
276
|
/** What it links to, from its trail: the PRD (with its version), the rubric, the evaluation, the release notes, what it waits on, its epic. */
|
|
256
277
|
export function linkedOf(r) {
|
|
@@ -261,6 +282,69 @@ export function linkedOf(r) {
|
|
|
261
282
|
if (epic) out.push({ kind: 'epic', label: 'Epic ' + epic });
|
|
262
283
|
return out;
|
|
263
284
|
}
|
|
285
|
+
|
|
286
|
+
/* ── Group by (batch 11 item 20; canvas In development, row "Tasks takes over the old All tasks panel": XtaA1Group to XtaA5Phone) ──
|
|
287
|
+
* The old All tasks panel is gone; its two jobs live in the Tasks section. The PM's grouping is kept for the workspace (lib/initiative-
|
|
288
|
+
* layout.js: by, picked, names, of, sets). Stage is the WBS above, unchanged. The other groupings take every task of every section and
|
|
289
|
+
* group it again; each group is a section of kind 'group' (or 'epic'), so the three views draw it with no code of their own. Links,
|
|
290
|
+
* the ◇ and the trash belong to the task, so they come with it. Jira's own tickets (Build's section) have no owner or epic here: in any
|
|
291
|
+
* grouping but Stage they sit in one "In Jira" section. */
|
|
292
|
+
export const GROUP_BY = { stage: 'Stage', epic: 'Epic', mine: 'Your groups', owner: 'Owner', status: 'Status' };
|
|
293
|
+
/** An old layout's 'stage' (from before tasks were the WBS) means what Stage means again; 'none' is no longer offered and reads as Stage. */
|
|
294
|
+
export function groupBy(L, T) {
|
|
295
|
+
const l = L || {};
|
|
296
|
+
if (l.picked && GROUP_BY[l.by]) return l.by;
|
|
297
|
+
if (l.picked) return 'stage';
|
|
298
|
+
return T && T.ok === true && T.drafted ? 'epic' : 'stage';
|
|
299
|
+
}
|
|
300
|
+
const STATUS_ORDER = ['To do', 'In progress', 'Done', "Won't do"];
|
|
301
|
+
export function groupSections(tasks, by, L, T) {
|
|
302
|
+
const S = (tasks && tasks.sections) || [];
|
|
303
|
+
if (!GROUP_BY[by] || by === 'stage') return { sections: S, sum: null };
|
|
304
|
+
const all = [], arch = [], jr = []; let jd = 0, jt = 0, jat = '';
|
|
305
|
+
const walk = (s) => {
|
|
306
|
+
if (s.stages) { s.stages.forEach(walk); return; }
|
|
307
|
+
all.push(...s.top, ...s.groups.flatMap((g) => g.rows), ...s.done); arch.push(...(s.archived || []));
|
|
308
|
+
if (s.jira) { jr.push(...s.jira.open); jd += s.jira.done; jt += s.jira.total; jat = s.jira.at || jat; }
|
|
309
|
+
};
|
|
310
|
+
S.forEach(walk);
|
|
311
|
+
const sec = (kind, key, label, rows, more = {}) => {
|
|
312
|
+
const op = rows.filter((x) => !x.closed), lt = op.filter((x) => x.late);
|
|
313
|
+
return { kind, key, label, sub: '', count: countOf(op.length, lt.length, rows.length - op.length), warn: lt.length > 0, open: true, ...bodyOf(rows, more.archived || []), jira: null, ...more };
|
|
314
|
+
};
|
|
315
|
+
const out = [], lay = L || {}, names = lay.names || [], of = lay.of || {};
|
|
316
|
+
let sum = null;
|
|
317
|
+
if (by === 'mine') {
|
|
318
|
+
const g = (x) => { const n = of['task:' + x.uid]; return n && names.includes(n) ? n : ''; };
|
|
319
|
+
for (const n of names) out.push(sec('group', 'g:' + n, n, all.filter((x) => g(x) === n), { archived: arch.filter((x) => g(x) === n), mine: n }));
|
|
320
|
+
const rest = all.filter((x) => !g(x));
|
|
321
|
+
// the tasks in no group fold while the PM's own groups are there (XtaA3Mine); with none yet they are the list
|
|
322
|
+
out.push(sec('group', 'g:', names.length ? 'Not in a group' : 'Not in a group yet', rest, { archived: arch.filter((x) => !g(x)), mine: '', loose: true, open: !names.length }));
|
|
323
|
+
} else if (by === 'owner') {
|
|
324
|
+
const who = [...new Set(all.concat(arch).map((x) => x.owner || ''))].sort((a, b) => (!a) - (!b) || a.localeCompare(b));
|
|
325
|
+
who.forEach((n, i) => out.push(sec('group', 'o:' + n, n || 'No owner', all.filter((x) => (x.owner || '') === n), { archived: arch.filter((x) => (x.owner || '') === n), open: i === 0 })));
|
|
326
|
+
} else if (by === 'status') {
|
|
327
|
+
const keys = STATUS_ORDER.concat([...new Set(all.map((x) => x.status).filter((s) => !STATUS_ORDER.includes(s)))]);
|
|
328
|
+
for (const k of keys) { const rs = all.filter((x) => x.status === k); if (rs.length) out.push(sec('group', 's:' + k, k, rs, { open: !out.length })); }
|
|
329
|
+
if (arch.length) out.push(sec('group', 's:Archived', 'Archived', [], { archived: arch, open: false }));
|
|
330
|
+
} else if (by === 'epic') {
|
|
331
|
+
const G = ticketGroups(T), pushed = new Set(((T && T.tickets) || []).map((t) => t.key).filter(Boolean));
|
|
332
|
+
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,
|
|
333
|
+
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, tk: g.rows }));
|
|
334
|
+
// "Jira read at 9:02", said once, under the last epic that has a ticket in Jira
|
|
335
|
+
const lastJ = out.filter((x) => x.kind === 'epic' && x.tk.some((r) => r.inJira)).pop(); if (lastJ && T.checkedAt) lastJ.tkRead = T.checkedAt;
|
|
336
|
+
// nothing drafted: By epic says what comes next (every gap has its next action): Draft the tickets, or why there is nothing to draft
|
|
337
|
+
if (!G.length) out.push({ kind: 'epic', key: 'ep:', label: 'Jira tickets', sub: '', count: '', open: true, top: [], groups: [], done: [], archived: [], jira: null,
|
|
338
|
+
tkEmpty: !T ? { reading: true } : T.ok !== true ? { error: T.error || 'The tickets could not be read.' } : T.items ? { items: T.items } : { none: true } });
|
|
339
|
+
for (let i = jr.length - 1; i >= 0; i--) if (pushed.has(jr[i].key)) jr.splice(i, 1);
|
|
340
|
+
out.push(sec('group', 'yours', 'Your tasks', all, { archived: arch, open: !G.length }));
|
|
341
|
+
const send = G.reduce((a, g) => a + g.send, 0), open = tasks.open || 0, meta = [open ? open + ' open' : '', 'grouped by epic'].filter(Boolean).join(' · ');
|
|
342
|
+
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 };
|
|
343
|
+
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' } };
|
|
344
|
+
}
|
|
345
|
+
if (jr.length || jt) out.push({ kind: 'group', key: 'jira', label: 'In Jira', sub: '', count: countOf(jr.length, 0, jd), warn: jr.some((k) => k.warn), open: false, top: [], groups: [], done: [], archived: [], jira: { open: jr, done: jd, total: jt, at: jat } });
|
|
346
|
+
return { sections: out, sum };
|
|
347
|
+
}
|
|
264
348
|
/** The one sentence that says why the status is what it is: the plan end passed, or Jira's pace runs past it, then the first blocked ticket. */
|
|
265
349
|
function whyText(r, list, cur, today, finished) {
|
|
266
350
|
const t = r.track || {}, end = dayOf(r.end), fc = dayOf(t.forecast), said = [];
|