create-pmos 0.421.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 +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/scripts/anchor-resolve.js +93 -15
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-programs-test.js +87 -3
- package/workspace/briefing-premium-adddoc-test.js +1 -1
- package/workspace/briefing-premium-board-test.js +13 -11
- package/workspace/briefing-premium-initiative-test.js +30 -38
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/report-api/draft.json +2 -1
- package/workspace/guide/briefing-premium.md +2 -1
- package/workspace/guide/home.md +14 -4
- package/workspace/guide/programs.md +5 -3
- package/workspace/guide/workflows.md +5 -1
- package/workspace/home-other-product-test.js +55 -0
- package/workspace/ini-workflow-test.js +4 -4
- package/workspace/lib/board-premium.js +21 -6
- package/workspace/lib/custom-docs.js +65 -3
- package/workspace/lib/doc-live-root.js +37 -0
- package/workspace/lib/engine/anchor-resolve.js +93 -15
- package/workspace/lib/engine/boards.js +30 -2
- package/workspace/lib/engine/intake.js +1 -1
- package/workspace/lib/hold-spans.js +24 -10
- package/workspace/lib/initiative-writer.js +63 -1
- package/workspace/lib/kg.js +1 -1
- package/workspace/lib/plan-items.js +36 -5
- package/workspace/lib/programs.js +11 -3
- package/workspace/lib/report-draft.js +3 -0
- package/workspace/lib/route-modules.js +2 -0
- package/workspace/lib/routes-board-premium.js +28 -0
- package/workspace/lib/routes-boards.js +92 -13
- package/workspace/lib/routes-doc-sheet.js +29 -1
- package/workspace/lib/routes-initiatives.js +12 -0
- package/workspace/lib/routes-programs.js +44 -5
- package/workspace/lib/routes-task-links.js +329 -0
- package/workspace/lib/routes-task-plans.js +333 -0
- package/workspace/lib/split-merge-suggest.js +162 -0
- package/workspace/lib/split-merge.js +379 -0
- package/workspace/lib/task-cli.js +73 -13
- package/workspace/lib/task-items.js +15 -3
- package/workspace/lib/task-links.js +422 -0
- package/workspace/lib/task-plans.js +232 -0
- package/workspace/lib/vendor/scripts/anchor-resolve.js +93 -15
- package/workspace/lib/vendor/scripts/intake.js +1 -1
- 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-doc-test.js +26 -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-leave-test.js +203 -0
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-acts.js +5 -2
- package/workspace/public/pm/bd-ini-panel.js +32 -9
- package/workspace/public/pm/bd-prog-panel.js +22 -7
- package/workspace/public/pm/bd-prog.js +6 -1
- package/workspace/public/pm/bd-span.js +234 -30
- package/workspace/public/pm/bd-views.js +3 -2
- package/workspace/public/pm/cozy-board.css +90 -0
- package/workspace/public/pm/cozy-home.css +3 -0
- package/workspace/public/pm/doc-follow.js +36 -0
- package/workspace/public/pm/home-app.js +62 -14
- package/workspace/public/pm/home-ini-model.js +0 -34
- package/workspace/public/pm/home-ini.js +81 -204
- package/workspace/public/pm/home-list.js +2 -2
- package/workspace/public/pm/home-today.js +3 -1
- 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 +131 -30
- package/workspace/public/pm/ini-versions.js +348 -0
- package/workspace/public/pm/ini-view-model.js +113 -43
- package/workspace/public/pm/ini-view.css +341 -18
- package/workspace/public/pm/ini-view.js +153 -38
- package/workspace/public/pm/premium-board.js +160 -21
- package/workspace/public/pm/premium-report-read.js +20 -1
- package/workspace/public/pm/premium-shell.js +29 -4
- package/workspace/public/pm/premium-vw-doc.js +46 -11
- package/workspace/public/pm/prog-move.js +69 -0
- 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.css +3 -0
- package/workspace/public/pm/task-card.js +15 -6
- 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 +176 -0
- package/workspace/task-plans-test.js +181 -0
- package/workspace/task-views-test.js +3 -3
- package/workspace/test-lists/bd-ini-panel.json +8 -2
- package/workspace/test-lists/product-lane.json +6 -0
- package/workspace/test-lists/program-leave.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/test-lists/task-milestones.json +6 -0
- package/workspace/test-lists/task-plans.json +6 -0
- package/workspace/test-lists/viewer-live-file.json +9 -0
- package/workspace/timeline-holds-test.js +61 -4
- package/workspace/tk-tasks-test.js +173 -57
- package/workspace/workflows-setup-test.js +4 -3
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
* iniPage() the initiative's page in the Viewer: the ONE view the Board's panel draws too (ini-view.js; batch 6 items 1 and 3):
|
|
8
8
|
* summary, stage card with the dates line, Tasks as the WBS, Documents and Linked. The next stage opens the move sheet;
|
|
9
9
|
* Documents drills into the documents view, with ← back to the page. true when it opened.
|
|
10
|
-
* iniOverview(v, o) the initiative in the Viewer:
|
|
10
|
+
* iniOverview(v, o) the initiative in the Viewer: Documents or Stage; o.back keeps the page behind it. true when it opened. Any other view
|
|
11
|
+
* opens the page: the old All tasks panel is gone (batch 11 item 20), its Group by and Send to Jira live in the page's Tasks
|
|
12
|
+
* (ini-groups.js).
|
|
13
|
+
* iniAddTask() New → A task: the page with the Tasks field open and the cursor in it (XtaA4NewTask). true when it opened.
|
|
11
14
|
*
|
|
12
15
|
* The stage move (stage card D, canvas XscD and XscDDesk; it replaced InStage's switch, Move to <next> and Back on the card): the card's last
|
|
13
16
|
* node is the next stage (home-stage-card.js). A press opens the move sheet on the phone and a popover under it on a desktop, with the
|
|
@@ -16,17 +19,13 @@
|
|
|
16
19
|
* (Move anyway, with a note); Back always asks for a reason. Both go to POST /api/boards/move
|
|
17
20
|
* with the note or reason as the move's why. When every exit item is done and the switch is on, the page moves the stage by itself, never into a
|
|
18
21
|
* milestone (Deliver, Evaluate), and says so in a toast with Undo; Undo moves it back and keeps it from moving out of that stage by itself again.
|
|
19
|
-
*
|
|
20
|
-
* or not at all. Core documents (InDocs): the list column shows only the documents that need a look; the Viewer lists them all with their details.
|
|
22
|
+
* Core documents (InDocs): the list column shows only the documents that need a look; the Viewer lists them all with their details.
|
|
21
23
|
* Every write is the PM's press, file mode only: /api/boards/move, /api/boards/tasks/*, /api/lifecycle, /api/core-docs/draft, /api/initiative-layout.
|
|
22
24
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* under "Your tasks". In shell A the summary card comes first and the group picker, Documents, Stage, the record and the sprint sit
|
|
27
|
-
* under ⋯; the phone keeps the Tasks | Documents | Stage switch. The pure half of the tickets is tk-model.js. */
|
|
25
|
+
* Grouping the tasks (by epic, your groups, owner or status) and sending the drafted tickets to Jira were the old All tasks panel's; since
|
|
26
|
+
* batch 11 item 20 they are the page's Tasks section's, the same on the Board (ini-groups.js). In shell A Documents and Stage open from the
|
|
27
|
+
* page; the phone keeps the Documents | Stage switch. */
|
|
28
28
|
import * as MD from './home-ini-model.js';
|
|
29
|
-
import * as TKM from './tk-model.js';
|
|
30
29
|
import * as WF from './ini-wf.js';
|
|
31
30
|
import * as SC from './home-stage-card.js';
|
|
32
31
|
import { viewHtml, wireView } from './ini-view.js'; // the one initiative view, the Board's panel's own renderer
|
|
@@ -40,8 +39,7 @@ const I = {
|
|
|
40
39
|
};
|
|
41
40
|
const PHONE = 760;
|
|
42
41
|
const isPhone = () => innerWidth <= PHONE;
|
|
43
|
-
const X = { ctx: null, L: new Map(), reading: new Set(), tried: new Set(), view: '
|
|
44
|
-
T: new Map(), tReading: new Set(), fold: new Map(), more: new Set() };
|
|
42
|
+
const X = { ctx: null, L: new Map(), reading: new Set(), tried: new Set(), view: 'page', doc: { by: 'stage', filter: 'all', more: new Set() }, pop: null, toastT: 0 };
|
|
45
43
|
|
|
46
44
|
/* ── reading the layout record ── */
|
|
47
45
|
const curM = () => { const S = X.ctx && X.ctx.S; return S && S.ini && S.ini !== 'product' && S.IMid === S.ini ? S.IM : null; };
|
|
@@ -56,18 +54,6 @@ async function readL(id, M, force) {
|
|
|
56
54
|
X.ctx.drawList(); redrawView();
|
|
57
55
|
}
|
|
58
56
|
const Lof = (id) => X.L.get(id) || { auto: true, held: [], by: 'mine', names: [], of: {}, stage: {}, sets: [], read: false };
|
|
59
|
-
/* ── the drafted Jira tickets (T1) ── */
|
|
60
|
-
async function readT(id, M, force) {
|
|
61
|
-
if (!force && (X.T.has(id) || X.tReading.has(id))) return;
|
|
62
|
-
X.tReading.add(id);
|
|
63
|
-
const r = await X.ctx.pmGet('/api/jira/tickets?initiative=' + encodeURIComponent(id) + (wsOf(M) ? '&ws=' + encodeURIComponent(wsOf(M)) : ''));
|
|
64
|
-
X.tReading.delete(id);
|
|
65
|
-
X.T.set(id, r && r.ok === true ? r : { ok: false, error: (r && r.error) || 'The tickets could not be read.' });
|
|
66
|
-
redrawView();
|
|
67
|
-
}
|
|
68
|
-
const Tof = (id) => X.T.get(id) || null;
|
|
69
|
-
/** The grouping: the PM's choice; until the PM chooses, Epic once tickets are drafted. */
|
|
70
|
-
const byOf = (L, T) => { const b = (L.picked ? L.by : T && T.ok && T.drafted ? 'epic' : L.by) || 'mine'; return MD.BY_LABEL[b] ? b : 'mine'; }; // an old 'stage' reads as Your groups
|
|
71
57
|
async function press(id, M, body) {
|
|
72
58
|
const r = await X.ctx.pmPost('/api/initiative-layout', { ws: wsOf(M), initiative: id, ...body });
|
|
73
59
|
if (r && r.ok) { X.L.set(id, { ...r, read: true }); X.ctx.drawList(); redrawView(); return true; }
|
|
@@ -259,6 +245,7 @@ export function iniList(sc) {
|
|
|
259
245
|
* the dates line, Tasks as the WBS, Documents and Linked as folds. Home keeps its own presses: the next stage opens the move sheet, a task
|
|
260
246
|
* drills into the task editor, Documents drills into the documents view. */
|
|
261
247
|
let ADDING = null; // the initiative whose inline Add a task is open
|
|
248
|
+
let ADD_DATES = null; // the start and due a task added there takes (a gap's + under the stage card's line, batch 11 item 21)
|
|
262
249
|
function pageHtml(id, M) {
|
|
263
250
|
X.ctx.head(id); // the stage head the move sheet and the primary read (S.H)
|
|
264
251
|
const v = X.ctx.view(id);
|
|
@@ -267,20 +254,46 @@ function pageHtml(id, M) {
|
|
|
267
254
|
// a phone: the page is a sheet over the list, and the chat is one press away (HbCPhone)
|
|
268
255
|
const talk = isPhone() ? `<button type="button" class="hi-talk" data-hi-talk>Message Claude about ${esc(X.ctx.iniTitle(id))}</button>` : '';
|
|
269
256
|
return `<div class="hi-v hi-page" data-hi-v="page">${WF.endedHtml(rowOf(id))}`
|
|
270
|
-
+ viewHtml(v, { add: true, adding: ADDING === id, next: !!v.stage.next, openTask: true, quick: true, docs: docs.length ? { n: docs.length } : null, wf: !(M.acts && M.acts.self) && !rowOf(id).ended })
|
|
257
|
+
+ viewHtml(v, { add: true, adding: ADDING === id, addHint: ADDING === id && ADD_DATES ? ADD_DATES.start + ' to ' + ADD_DATES.due : '', hold: true, next: !!v.stage.next, openTask: true, quick: true, docs: docs.length ? { n: docs.length } : null, wf: !(M.acts && M.acts.self) && !rowOf(id).ended })
|
|
271
258
|
+ `${talk}<p class="hi-small" role="status" id="ovMsg"></p></div>`;
|
|
272
259
|
}
|
|
260
|
+
/** A hold's card from the stage card (batch 11 item 21): its words and the return date, which writes an on-hold line with the new date
|
|
261
|
+
* (POST /api/lifecycle, the same write as the Board's hold menu), or Resume. */
|
|
262
|
+
function holdPop(anchor, id) {
|
|
263
|
+
const M = curM(); if (!M) return;
|
|
264
|
+
const r = rowOf(id), a = r.acts || {};
|
|
265
|
+
openPop(anchor, 'hold', `<p class="hi-h3">On hold${a.reason ? ': ' + esc(a.reason) : ''}</p>`
|
|
266
|
+
+ `<label class="hi-field"><span>Back on</span><input id="hiBack" type="date" value="${esc(a.back || '')}"></label>`
|
|
267
|
+
+ `<div class="hi-acts"><button type="button" class="hi-btn dark" data-hi-go>Save</button><button type="button" class="hi-btn ghost" data-hi-resume>Resume now</button></div>`,
|
|
268
|
+
async (b, el) => {
|
|
269
|
+
const say = (res, m) => { if (res && res.ok !== false) { X.ctx.toast(m); X.ctx.load().then(() => redrawView()); } else X.ctx.toast((res && res.error) || 'Nothing was changed.'); };
|
|
270
|
+
if ('hiResume' in b.dataset) { closePop(); say(await X.ctx.pmPost('/api/lifecycle', { ws: M.board.ws, initiative_id: id, state: 'active', reason: 'resumed' }), 'Resumed.'); return; }
|
|
271
|
+
if ('hiGo' in b.dataset) {
|
|
272
|
+
const v = el.querySelector('#hiBack').value; if (!/^\d{4}-\d{2}-\d{2}$/.test(v)) return;
|
|
273
|
+
closePop(); say(await X.ctx.pmPost('/api/lifecycle', { ws: M.board.ws, initiative_id: id, state: 'on-hold', reason: a.reason || 'Held from the stage card', back: v }), 'Back on ' + v + '.');
|
|
274
|
+
}
|
|
275
|
+
}, { label: 'On hold', sheetFocus: '#hiBack' });
|
|
276
|
+
}
|
|
273
277
|
/** The one view's presses on Home's page. */
|
|
274
278
|
function wirePage(b, id) {
|
|
275
279
|
const C = X.ctx, say = (m) => C.toast(m);
|
|
276
280
|
wireView(b, {
|
|
277
281
|
redraw: () => redrawView(),
|
|
282
|
+
// Claude's split or merge card (batch 11 item 14): ✕ Not now, ✎ Change it first, ✓ as suggested; the merged summary's link opens the one that stays
|
|
283
|
+
sm: (act) => { if (C.smPress) C.smPress(id, act); },
|
|
284
|
+
openIni: (to) => { if (C.goIni) C.goIni(to); },
|
|
285
|
+
// planned versus actual (batch 11 item 8, pm/ini-versions.js): where a draft's writes go, the read after Make live, the toast with Undo
|
|
286
|
+
where: () => { const M = curM(); return M ? bw(M) : {}; },
|
|
287
|
+
reload: async () => { await C.load(); redrawView(); },
|
|
288
|
+
toast: (m, undo) => (undo ? undoToast(m, undo) : say(m)),
|
|
278
289
|
// one press on the box marks done, with Undo in the toast (batch 9 item 5b); the caret and the date press change the rest
|
|
279
290
|
check: async (uid, btn) => {
|
|
280
291
|
await setState(id, uid, btn.getAttribute('aria-pressed') === 'true' ? 'To do' : 'Done');
|
|
281
292
|
},
|
|
282
293
|
status: (uid, state) => setState(id, uid, state),
|
|
283
294
|
dates: (uid, patch) => setDates(id, uid, patch),
|
|
295
|
+
milestone: (uid, on) => setDates(id, uid, { milestone: !!on }), // the ◇ in the status picker (batch 11 item 3)
|
|
296
|
+
remove: (uid) => removeTask(id, uid), // the trash in the status picker (batch 11 item 16)
|
|
284
297
|
openTask: (uid) => {
|
|
285
298
|
const M = curM();
|
|
286
299
|
const row = M && (M.tasks.rows || []).find((x) => x.uid === uid || x.key === uid || x.key === 'task:' + uid);
|
|
@@ -291,12 +304,16 @@ function wirePage(b, id) {
|
|
|
291
304
|
if (k && C.openBoardTask) { C.VW.drill(); C.openBoardTask({ ...k, ini: id, ws: (M && M.board.ws) || r.ws || undefined, board: (M && M.board.id) || r.boardId || undefined }); return; }
|
|
292
305
|
if (M) { C.VW.drill(); openTask(id, M, 'task:' + uid); }
|
|
293
306
|
},
|
|
294
|
-
|
|
295
|
-
|
|
307
|
+
// a Jira ticket in Tasks opens its ticket view (batch 11 item 20: the old All tasks panel was the only other way in)
|
|
308
|
+
openTicket: async (key) => { const M = curM(); if (!M) return; C.VW.drill(); (await import('./premium-vw-jira.js')).openTicket({ ...bw(M), initiative: id, ref: key }); },
|
|
309
|
+
add: (b, dates) => { ADDING = id; ADD_DATES = dates && dates.start ? dates : null; redrawView(); const f = BODY && BODY.querySelector('#ivAddTask'); if (f) f.focus(); },
|
|
310
|
+
addCancel: () => { ADDING = null; ADD_DATES = null; redrawView(); },
|
|
311
|
+
// the stage card's ⏸ or calendar on a hold (batch 11 item 21): what the hold says, and its return date set or changed here
|
|
312
|
+
hold: (i, btn) => holdPop(btn, id),
|
|
296
313
|
addTask: async (title, inp) => {
|
|
297
314
|
const M = curM(); if (!M) return;
|
|
298
315
|
inp.disabled = true;
|
|
299
|
-
const r = await C.pmPost('/api/boards/tasks/add', { ...bw(M), initiative: id, title });
|
|
316
|
+
const r = await C.pmPost('/api/boards/tasks/add', { ...bw(M), initiative: id, title, ...(ADD_DATES ? { start: ADD_DATES.start, due: ADD_DATES.due } : {}) });
|
|
300
317
|
inp.disabled = false;
|
|
301
318
|
if (!r || r.ok === false) { say((r && r.error) || 'The task was not added.'); return; }
|
|
302
319
|
say('Task added.'); await C.load(); redrawView();
|
|
@@ -328,6 +345,15 @@ async function setState(id, uid, state) {
|
|
|
328
345
|
if (was && was !== state && !(k.item && state === "Won't do")) undoToast(state + ': ' + k.title + '.', async () => { const u = await C.pmPost('/api/boards/tasks/state', { ...body, state: was }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); });
|
|
329
346
|
else C.toast(state + (k ? ': ' + k.title : '') + '.');
|
|
330
347
|
}
|
|
348
|
+
/** The status picker's trash (batch 11 item 16): POST /api/boards/tasks/delete, a Board task or a breakdown item; Undo restores it. */
|
|
349
|
+
async function removeTask(id, uid) {
|
|
350
|
+
const M = curM(); if (!M) return;
|
|
351
|
+
const k = taskAt(id, uid), C = X.ctx, body = { ...bw(M), task: uid }, title = (k && k.title) || uid;
|
|
352
|
+
const r = await C.pmPost('/api/boards/tasks/delete', body);
|
|
353
|
+
if (!r || r.ok === false) { C.toast((r && r.error) || 'The task was not deleted.'); return; }
|
|
354
|
+
await C.load(); redrawView();
|
|
355
|
+
undoToast('Deleted · ' + title + '.', async () => { const u = await C.pmPost('/api/boards/tasks/restore', body); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); });
|
|
356
|
+
}
|
|
331
357
|
/** The quick dates (the date press, a Timeline drag): POST /api/boards/tasks/edit, Undo puts the old days back. */
|
|
332
358
|
async function setDates(id, uid, patch) {
|
|
333
359
|
const M = curM(); if (!M) return;
|
|
@@ -335,8 +361,9 @@ async function setDates(id, uid, patch) {
|
|
|
335
361
|
const r = await C.pmPost('/api/boards/tasks/edit', { ...body, ...patch });
|
|
336
362
|
if (!r || r.ok === false) { C.toast((r && r.error) || 'Nothing was changed.'); return; }
|
|
337
363
|
await C.load(); redrawView();
|
|
338
|
-
const back = {}; for (const f of Object.keys(patch)) back[f] = k ? (f === 'due' ? k.end : k[f]) || '' : '';
|
|
339
|
-
if (
|
|
364
|
+
const back = {}; for (const f of Object.keys(patch)) back[f] = f === 'milestone' ? (r.from && 'milestone' in r.from ? !!r.from.milestone : !patch.milestone) : k ? (f === 'due' ? k.end : k[f]) || '' : r.from && f in r.from ? r.from[f] || '' : ''; // a Jira ticket's days come back in from (batch 11 item 23)
|
|
365
|
+
if ('milestone' in patch) { undoToast((patch.milestone ? 'Milestone: ' : 'Not a milestone: ') + (k ? k.title : uid) + '.', async () => { const u = await C.pmPost('/api/boards/tasks/edit', { ...body, ...back }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); }); return; }
|
|
366
|
+
if (k || (r.from && ('start' in r.from || 'due' in r.from))) undoToast('Dates saved: ' + (k ? k.title : uid + ', kept in PMOS') + '.', async () => { const u = await C.pmPost('/api/boards/tasks/edit', { ...body, ...back }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); });
|
|
340
367
|
else C.toast('Dates saved.');
|
|
341
368
|
}
|
|
342
369
|
/** ⋯ of the page (HbCMore): change it, look at it elsewhere, then stop it, red and last. */
|
|
@@ -345,14 +372,17 @@ function pageMore(id) {
|
|
|
345
372
|
const mv = mvOf(id, M), out = [], row = rowOf(id), self = !!(M.acts && M.acts.self);
|
|
346
373
|
// D99 (WfAWontDo): Change workflow and Rename first; the PMOS-self board keeps its derived ladder, so it has no workflow to change
|
|
347
374
|
if (!self && !row.ended) out.push({ label: 'Change workflow', note: (row.wf || {}).name || 'Product feature', on: (b) => WF.openPicker(b || moreBtn(), wfUi(), id) });
|
|
348
|
-
// the one view lists the tasks as the WBS; grouping them by epic, owner or your own groups, and sending them to Jira, is the Tasks view
|
|
349
|
-
out.push({ label: 'All tasks', note: 'Group, send to Jira', on: () => iniOverview('tasks', { back: true }) });
|
|
350
375
|
if (X.ctx.renameIni) out.push({ label: 'Rename', on: () => { const t = document.querySelector('#czViewer [data-cz-vw-rn]'); if (t) t.click(); } });
|
|
351
376
|
if (!mv.why) out.push({ label: 'Moves on by itself', note: mv.auto ? 'On' : 'Off', on: () => (ownWf(row) ? autoPress(id, M, !mv.auto) : press(id, M, { kind: 'auto', on: !mv.auto })) });
|
|
352
377
|
if (mv.canBack) out.push({ label: 'Move back a stage', note: mv.prev, on: (b) => popBack(b || document.querySelector('#czViewer [data-cz-vw="more"]'), id, M, mv) });
|
|
353
378
|
if ((M.acts.stages || []).length && !M.acts.self) out.push({ label: 'Move to a stage', on: () => iniOverview('stage', { back: true }) });
|
|
354
379
|
out.push({ label: 'Add a stakeholder', on: () => X.ctx.addPerson() });
|
|
355
|
-
|
|
380
|
+
// P7: an initiative in no program can become one; one in a program can move out of it or to another (batch 11 item 2, canvas LpA1More)
|
|
381
|
+
const pm = X.ctx.moveItems ? X.ctx.moveItems(id, (b, label, rows) => menu(b || moreBtn(), [{ head: label }, ...rows], 'Move to another program')) : [];
|
|
382
|
+
if (X.ctx.turnProgram && !pm.length) out.push({ label: 'Turn into a program', on: () => X.ctx.turnProgram(id) });
|
|
383
|
+
// split it into a new initiative, or merge it into another, above the program moves (batch 11 item 14, canvas XsmA1Menu)
|
|
384
|
+
const sm = X.ctx.smItems && !row.ended ? X.ctx.smItems(id, (b, label, rows) => menu(b || moreBtn(), [{ head: label }, ...rows], label)) : [];
|
|
385
|
+
if (sm.length || pm.length) out.push({ sep: true }, ...sm, ...pm);
|
|
356
386
|
out.push({ sep: true }, { label: 'Open on the Board', on: () => { location.href = '/premium-board.html?focus=' + encodeURIComponent(id) + (M.board.ws ? '&ws=' + encodeURIComponent(M.board.ws) : '') + (M.board.id ? '&board=' + encodeURIComponent(M.board.id) : ''); } },
|
|
357
387
|
{ label: 'The record', on: async () => (X.ctx.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }) });
|
|
358
388
|
// Won't do and Archive hold from any stage (wfRules); Won't do comes back to Triage. Cancel stays red and last (HbCMore)
|
|
@@ -383,91 +413,22 @@ export function iniPage() {
|
|
|
383
413
|
if (!curM()) { X.failed = null; X.ctx.loadIni().then(() => { if (S.ini !== id) return; if (!curM()) X.failed = id; redrawView(); }); }
|
|
384
414
|
return true;
|
|
385
415
|
}
|
|
416
|
+
/** New → A task (XtaA4NewTask): the initiative's page with the Tasks field open and the cursor in it. true when it opened. */
|
|
417
|
+
export function iniAddTask() {
|
|
418
|
+
if (!X.ctx) return false;
|
|
419
|
+
const id = X.ctx.S.ini, c = X.ctx.VW.current();
|
|
420
|
+
if (!id || id === 'product') return false;
|
|
421
|
+
if (!(c && c.id === 'ov:' + id && X.view === 'page') && !iniPage()) return false;
|
|
422
|
+
ADDING = id; redrawView();
|
|
423
|
+
setTimeout(() => { const f = BODY && BODY.querySelector('#ivAddTask'); if (f) f.focus(); }, 0);
|
|
424
|
+
return true;
|
|
425
|
+
}
|
|
386
426
|
|
|
387
|
-
/* ── the Viewer:
|
|
388
|
-
const KIND = {
|
|
389
|
-
const ICON = {
|
|
427
|
+
/* ── the Viewer: Documents, Stage ── */
|
|
428
|
+
const KIND = { docs: 'Documents', stage: 'Stage' };
|
|
429
|
+
const ICON = { docs: 'doc', stage: 'goal' };
|
|
390
430
|
let BODY = null;
|
|
391
431
|
function segHtml(v) { return `<div class="cz-seg hi-seg" role="group" aria-label="Show">${Object.entries(KIND).map(([k, l]) => `<button type="button" data-hi-view="${k}" aria-pressed="${k === v}">${l}</button>`).join('')}</div>`; }
|
|
392
|
-
function taskRowHtml(t, mine) {
|
|
393
|
-
// a task's only stage is its state (Wawan, 2026-10-25): the checkbox, and the five states under ⋯; Won't do sits struck with the done ones
|
|
394
|
-
return `<div class="hi-trow${t.closed ? ' done' : ''}${t.wontdo ? ' wontdo' : ''}" data-ov-tkrow="${esc(t.key)}"${mine ? ` draggable="true" data-hi-drag="${esc(t.key)}"` : ''}>`
|
|
395
|
-
+ (t.canCheck ? `<button type="button" class="hi-chk${t.done ? ' on' : ''}" data-hi-chk="${esc(t.key)}" aria-pressed="${t.done}" aria-label="${t.done ? 'Reopen' : 'Mark done'}: ${esc(t.title)}">${t.done ? SVG(I.check, 12, 3) : ''}</button>` : `<span class="hi-chk off${t.done ? ' on' : ''}" aria-hidden="true" title="${t.jira ? 'Jira keeps its state' : 'A PRD requirement has no state'}">${t.done ? SVG(I.check, 12, 3) : ''}</span>`)
|
|
396
|
-
+ `<button type="button" class="hi-tt" data-ov-tk="${esc(t.key)}" aria-label="Open ${esc(t.title)}">${esc(t.title)}${t.jira && t.ref ? ` <em>${esc(t.ref)}</em>` : ''}</button>`
|
|
397
|
-
+ (t.av ? `<span class="hi-av" title="${esc(t.owner)}">${esc(t.av)}</span>` : '') + `<span class="hi-due${t.late ? ' late' : ''}">${esc(t.due || (t.req ? 'PRD' : t.state === 'In progress' ? 'running' : ''))}</span>`
|
|
398
|
-
+ `<button type="button" class="hi-ib sm" data-hi-tmore="${esc(t.key)}" aria-haspopup="menu" aria-label="More for ${esc(t.title)}">${SVG(I.more, 14, 3)}</button></div>`;
|
|
399
|
-
}
|
|
400
|
-
/* ── the epic groups (T1) and shell A's summary card (XvATasks) ── */
|
|
401
|
-
const TI = { send: 'M4 12l16-8-6 16-3-7z' };
|
|
402
|
-
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
403
|
-
const foldOpen = (key, dflt) => (X.fold.has(key) ? X.fold.get(key) : dflt);
|
|
404
|
-
/** A group header: the name, an optional send icon, the count and the fold chevron (PgTkList .gh). */
|
|
405
|
-
function headHtml(key, title, n, open, send = '') {
|
|
406
|
-
return `<div class="tk-gh${send ? ' s' : ''}"><button type="button" class="tk-ghb" data-tk-gfold="${esc(key)}" aria-expanded="${open}"><b>${esc(title)}</b><span class="tk-ghr"><span class="tk-gn">${n}</span>${SVG(open ? I.down : I.right, 16, 2)}</span></button>${send}</div>`;
|
|
407
|
-
}
|
|
408
|
-
function tkRowHtml(r) {
|
|
409
|
-
const ck = r.inJira ? `<span class="tk-ck" role="img" aria-label="In Jira: ${esc(r.status)}"><i class="tk-sq ${esc(r.cat)}"></i></span>` : '<span class="tk-ck" aria-hidden="true"></span>';
|
|
410
|
-
const mark = r.mark ? `<span class="tk-mk ${esc(r.mark[0])}" role="img" aria-label="${esc(r.mark[1])}" title="${esc(r.mark[1])}"></span>` : '';
|
|
411
|
-
return `<button type="button" class="tk-row" data-tk-open="${esc(r.id)}">${ck}<span class="tk-t"><b>${esc(r.title)}</b>${r.sub ? `<span>${esc(r.sub)}</span>` : ''}</span>${mark}${r.av ? `<span class="tk-av" role="img" aria-label="Assigned to ${esc(r.who)}" title="${esc(r.who)}">${esc(r.av)}</span>` : ''}</button>`;
|
|
412
|
-
}
|
|
413
|
-
function epicGroupsHtml(id, M, T) {
|
|
414
|
-
if (!T) return '<p class="hi-small" role="status">Reading the tickets.</p>';
|
|
415
|
-
if (!T.ok) return `<p class="hi-empty">${esc(T.error)}</p>`;
|
|
416
|
-
if (!T.drafted) return T.items
|
|
417
|
-
? `<div class="tk-card tk-empty"><p>The PRD lists ${plural(T.items, 'story', 'stories')}. Each one becomes a task with its Jira ticket drafted in your template. Nothing goes to Jira until you send it.</p><button type="button" class="hi-btn sm dark" data-tk-drafts>Draft the tickets</button></div>`
|
|
418
|
-
: '<p class="hi-empty">The PRD lists no user stories yet. Give it a "User stories" section, one subheading per story, and each one becomes a task here.</p>';
|
|
419
|
-
const out = TKM.ticketGroups(T).map((g) => {
|
|
420
|
-
const key = 'ep:' + id + ':' + g.id, open = foldOpen(key, true);
|
|
421
|
-
const shown = X.more.has(key) || g.rows.length <= 4 ? g.rows : g.rows.slice(0, 3);
|
|
422
|
-
const send = g.send && !T.pushing ? `<button type="button" class="tk-snd" data-tk-sendg="${esc(g.id)}" aria-label="Send ${esc(g.name)} to Jira" title="Send to Jira">${SVG(TI.send, 17)}</button>` : '';
|
|
423
|
-
return `<section class="tk-g" aria-label="${esc(g.name)}">${headHtml(key, g.name, g.n, open, send)}`
|
|
424
|
-
+ (open ? `<div class="tk-list">${shown.map(tkRowHtml).join('')}${shown.length < g.rows.length ? `<button type="button" class="tk-fold" data-tk-more="${esc(key)}">${g.rows.length - shown.length} more${SVG(I.down, 16, 2)}</button>` : ''}</div>` : '') + '</section>';
|
|
425
|
-
}).join('');
|
|
426
|
-
return out + (T.inJira && T.checkedAt ? `<p class="tk-read">${esc(TKM.readLine(T.checkedAt))}</p>` : '');
|
|
427
|
-
}
|
|
428
|
-
/** The summary card (shell A, desktop): what waits on the PM in the tasks, with one primary. Zero is silence. */
|
|
429
|
-
function summaryHtml(id, M, rows, T, by) {
|
|
430
|
-
const VW = X.ctx.VW;
|
|
431
|
-
if (isPhone() || !VW.czSummary) return '';
|
|
432
|
-
const open = rows.filter((r) => !r.closed && !r.req).length;
|
|
433
|
-
const meta = [open ? open + ' open' : '', 'grouped by ' + MD.BY_LABEL[by].toLowerCase()].filter(Boolean).join(' · ');
|
|
434
|
-
const G = T && T.ok ? TKM.ticketGroups(T) : [];
|
|
435
|
-
const send = G.reduce((a, g) => a + g.send, 0);
|
|
436
|
-
if (T && T.ok && T.pushing) return VW.czSummary({ 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 });
|
|
437
|
-
if (send) return VW.czSummary({ 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: { label: 'Send to Jira', act: 'tk-sendall' } });
|
|
438
|
-
const week = Date.now() + 7 * 864e5;
|
|
439
|
-
const due = rows.filter((r) => !r.closed && !r.req && r.end && Date.parse(r.end) <= week).sort((a, b) => a.end.localeCompare(b.end));
|
|
440
|
-
if (!due.length) return VW.czSummary({ meta });
|
|
441
|
-
const words = due.slice(0, 2).map((r) => r.title + (r.due ? ' ' + (/^(today|tomorrow|yesterday)$/.test(r.due) ? r.due : 'by ' + r.due) : ''));
|
|
442
|
-
return VW.czSummary({ line: plural(due.length, 'is', 'are') + ' due this week', tone: due.some((r) => r.late) ? 'warn' : 'you', text: words.join(', and ') + '.', meta,
|
|
443
|
-
primary: { label: 'Open ' + (due[0].title.length > 36 ? due[0].title.slice(0, 35) + '…' : due[0].title), act: 'tk-openfirst' } });
|
|
444
|
-
}
|
|
445
|
-
function tasksView(id, M) {
|
|
446
|
-
const L = Lof(id), T = Tof(id), by = byOf(L, T), rows = MD.taskRows(M, L);
|
|
447
|
-
if (!T) readT(id, M);
|
|
448
|
-
const mine = by === 'mine';
|
|
449
|
-
const target = mine ? (L.names.includes(X.addTo) ? X.addTo : L.names[0] || '') : '';
|
|
450
|
-
let groups;
|
|
451
|
-
if (by === 'epic') {
|
|
452
|
-
// the PM's own tasks: the PRD stories are tasks of their epics once drafted, and a Jira row of a pushed ticket is that task
|
|
453
|
-
const keys = new Set(((T && T.ok && T.tickets) || []).map((t) => t.key).filter(Boolean));
|
|
454
|
-
const own = rows.filter((r) => !(T && T.ok && T.drafted && r.req) && !(r.jira && keys.has(r.ref)));
|
|
455
|
-
const k2 = 'ep:' + id + ':mine', open2 = foldOpen(k2, false), n2 = own.filter((r) => !r.closed).length;
|
|
456
|
-
groups = epicGroupsHtml(id, M, T)
|
|
457
|
-
+ `<section class="tk-g hi-tg" aria-label="Your tasks">${headHtml(k2, 'Your tasks', n2 || own.length, open2)}${open2 ? own.map((t) => taskRowHtml(t, false)).join('') || '<p class="hi-empty">No task of yours yet. Add one below.</p>' : ''}</section>`;
|
|
458
|
-
} else {
|
|
459
|
-
const G = MD.taskGroups(rows, L, by);
|
|
460
|
-
groups = rows.length ? G.map((g) => {
|
|
461
|
-
const shut = X.shut.has('vt:' + g.key);
|
|
462
|
-
const head = g.title == null ? '' : `<div class="hi-gh"><button type="button" class="hi-ghb" data-hi-vfold="${esc(g.key)}" aria-expanded="${!shut}">${SVG(shut ? I.right : I.down, 14, 2)}<b>${esc(g.title)}</b><span>${g.open} open</span></button>`
|
|
463
|
-
+ (g.mine ? `<button type="button" class="hi-ib sm" data-hi-gmore="${esc(g.title)}" aria-haspopup="menu" aria-label="More for ${esc(g.title)}">${SVG(I.more, 14, 3)}</button>` : '') + '</div>';
|
|
464
|
-
return `<section class="hi-tg" data-hi-drop="${esc(g.mine ? g.title : g.loose ? '' : '')}"${mine ? ' data-hi-dz' : ''} aria-label="${esc(g.title || 'Tasks')}">${head}${shut ? '' : g.rows.map((t) => taskRowHtml(t, mine)).join('') || '<p class="hi-empty">Drag a task here.</p>'}</section>`;
|
|
465
|
-
}).join('') : `<p class="hi-empty">${esc((M.tasks && M.tasks.note) || 'No task yet.')} Add one below.</p>`;
|
|
466
|
-
}
|
|
467
|
-
return summaryHtml(id, M, rows, T, by) + groups
|
|
468
|
-
+ (mine ? `<button type="button" class="hi-btn sm ghost hi-self" data-hi-newgroup>${SVG(I.plus, 14)}New group</button>` : '')
|
|
469
|
-
+ `<div class="hi-add"><label for="ovTask" class="hi-vh">Add a task</label><input id="ovTask" maxlength="200" autocomplete="off" placeholder="Add a task${target ? ' to ' + esc(target) : ''}" data-hi-target="${esc(target)}"><button type="button" class="hi-ib sm" data-ov-add aria-label="Add the task">${SVG(I.next, 14)}</button></div>`;
|
|
470
|
-
}
|
|
471
432
|
function docRowHtml(d, cur, later, phases) {
|
|
472
433
|
const draft = d.act && d.act.kind === 'draft' && !d.running && !d.path && d.st !== 'stale';
|
|
473
434
|
if (later) return `<div class="czs-it hi-drow later" data-ov-doc="${esc(d.key)}"><span class="ut-tki dash" aria-hidden="true">${SVG(I.doc, 15)}</span><span class="w">${esc(d.title)}<span>comes in ${esc(d.phase)}</span></span>${draft ? `<button type="button" class="hi-btn sm ghost" data-ov-draft="${esc(d.key)}">Draft it now</button>` : ''}</div>`;
|
|
@@ -519,8 +480,8 @@ function draw(b) {
|
|
|
519
480
|
if (v === 'page') { const h = pageHtml(id, M); if (b.__pg !== h || !b.firstChild) { b.__pg = h; b.innerHTML = h; } return; }
|
|
520
481
|
// Documents is shell A (XvADocs): no tabs, the summary card and folding groups straight in the body
|
|
521
482
|
if (v === 'docs') { b.innerHTML = docsView(id, M) + '<p class="hi-small" role="status" id="ovMsg"></p>'; return; }
|
|
522
|
-
// the phone keeps the
|
|
523
|
-
b.innerHTML = `<div class="hi-v" data-hi-v="${v}">${isPhone() || !X.ctx.VW.czSummary ? segHtml(v) : ''}${
|
|
483
|
+
// the phone keeps the Documents | Stage switch (PgTkList); in shell A on a desktop the other view sits under ⋯ (XvATasks)
|
|
484
|
+
b.innerHTML = `<div class="hi-v" data-hi-v="${v}">${isPhone() || !X.ctx.VW.czSummary ? segHtml(v) : ''}${stageView(id, M, STAGE_ASK)}<p class="hi-small" role="status" id="ovMsg"></p></div>`;
|
|
524
485
|
}
|
|
525
486
|
function redrawView() {
|
|
526
487
|
if (!BODY || !BODY.isConnected || !X.ctx) return;
|
|
@@ -528,46 +489,23 @@ function redrawView() {
|
|
|
528
489
|
const ae = document.activeElement, keep = ae && BODY.contains(ae) && ae.id ? ae.id : null, val = keep && ae.value != null ? ae.value : null;
|
|
529
490
|
const st = BODY.scrollTop; draw(BODY); BODY.scrollTop = st;
|
|
530
491
|
if (keep) { const n = BODY.querySelector('#' + keep); if (n) { if (val != null) n.value = val; n.focus(); } }
|
|
492
|
+
else if (ADDING && X.view === 'page') { const f = BODY.querySelector('#ivAddTask'); if (f) f.focus(); } // New → A task on a page still reading
|
|
531
493
|
}
|
|
532
494
|
/** ⋯ of the initiative in the Viewer (xvMore order: change it, then look back). */
|
|
533
495
|
function moreOf(id, view) {
|
|
534
496
|
const M0 = () => curM();
|
|
535
497
|
const out = [];
|
|
536
|
-
if (view === 'tasks') out.push({ label: 'Group tasks by', on: (b) => { const M = M0(); if (M) groupMenu(b, id, M); } });
|
|
537
498
|
for (const [k, l] of Object.entries(KIND)) if (k !== view) out.push({ label: l, on: () => iniOverview(k) });
|
|
538
499
|
out.push({ sep: true }, { label: 'Open the full record', on: async () => { const M = M0(); if (M) (X.ctx.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }); } });
|
|
539
500
|
if (M0() && M0().board && M0().board.id) out.push({ label: 'Sprint', on: async () => { const M = M0(); if (M) (X.ctx.VW.drill(), await import('./premium-vw-jira.js')).openSprint(bw(M)); } });
|
|
540
501
|
return out;
|
|
541
502
|
}
|
|
542
|
-
function groupMenu(t, id, M) {
|
|
543
|
-
const L = Lof(id), T = Tof(id), by = byOf(L, T);
|
|
544
|
-
const same = (n) => n.join('|').toLowerCase() === L.names.join('|').toLowerCase();
|
|
545
|
-
const G = T && T.ok ? TKM.ticketGroups(T) : [];
|
|
546
|
-
menu(t, [{ head: 'Group by' }, ...['epic', 'mine', 'owner', 'status', 'none'].map((k) => ({ label: MD.BY_LABEL[k],
|
|
547
|
-
sub: k === 'mine' && L.names.length ? L.names.join(', ') : k === 'epic' && G.length ? G.map((g) => g.name).slice(0, 2).join(', ') : '',
|
|
548
|
-
radio: true, on: by === k, go: () => press(id, M, { kind: 'by', by: k }) })),
|
|
549
|
-
{ hr: true }, { head: 'Saved group sets' },
|
|
550
|
-
...(L.sets || []).map((s) => ({ label: s.names.join(' · '), sub: same(s.names) ? 'this one' : s.name !== s.names.join(' · ') ? s.name : '', go: async () => { if (await press(id, M, { kind: 'groups', names: s.names })) press(id, M, { kind: 'by', by: 'mine' }); } })),
|
|
551
|
-
{ label: 'Save these groups as a set', icon: I.plus, disabled: !L.names.length, go: () => press(id, M, { kind: 'set', name: L.names.join(' · '), names: L.names }) }], 'Group tasks by');
|
|
552
|
-
}
|
|
553
|
-
/** The Send sheet (T3): one path to Jira, from a group's send icon, a drafted ticket, the summary card or the Board's Commit row. */
|
|
554
|
-
async function sendSheet(id, M, o = {}) {
|
|
555
|
-
const S = await import('./tk-send.js');
|
|
556
|
-
return S.openSend({ ws: wsOf(M), board: M.board && M.board.id, initiative: id, ...o, toast: X.ctx.toast,
|
|
557
|
-
onDone: async () => { await readT(id, M, true); setTimeout(() => readT(id, curM() || M, true), 4000); } });
|
|
558
|
-
}
|
|
559
|
-
async function openTicket(id, M, tid) {
|
|
560
|
-
const T = Tof(id), t = T && T.ok ? (T.tickets || []).find((x) => x.id === tid) : null;
|
|
561
|
-
if (t && t.inJira && !t.selectable) { (await import('./premium-vw-jira.js')).openTicket({ ...bw(M), initiative: id, ref: t.key }); return; }
|
|
562
|
-
const D = await import('./tk-draft.js');
|
|
563
|
-
D.openDraft({ VW: X.ctx.VW, ws: wsOf(M), initiative: id, id: tid, view: T && T.ok ? T : null, toast: X.ctx.toast, ui: { menu, ask },
|
|
564
|
-
onChange: () => readT(id, M, true), onSend: (x) => sendSheet(id, M, { ticket: x }) });
|
|
565
|
-
}
|
|
566
503
|
export function iniOverview(view, o = {}) {
|
|
567
504
|
if (!X.ctx) return false;
|
|
568
505
|
const S = X.ctx.S, id = S.ini;
|
|
569
506
|
if (!id || id === 'product') return false;
|
|
570
|
-
|
|
507
|
+
if (!KIND[view]) return iniPage(); // the old Tasks view is the page's own Tasks now (batch 11 item 20)
|
|
508
|
+
const v = view;
|
|
571
509
|
const c = X.ctx.VW.current(), keep = !o.back && !!c && c.id === 'ov:' + id && X.view !== 'page'; // a switch between views keeps the page behind them
|
|
572
510
|
X.view = v;
|
|
573
511
|
STAGE_ASK = o.ask || null;
|
|
@@ -593,7 +531,6 @@ function docsMore(id) {
|
|
|
593
531
|
{ label: 'Show', note: on ? on.label : '', on: (b) => menu(b, chips.map((c) => ({ label: c.label + ' ' + c.n, radio: true, on: X.doc.filter === c.k, go: () => { X.doc.filter = c.k; redrawView(); } })), 'Show documents') },
|
|
594
532
|
{ label: 'Add a document', on: () => addDoc(id) },
|
|
595
533
|
{ sep: true },
|
|
596
|
-
{ label: 'Tasks', on: () => iniOverview('tasks') },
|
|
597
534
|
{ label: 'Stage', on: () => iniOverview('stage') },
|
|
598
535
|
{ label: 'Open the full record', on: async () => (X.ctx.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }) },
|
|
599
536
|
];
|
|
@@ -604,69 +541,14 @@ async function addDoc(id) {
|
|
|
604
541
|
A.openAddDocVw({ VW: X.ctx.VW, pmPost: X.ctx.pmPost, toast: X.ctx.toast, wait: X.ctx.wait || '', ws: M.board.ws, scope: M.docs.scope, phases: MD.PHASES, title: X.ctx.iniTitle(id), back: () => iniOverview('docs'), onAdded: async () => { await X.ctx.load(); if (S.ini === id) iniOverview('docs'); } });
|
|
605
542
|
}
|
|
606
543
|
function wire(body, id) {
|
|
607
|
-
const S = X.ctx.S;
|
|
608
544
|
const say = (m) => { const el = body.querySelector('#ovMsg'); if (el) el.textContent = m; };
|
|
609
545
|
const after = async (r, ok) => { if (r && r.ok !== false) { X.ctx.toast(ok); await X.ctx.load(); redrawView(); return true; } say((r && r.error) || 'Nothing was changed.'); return false; };
|
|
610
|
-
const addTask = async () => {
|
|
611
|
-
const M = curM(); const inp = body.querySelector('#ovTask'); if (!M || !inp) return;
|
|
612
|
-
const v = inp.value.trim(); if (!v) return;
|
|
613
|
-
const L = Lof(id), target = inp.dataset.hiTarget || '';
|
|
614
|
-
const r = await X.ctx.pmPost('/api/boards/tasks/add', { ...bw(M), initiative: id, title: v });
|
|
615
|
-
if (!r || r.ok === false) { say((r && r.error) || 'The task was not added.'); return; }
|
|
616
|
-
const key = r.item ? 'task:' + (r.item.uid || r.item.key) : '';
|
|
617
|
-
if (key && /^task:[A-Za-z0-9]/.test(key)) {
|
|
618
|
-
if (L.by === 'mine' && target) await press(id, M, { kind: 'place', task: key, group: target });
|
|
619
|
-
}
|
|
620
|
-
inp.value = '';
|
|
621
|
-
await after(r, 'Task added.');
|
|
622
|
-
const n = body.querySelector('#ovTask'); if (n) n.focus();
|
|
623
|
-
};
|
|
624
|
-
body.onkeydown = (e) => { if (e.target.id === 'ovTask' && e.key === 'Enter') { e.preventDefault(); addTask(); } };
|
|
625
546
|
body.onclick = async (e) => {
|
|
626
547
|
const t = e.target.closest('button'); const M = curM(); if (!t || t.disabled || !M) return;
|
|
627
548
|
const d = t.dataset;
|
|
628
549
|
if (X.view === 'page' && pagePress(t, id, M)) return;
|
|
629
550
|
if (d.hiView) { iniOverview(d.hiView); return; }
|
|
630
551
|
if ('hiAuto' in d) { const on = t.getAttribute('aria-checked') !== 'true'; if (ownWf(rowOf(id))) autoPress(id, M, on); else press(id, M, { kind: 'auto', on }); return; }
|
|
631
|
-
if ('hiBy' in d) { groupMenu(t, id, M); return; }
|
|
632
|
-
// PRD to Jira (T1 to T3)
|
|
633
|
-
if (d.czsAct === 'tk-sendall') { sendSheet(id, M); return; }
|
|
634
|
-
if (d.czsAct === 'tk-openfirst') {
|
|
635
|
-
const wk = Date.now() + 7 * 864e5, r = MD.taskRows(M, Lof(id)).filter((x) => !x.closed && !x.req && x.end && Date.parse(x.end) <= wk).sort((a, b) => a.end.localeCompare(b.end))[0];
|
|
636
|
-
if (r) openTask(id, M, r.key); return;
|
|
637
|
-
}
|
|
638
|
-
if (d.tkGfold) { X.fold.set(d.tkGfold, t.getAttribute('aria-expanded') !== 'true'); redrawView(); return; }
|
|
639
|
-
if (d.tkMore) { X.more.add(d.tkMore); redrawView(); return; }
|
|
640
|
-
if (d.tkSendg != null) { sendSheet(id, M, { group: d.tkSendg }); return; }
|
|
641
|
-
if (d.tkOpen) { openTicket(id, M, d.tkOpen); return; }
|
|
642
|
-
if ('tkDrafts' in d) {
|
|
643
|
-
t.disabled = true;
|
|
644
|
-
const r = await X.ctx.pmPost('/api/jira/draft', { ws: wsOf(M), initiative: id });
|
|
645
|
-
if (!r || r.ok === false) { say((r && r.error) || 'The tickets were not drafted.'); t.disabled = false; return; }
|
|
646
|
-
X.ctx.toast(plural(r.tickets, 'ticket', 'tickets') + ' drafted. Nothing is in Jira yet.'); await readT(id, M, true); return;
|
|
647
|
-
}
|
|
648
|
-
if ('hiNewgroup' in d) { const L = Lof(id); ask(t, 'Name the group', '', (v) => press(id, M, { kind: 'groups', names: L.names.concat(v) })); return; }
|
|
649
|
-
if (d.hiGmore) {
|
|
650
|
-
const g = d.hiGmore, L = Lof(id);
|
|
651
|
-
menu(t, [{ label: 'Rename', go: (a) => ask(a, 'Rename ' + g, g, (v) => press(id, M, { kind: 'rename', from: g, to: v })) },
|
|
652
|
-
{ label: 'Add a task here', go: () => { X.addTo = g; redrawView(); const n = body.querySelector('#ovTask'); if (n) n.focus(); } },
|
|
653
|
-
{ label: 'Delete the group', sub: 'Its tasks stay', go: () => press(id, M, { kind: 'groups', names: L.names.filter((x) => x !== g) }) }], 'More for ' + g);
|
|
654
|
-
return;
|
|
655
|
-
}
|
|
656
|
-
if (d.hiVfold) { const k = 'vt:' + d.hiVfold; if (X.shut.has(k)) X.shut.delete(k); else X.shut.add(k); redrawView(); return; }
|
|
657
|
-
if ('hiFocusadd' in d) { const n = body.querySelector('#ovTask'); if (n) n.focus(); return; }
|
|
658
|
-
if ('ovAdd' in d) { addTask(); return; }
|
|
659
|
-
if (d.hiChk) { const row = MD.taskRows(M, Lof(id)).find((x) => x.key === d.hiChk); if (row && row.canCheck) after(await X.ctx.pmPost('/api/boards/tasks/state', { ...bw(M), task: row.uid, state: row.done ? 'To do' : 'Done' }), row.done ? 'Reopened.' : 'Done.'); return; }
|
|
660
|
-
if (d.hiTmore) {
|
|
661
|
-
const key = d.hiTmore, row = MD.taskRows(M, Lof(id)).find((x) => x.key === key); if (!row) return;
|
|
662
|
-
const L = Lof(id);
|
|
663
|
-
const items = [{ label: 'Open', go: () => openTask(id, M, key) }];
|
|
664
|
-
if (row.canCheck) { items.push({ head: 'Status' }); for (const s of MD.TASK_STATES) items.push({ label: s, radio: true, on: row.state === s, go: async () => after(await X.ctx.pmPost('/api/boards/tasks/state', { ...bw(M), task: row.uid, state: s }), 'Status changed.') }); }
|
|
665
|
-
if (L.names.length) { items.push({ head: 'Group' }); for (const g of L.names) items.push({ label: g, radio: true, on: row.group === g, go: () => press(id, M, { kind: 'place', task: key, group: g }) }); items.push({ label: 'Not in a group', go: () => press(id, M, { kind: 'place', task: key, group: '' }) }); }
|
|
666
|
-
menu(t, items, 'More for ' + row.title);
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
if (d.ovTk) { openTask(id, M, d.ovTk); return; }
|
|
670
552
|
if ('ovRecord' in d || 'ovSprint' in d) {
|
|
671
553
|
const o = bw(M);
|
|
672
554
|
if ('ovSprint' in d) { (X.ctx.VW.drill(), await import('./premium-vw-jira.js')).openSprint(o); return; }
|
|
@@ -709,11 +591,6 @@ function wire(body, id) {
|
|
|
709
591
|
if ('ovLifeNo' in d) { STAGE_ASK = null; redrawView(); return; }
|
|
710
592
|
if ('ovLifeGo' in d) { const reason = (body.querySelector('#ovWhy').value || '').trim(); if (reason.length < 3) { say('Say why in a few words. It goes on the record.'); return; } const st = STAGE_ASK; STAGE_ASK = null; after(await X.ctx.pmPost('/api/lifecycle', { ws: M.board.ws, initiative_id: id, state: st, reason }), 'Recorded.'); }
|
|
711
593
|
};
|
|
712
|
-
// drag a task between the PM's groups (InTasks)
|
|
713
|
-
body.ondragstart = (e) => { const r = e.target.closest && e.target.closest('[data-hi-drag]'); if (!r) return; e.dataTransfer.setData('text/plain', r.dataset.hiDrag); e.dataTransfer.effectAllowed = 'move'; r.classList.add('drag'); };
|
|
714
|
-
body.ondragend = (e) => { const r = e.target.closest && e.target.closest('[data-hi-drag]'); if (r) r.classList.remove('drag'); body.querySelectorAll('.hi-tg.over').forEach((n) => n.classList.remove('over')); };
|
|
715
|
-
body.ondragover = (e) => { const z = e.target.closest && e.target.closest('[data-hi-dz]'); if (!z) return; e.preventDefault(); body.querySelectorAll('.hi-tg.over').forEach((n) => { if (n !== z) n.classList.remove('over'); }); z.classList.add('over'); };
|
|
716
|
-
body.ondrop = (e) => { const z = e.target.closest && e.target.closest('[data-hi-dz]'); if (!z) return; e.preventDefault(); z.classList.remove('over'); const key = e.dataTransfer.getData('text/plain'); const M = curM(); if (key && M) press(id, M, { kind: 'place', task: key, group: z.dataset.hiDrop || '' }); };
|
|
717
594
|
}
|
|
718
595
|
async function openTask(id, M, key) {
|
|
719
596
|
const row = (M.tasks.rows || []).find((x) => x.key === key) || (/^task:/.test(key) ? { key, uid: key.slice(5), title: '', pmos: true } : null); if (!row) return;
|
|
@@ -735,7 +612,7 @@ function pagePress(t, id, M) {
|
|
|
735
612
|
if ('hiTalk' in d) { C.talk(id); return true; }
|
|
736
613
|
if ('hiMove' in d) { const mv = mvOf(id, M); if (!mv.canMove) return true; if (mv.open.length) popMove(t, id, M, mv); else doMove(id, M, mv.next, mv.allDone ? 'Moved by hand: every exit item is done.' : 'Moved by hand'); return true; }
|
|
737
614
|
if ('hiBack' in d) { const mv = mvOf(id, M); if (mv.canBack) popBack(t, id, M, mv); return true; }
|
|
738
|
-
if ('hiAddtask' in d) {
|
|
615
|
+
if ('hiAddtask' in d) { iniAddTask(); return true; }
|
|
739
616
|
if (d.hiOpen) { iniOverview(d.hiOpen, { back: true }); return true; }
|
|
740
617
|
if (d.hiTask) { VW.drill(); openTask(id, M, d.hiTask); return true; }
|
|
741
618
|
if (d.hiChk) { const row = MD.taskRows(M, Lof(id)).find((x) => x.key === d.hiChk); if (row && row.canCheck) C.pmPost('/api/boards/tasks/state', { ...bw(M), task: row.uid, state: 'Done' }).then(async (r) => { if (r && r.ok !== false) { C.toast('Done: ' + row.title + '.'); await C.load(); redrawView(); } else C.toast((r && r.error) || 'Nothing was changed.'); }); return true; }
|
|
@@ -89,7 +89,7 @@ export function tasksOf(D, ini, now = Date.now()) {
|
|
|
89
89
|
return items.map((t) => {
|
|
90
90
|
const ow = String(t.owner || '').toLowerCase();
|
|
91
91
|
const mine = !ow || /^(pm|you)(:|$)/.test(ow) || (!!me && (ow === me || ow.startsWith(me + ' ')));
|
|
92
|
-
return { id: 't:' + t.uid, kind: 'task', ini, name: t.title, hint: taskHint(t, now, mine), state: mine ? 'quiet' : 'wait', mine, due: t.end || '', late: !!(t.end && dayDiff(t.end, now) < 0), task: t };
|
|
92
|
+
return { id: 't:' + t.uid, kind: 'task', ini, name: t.title, hint: taskHint(t, now, mine), state: mine ? 'quiet' : 'wait', mine, due: t.end || '', late: !!(t.end && dayDiff(t.end, now) < 0), task: t, ...(t.milestone ? { ms: true } : {}) };
|
|
93
93
|
}).map((r) => ({ ...r, rank: urgency(r.task, now) }))
|
|
94
94
|
.sort((a, b) => (b.mine - a.mine) || (a.rank[0] - b.rank[0]) || (a.rank[1] - b.rank[1]));
|
|
95
95
|
}
|
|
@@ -248,7 +248,7 @@ export function homeList(D, o = {}) {
|
|
|
248
248
|
* { id, name, sub (its initiative, or the hint of a row with none), late, state, when (the weekly update's send time) }. */
|
|
249
249
|
function moveOf(groups, needs) {
|
|
250
250
|
const late = [], rest = [], seen = new Set();
|
|
251
|
-
const put = (L, r, sub) => { if (!r || seen.has(r.id)) return; seen.add(r.id); L.push({ id: r.id, name: r.name, sub: sub || '', late: !!r.late, state: r.state || 'needs', check: !!(r.check || r.kind === 'task'), when: whenOf(r) }); };
|
|
251
|
+
const put = (L, r, sub) => { if (!r || seen.has(r.id)) return; seen.add(r.id); L.push({ id: r.id, name: r.name, sub: sub || '', late: !!r.late, state: r.state || 'needs', check: !!(r.check || r.kind === 'task'), when: whenOf(r), ...(r.ms ? { ms: true } : {}) }); };
|
|
252
252
|
for (const g of groups) {
|
|
253
253
|
if (g.kind === 'loose') { for (const r of g.rows) if (r.check && r.late) put(late, r); else if (r.state === 'needs' || r.state === 'blocked') put(rest, r, r.kind === 'session' ? '' : bareHint(r)); continue; }
|
|
254
254
|
for (const t of g.tasks || []) if (t.mine && t.late) put(late, t, g.name);
|
|
@@ -51,6 +51,8 @@ function checkHtml(r) {
|
|
|
51
51
|
const isCheck = (r) => r.check || r.kind === 'task' || r.done;
|
|
52
52
|
const track = (at, label, steps) => (at < 0 ? '' : `<span class="hv-mt" role="img" aria-label="${esc(label)}">${(steps || STEPS).map((x, i) => `<i class="${[i < at ? 'on' : i === at ? 'now' : '', x.ms ? 'ms' : ''].filter(Boolean).join(' ')}"></i>`).join('')}</span>`);
|
|
53
53
|
const clock = (when) => (when ? `<span class="hv-st">${svg(P.clock, 13)}${esc(String(when).split(' ')[0])}</span>` : '');
|
|
54
|
+
/** The small grey ◇ after a milestone task's name (feedback batch 11 item 3): the same glyph as the initiative's Tasks rows. */
|
|
55
|
+
const MS = '<span class="hv-ms" role="img" aria-label="Milestone" title="Milestone"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round" aria-hidden="true"><path d="M12 4l8 8-8 8-8-8z"/></svg></span>';
|
|
54
56
|
/** A row of the list: a next step, a task, a note, a mention, a session or a meeting. o: { sel, kid } */
|
|
55
57
|
export function rowHtml(r, o) {
|
|
56
58
|
const sel = o.sel === r.id;
|
|
@@ -61,7 +63,7 @@ export function rowHtml(r, o) {
|
|
|
61
63
|
: r.kind === 'need' && r.row && r.row.kind !== 'source' ? `<button type="button" class="ut-ib hm-x" data-hm-end="${esc(r.id)}" aria-label="Put off ${esc(r.name)} until tomorrow" title="Put off until tomorrow">${svg(P.x, 14)}</button>` : '';
|
|
62
64
|
const link = r.link && r.kind === 'loose-rec' ? '<span class="hv-st">Link it</span>' : '';
|
|
63
65
|
return `<div class="${cls}" data-id="${esc(r.id)}">${lead}<button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"${sel ? ' aria-current="true"' : ''}${r.hint ? ` title="${esc(r.hint)}"` : ''}>${lead ? '' : markHtml(r)}`
|
|
64
|
-
+ `<span class="hm-rt"><b>${esc(r.name)}</b
|
|
66
|
+
+ `<span class="hm-rt${r.ms ? ' ms' : ''}"><b>${esc(r.name)}</b>${r.ms ? MS : ''}</span>${clock(r.when || whenOf(r))}${link}</button>${end}</div>`;
|
|
65
67
|
}
|
|
66
68
|
/** The chat's header line on a desktop (HvACDesk .ch): the open row's mark, its title and the chip of where it sits (the initiative's stage
|
|
67
69
|
* track and name, or the program's tile and name). h: { row, title, scope, at, stage, prog }. A chip that repeats the title is left out, and
|