create-pmos 0.397.0 → 0.399.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 +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +105 -52
- package/workspace/briefing-premium-board-test.js +284 -128
- package/workspace/briefing-premium-calendar-2-test.js +135 -198
- package/workspace/briefing-premium-calendar-3-test.js +143 -418
- package/workspace/briefing-premium-calendar-test.js +85 -196
- package/workspace/briefing-premium-doc-edit-test.js +99 -83
- package/workspace/briefing-premium-initiative-test.js +175 -290
- package/workspace/briefing-premium-insights-test.js +414 -219
- package/workspace/briefing-premium-metrics-test.js +55 -97
- package/workspace/briefing-premium-products-test.js +44 -28
- package/workspace/briefing-premium-sources-test.js +70 -49
- package/workspace/briefing-premium-test.js +155 -648
- package/workspace/briefing-premium-work-test.js +88 -283
- package/workspace/changelog.json +24 -0
- package/workspace/ev-everywhere-test.js +210 -0
- package/workspace/fixtures/board-premium-trail.js +32 -0
- package/workspace/fixtures/premium-viewer-fixtures.js +187 -0
- package/workspace/guide/briefing-premium.md +3 -1
- package/workspace/guide/home.md +68 -0
- package/workspace/guide/index.md +1 -0
- package/workspace/lib/agent-roles.js +71 -0
- package/workspace/lib/board-grill.js +63 -0
- package/workspace/lib/board-premium.js +121 -24
- package/workspace/lib/board-trail.js +223 -0
- package/workspace/lib/home-work-item.js +58 -0
- package/workspace/lib/initiative-layout.js +77 -0
- package/workspace/lib/insights-goals.js +196 -0
- package/workspace/lib/insights-premium.js +64 -15
- package/workspace/lib/insights-records.js +115 -0
- package/workspace/lib/jira-tickets.js +1 -1
- package/workspace/lib/meeting-points.js +52 -0
- package/workspace/lib/news-for-you.js +88 -0
- package/workspace/lib/notes-series.js +29 -6
- package/workspace/lib/report-confirm.js +48 -0
- package/workspace/lib/route-modules.js +12 -0
- package/workspace/lib/routes-board-docs.js +46 -0
- package/workspace/lib/routes-board-grill.js +90 -0
- package/workspace/lib/routes-board-trail.js +33 -0
- package/workspace/lib/routes-home-desk.js +176 -0
- package/workspace/lib/routes-home-review.js +108 -0
- package/workspace/lib/routes-initiative-layout.js +57 -0
- package/workspace/lib/routes-insights-premium.js +16 -4
- package/workspace/lib/routes-insights-records.js +133 -0
- package/workspace/lib/routes-meeting-points.js +37 -0
- package/workspace/lib/routes-news.js +57 -0
- package/workspace/lib/routes-notes.js +3 -1
- package/workspace/lib/routes-report-confirm.js +31 -0
- package/workspace/lib/routes-search.js +38 -0
- package/workspace/lib/routes-viewer.js +108 -0
- package/workspace/lib/search-index.js +176 -0
- package/workspace/lib/transcript-steps.js +123 -0
- package/workspace/lib/viewer-meeting.js +205 -0
- package/workspace/lib/viewer-report.js +89 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +128 -82
- package/workspace/premium-briefing-depth-test.js +104 -90
- package/workspace/premium-chat-attach-test.js +54 -63
- package/workspace/premium-chat-chart-tab-test.js +37 -37
- package/workspace/premium-chat-context-test.js +19 -18
- package/workspace/premium-chat-goal-view-test.js +23 -23
- package/workspace/premium-chat-notes-test.js +26 -31
- package/workspace/premium-chat-report-tab-test.js +46 -28
- package/workspace/premium-chat-term-test.js +16 -16
- package/workspace/premium-chat-viewer-test.js +60 -59
- package/workspace/premium-core-doc-issue-test.js +52 -43
- package/workspace/premium-html-viewer-test.js +14 -17
- package/workspace/premium-phone-card-test.js +10 -3
- package/workspace/premium-phone-room-test.js +41 -35
- package/workspace/premium-report-read-test.js +152 -197
- package/workspace/premium-viewer-download-test.js +19 -22
- package/workspace/premium-viewer-flicker-test.js +11 -16
- package/workspace/premium-viewer-share-test.js +6 -9
- package/workspace/premium-viewer-test.js +41 -60
- package/workspace/premium-vw-backlog-test.js +53 -33
- package/workspace/premium-vw-cal-test.js +97 -128
- package/workspace/premium-vw-copy-test.js +17 -33
- package/workspace/premium-vw-doc-test.js +17 -10
- package/workspace/premium-vw-item-test.js +50 -49
- package/workspace/premium-vw-jira-test.js +53 -27
- package/workspace/premium-vw-meet-test.js +115 -187
- package/workspace/premium-vw-notes-test.js +88 -109
- package/workspace/premium-vw-rec-test.js +71 -194
- package/workspace/premium-vw-slides-test.js +46 -50
- package/workspace/premium-welcome-test.js +3 -2
- package/workspace/premium-work-depth-test.js +61 -53
- package/workspace/public/pm/bd-acts.js +383 -0
- package/workspace/public/pm/bd-asks.js +261 -0
- package/workspace/public/pm/bd-pop.js +59 -0
- package/workspace/public/pm/bd-span.js +222 -82
- package/workspace/public/pm/bd-stages.js +25 -11
- package/workspace/public/pm/bd-views.js +169 -0
- package/workspace/public/pm/c3-doc-sheet.js +1 -1
- package/workspace/public/pm/c3-md.js +3 -395
- package/workspace/public/pm/c3-phone-detail.js +1 -1
- package/workspace/public/pm/c3-phone-model.js +3 -68
- package/workspace/public/pm/chat-term.js +3 -3
- package/workspace/public/pm/cozy-board.css +798 -230
- package/workspace/public/pm/cozy-ev.css +228 -0
- package/workspace/public/pm/cozy-evmodel.js +106 -0
- package/workspace/public/pm/cozy-evui.js +47 -0
- package/workspace/public/pm/cozy-home.css +570 -142
- package/workspace/public/pm/cozy-home.js +5 -3
- package/workspace/public/pm/cozy-insights.css +437 -170
- package/workspace/public/pm/cozy-md.js +396 -0
- package/workspace/public/pm/cozy-nav.js +104 -29
- package/workspace/public/pm/cozy-news.js +140 -0
- package/workspace/public/pm/cozy-placeholder.js +26 -0
- package/workspace/public/pm/cozy-search.js +203 -0
- package/workspace/public/pm/cozy-settings.js +198 -0
- package/workspace/public/pm/cozy-sources.js +89 -0
- package/workspace/public/pm/cozy-today.css +217 -0
- package/workspace/public/pm/cozy-viewer.css +3 -3
- package/workspace/public/pm/cozy-viewer.js +145 -0
- package/workspace/public/pm/cozy-vw-mtg.css +350 -0
- package/workspace/public/pm/cozy-vw-rp.css +152 -0
- package/workspace/public/pm/cozy-vw.css +485 -0
- package/workspace/public/pm/cozy.css +83 -1
- package/workspace/public/pm/home-adddoc.js +48 -0
- package/workspace/public/pm/home-app.js +1179 -0
- package/workspace/public/pm/home-around.js +413 -0
- package/workspace/public/pm/home-chat.js +512 -0
- package/workspace/public/pm/home-data.js +312 -0
- package/workspace/public/pm/home-dictate.js +54 -0
- package/workspace/public/pm/home-draft.js +68 -0
- package/workspace/public/pm/home-ini-model.js +190 -0
- package/workspace/public/pm/home-ini.css +171 -0
- package/workspace/public/pm/home-ini.js +456 -0
- package/workspace/public/pm/home-list.js +276 -0
- package/workspace/public/pm/home-more.js +132 -0
- package/workspace/public/pm/home-phone-card.js +109 -0
- package/workspace/public/pm/home-review.js +104 -0
- package/workspace/public/pm/home-task.js +67 -0
- package/workspace/public/pm/home-today.js +144 -0
- package/workspace/public/pm/home-work.js +547 -0
- package/workspace/public/pm/phone-moment.js +69 -0
- package/workspace/public/pm/pm-work-view.js +1 -1
- package/workspace/public/pm/premium-attach.js +4 -0
- package/workspace/public/pm/premium-board.js +548 -395
- package/workspace/public/pm/premium-chart-tab.js +109 -62
- package/workspace/public/pm/premium-deck.js +3 -3
- package/workspace/public/pm/premium-first.js +23 -21
- package/workspace/public/pm/premium-insights.js +1102 -581
- package/workspace/public/pm/premium-meeting.js +61 -549
- package/workspace/public/pm/premium-mtg-present.js +138 -0
- package/workspace/public/pm/premium-mtg-replay.js +142 -0
- package/workspace/public/pm/premium-notes.js +1 -1
- package/workspace/public/pm/premium-report-frame.css +20 -0
- package/workspace/public/pm/premium-report-read.js +669 -476
- package/workspace/public/pm/premium-report-tab.js +116 -67
- package/workspace/public/pm/premium-shell.js +76 -123
- package/workspace/public/pm/premium-viewer.js +22 -1
- package/workspace/public/pm/premium-vw-cal.js +277 -48
- package/workspace/public/pm/premium-vw-doc.css +6 -0
- package/workspace/public/pm/premium-vw-doc.js +40 -2
- package/workspace/public/pm/premium-vw-file.js +2 -2
- package/workspace/public/pm/premium-vw-meet.js +6 -83
- package/workspace/public/pm/premium-vw-mtg.js +958 -0
- package/workspace/public/pm/premium-vw-notes.js +116 -68
- package/workspace/public/pm/premium-vw-open.js +35 -0
- package/workspace/public/pm/premium-vw-page.js +16 -0
- package/workspace/public/pm/premium-vw-rec.js +11 -218
- package/workspace/public/pm/premium-vw-slides.css +5 -0
- package/workspace/public/pm/premium-vw-slides.js +44 -8
- package/workspace/public/pm/rp-parts.js +269 -0
- package/workspace/public/pm/term-view.js +22 -0
- package/workspace/public/premium-board.html +29 -70
- package/workspace/public/premium-initiative.html +8 -48
- package/workspace/public/premium-insights.html +26 -64
- package/workspace/public/premium-viewer.html +20 -0
- package/workspace/public/premium.html +18 -107
- package/workspace/r/m1.png +0 -0
- package/workspace/r/m2.png +0 -0
- package/workspace/r/m3.png +0 -0
- package/workspace/r/nl.png +0 -0
- package/workspace/server.js +18 -3
- package/workspace/test-files.json +1 -0
- package/workspace/test-lists/home-libs.json +9 -0
- package/workspace/test-lists/initiative-layout.json +9 -0
- package/workspace/test-lists/premium-report-read.json +1 -1
- package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
- package/workspace/test-lists/premium-uncovered-reports.json +9 -0
- package/workspace/test-lists/premium-vw-agreed.json +9 -0
- package/workspace/test-lists/premium-vw-notes.json +1 -1
- package/workspace/test-lists/uf-everywhere.json +15 -0
- package/workspace/test-lists/uf-home.json +9 -0
- package/workspace/test-lists/uncovered-board.json +9 -0
- package/workspace/public/pm/premium-work.js +0 -729
- package/workspace/public/pm/premium.js +0 -1146
|
@@ -1,50 +1,78 @@
|
|
|
1
|
-
/* pm/premium-board.js — the premium Board in the Agreed design (initiative premium-agreed-design:
|
|
1
|
+
/* pm/premium-board.js — the premium Board in the Agreed design (initiative premium-agreed-design: the AgBoard* frames; built on briefing-premium-board).
|
|
2
2
|
* Reads GET /api/board-premium and draws the model lib/board-premium.js builds from the routes the production Initiatives page reads.
|
|
3
|
-
* · one toolbar
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* · the
|
|
3
|
+
* · one toolbar: the product picker, the view toggle, Find, Filter, the shell's bell, New initiative and the shell's ⋯ menu; under it the
|
|
4
|
+
* Initiatives and Documents tabs and the chips (Jira read time, sprint and release, new asks, late, at risk, blocked, idle, This sprint).
|
|
5
|
+
* · the stage track (default): each initiative is a row across the six stages and two milestones (◆), with the parts or tickets counted
|
|
6
|
+
* toward the output that finishes its current step. Monitor and Evaluate rows fold under the table after the first of each.
|
|
7
|
+
* · List and By stage (pm/bd-views.js; BdList, BdByStage) and the timeline (pm/bd-span.js): Sprint, Quarter, Half, Year, 2 yr and 5 yr.
|
|
8
|
+
* · a row opens the initiative panel and a ticket opens the Jira ticket panel, in the side panel (a bottom sheet on a phone).
|
|
9
9
|
* · the Board has no chat: "Ask about this" sends the question to Home (/premium.html?ask=<initiative>&q=<question>).
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
12
|
-
|
|
10
|
+
* The uncovered features (initiative premium-uncovered-features: BdList, BdByStage, BdDocs, BdSpans, BdAsks, BdNew, BdGrill, BdActions, BdFilter,
|
|
11
|
+
* BdSprint, BdPanel, BdPhone, BdHead) are drawn by pm/bd-views.js (the views and Documents), pm/bd-asks.js (new asks, New initiative and its first
|
|
12
|
+
* questions), pm/bd-acts.js (the row actions, Find, Filter, the sprint and release, the trends, the document panel) and pm/bd-pop.js (popovers).
|
|
13
|
+
* A phone has List, By stage and the stage track; the timeline needs a wider screen (BdPhone).
|
|
14
|
+
* After the model, GET /api/board-trail (lib/board-trail.js) adds what the model does not carry: days in the step and the usual days, the
|
|
15
|
+
* skipped steps and why, the parts of the output, what waits on you, tickets drafted in PMOS, PRD drift, links, dependencies and themes.
|
|
16
|
+
* Where no record holds a value for an initiative, the element says so: nothing is invented. */
|
|
13
17
|
import { pmPost } from './http.js';
|
|
14
|
-
import {
|
|
15
|
-
import { $, $$, esc, openDlg, toast, loadThread, wireRail, logHtml, turnA, ptx, pillOf, store, crumbHtml, wireCrumb, chatAbout, kv, H, openAddDoc, setPageGaps, openSources } from './premium-shell.js';
|
|
16
|
-
import { mountDocSheet } from './premium-doc-sheet.js';
|
|
17
|
-
import * as MT from './premium-metric-tiles.js';
|
|
18
|
-
import { openSprint } from './premium-vw-jira.js';
|
|
19
|
-
import { dotsBtn, openMenu, closeMenu, menuKey, asksHtml, onAsks, openIniForm } from './premium-acts.js';
|
|
18
|
+
import { $, $$, esc, store, crumbHtml, wireCrumb, chatAbout, setPageGaps } from './premium-shell.js';
|
|
20
19
|
import { mountNav } from './cozy-nav.js';
|
|
21
|
-
import { stepsHelpHtml } from './bd-stages.js';
|
|
22
|
-
import { timelineHtml, SPANS } from './bd-span.js';
|
|
20
|
+
import { stepsHelpHtml, rulesHelpHtml } from './bd-stages.js';
|
|
21
|
+
import { timelineHtml, SPANS, GROUPS, md } from './bd-span.js';
|
|
22
|
+
import * as Acts from './bd-acts.js';
|
|
23
|
+
import * as V from './bd-views.js';
|
|
24
|
+
import * as Asks from './bd-asks.js';
|
|
25
|
+
import { open as viewerOpen } from './cozy-viewer.js';
|
|
23
26
|
|
|
24
|
-
const
|
|
25
|
-
let M = null;
|
|
26
|
-
|
|
27
|
+
const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUP_KEY = 'pmos.board.group';
|
|
28
|
+
let M = null; // the model
|
|
29
|
+
let TR = null; // the trail (GET /api/board-trail): { usual, themes, items: { [id]: item } }
|
|
30
|
+
let group = GROUPS.some(([k]) => k === store.get(GROUP_KEY)) ? store.get(GROUP_KEY) : 'theme';
|
|
27
31
|
let view = ['track', 'stages', 'time', 'list'].includes(store.get(VIEW_KEY)) ? store.get(VIEW_KEY) : 'track';
|
|
32
|
+
let pview = ['list', 'stages', 'track'].includes(store.get(PVIEW_KEY)) ? store.get(PVIEW_KEY) : 'list'; // a phone's view (BdPhone)
|
|
28
33
|
let span = SPANS.some(([k]) => k === store.get(SPAN_KEY)) ? store.get(SPAN_KEY) : 'quarter';
|
|
29
34
|
let tab = 'ini';
|
|
30
|
-
let shown = 25; // rows on screen in the track and the list
|
|
31
35
|
let readTimer = null;
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
let foldOpen = false; // the Monitor and Evaluate rows under the table
|
|
37
|
+
let sprintSet = false; // "This sprint" starts on, once, when the board has a sprint
|
|
38
|
+
const F = { chips: new Set(), q: '', owners: new Set(), lanes: new Set(), sprints: new Set() }; // the chip filters, Find and Filter
|
|
39
|
+
let GR = {}; // the first questions still open per initiative (GET /api/board-grill?ids=): { [id]: { open, total, later } }
|
|
40
|
+
let DM = {}; // the documents' history (GET /api/board-docs): { [path]: { changed, by, log } }
|
|
41
|
+
let peek = null; // the open panel: { kind: 'ini' | 'tk' | 'acts', key, tk, from: 'track' | 'time' }
|
|
36
42
|
mountNav('board');
|
|
37
|
-
/** The context of the board presses (pm/premium-acts.js). */
|
|
38
|
-
const ctxOf = () => ({ ws: M.board.ws, board: M.board.id, boardName: M.board.name, self: M.board.self, first: (M.board.stages || [])[0] || '', reload: load });
|
|
39
|
-
const ICO = (p) => `<svg class="i" viewBox="0 0 24 24">${p}</svg>`;
|
|
40
43
|
const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
41
|
-
const
|
|
42
|
-
|
|
44
|
+
const I = {
|
|
45
|
+
x: 'M6 6l12 12M18 6L6 18', expand: 'M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7', more: 'M5 12h.01M12 12h.01M19 12h.01', go: 'M5 12h14M13 6l6 6-6 6', next: 'M9 6l6 6-6 6',
|
|
46
|
+
ext: 'M14 4h6v6M20 4l-9 9M10 6H5v13h13v-5', refresh: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7', cal: 'M4 6h16v14H4zM4 10h16M9 3v4M15 3v4', jira: 'M12 3l9 9-9 9-9-9z',
|
|
47
|
+
flag: 'M5 21V4M5 4h11l-2 4 2 4H5', note: 'M4 5h16v11h-9l-5 4v-4H4z', spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z',
|
|
48
|
+
doc: 'M6 3h9l4 4v14H6zM14 3v5h5', link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1', chev: 'M7 10l5 5 5-5', chevUp: 'M7 14l5-5 5 5',
|
|
49
|
+
move: 'M4 12h12M12 6l6 6-6 6M20 5v14', hold: 'M9 5v14M15 5v14', archive: 'M4 5h16v4H4zM6 9v10h12V9M10 13h4', group: 'M3 5h18v4H3zM3 11h18v4H3zM3 17h12v3H3z',
|
|
50
|
+
track: 'M3 5h18v4H3zM3 11h18v4H3zM3 17h12v3H3z', time: 'M4 6h9M8 12h11M6 18h7',
|
|
51
|
+
};
|
|
43
52
|
const plural = (n, a, b) => (n === 1 ? a : b);
|
|
44
|
-
const ago = (iso) => { const t = Date.parse(iso || ''); if (!t) return ''; const m = Math.max(0, Math.round((Date.now() - t) / 60000)); return m < 1 ? 'just now' : m < 60 ? m + ' min ago' : m < 60 * 36 ? Math.round(m / 60) + ' h ago' : Math.round(m / 1440) + ' days ago'; };
|
|
45
|
-
const
|
|
53
|
+
const ago = (iso, short) => { const t = Date.parse(iso || ''); if (!t) return ''; const m = Math.max(0, Math.round((Date.now() - t) / 60000)); return m < 1 ? 'just now' : m < 60 ? m + ' min' + (short ? '' : ' ago') : m < 60 * 36 ? Math.round(m / 60) + ' h' + (short ? '' : ' ago') : Math.round(m / 1440) + ' days' + (short ? '' : ' ago'); };
|
|
54
|
+
const isoDate = (iso) => { const x = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return x ? new Date(+x[1], +x[2] - 1, +x[3]) : null; };
|
|
55
|
+
const fmt = (iso) => { const d = isoDate(iso); return d ? md(d) : ''; };
|
|
56
|
+
const PHONE = matchMedia('(max-width: 720px)');
|
|
57
|
+
const goneRows = () => { const G = (M && M.initiatives && M.initiatives.gone) || {}; return [...(G.cancelled || []), ...(G.archived || [])]; };
|
|
58
|
+
const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || goneRows().find((r) => r.key === key) || null;
|
|
59
|
+
|
|
60
|
+
/** A panel of pm/bd-acts.js or pm/bd-asks.js: it goes in the side panel like the others; cls widens it (pk-new, pk-wide, pk-doc). */
|
|
61
|
+
function actsPanel(html, from, cls) {
|
|
62
|
+
peek = { kind: 'acts', key: peek && peek.key }; showPeek(html, from); // keeps the initiative, so Close goes back to its row
|
|
63
|
+
const pk = $('#peek'); pk.classList.remove('pk-new', 'pk-wide', 'pk-doc'); if (cls) pk.classList.add(cls);
|
|
64
|
+
}
|
|
46
65
|
|
|
47
|
-
/* ── the
|
|
66
|
+
/* ── the toast: the Agreed design's dark pill ─────────────────────────────────────────────────────────────────────────────── */
|
|
67
|
+
let toastT = null;
|
|
68
|
+
/** The toast; with `undo`, an Undo button that runs it once (the write's opposite, through the same route). */
|
|
69
|
+
function say(msg, undo) {
|
|
70
|
+
const t = $('#bdToast'); t.innerHTML = `<span>${esc(msg)}</span>${undo ? '<button type="button" class="bd-undo">Undo</button>' : ''}`; t.hidden = false;
|
|
71
|
+
const u = t.querySelector('.bd-undo'); if (u) u.onclick = () => { u.disabled = true; t.hidden = true; undo(); };
|
|
72
|
+
clearTimeout(toastT); toastT = setTimeout(() => { t.hidden = true; }, undo ? 10000 : 5000);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* ── the toolbar: picker, chips ───────────────────────────────────────────────────────────────────────────────────── */
|
|
48
76
|
let crumbed = false;
|
|
49
77
|
function drawHead() {
|
|
50
78
|
if (!crumbed) {
|
|
@@ -56,173 +84,253 @@ function drawHead() {
|
|
|
56
84
|
chatAbout('board:this-board', M.board.name ? 'the ' + M.board.name + ' board' : 'this board');
|
|
57
85
|
}
|
|
58
86
|
$('#snap').textContent = M.header.text;
|
|
87
|
+
$('#newIni').hidden = !!M.board.self; // PMOS-self: new work starts at the pmos-router skill
|
|
59
88
|
setPageGaps(((M.header && M.header.missing) || []).length);
|
|
60
|
-
$('#snap').title = 'Every figure on this page comes from a record of the board. A date, owner or progress shows only when one was set.';
|
|
61
|
-
$('#brief').textContent = '';
|
|
62
89
|
}
|
|
63
90
|
const CHIP_F = [['late', 'late', 'm-warn', (n) => n + ' late'], ['risk', 'risk', 'm-warn', (n) => n + ' at risk'], ['blocked', 'red', 'm-crit', (n) => n + ' blocked'], ['idle', 'q', '', (n) => n + ' idle 30+ days']];
|
|
91
|
+
const longSpan = () => view === 'time' && (span === 'year' || span === 'y5');
|
|
64
92
|
function drawChips() {
|
|
65
|
-
const J = M.jira || {}, C = M.chips || {}, sp = J.sprint, rel = J.release;
|
|
66
|
-
const jira = J.readAt ? 'Jira · read ' + ago(J.readAt) : 'Jira · not read';
|
|
67
|
-
const sprint = [sp ? sp.name : null, rel ? rel.name + ' ships ' + rel.at : null].filter(Boolean).join(' · ') || 'No sprint on record';
|
|
68
|
-
const asks =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
93
|
+
const J = M.jira || {}, C = M.chips || {}, sp = J.sprint, rel = J.release, phone = PHONE.matches;
|
|
94
|
+
const jira = J.readAt ? (phone ? 'Jira ' + ago(J.readAt, true) : 'Jira · read ' + ago(J.readAt)) : phone ? 'Jira not read' : 'Jira · not read';
|
|
95
|
+
const sprint = [sp ? sp.name : null, rel ? rel.name + ' ships ' + rel.at.replace(/^(\d+) (\w+)$/, '$2 $1') : null].filter(Boolean).join(' · ') || 'No sprint on record';
|
|
96
|
+
const asks = C.asks == null ? 'New asks · not read' : null;
|
|
97
|
+
const flt = (keys) => CHIP_F.filter(([k]) => keys.includes(k)).map(([k, tone, mo, word]) => (C[k] ? `<button type="button" class="bd-chip gh${F.chips.has(k) ? ' on' : ''}" data-f="${k}" aria-pressed="${F.chips.has(k)}"><i class="cz-dot ${tone} ${mo}"></i>${esc(word(C[k]))}</button>` : '')).join('');
|
|
98
|
+
const thisSprint = sp && (view === 'track' || phone) ? `<button type="button" class="bd-chip${F.chips.has('sprint') ? ' on' : ''}" data-f="sprint" aria-pressed="${F.chips.has('sprint')}">This sprint</button>` : '';
|
|
99
|
+
if (longSpan()) {
|
|
100
|
+
const gn = (GROUPS.find(([k]) => k === group) || GROUPS[0])[1];
|
|
101
|
+
$('#bdChipset').innerHTML = `<span class="bd-grpw"><button type="button" class="bd-chip" id="chGroup" aria-haspopup="menu" aria-expanded="false">${SV(I.group)}<span>Group:</span><b>${esc(gn)}</b></button><span class="bd-grpm" id="grpMenu" role="menu" hidden>${GROUPS.map(([k, n]) => `<button type="button" role="menuitemradio" aria-checked="${k === group}" data-grp="${k}">${esc(n)}</button>`).join('')}</span></span><span class="bd-sp"></span>${flt(['late', 'risk', 'blocked'])}`;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const jiraChip = `<button type="button" class="bd-chip" id="chJira" title="Read Jira again">${SV(I.refresh)}<span>${esc(jira)}</span></button>`;
|
|
105
|
+
const askChip = `<button type="button" class="bd-chip" id="chAsks" aria-haspopup="dialog">${asks ? esc(asks) : `<i class="cz-dot you${C.asks ? ' m-info' : ''}"></i><b>${C.asks}</b> new ${plural(C.asks, 'ask', 'asks')}`}</button>`;
|
|
106
|
+
if (phone) {
|
|
107
|
+
const docs = M.docs && M.docs.rows ? M.docs.rows.length : 0;
|
|
108
|
+
$('#bdChipset').innerHTML = thisSprint + jiraChip + askChip + flt(['late', 'risk', 'blocked', 'idle']) + `<button type="button" class="bd-chip" id="chDocs">Docs ${docs}</button>`;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
$('#bdChipset').innerHTML = jiraChip
|
|
112
|
+
+ `<button type="button" class="bd-chip" id="chSprint" aria-haspopup="dialog">${SV(I.cal)}<span>${esc(sprint)}</span></button>`
|
|
113
|
+
+ askChip + '<span class="bd-vr"></span>' + flt(['late', 'risk', 'blocked', 'idle'])
|
|
114
|
+
+ (thisSprint ? '<span class="bd-sp"></span>' + thisSprint : '');
|
|
75
115
|
}
|
|
76
116
|
$('#bdChipset').addEventListener('click', (e) => {
|
|
77
117
|
const f = e.target.closest('[data-f]');
|
|
78
|
-
if (f) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
118
|
+
if (f) {
|
|
119
|
+
const k = f.dataset.f;
|
|
120
|
+
// a metric chip opens its trend (BdPanel), whose "Show only" filters; a chip that is on turns off at once
|
|
121
|
+
if (k !== 'sprint' && !F.chips.has(k)) { Acts.open.trend(k, f); return; }
|
|
122
|
+
if (F.chips.has(k)) F.chips.delete(k); else F.chips.add(k); drawChips(); drawInit(); return;
|
|
123
|
+
}
|
|
124
|
+
const g = e.target.closest('[data-grp]');
|
|
125
|
+
if (g) { group = g.dataset.grp; store.set(GROUP_KEY, group); drawChips(); drawInit(); const c = $('#chGroup'); if (c) c.focus(); return; }
|
|
126
|
+
const b = e.target.closest('button'); if (!b) return;
|
|
127
|
+
if (b.id === 'chJira') refreshJira(b);
|
|
128
|
+
else if (b.id === 'chSprint') Acts.open.sprint(b);
|
|
129
|
+
else if (b.id === 'chAsks') Acts.open.asks(b);
|
|
130
|
+
else if (b.id === 'chGroup') { const m = $('#grpMenu'), o = m.hidden; m.hidden = !o; b.setAttribute('aria-expanded', String(o)); if (o) m.querySelector('[aria-checked="true"]').focus(); }
|
|
131
|
+
else if (b.id === 'chDocs') setTab('docs');
|
|
82
132
|
});
|
|
133
|
+
/** Read Jira again: the Jira source's own refresh (POST /api/sources/refresh), the one the Sources list runs. It starts a read and changes no record. */
|
|
134
|
+
async function refreshJira(btn) {
|
|
135
|
+
if (btn) btn.disabled = true;
|
|
136
|
+
const r = await pmPost('/api/sources/refresh', { ws: (M && M.board.ws) || '', source: 'jira' }).catch(() => null);
|
|
137
|
+
if (btn) btn.disabled = false;
|
|
138
|
+
say(r && r.ok ? 'Reading Jira again. The Board shows it when the read lands.' : 'Jira was not read again: ' + ((r && r.error) || 'the server did not answer') + '.');
|
|
139
|
+
if (r && r.ok) setTimeout(load, 4000);
|
|
140
|
+
}
|
|
83
141
|
|
|
84
|
-
/* ── popovers
|
|
142
|
+
/* ── the popovers: what finishes each step, and the timeline's spans ───────────────────────────────────────────────────── */
|
|
85
143
|
let popBtn = null;
|
|
86
|
-
function closePops(back) { $$('.bd-pop').forEach((p) => { p.hidden = true; }); if (popBtn
|
|
87
|
-
function togglePop(id, btn
|
|
144
|
+
function closePops(back) { $$('.bd-pop').forEach((p) => { p.hidden = true; }); if (popBtn && back) popBtn.focus(); popBtn = null; }
|
|
145
|
+
function togglePop(id, btn) {
|
|
88
146
|
const p = $('#' + id), open = p.hidden;
|
|
89
147
|
closePops();
|
|
90
148
|
if (!open) return;
|
|
91
|
-
p.hidden = false; popBtn =
|
|
92
|
-
|
|
93
|
-
else { p.style.top = ''; p.style.left = ''; }
|
|
94
|
-
const f = p.querySelector('button, input, a'); if (f) f.focus({ preventScroll: true });
|
|
149
|
+
p.hidden = false; popBtn = btn || null;
|
|
150
|
+
const f = p.querySelector('button'); if (f) f.focus({ preventScroll: true });
|
|
95
151
|
}
|
|
152
|
+
$('#popSteps').innerHTML = stepsHelpHtml();
|
|
153
|
+
$('#popRules').innerHTML = rulesHelpHtml();
|
|
96
154
|
document.addEventListener('click', (e) => {
|
|
97
155
|
if (e.target.closest('[data-pop-close]')) { closePops(true); return; }
|
|
98
|
-
if (!e.target.closest('.bd-pop, [
|
|
156
|
+
if (!e.target.closest('.bd-pop, [data-steps], [data-rules]')) closePops();
|
|
157
|
+
if (!e.target.closest('.bd-grpw')) { const m = $('#grpMenu'); if (m && !m.hidden) { m.hidden = true; $('#chGroup').setAttribute('aria-expanded', 'false'); } }
|
|
99
158
|
});
|
|
100
159
|
|
|
101
|
-
/* ── the rows on screen: the filters
|
|
160
|
+
/* ── the rows on screen: the chip filters ─────────────────────────────────────────────────────────────────────────── */
|
|
161
|
+
/** "This sprint": an initiative with Jira tickets shows when one of them is in the current sprint; one with plan dates shows when they
|
|
162
|
+
* overlap the sprint; one with neither (the early stages) always shows. */
|
|
163
|
+
function inSprint(r, sp) {
|
|
164
|
+
const t = r.track || {};
|
|
165
|
+
if ((t.tickets || []).length) return t.tickets.some((k) => k.sprint === sp.name);
|
|
166
|
+
if (r.start && r.end && sp.start && sp.end) return r.start.slice(0, 10) <= sp.end && r.end.slice(0, 10) >= sp.start;
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
102
169
|
function visible() {
|
|
103
|
-
const
|
|
170
|
+
const sp = M.jira && M.jira.sprint;
|
|
104
171
|
return M.initiatives.list.rows.filter((r) => {
|
|
105
172
|
const t = r.track || {};
|
|
106
173
|
if (F.chips.has('late') && !r.late) return false;
|
|
107
174
|
if (F.chips.has('risk') && r.status !== 'at risk') return false;
|
|
108
175
|
if (F.chips.has('blocked') && !t.blocked) return false;
|
|
109
176
|
if (F.chips.has('idle') && t.idle == null) return false;
|
|
110
|
-
if (F.chips.has('sprint') &&
|
|
111
|
-
if (F.
|
|
112
|
-
if (F.
|
|
113
|
-
if (
|
|
177
|
+
if (F.chips.has('sprint') && sp && (view === 'track' || PHONE.matches) && !inSprint(r, sp)) return false;
|
|
178
|
+
if (F.q && !String(r.title || '').toLowerCase().includes(F.q.toLowerCase())) return false;
|
|
179
|
+
if (F.owners.size && !F.owners.has(r.owner || 'No owner')) return false;
|
|
180
|
+
if (F.lanes.size && !F.lanes.has(r.lane)) return false;
|
|
181
|
+
if (F.sprints.size && !(t.tickets || []).some((k) => F.sprints.has(k.sprint || 'Backlog'))) return false;
|
|
114
182
|
return true;
|
|
115
183
|
});
|
|
116
184
|
}
|
|
117
|
-
const filtered = () => F.chips.
|
|
118
|
-
|
|
185
|
+
const filtered = () => [...F.chips].some((k) => k !== 'sprint') || !!F.q || F.owners.size > 0 || F.lanes.size > 0 || F.sprints.size > 0;
|
|
186
|
+
const clearFilters = () => { F.chips.forEach((k) => { if (k !== 'sprint') F.chips.delete(k); }); F.q = ''; F.owners.clear(); F.lanes.clear(); F.sprints.clear(); };
|
|
187
|
+
/** The "Showing" bar (BdFilter): what Filter has on, each with its own ×, Clear all, and how many initiatives show. */
|
|
188
|
+
function showingHtml(n) {
|
|
189
|
+
const G = [['owners', 'Owner'], ['lanes', 'Kind'], ['sprints', 'Sprint']].filter(([k]) => F[k].size);
|
|
190
|
+
if (!G.length && !F.q) return '';
|
|
191
|
+
const cap = (x) => (x ? x.charAt(0).toUpperCase() + x.slice(1) : x);
|
|
192
|
+
const chips = G.map(([k, n2]) => `<button type="button" class="bd-chip on" data-unf="${k}" aria-label="Remove ${n2}: ${esc([...F[k]].join(', '))}">${esc(n2)}: ${esc([...F[k]].map((v) => (k === 'lanes' ? cap(v) : v)).join(', '))}${SV(I.x)}</button>`).join('')
|
|
193
|
+
+ (F.q ? `<button type="button" class="bd-chip on" data-unf="q" aria-label="Remove the search">“${esc(F.q)}”${SV(I.x)}</button>` : '');
|
|
194
|
+
return `<div class="bd-showing" role="status"><span class="bd-mlbl">Showing</span>${chips}<button type="button" class="dlink" id="fClear">Clear all</button><span class="bd-sp"></span><span class="bd-amut">${n} of ${M.initiatives.list.rows.length} initiatives</span></div>`;
|
|
195
|
+
}
|
|
196
|
+
/** The status line of a row: on hold, waiting on you, late, at risk, idle, shipping, on track. A blocked ticket stays on its ticket. */
|
|
119
197
|
function statusOf(r) {
|
|
120
198
|
const t = r.track || {};
|
|
121
199
|
if (r.acts && r.acts.life === 'hold') return { tone: 'q', mo: '', text: 'On hold' + (r.acts.back ? ' · back ' + r.acts.back : '') };
|
|
122
|
-
if (t.
|
|
200
|
+
if (t.you) return { tone: 'you', mo: 'm-info', text: t.you };
|
|
201
|
+
const g = r.id && GR[r.id]; if (g && g.open && !g.later) return { tone: 'you', mo: 'm-info', text: g.open + ' ' + plural(g.open, 'question', 'questions') + ' before the BRD' };
|
|
123
202
|
if (r.late) return { tone: 'late', mo: 'm-warn', text: r.overDays > 0 ? r.overDays + ' ' + plural(r.overDays, 'day', 'days') + ' over' : 'Late' };
|
|
124
203
|
if (r.status === 'at risk') return { tone: 'risk', mo: 'm-warn', text: 'At risk' + (r.owner ? '' : ' · no owner') };
|
|
125
204
|
if (t.idle != null) return { tone: 'q', mo: '', text: 'Idle ' + t.idle + ' days' };
|
|
126
|
-
if (r.status === 'on track'
|
|
205
|
+
if (r.status === 'on track' && r.release && r.release.days != null && r.release.days >= 0 && t.key === 'deliver') {
|
|
206
|
+
const d = r.release.days; return { tone: 'ok', mo: '', text: d === 0 ? 'Ships today' : d === 1 ? 'Ships tomorrow' : 'Ships ' + fmt(r.release.iso) };
|
|
207
|
+
}
|
|
208
|
+
if (r.status === 'on track') return { tone: 'ok', mo: '', text: 'On track' };
|
|
127
209
|
return { tone: 'q', mo: '', text: r.statusLabel || r.sub };
|
|
128
210
|
}
|
|
129
|
-
|
|
211
|
+
/** The Output bar: one segment per ticket (a ticket opens its panel) or per part; a progress the record holds fills it as one bar. */
|
|
130
212
|
function segHtml(r, big) {
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
return `<div class="seg5
|
|
135
|
-
}
|
|
213
|
+
const t = r.track || {}, segs = t.segs || [], n = segs.length;
|
|
214
|
+
if (!n) return `<div class="seg5 none${big ? ' big' : ''}" aria-hidden="true"><i class="na"></i></div>`;
|
|
215
|
+
const fill = (i) => { if (t.pct == null) return ''; const f = Math.max(0, Math.min(1, (t.pct / 100) * n - i)) * 100; return f > 0 ? ` style="background:linear-gradient(90deg,var(--bd-done) ${f.toFixed(1)}%,var(--bd-rail) ${f.toFixed(1)}%)"` : ''; };
|
|
216
|
+
return `<div class="seg5${big ? ' big' : ''}"${t.pct != null ? ` role="img" aria-label="${t.pct}% on record"` : ''}>${segs.map((s, i) => (s.tk
|
|
217
|
+
? `<button type="button" class="bt-tk ${esc(s.cls || 'td')}" data-tk="${esc(s.tk)}" data-ini="${esc(r.key)}" aria-label="${esc(s.tk + ': ' + ((t.tickets.find((k) => k.key === s.tk) || {}).title || '') + ', ' + ((t.tickets.find((k) => k.key === s.tk) || {}).blocked ? 'blocked' : (t.tickets.find((k) => k.key === s.tk) || {}).status))}" title="${esc(s.tk)}"></button>`
|
|
218
|
+
: `<i class="${esc(s.cls || '')}"${fill(i)}></i>`)).join('')}</div>`;
|
|
219
|
+
}
|
|
220
|
+
const lineHtml = (r) => ((r.track && r.track.line) || []).map((x) => (x.tone ? `<em class="s-${x.tone}">${esc(x.text)}</em>` : esc(x.text))).join(' · ');
|
|
136
221
|
|
|
137
|
-
/* ── the stage track (
|
|
138
|
-
const LEGEND = '<span class="lg" aria-hidden="true"><span><i class="dn"></i>Done</span><span><i class="rv"></i>Review</span><span><i class="ip"></i>Doing</span><span><i class="bl"></i>Blocked</span></span>';
|
|
222
|
+
/* ── the stage track (AgBoard, AgBoardPhone) ──────────────────────────────────────────────────────────────────────────── */
|
|
223
|
+
const LEGEND = '<span class="lg" aria-hidden="true"><span><i class="sk"></i>Skipped</span><span><i class="dn"></i>Done</span><span><i class="rv"></i>Review</span><span><i class="ip"></i>Doing</span><span><i class="yo"></i>You</span><span><i class="bl"></i>Blocked</span></span>';
|
|
224
|
+
const DAYS = (t) => (t.days != null ? t.days + 'd' : '—');
|
|
225
|
+
/** "usually N days": the median of past initiatives in that step (lib/board-trail.js), shown only from 3 samples on. */
|
|
226
|
+
const usualOf = (t) => { const u = TR && TR.usual && t && TR.usual[t.key]; return u && u.n >= 3 && u.days != null ? u : null; };
|
|
227
|
+
const usualText = (u) => (u.days === 0 ? 'usually under a day' : 'usually ' + u.days + ' ' + plural(u.days, 'day', 'days'));
|
|
228
|
+
const dayTitle = (t) => t.label + ' · ' + (t.days != null ? t.days + ' ' + plural(t.days, 'day', 'days') + ' in this step' : 'days in this step are not on record') + (usualOf(t) ? ' · ' + usualText(usualOf(t)) : '');
|
|
139
229
|
function trackRow(r) {
|
|
140
|
-
const t = r.track || { k: -1, label: r.stage || 'No stage', output: '',
|
|
230
|
+
const t = r.track || { k: -1, label: r.stage || 'No stage', output: '', segs: [], skipped: [] }, s = statusOf(r), k = t.k, sk = new Set(t.skipped || []);
|
|
141
231
|
const cells = M.steps.map((st, j) => {
|
|
142
|
-
const cls = ['sc', j === 0 ? 'f0' : '', j === 7 ? 'l' : '', st.ms ? 'ms' : '', j < k ? 'p' : '', j === k ? 'c bg' : ''].filter(Boolean).join(' ');
|
|
143
|
-
|
|
232
|
+
const cls = ['sc', j === 0 ? 'f0' : '', j === 7 ? 'l' : '', st.ms ? 'ms' : '', j < k ? 'p' : '', sk.has(j) ? 'k' : '', j === k ? 'c bg' : ''].filter(Boolean).join(' ');
|
|
233
|
+
const why = sk.has(j) && (t.skipWhy || []).find((x) => x.stage === st.key);
|
|
234
|
+
const title = j === k ? dayTitle(t) : sk.has(j) ? st.label + ' skipped' + (why && why.why ? ': ' + why.why : '') : '';
|
|
235
|
+
return `<div class="${cls}" role="cell"${title ? ` title="${esc(title)}"` : ''}>${j === k ? `<span class="cur"><u class="cz-dot ${s.tone} ${s.mo}"></u><small>${DAYS(t)}</small></span>` : '<i></i>'}</div>`;
|
|
144
236
|
}).join('');
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
+ `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${esc(r.title)}</b><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)}</span></button>`
|
|
237
|
+
return `<div class="bt-r bt-l${peek && peek.key === r.key && peek.kind !== 'acts' ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}">`
|
|
238
|
+
+ `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${esc(r.title)}</b><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
|
|
148
239
|
+ `<div class="bt-cells" role="presentation">${cells}</div>`
|
|
149
|
-
+ `<div class="bt-dl" role="cell"><div class="t1"><b>${esc(t.output)}</b><span>${esc(
|
|
150
|
-
+ `<div class="bt-act" role="cell">${r.acts ? dotsBtn(r) : ''}</div></div>`;
|
|
240
|
+
+ `<div class="bt-dl" role="cell"><div class="t1"><b>${esc(t.output)}</b><span>${esc(t.count || '')}</span></div>${segHtml(r)}<div class="t3">${lineHtml(r)}</div></div></div>`;
|
|
151
241
|
}
|
|
242
|
+
const isME = (r) => r.track && r.track.k >= 6;
|
|
152
243
|
function drawTrack(L) {
|
|
153
244
|
const S = M.steps || [];
|
|
154
245
|
const sorted = L.slice().sort((a, b) => ((a.track ? a.track.k : -1) < 0 ? 99 : a.track.k) - ((b.track ? b.track.k : -1) < 0 ? 99 : b.track.k));
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
246
|
+
// Monitor and Evaluate fold away after the first row of each (AgBoard: "19 more in Monitor and Evaluate")
|
|
247
|
+
const seen = new Set(), shown = [], folded = [];
|
|
248
|
+
for (const r of sorted) { if (isME(r) && seen.has(r.track.k) && !foldOpen) folded.push(r); else { if (isME(r)) seen.add(r.track.k); shown.push(r); } }
|
|
249
|
+
const meTotal = (S[6] ? S[6].count : 0) + (S[7] ? S[7].count : 0), meShown = shown.filter(isME).length, more = Math.max(folded.length, meTotal - meShown);
|
|
250
|
+
const n = M.initiatives.open || M.initiatives.list.rows.length;
|
|
251
|
+
const head = `<div class="bt-r bt-h" role="row"><div class="bt-nmh" role="columnheader">Initiative <span>${n}</span></div><div class="bt-cells" role="presentation">${S.map((s) => `<div role="columnheader" class="${s.ms ? 'msh' : ''}" data-steps title="What finishes each step" aria-haspopup="dialog" tabindex="0"><span class="bt-hl">${s.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(s.label)}</span><span>${s.count}</span></div>`).join('')}</div><div class="bt-oh" role="columnheader">Output ${LEGEND}</div></div>`;
|
|
252
|
+
const tf = more > 0 && !foldOpen ? `<button type="button" class="dlink" id="fold" aria-expanded="false">${SV(I.chev)}${more} more in Monitor and Evaluate</button>`
|
|
253
|
+
: foldOpen && meTotal > 1 ? `<button type="button" class="dlink" id="fold" aria-expanded="true">${SV(I.chevUp)}Fold Monitor and Evaluate${meTotal > meShown ? ` · ${meTotal - meShown} more are not loaded` : ''}</button>` : '<span></span>';
|
|
254
|
+
if (!L.length) return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}<p class="bt-empty">${filtered() ? 'No initiative matches the chips, Find or Filter. <button type="button" class="dlink" id="fClear">Clear them</button>' : 'No initiatives are on this board\'s now view.'}</p></div>`;
|
|
255
|
+
return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}${shown.map(trackRow).join('')}<div class="bt-tf">${tf}<span class="bt-srt">Sorted by stage</span></div>${PHONE.matches ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-steps aria-haspopup="dialog">What finishes each step</button><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : ''}</div>`; // the phone has no step heads: a plain entry to the steps help
|
|
159
256
|
}
|
|
160
257
|
|
|
161
|
-
/* ── the
|
|
162
|
-
const sub = (r) => `${esc(r.sub)}${r.statusLabel ? ` · <span class="${r.late ? 'bad' : 'warn'}">${esc(r.statusLabel)}</span>` : ''}`;
|
|
163
|
-
function listBtn(r) {
|
|
164
|
-
return `<button class="ini2 ibi${r.first ? ' first' : ''}" data-key="${esc(r.key)}"><span class="it"><b>${esc(r.title)}${r.first ? '<em class="tgf">Do this first</em>' : ''}</b><small>${sub(r)}</small></span><span class="wst"><span class="sg2" aria-hidden="true">${r.seg.map((c) => `<i class="${c}"></i>`).join('')}</span><em>${esc(r.stage || 'No stage')}${r.stageNote ? ' · ' + esc(r.stageNote) : ''}</em></span><span class="pg">${r.progress == null ? '' : `<i><b style="width:${r.progress}%"></b></i>`}</span><span class="rl${r.over ? ' over' : ''}">${esc(r.finish)}</span></button>`;
|
|
165
|
-
}
|
|
166
|
-
function drawList(L) {
|
|
167
|
-
if (!L.length) return `<p class="empty3 plain">${filtered() ? 'No initiative matches the filters.' : 'No initiatives are on this board\'s now view.'}</p>` + goneHtml();
|
|
168
|
-
return `<div class="inih"><span>Initiative</span><span>Where it is</span><span>Progress</span><span>Planned finish</span></div><div class="inil">` + L.slice(0, shown).map((r) => `<div class="inirw">${listBtn(r)}${r.acts ? dotsBtn(r) : ''}</div>`).join('') + '</div>'
|
|
169
|
-
+ (L.length > shown ? `<p class="note" style="margin-top:10px">${L.length - shown} more are loaded. <button class="fold alt" id="more" type="button">Show ${Math.min(25, L.length - shown)} more</button></p>` : '') + goneHtml();
|
|
170
|
-
}
|
|
171
|
-
/** The cancelled and archived rows, under a fold (initiative premium-board-actions). Their menu offers Reopen or Restore. */
|
|
172
|
-
function goneHtml() {
|
|
173
|
-
const G = M.initiatives.gone || { cancelled: [], archived: [] }, nc = G.cancelled.length, na = G.archived.length;
|
|
174
|
-
if (!nc && !na) return '';
|
|
175
|
-
return `<div class="bagone"><button class="dlink" type="button" id="goneT" aria-expanded="${showGone}">${[nc ? nc + ' cancelled' : '', na ? na + ' archived' : ''].filter(Boolean).join(' · ')}. ${showGone ? 'Hide them' : 'Show them'}</button>${showGone ? `<div class="inil">${G.cancelled.concat(G.archived).map((r) => `<div class="inirw gone">${listBtn(r)}${dotsBtn(r)}</div>`).join('')}</div>` : ''}</div>`;
|
|
176
|
-
}
|
|
177
|
-
function drawStages() {
|
|
178
|
-
const S = M.initiatives.stages;
|
|
179
|
-
if (!S.length) return '<p class="empty3 plain">This board has no workflow stages on record.</p>';
|
|
180
|
-
const keep = new Set(visible().map((r) => r.key));
|
|
181
|
-
return `<div class="istg">${S.map((s) => { const rows = s.rows.filter((r) => !filtered() || keep.has(r.key)); return `<div class="isc"><p class="label">${esc(s.stage)} <em>${s.count}</em></p>${rows.map((r) => `<button class="icd ibi" data-key="${esc(r.key)}"><b>${esc(r.title)}</b><small>${sub(r)}</small>${r.progress == null ? '' : `<span class="pg"><i><b style="width:${r.progress}%"></b></i></span>`}<small>${esc(r.finish)}</small></button>`).join('') || '<p class="mut">None</p>'}${s.more ? `<p class="mut">${s.more} more</p>` : ''}</div>`; }).join('')}</div>`;
|
|
182
|
-
}
|
|
183
|
-
/* ── the timeline (B2) ───────────────────────────────────────────────────────────────────────────────────────── */
|
|
258
|
+
/* ── the timeline (AgBoardTimeline, AgBoardTlYear, AgBoardTl5y, AgBoardTimelinePhone) ───────────────────────────────────────── */
|
|
184
259
|
function drawTime(L) {
|
|
185
|
-
const
|
|
186
|
-
const
|
|
187
|
-
|
|
260
|
+
const S = M.steps || [];
|
|
261
|
+
const T = timelineHtml(L, M, span, { sel: peek && peek.kind !== 'acts' ? peek.key : null, status: statusOf, hiddenCount: (S[6] ? S[6].count : 0) + (S[7] ? S[7].count : 0), themes: (TR && TR.themes) || [], group, avatar: (n) => V.avatar(n, 'sm'),
|
|
262
|
+
askHref: (none) => askHref(null, 'Propose start and end dates for ' + none.map((r) => r.title).join(', ')) });
|
|
263
|
+
return T.html;
|
|
188
264
|
}
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
PHONE.addEventListener('change', () => { if (M) drawInit(); });
|
|
265
|
+
/** A phone's view switch (BdPhone): List and By stage, and the stage track; the timeline needs a wider screen. */
|
|
266
|
+
const phoneSeg = (v) => `<div class="bd-phseg"><div class="bd-seg" role="group" aria-label="View">${[['list', 'List'], ['stages', 'By stage'], ['track', 'Track']].map(([k, n]) => `<button type="button" data-pv="${k}" aria-pressed="${v === k}">${n}</button>`).join('')}</div><span class="bd-amut">Timeline needs a wider screen.</span></div>`;
|
|
192
267
|
function drawInit() {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
$('#
|
|
268
|
+
$('#nIni').textContent = String(M.initiatives.open || M.initiatives.list.rows.length);
|
|
269
|
+
const phone = PHONE.matches, L = visible(), v = phone ? pview : view;
|
|
270
|
+
const body = $('#ibBody');
|
|
271
|
+
body.dataset.view = v; body.dataset.span = v === 'time' ? span : '';
|
|
272
|
+
const html = v === 'track' ? drawTrack(L) : v === 'time' ? drawTime(L) : v === 'list' ? (phone ? V.phoneListHtml(L) : V.listHtml(L, filtered())) : V.stagesHtml(L, { phone });
|
|
273
|
+
// a phone has no ⋯ menu: Metrics and Cancelled and archived stay one press away in every view, not only the track
|
|
274
|
+
const phx = phone && v !== 'track' ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : '';
|
|
275
|
+
body.innerHTML = (phone ? phoneSeg(v) : '') + html + phx;
|
|
276
|
+
$('#bdShowing').innerHTML = showingHtml(L.length); $('#bdShowing').hidden = !$('#bdShowing').innerHTML;
|
|
202
277
|
$$('#ibTabs [data-v]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.v === v)));
|
|
203
|
-
$('#
|
|
278
|
+
$('#bdView').innerHTML = SV(v === 'time' ? I.time : I.track); $('#bdView').setAttribute('aria-label', 'Change view. Now: ' + (v === 'time' ? 'Timeline' : 'Stage track'));
|
|
279
|
+
$('#bdSpans').hidden = v !== 'time' || phone;
|
|
204
280
|
$$('#bdSpans [data-sp]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.sp === span)));
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
281
|
+
document.body.dataset.bdView = v;
|
|
282
|
+
}
|
|
283
|
+
PHONE.addEventListener('change', () => { if (M) { drawChips(); drawInit(); } });
|
|
284
|
+
function setView(v) { if (PHONE.matches) { pview = v; store.set(PVIEW_KEY, v); } else { view = v; store.set(VIEW_KEY, view); } closePeek(); drawChips(); drawInit(); }
|
|
285
|
+
$('#ibTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-v]'); if (!b || !M) return; setTab('ini'); setView(b.dataset.v); });
|
|
286
|
+
$('#bdView').addEventListener('click', () => { if (M) setView(PHONE.matches ? (pview === 'list' ? 'stages' : pview === 'stages' ? 'track' : 'list') : view === 'time' ? 'track' : 'time'); });
|
|
287
|
+
$('#bdShowing').addEventListener('click', (e) => {
|
|
288
|
+
if (e.target.closest('#fClear')) { clearFilters(); drawChips(); drawInit(); return; }
|
|
289
|
+
const u = e.target.closest('[data-unf]'); if (!u) return;
|
|
290
|
+
if (u.dataset.unf === 'q') F.q = ''; else F[u.dataset.unf].clear(); drawChips(); drawInit();
|
|
291
|
+
});
|
|
292
|
+
$('#bdSpans').addEventListener('click', (e) => { const b = e.target.closest('[data-sp]'); if (!b || !M) return; span = b.dataset.sp; store.set(SPAN_KEY, span); drawChips(); drawInit(); });
|
|
208
293
|
$('#ibBody').addEventListener('click', (e) => {
|
|
209
|
-
if (e.target.closest('#
|
|
210
|
-
if (e.target.closest('#fClear')) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
294
|
+
if (e.target.closest('#fold')) { foldOpen = !foldOpen; drawInit(); const f = $('#fold'); if (f) f.focus(); return; }
|
|
295
|
+
if (e.target.closest('#fClear')) { clearFilters(); drawChips(); drawInit(); return; }
|
|
296
|
+
const pv = e.target.closest('[data-pv]'); if (pv) { setView(pv.dataset.pv); const b = $(`#ibBody [data-pv="${pv.dataset.pv}"]`); if (b) b.focus(); return; }
|
|
297
|
+
const so = e.target.closest('[data-sort]'); if (so) { V.setSort(so.dataset.sort); drawInit(); const b = $(`#ibBody [data-sort="${so.dataset.sort}"]`); if (b) b.focus(); return; }
|
|
298
|
+
if (e.target.closest('[data-me]')) { V.toggleME(); drawInit(); const b = $('#ibBody [data-me]'); if (b) b.focus(); return; }
|
|
299
|
+
const sr = e.target.closest('[data-strip]'); if (sr) { V.toggleStrip(sr.dataset.strip); drawInit(); const b = $(`#ibBody [data-strip="${sr.dataset.strip}"]`); if (b) b.focus(); return; }
|
|
300
|
+
const rm = e.target.closest('[data-rowmenu]'); if (rm) { const r = rowOf(rm.dataset.rowmenu); if (r) Acts.open.row(r, rm); return; }
|
|
301
|
+
if (e.target.closest('[data-backlog]')) return; // pm/bd-acts.js opens the backlog
|
|
302
|
+
const op = e.target.closest('[data-open]'); if (op) { Acts.open[op.dataset.open](op); return; }
|
|
303
|
+
const st = e.target.closest('[data-steps]'); if (st) { togglePop('popSteps', st); return; }
|
|
304
|
+
const ru = e.target.closest('[data-rules]'); if (ru) { togglePop('popRules', ru); return; }
|
|
305
|
+
const go = e.target.closest('[data-span-go]'); if (go) { span = go.dataset.spanGo; store.set(SPAN_KEY, span); drawChips(); drawInit(); return; }
|
|
214
306
|
const tk = e.target.closest('[data-tk]'); if (tk) { openTicket(tk.dataset.ini, tk.dataset.tk, tk); return; }
|
|
215
|
-
const th = e.target.closest('[data-tgtheme]'); if (th) { span = 'year'; store.set(SPAN_KEY, span); drawInit(); return; }
|
|
216
|
-
|
|
307
|
+
const th = e.target.closest('[data-tgtheme]'); if (th) { span = 'year'; store.set(SPAN_KEY, span); drawChips(); drawInit(); return; }
|
|
308
|
+
if (e.target.closest('[data-act]')) return; // pm/bd-acts.js handles its own presses
|
|
309
|
+
const b = e.target.closest('[data-key]'); if (b) openIni(rowOf(b.dataset.key), b, view === 'time' ? 'time' : 'track');
|
|
217
310
|
});
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
$('#
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
311
|
+
$('#ibBody').addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches('[data-steps]')) { e.preventDefault(); togglePop('popSteps', e.target); } });
|
|
312
|
+
/* By stage (BdByStage): a card dragged to another column moves the initiative there (POST /api/boards/move), with Undo in the toast. The column is
|
|
313
|
+
* one of the eight steps; the move goes to the first of the board's own stages that maps onto it. */
|
|
314
|
+
let dragKey = null;
|
|
315
|
+
$('#ibBody').addEventListener('dragstart', (e) => { const c = e.target.closest('.bd-bc[draggable]'); if (!c) return; dragKey = c.dataset.key; e.dataTransfer.effectAllowed = 'move'; try { e.dataTransfer.setData('text/plain', dragKey); } catch { /* some browsers refuse */ } c.classList.add('drag'); });
|
|
316
|
+
$('#ibBody').addEventListener('dragend', () => { dragKey = null; $$('#ibBody .drag, #ibBody .drop').forEach((x) => x.classList.remove('drag', 'drop')); });
|
|
317
|
+
$('#ibBody').addEventListener('dragover', (e) => { const col = dragKey && e.target.closest('.bd-scol[data-step]'); if (!col) return; e.preventDefault(); $$('#ibBody .bd-scol.drop').forEach((x) => { if (x !== col) x.classList.remove('drop'); }); col.classList.add('drop'); });
|
|
318
|
+
$('#ibBody').addEventListener('drop', async (e) => {
|
|
319
|
+
const col = e.target.closest('.bd-scol[data-step]'); if (!col || !dragKey) return;
|
|
320
|
+
e.preventDefault();
|
|
321
|
+
const r = rowOf(dragKey), j = +col.dataset.step; dragKey = null; col.classList.remove('drop');
|
|
322
|
+
if (!r || !r.track || r.track.k === j || !r.acts) return;
|
|
323
|
+
const step = M.steps[j], to = (r.acts.stages || []).find((n) => stepOfName(n) === step.key);
|
|
324
|
+
if (!to) { say(step.label + ' is not one of this board\'s stages, so it did not move.'); return; }
|
|
325
|
+
const from = r.acts.stage, body = { ws: M.board.ws, board: M.board.id, id: r.id };
|
|
326
|
+
const res = await pmPost('/api/boards/move', { ...body, to }).catch(() => null);
|
|
327
|
+
if (!res || !res.ok) { say((res && res.error) || 'It did not move. The server did not say why.'); return; }
|
|
328
|
+
say('Moved to ' + to + ' · ' + r.title + '.', async () => { const u = await pmPost('/api/boards/move', { ...body, to: from, why: 'Undo' }).catch(() => null); say(u && u.ok ? 'Back in ' + from + '.' : (u && u.error) || 'The undo did not land.'); load(); });
|
|
329
|
+
load();
|
|
330
|
+
});
|
|
331
|
+
/** The step key of one of the board's own stage names, by the same old-name map as the model (lib/board-premium.js OLD_STEP). */
|
|
332
|
+
const OLD_STEP = { ideate: 'discover', ideation: 'discover', strategize: 'prioritize', intake: 'triage', ship: 'deliver', release: 'deliver', learn: 'monitor' };
|
|
333
|
+
function stepOfName(n) { const k = String(n || '').trim().toLowerCase(); const s = (M.steps || []).find((x) => x.key === k || x.label.toLowerCase() === k); return s ? s.key : OLD_STEP[k] || null; }
|
|
226
334
|
|
|
227
335
|
/* ── "Ask about this": the Board has no chat; the question goes to Home as a quick ask in that initiative (B3) ───────────────── */
|
|
228
336
|
function askHref(r, q) {
|
|
@@ -232,262 +340,349 @@ function askHref(r, q) {
|
|
|
232
340
|
if (M.board.ws) p.set('ws', M.board.ws);
|
|
233
341
|
return '/premium.html?' + p.toString();
|
|
234
342
|
}
|
|
343
|
+
const pageHref = (r) => '/premium-initiative.html?id=' + encodeURIComponent(r.id) + (M.board.ws ? '&ws=' + encodeURIComponent(M.board.ws) + '&board=' + encodeURIComponent(M.board.id) : '');
|
|
235
344
|
|
|
236
|
-
/* ── the
|
|
345
|
+
/* ── the side panel: the initiative (AgBoardPanel), the Jira ticket (AgBoardTicket) and the initiative from the timeline (AgBoardTimelinePanel) ── */
|
|
237
346
|
let peekBack = null;
|
|
238
347
|
function ladderHtml(t) {
|
|
239
|
-
const k = t ? t.k : -1;
|
|
240
|
-
return `<div class="pk-lad" role="img" aria-label="${esc(k >= 0 ? 'Step ' + (k + 1) + ' of 8: ' + t.label : 'No step on record')}"><i class="ln"></i><i class="lp" style="width:${k > 0 ? (k / 7) * 87.5 : 0}%"></i>${M.steps.map((s, j) => `<span class="${[j < k ? 'p' : '', j === k ? 'c' : '', s.ms ? 'm' : ''].filter(Boolean).join(' ')}"><i></i>${esc(s.short)}</span>`).join('')}</div>`;
|
|
348
|
+
const k = t ? t.k : -1, sk = new Set((t && t.skipped) || []);
|
|
349
|
+
return `<div class="pk-lad" role="img" aria-label="${esc(k >= 0 ? 'Step ' + (k + 1) + ' of 8: ' + t.label : 'No step on record')}"><i class="ln"></i><i class="lp" style="width:${k > 0 ? (k / 7) * 87.5 : 0}%"></i>${M.steps.map((s, j) => `<span class="${[j < k ? 'p' : '', j === k ? 'c' : '', s.ms ? 'm' : '', sk.has(j) ? 'k' : ''].filter(Boolean).join(' ')}"><i></i>${esc(s.short)}</span>`).join('')}</div>`;
|
|
241
350
|
}
|
|
242
|
-
function askForm(r, label) {
|
|
351
|
+
function askForm(r, label, o = {}) {
|
|
243
352
|
const J = M.jira || {};
|
|
244
|
-
|
|
353
|
+
const ft = o.inside ? `<span>The answer lands in Home, inside ${esc(r.title)}.</span>`
|
|
354
|
+
: `<span>Answer lands in Home</span><span class="sp"></span><span class="jr">${SV(I.jira)}Jira ${J.readAt ? esc(ago(J.readAt)) : 'not read'}</span><button type="button" class="bd-ib sm" data-pk="jira" aria-label="Read Jira again" title="Read Jira again">${SV(I.refresh)}</button>`;
|
|
355
|
+
return `<form class="pk-ask" data-ask="${esc(r.key)}"><div class="in"><input type="text" name="q" maxlength="2000" autocomplete="off" placeholder="Ask about ${esc(label)}…" aria-label="Ask about ${esc(label)}"><button type="submit" class="bd-ib solid" aria-label="Ask in Home" title="Ask in Home">${SV(I.go)}</button></div><div class="ft">${ft}</div></form>`;
|
|
356
|
+
}
|
|
357
|
+
const eyeOf = (r, lower) => [r.lane ? (lower ? r.lane : r.lane.charAt(0).toUpperCase() + r.lane.slice(1)) : '', r.kr, ...(lower ? [] : [r.owner ? 'owner ' + r.owner : 'no owner'])].filter(Boolean);
|
|
358
|
+
const tkState = (k) => (k.blocked ? 'blocked' + (k.reason ? ' by ' + k.reason.replace(/^Waiting on /i, '') : '') : k.status === 'In review' ? 'in review' : k.status === 'In progress' ? 'in progress' : k.status === 'Done' ? 'done' : 'to do');
|
|
359
|
+
/** The output box: the open tickets (blocked first) with their state and assignee, the done ones folded into one line, and Deliver's two
|
|
360
|
+
* parts that are not tickets; for the other steps, the parts of the output, each counted only where a record holds it. */
|
|
361
|
+
function outRows(r) {
|
|
362
|
+
const t = r.track || {};
|
|
363
|
+
if (t.tickets && t.tickets.length && (t.key === 'build' || t.key === 'deliver')) {
|
|
364
|
+
const open = t.tickets.filter((k) => k.status !== 'Done').sort((a, b) => (b.blocked ? 1 : 0) - (a.blocked ? 1 : 0)), done = t.tickets.filter((k) => k.status === 'Done');
|
|
365
|
+
const rows = open.slice(0, 10).map((k) => `<button type="button" class="gi" data-tk="${esc(k.key)}" data-ini="${esc(r.key)}"><i class="k ${esc(k.cls || 'td')}"></i><span class="n"><em>${esc(k.key)}</em>${esc(k.title)} · ${esc(tkState(k))}</span>${k.assignee || k.age != null ? `<span class="r">${esc([k.assignee, k.age != null ? k.age + 'd' : ''].filter(Boolean).join(' · '))}</span>` : ''}</button>`);
|
|
366
|
+
if (open.length > 10) rows.push(`<p class="gi gm"><i class="k"></i><span class="n">${open.length - 10} more open tickets</span></p>`);
|
|
367
|
+
if (done.length) rows.push(`<p class="gi gm"><i class="k dn"></i><span class="n">${done.length} ${plural(done.length, 'ticket', 'tickets')} done · ${esc(done.slice(0, 3).map((k) => k.title.toLowerCase()).join(', '))}${done.length > 3 ? ', …' : ''}</span></p>`);
|
|
368
|
+
if (t.key === 'deliver') rows.push('<p class="gi gm"><i class="k"></i><span class="n">Release notes</span><span class="r">not on record</span></p>', `<p class="gi gm"><i class="k${t.you ? ' yo' : ''}"></i><span class="n">Your sign-off</span><span class="r">${t.you ? 'waiting' : 'after the tickets'}</span></p>`);
|
|
369
|
+
return rows.join('');
|
|
370
|
+
}
|
|
371
|
+
if (t.key === 'build' || t.key === 'deliver') return '<p class="gi gm"><i class="k na"></i><span class="n">No Jira ticket has been read for it yet</span></p>';
|
|
372
|
+
return (t.segs || []).map((s) => `<p class="gi gm"><i class="k ${esc(s.cls || '')}"></i><span class="n">${esc(s.name || '')}</span><span class="r">${esc(s.st || '')}</span></p>`).join('');
|
|
373
|
+
}
|
|
374
|
+
const TI = (r) => (r && r.trail) || null;
|
|
375
|
+
/** The skipped steps, each with its reason: the lane's own ladder or the board move's why (lib/board-trail.js). */
|
|
376
|
+
function skipHtml(t) {
|
|
377
|
+
const sk = (t.skipped || []).map((j) => M.steps[j]).filter(Boolean);
|
|
378
|
+
if (!sk.length) return '';
|
|
379
|
+
const why = sk.map((s) => { const w = (t.skipWhy || []).find((x) => x.stage === s.key); return w && w.why ? s.label + ' skipped. ' + w.why : null; });
|
|
380
|
+
if (why.every(Boolean)) return `<p class="pk-skip">${esc(why.join(' '))}</p>`;
|
|
381
|
+
return `<p class="pk-skip">${esc(sk.map((s) => s.label).join(', '))} skipped: it was moved past ${sk.length === 1 ? 'that step' : 'those steps'}. No reason is on record.</p>`;
|
|
382
|
+
}
|
|
383
|
+
/** What waits on you: the release sign-off (the model), else the trail's next action (the Commit of drafted tickets, a PRD change, the verdict). */
|
|
384
|
+
function nextHtml(r) {
|
|
385
|
+
const t = r.track || {};
|
|
386
|
+
if (t.you && t.youKind) {
|
|
387
|
+
const go = t.youKind === 'drift' && TI(r) && TI(r).links.prd ? `<button type="button" class="bd-ib solid" data-doc="${esc(TI(r).links.prd)}" aria-label="Open the PRD" title="Open the PRD">${SV(I.next)}</button>`
|
|
388
|
+
: r.id ? `<a class="bd-ib solid" href="${esc(pageHref(r))}" aria-label="${esc(t.you)}: open the initiative page" title="Open the initiative page">${SV(I.next)}</a>` : '';
|
|
389
|
+
return `<div class="pk-nb"><div class="t"><b>${esc(t.you)}</b><div>${esc(t.youWhy || '')}</div></div>${go}</div>`;
|
|
390
|
+
}
|
|
391
|
+
if (t.you) return `<div class="pk-nb"><div class="t"><b>Sign off ${esc(r.release ? r.release.name : t.output)}</b><div>Every release ticket is done. Release notes are not on record in PMOS.</div></div>${r.id ? `<a class="bd-ib solid" href="${esc(pageHref(r))}" aria-label="Review the release" title="Review the release">${SV(I.next)}</a>` : ''}</div>`;
|
|
392
|
+
return ''; // nothing waits on you: AgBoardPanel draws the card only when something does
|
|
393
|
+
}
|
|
394
|
+
/** Tickets drafted in PMOS and not yet in Jira: they go to Jira only through your Commit. */
|
|
395
|
+
function draftedHtml(r) {
|
|
396
|
+
const it = TI(r); if (!it) return '';
|
|
397
|
+
const d = (it.drafted || []).filter((x) => !x.key); if (!d.length) return '';
|
|
398
|
+
const g = it.gate || {};
|
|
399
|
+
return `<div class="pk-sec"><p class="lbl">Drafted in PMOS · ${d.length}</p><div class="pk-tks">${d.slice(0, 8).map((x) => `<p class="gi gm"><i class="k${x.waiting ? ' yo' : ''}"></i><span class="n">${x.id ? `<em>${esc(x.id)}</em>` : ''}${esc(x.summary || '')}</span><span class="r">not in Jira</span></p>`).join('')}${d.length > 8 ? `<p class="gi gm"><i class="k"></i><span class="n">${d.length - 8} more drafted</span></p>` : ''}</div><p class="pk-mut">They go to Jira only through your Commit${g.open === false && g.why ? '. The Commit is closed: ' + esc(g.why) : ''}.</p></div>`;
|
|
400
|
+
}
|
|
401
|
+
/** The PRD against what was pushed: tickets whose text came from a PRD that changed after the push. AgBoardPanel and AgBoardTicket draw only the
|
|
402
|
+
* amber card, so nothing shows when Jira and the PRD agree (or nothing is pushed yet). Its button puts a question about the change in the ask box. */
|
|
403
|
+
function driftHtml(r, one) {
|
|
404
|
+
const it = TI(r);
|
|
405
|
+
const keys = ((it && it.drift) || []).filter((k) => !one || k === one);
|
|
406
|
+
if (!keys.length) return '';
|
|
407
|
+
const q = 'What changed in the PRD after ' + keys.join(', ') + ' ' + (keys.length === 1 ? 'was' : 'were') + ' pushed?';
|
|
408
|
+
const btn = `<button type="button" class="bd-ib sm" data-pk="drift" data-q="${esc(q)}" aria-label="Ask about the PRD change" title="Ask about the PRD change">${SV(one ? I.spark : I.note)}</button>`;
|
|
409
|
+
return one
|
|
410
|
+
? `<div class="pk-wt">${SV(I.flag)}<span><b>The PRD changed after the push.</b> ${esc(keys[0])} was pushed from an older PRD. Review it before the next push.</span>${btn}</div>`
|
|
411
|
+
: `<div class="pk-wt">${SV(I.flag)}<span><b>Jira differs from the PRD</b> · ${esc(keys.join(', '))} ${keys.length === 1 ? 'was' : 'were'} pushed from an older PRD. Review ${keys.length === 1 ? 'it' : 'them'} before the next push.</span>${btn}</div>`;
|
|
412
|
+
}
|
|
413
|
+
const DEP_ST = (d) => (!d.known ? 'not on this repository' : d.done ? 'done' : d.stage || 'open');
|
|
414
|
+
function linkedHtml(r) {
|
|
415
|
+
const it = TI(r), L = (it && it.links) || {}, epic = L.epic || (r.epics || [])[0];
|
|
416
|
+
// AgBoardPanel: PRD v3 · Rubric · Release notes · Blocks <initiative> · Epic <key>. A chip shows only where something is linked.
|
|
417
|
+
const doc = (label, path) => (path ? `<button type="button" class="bd-chip" data-doc="${esc(path)}" title="${esc(path)}">${SV(I.doc)}${esc(label)}</button>` : '');
|
|
418
|
+
const D = (it && it.deps) || [];
|
|
419
|
+
const chips = doc(L.prdVersion ? 'PRD v' + String(L.prdVersion).replace(/^v/i, '') : 'PRD', L.prd) + doc('Rubric', L.rubric) + doc('Evaluation', L.evaluation) + doc('Release notes', L.notes)
|
|
420
|
+
+ D.map((d) => `<span class="bd-chip" title="${esc((d.title || d.id) + ': ' + DEP_ST(d))}">${SV(I.link)}${esc('Waits on ' + (d.title || d.id))}</span>`).join('')
|
|
421
|
+
+ (epic ? `<span class="bd-chip">${SV(I.jira)}${esc('Epic ' + epic)}</span>` : '');
|
|
422
|
+
return chips ? `<div class="pk-sec"><p class="lbl">Linked</p><div class="pk-lk">${chips}</div></div>` : '';
|
|
423
|
+
}
|
|
424
|
+
/** Dates (BdPanel): when the step started (days in the step, from the trail), the planned end (yours) and the end Jira's pace expects. */
|
|
425
|
+
function datesHtml(r) {
|
|
426
|
+
const t = r.track || {};
|
|
427
|
+
const st = t.days != null ? md(new Date(Date.now() - t.days * 86400000)) : null, end = r.end ? fmt(r.end) : null, exp = t.forecast ? fmt(t.forecast) : null;
|
|
428
|
+
if (!st && !end && !exp) return '';
|
|
429
|
+
const late = !!(r.end && t.forecast && t.forecast.slice(0, 10) > r.end.slice(0, 10));
|
|
430
|
+
const box = (label, v, cls) => `<div class="bd-box${cls ? ' ' + cls : ''}"><span class="bd-amut">${esc(label)}</span><b>${esc(v || '—')}</b></div>`;
|
|
431
|
+
return `<div class="pk-sec"><p class="lbl">Dates</p><div class="pk-dg">${box('Started ' + (t.label || 'the step'), st)}${box('Planned end', end)}${box('Now expected', exp, late ? 'late' : '')}</div><p class="pk-mut">Planned end is yours. Expected comes from Jira pace, and moves when tickets move.</p></div>`;
|
|
432
|
+
}
|
|
433
|
+
/** In Jira (BdPanel): the step's tickets as a table, each opening its ticket panel. */
|
|
434
|
+
function jiraHtml(r) {
|
|
435
|
+
const t = r.track || {}, tk = (t.tickets || []).slice().sort((a, b) => (b.blocked ? 1 : 0) - (a.blocked ? 1 : 0)), sp = [...new Set(tk.map((k) => k.sprint).filter(Boolean))];
|
|
436
|
+
const st = (k) => (k.blocked ? 'Blocked' : k.status === 'In progress' ? 'Doing' : k.status) + (k.age != null && k.status !== 'Done' ? ' · ' + k.age + 'd' : '');
|
|
437
|
+
const rows = tk.slice(0, 12).map((k) => `<button type="button" class="pk-jt" data-tk="${esc(k.key)}" data-ini="${esc(r.key)}"><span class="bd-pill">${esc(k.key)}</span><span class="bd-ell">${esc(k.title)}</span><span class="${k.blocked ? 's-red' : k.status === 'Done' || k.status === 'To do' ? 'bd-amut' : ''}">${esc(st(k))}</span>${k.assignee ? V.avatar(k.assignee, 'sm') : '<span class="bd-amut">—</span>'}</button>`).join('');
|
|
438
|
+
// Deliver's two parts that are not tickets: the release notes and your sign-off
|
|
439
|
+
const dl = t.key === 'deliver' ? `<div class="pk-tks">${'<p class="gi gm"><i class="k"></i><span class="n">Release notes</span><span class="r">not on record</span></p>'}<p class="gi gm"><i class="k${t.you ? ' yo' : ''}"></i><span class="n">Your sign-off</span><span class="r">${t.you ? 'waiting' : 'after the tickets'}</span></p></div>` : '';
|
|
440
|
+
return `<div class="pk-sec"><p class="lbl">In Jira${sp.length === 1 ? ' · ' + esc(sp[0]) : ''}</p><div class="pk-jtw"><div class="pk-jt h"><span>Key</span><span>Work-item</span><span>Status</span><span>Who</span></div>${rows}${tk.length > 12 ? `<p class="pk-mut">${tk.length - 12} more in Jira</p>` : ''}</div>${dl}</div>`;
|
|
441
|
+
}
|
|
442
|
+
/** Progress (BdPanel): points done of the total; where Jira has no points, the work-items done by count, striped so a count never reads as points. */
|
|
443
|
+
function progHtml(r) {
|
|
444
|
+
const p = (r.track || {}).prog; if (!p || !p.total) return '';
|
|
445
|
+
const pct = Math.round((p.done / p.total) * 100), count = p.unit === 'tickets';
|
|
446
|
+
const what = p.unit === 'pts' ? p.done + ' of ' + p.total + ' points' : count ? p.done + ' of ' + p.total + ' work-items done' : p.done + '% on record';
|
|
447
|
+
return `<div class="pk-sec"><p class="lbl">Progress</p><div class="bd-box"><div class="bd-boxh"><b>${esc(what)}</b><span class="bd-amut">${pct}%${count ? ' · by count' : ''}</span></div>${V.barHtml({ pct, count, label: what })}${count ? '<p class="pk-mut">The bar is striped so a count never reads as points.</p>' : ''}</div></div>`;
|
|
448
|
+
}
|
|
449
|
+
/** The first questions before the BRD (BdGrill), while some are open: the count and a button that opens them. */
|
|
450
|
+
function grillHtml(r) {
|
|
451
|
+
const g = r.id && GR[r.id]; if (!g || !g.open) return '';
|
|
452
|
+
return `<div class="pk-nb"><div class="t"><b>${g.open} ${plural(g.open, 'question', 'questions')} before the BRD</b><div>${g.later ? 'You chose to answer later. ' : ''}PMOS asks what the BRD needs that the Why does not say yet.</div></div><button type="button" class="bd-ib solid" data-pk="grill" aria-label="Answer the questions" title="Answer the questions">${SV(I.next)}</button></div>`;
|
|
245
453
|
}
|
|
246
454
|
function iniPanel(r) {
|
|
247
|
-
const t = r.track || {},
|
|
248
|
-
const
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
+ `<div class="pk-
|
|
254
|
-
+
|
|
255
|
-
+
|
|
256
|
-
+ (t.
|
|
257
|
-
|
|
258
|
-
+
|
|
455
|
+
const t = r.track || {}, s0 = statusOf(r);
|
|
456
|
+
const s = r.release && /^Ships /.test(s0.text) ? { ...s0, text: 'On track' } : s0; // the line already says when it ships
|
|
457
|
+
const when = r.release ? `<span>·</span><span>ships <b>${esc(fmt(r.release.iso))}</b> with ${esc(r.release.name)}</span>` : r.end ? `<span>·</span><span>plan ends <b>${esc(fmt(r.end))}</b></span>` : '';
|
|
458
|
+
// the status line is one line, as AgBoardPanel draws it; "usually N days" stays in the step's tooltip
|
|
459
|
+
return `<div class="pk-h"><div class="pk-ht"><p class="pk-eye">${esc(eyeOf(r).join(' · '))}</p><h2 id="pkTitle">${esc(r.title)}</h2><p class="pk-st"><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone} ${s.mo}"></i>${esc(s.text)}</span><span>·</span><span title="${esc(dayTitle(t))}">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}<b>${esc(t.label || r.stage || 'No stage')}</b>${t.days != null ? ' day ' + t.days : ''}</span>${when}</p></div>`
|
|
460
|
+
+ `<div class="pk-tools">${r.id ? `<a class="bd-ib" data-pk="expand" href="${esc(pageHref(r))}" aria-label="Open the initiative page" title="Open the initiative page">${SV(I.expand)}</a>` : ''}<button type="button" class="bd-ib" data-pk="acts" aria-label="Initiative actions" title="Initiative actions">${SV(I.more)}</button><button type="button" class="bd-ib" data-pk="close" aria-label="Close" title="Close">${SV(I.x)}</button></div></div>`
|
|
461
|
+
+ `<div class="pk-b">${ladderHtml(t)}${skipHtml(t)}`
|
|
462
|
+
+ nextHtml(r)
|
|
463
|
+
+ grillHtml(r)
|
|
464
|
+
+ ((t.key === 'build' || t.key === 'deliver') && (t.tickets || []).length ? jiraHtml(r)
|
|
465
|
+
: `<div class="pk-box"><div class="t1"><b>${esc(t.output || 'No step on record')}</b><span>${esc(t.count || '')}</span></div>${segHtml(r, true)}<div class="pk-tks">${outRows(r)}</div>${typeof t.next === 'string' && t.next && !(t.tickets || []).length ? `<p class="pk-nx">Next: <b>${esc(t.next)}</b></p>` : ''}</div>`)
|
|
466
|
+
+ datesHtml(r) + progHtml(r)
|
|
467
|
+
+ draftedHtml(r) + driftHtml(r) + linkedHtml(r) // the dependencies are Linked chips, as AgBoardPanel draws them
|
|
259
468
|
+ `</div>${askForm(r, r.title)}`;
|
|
260
469
|
}
|
|
261
|
-
|
|
470
|
+
function timePanel(r) {
|
|
471
|
+
const t = r.track || {}, k = t.k, epic = (r.epics || [])[0];
|
|
472
|
+
const eye = eyeOf(r, true).concat(epic ? ['epic ' + epic] : ['no Jira epic yet']);
|
|
473
|
+
const lad = `<div class="pk-seg" aria-hidden="true">${M.steps.map((_, j) => `<i class="${j < k ? 'p' : j === k ? 'c' : ''}"></i>`).join('')}</div>`;
|
|
474
|
+
const need = t.you
|
|
475
|
+
? `<div class="pk-need"><i class="cz-dot you m-info"></i><div class="t"><b>${esc(t.you)}</b><div>${esc(t.youKind ? t.youWhy || '' : 'Every release ticket is done.')}</div></div>${r.id ? `<a class="bd-ib" href="${esc(pageHref(r))}" aria-label="Open the initiative page" title="Open the initiative page">${SV(I.ext)}</a>` : ''}</div>`
|
|
476
|
+
: ''; // AgBoardTimelinePanel draws the card only when something waits on you
|
|
477
|
+
const tks = (t.tickets || []).slice(0, 8).map((x) => `<button type="button" class="wi" data-tk="${esc(x.key)}" data-ini="${esc(r.key)}"><span class="wk">${esc(x.key)}</span><span class="wt2">${esc(x.title)}</span><span class="st${x.blocked ? ' r' : x.status === 'Done' ? '' : ' y'}">${esc(x.blocked ? 'Blocked' : x.status)}</span></button>`).join('');
|
|
478
|
+
// AgBoardTimelinePanel: change the plan dates, move, hold, archive. Dates go through Home (no route writes plan dates from the Board).
|
|
479
|
+
const acts = `<a class="bd-ib" href="${esc(askHref(r, 'Propose new start and end dates for ' + r.title))}" aria-label="Change the plan dates" title="Change the plan dates">${SV(I.cal)}</a>`
|
|
480
|
+
+ [['move', 'Move to another stage'], ['hold', 'Put on hold'], ['archive', 'Archive']].map(([i, n]) => `<button type="button" class="bd-ib" data-pk="acts" aria-label="${n}" title="${n}">${SV(I[i])}</button>`).join('');
|
|
481
|
+
const D = (TI(r) && TI(r).deps) || [], open = D.filter((d) => d.known && !d.done);
|
|
482
|
+
const dep = D.length ? `<div class="pk-dep">${SV(I.link)}<div><b>Waits on ${esc(D.map((d) => d.title || d.id).join(', '))}</b><div>${esc(D.map((d) => (d.title || d.id) + ': ' + DEP_ST(d)).join(' · '))}.${open.length ? ' Its own dates hold only once ' + (open.length === 1 ? 'that one is' : 'those are') + ' done.' : ''}</div></div></div>`
|
|
483
|
+
: ''; // no card when nothing is on record
|
|
484
|
+
return `<div class="pk-h"><div class="pk-ht"><p class="pk-eye">${esc(eye.join(' · '))}</p><h2 id="pkTitle">${esc(r.title)}</h2></div><div class="pk-tools">${r.id ? `<a class="bd-ib" data-pk="expand" href="${esc(pageHref(r))}" aria-label="Open the initiative page" title="Open the initiative page">${SV(I.ext)}</a>` : ''}<button type="button" class="bd-ib" data-pk="close" aria-label="Close" title="Close">${SV(I.x)}</button></div></div>`
|
|
485
|
+
+ `<div class="pk-b"><div><p class="pk-stp"><b>${esc(t.label || 'No step')}</b>${k >= 0 ? ' · step ' + (k + 1) + ' of 8' : ''}</p>${lad}</div>${need}`
|
|
486
|
+
+ `<div class="pk-sec"><p class="lbl">Dates</p><div class="pk-kv"><span>PMOS plan</span><b>${esc(r.start || r.end ? [r.start ? fmt(r.start) : '…', r.end ? fmt(r.end) : '…'].join(' → ') : 'No dates on record')}</b><span>Jira forecast</span><b>${esc(t.forecastLabel ? fmt(t.forecast) : 'No open ticket in a dated sprint')}</b></div></div>`
|
|
487
|
+
+ dep
|
|
488
|
+
+ `<div class="pk-sec"><p class="lbl">Tickets · ${(t.tickets || []).length} in Jira</p>${tks ? `<div class="pk-wis">${tks}</div>` : '<p class="pk-mut">No ticket of this initiative is in a Jira reading.</p>'}</div>`
|
|
489
|
+
+ `<div class="pk-sec"><p class="lbl">Initiative</p><div class="pk-acts">${acts}</div></div></div>${askForm(r, r.title, { inside: true })}`;
|
|
490
|
+
}
|
|
491
|
+
/** The blocker's own summary, where its key (in the reason) is a ticket of a row on this board. */
|
|
492
|
+
function blockerTitle(reason) {
|
|
493
|
+
const m = /\b([A-Z][A-Z0-9]+-\d+)\b/.exec(String(reason || '')); if (!m) return '';
|
|
494
|
+
for (const r of (M && M.rows) || []) { const x = ((r.track && r.track.tickets) || []).find((y) => y.key === m[1]); if (x && x.title && x.title !== x.key) return x.title; }
|
|
495
|
+
return '';
|
|
496
|
+
}
|
|
262
497
|
function tkPanel(r, k) {
|
|
263
|
-
const t = r.track || {},
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
498
|
+
const t = r.track || {}, x = TI(r) && TI(r).tickets ? TI(r).tickets[k.key] : null, sub = x && x.subtasks;
|
|
499
|
+
// what a blocker delays: the sprint it sits in ends, and the release the initiative rides on
|
|
500
|
+
const slip = k.sprintEnd ? 'If it is not fixed by ' + fmt(k.sprintEnd) + ', the end of ' + (k.sprint || 'its sprint') + ', ' + (r.release ? r.release.name + ' on ' + fmt(r.release.iso) + ' slips.' : 'it carries into the next sprint.') : r.release ? 'It holds up ' + r.release.name + ' on ' + fmt(r.release.iso) + '.' : '';
|
|
501
|
+
// AgBoardTicket: Blocked 2 days · In review · (M) Mei · 5 pts · Sprint 24, each field only where the Jira reading holds it
|
|
502
|
+
const bd = k.blockedDays != null ? ' ' + k.blockedDays + ' ' + plural(k.blockedDays, 'day', 'days') : '';
|
|
503
|
+
const meta = [k.blocked ? `<span class="cs s-red"><i class="cz-dot red m-crit"></i>Blocked${esc(bd)}</span>` : '', esc(k.raw && !(k.blocked && /block/i.test(k.raw)) ? k.raw : k.blocked ? '' : k.status), k.assignee ? `<span class="pk-who"><span class="pk-av" aria-hidden="true">${esc(k.assignee.charAt(0))}</span>${esc(k.assignee)}</span>` : '', k.points != null ? esc(k.points + ' pts') : '', k.sprint ? esc(k.sprint) : ''].filter(Boolean).join('<span>·</span>');
|
|
504
|
+
const reason = k.reason || (x && x.reason) || 'Flagged as blocked in Jira', bt = blockerTitle(reason);
|
|
505
|
+
// the subtasks: one row each where the reading lists them; else the reading's two counts as rows (done, open)
|
|
506
|
+
const items = sub && Array.isArray(sub.items) ? sub.items : null;
|
|
507
|
+
const subRows = items && items.length ? items.map((y) => `<p class="gi gm"><i class="k${y.done ? ' dn' : ''}"></i><span class="n">${esc(y.name || y.summary || '')}</span><span class="r">${y.done ? 'done' : 'open'}</span></p>`).join('')
|
|
508
|
+
: sub && sub.total ? [[sub.done, 'done', ' dn'], [sub.total - sub.done, 'open', '']].filter(([n]) => n > 0).map(([n, w, c]) => `<p class="gi gm"><i class="k${c}"></i><span class="n">${n} ${plural(n, 'subtask', 'subtasks')}</span><span class="r">${w}</span></p>`).join('')
|
|
509
|
+
: '<p class="gi gm"><i class="k"></i><span class="n">No subtasks are in the Jira reading</span></p>';
|
|
510
|
+
return `<div class="pk-h"><div class="pk-ht"><button type="button" class="pk-back" data-pk="back">${SV(I.next)}${esc(r.title)} · ${esc(t.label || '')}</button><h2 id="pkTitle">${esc(k.key)} · ${esc(k.title)}</h2><p class="pk-st">${meta}</p></div>`
|
|
511
|
+
+ `<div class="pk-tools">${k.url ? `<a class="bd-ib" href="${esc(k.url)}" target="_blank" rel="noopener" aria-label="Open ${esc(k.key)} in Jira" title="Open in Jira">${SV(I.ext)}</a>` : ''}<button type="button" class="bd-ib" data-pk="close" aria-label="Close" title="Close">${SV(I.x)}</button></div></div>`
|
|
512
|
+
+ `<div class="pk-b">${k.blocked ? `<div class="pk-nb red"><div class="t"><b>${esc(reason)}</b>${bt ? `<span class="pk-bt"> · ${esc(bt)}</span>` : ''}${slip ? `<div>${esc(slip)}</div>` : ''}</div>${k.url ? `<a class="bd-ib" href="${esc(k.url)}" target="_blank" rel="noopener" aria-label="Comment in Jira" title="Comment in Jira">${SV(I.note)}</a>` : ''}</div>` : ''}`
|
|
513
|
+
+ driftHtml(r, k.key)
|
|
514
|
+
+ `<div class="pk-box"><div class="t1"><b>Subtasks</b><span>${sub && sub.total ? sub.done + ' of ' + sub.total : ''}</span></div><div class="pk-tks">${subRows}</div></div>`
|
|
515
|
+
+ `<div class="pk-sec"><p class="lbl">Counts toward</p><p class="pk-p">${esc(t.output || '')} · ${esc(t.count || '')}</p></div>`
|
|
270
516
|
+ '<p class="pk-mut">PMOS owns the ticket text. Status, sprint and assignee change only in Jira.</p></div>'
|
|
271
517
|
+ askForm(r, k.key);
|
|
272
518
|
}
|
|
273
519
|
function showPeek(html, back) {
|
|
274
520
|
const pk = $('#peek'); pk.innerHTML = html; pk.hidden = false; document.body.classList.add('pk-on');
|
|
275
|
-
|
|
276
|
-
|
|
521
|
+
pk.classList.toggle('pk-tl', !!peek && peek.kind === 'ini' && peek.from === 'time'); // AgBoardTimelinePanel is 420 px wide
|
|
522
|
+
if (back && !$('#peek').contains(back)) peekBack = back; // a press inside the panel keeps the row the panel was opened from
|
|
523
|
+
$$('#ibBody [data-row]').forEach((x) => x.classList.toggle('sel', !!peek && peek.kind !== 'acts' && x.dataset.row === peek.key));
|
|
524
|
+
$$('#ibBody .tgp-r').forEach((x) => x.classList.toggle('sel', !!peek && peek.kind !== 'acts' && x.dataset.key === peek.key));
|
|
277
525
|
const h = $('#pkTitle'); if (h) { h.tabIndex = -1; h.focus({ preventScroll: true }); }
|
|
278
526
|
}
|
|
279
527
|
function closePeek() {
|
|
280
528
|
if ($('#peek').hidden) return;
|
|
281
529
|
const key = peek && peek.key;
|
|
282
|
-
$('#peek').hidden = true; document.body.classList.remove('pk-on'); peek = null;
|
|
283
|
-
$$('#ibBody .
|
|
530
|
+
$('#peek').hidden = true; document.body.classList.remove('pk-on'); peek = null;
|
|
531
|
+
$$('#ibBody .sel').forEach((x) => x.classList.remove('sel'));
|
|
284
532
|
// a read can draw the rows again while the panel is open: then the focus goes to the same row as drawn now
|
|
285
533
|
const back = peekBack && document.contains(peekBack) ? peekBack : key ? $$('#ibBody [data-key]').find((x) => x.dataset.key === key) : null;
|
|
286
534
|
if (back) back.focus(); peekBack = null;
|
|
287
535
|
}
|
|
288
|
-
function openIni(r, from) {
|
|
289
|
-
if (!r) return;
|
|
290
|
-
|
|
291
|
-
peek = { kind: 'ini', key: r.key }; showPeek(iniPanel(r), from);
|
|
536
|
+
function openIni(r, from, where) {
|
|
537
|
+
if (!r || !r.track) return;
|
|
538
|
+
peek = { kind: 'ini', key: r.key, from: where || 'track' }; showPeek(peek.from === 'time' ? timePanel(r) : iniPanel(r), from);
|
|
292
539
|
}
|
|
293
540
|
function openTicket(iniKey, key, from) {
|
|
294
541
|
const r = rowOf(iniKey); if (!r || !r.track) return;
|
|
295
542
|
const k = (r.track.tickets || []).find((x) => x.key === key); if (!k) return;
|
|
296
|
-
peek = { kind: 'tk', key: r.key, tk: key }; showPeek(tkPanel(r, k), from);
|
|
543
|
+
peek = { kind: 'tk', key: r.key, tk: key, from: peek && peek.from }; showPeek(tkPanel(r, k), from);
|
|
297
544
|
}
|
|
298
545
|
$('#peek').addEventListener('click', (e) => {
|
|
299
546
|
const r = peek && rowOf(peek.key);
|
|
300
|
-
const im = e.target.closest('[data-im]'); if (im && r) { openMenu(im, ctxOf(), r); return; }
|
|
301
547
|
const tk = e.target.closest('[data-tk]'); if (tk) { openTicket(tk.dataset.ini, tk.dataset.tk); return; }
|
|
302
548
|
const b = e.target.closest('[data-pk]'); if (!b) return;
|
|
303
549
|
const a = b.dataset.pk;
|
|
304
550
|
if (a === 'close') closePeek();
|
|
305
|
-
else if (a === 'back' && r) { peek = { kind: 'ini', key: r.key }; showPeek(iniPanel(r)); }
|
|
306
|
-
else if (a === '
|
|
307
|
-
else if (a === '
|
|
308
|
-
else if (a === '
|
|
551
|
+
else if (a === 'back' && r) { peek = { kind: 'ini', key: r.key, from: peek.from }; showPeek(peek.from === 'time' ? timePanel(r) : iniPanel(r)); }
|
|
552
|
+
else if (a === 'jira') refreshJira(b);
|
|
553
|
+
else if (a === 'drift') { const q = $('#peek form.pk-ask input[name="q"]'); if (q) { q.value = b.dataset.q || ''; q.focus(); } }
|
|
554
|
+
else if (a === 'acts' && r) Acts.open.row(r, b);
|
|
555
|
+
else if (a === 'grill' && r) Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b);
|
|
556
|
+
});
|
|
557
|
+
/** A linked document opens in the Viewer: GET /api/doc, shown as its text. */
|
|
558
|
+
document.addEventListener('click', (e) => {
|
|
559
|
+
const d = e.target.closest('[data-doc]'); if (!d || !M) return;
|
|
560
|
+
const path = d.dataset.doc, ws = M.board.ws || '';
|
|
561
|
+
viewerOpen({ kind: 'Document', title: path.split('/').pop(), icon: 'doc', id: 'doc:' + path, render: async (body) => {
|
|
562
|
+
body.innerHTML = '<p class="bd-amut">Reading the document…</p>';
|
|
563
|
+
let text = null; try { const res = await fetch('/api/doc?ws=' + encodeURIComponent(ws) + '&path=' + encodeURIComponent(path), { credentials: 'same-origin' }); text = res.ok ? await res.text() : null; } catch { text = null; }
|
|
564
|
+
body.innerHTML = text == null ? `<p class="bd-amut">${esc(path)} could not be read.</p>` : `<p class="bd-amut">${esc(path)}</p><pre class="bd-doc">${esc(text)}</pre>`;
|
|
565
|
+
} });
|
|
309
566
|
});
|
|
310
567
|
$('#peek').addEventListener('submit', (e) => {
|
|
311
|
-
const f = e.target.closest('[data-ask]'); if (!f) return;
|
|
568
|
+
const f = e.target.closest('form.pk-ask[data-ask]'); if (!f) return;
|
|
312
569
|
e.preventDefault();
|
|
313
570
|
const r = rowOf(f.dataset.ask), q = f.q.value.trim();
|
|
314
571
|
if (!q) { f.q.focus(); return; }
|
|
315
572
|
location.assign(askHref(r, peek && peek.kind === 'tk' ? peek.tk + ': ' + q : q));
|
|
316
573
|
});
|
|
317
574
|
|
|
318
|
-
/* ──
|
|
319
|
-
$('#bdFind').addEventListener('click', () =>
|
|
320
|
-
$('#
|
|
321
|
-
$('#
|
|
322
|
-
|
|
323
|
-
if (!M) return;
|
|
324
|
-
const rows = M.initiatives.list.rows, owners = [...new Set(rows.map((r) => r.owner || ''))].sort(), lanes = [...new Set(rows.map((r) => r.lane || ''))].filter(Boolean).sort();
|
|
325
|
-
const chip = (kind, v, label, on) => `<button type="button" class="cz-chip${on ? ' on' : ''}" data-fk="${kind}" data-fv="${esc(v)}" aria-pressed="${on}">${esc(label)}</button>`;
|
|
326
|
-
$('#popFilter').innerHTML = `<div class="bd-fl"><p class="lbl">Owner</p><div class="pk-lk">${owners.map((o) => chip('o', o, o || 'No owner', F.owners.has(o))).join('')}</div><p class="lbl">Lane</p><div class="pk-lk">${lanes.map((l) => chip('l', l, l.charAt(0).toUpperCase() + l.slice(1), F.lanes.has(l))).join('')}</div>${F.owners.size || F.lanes.size ? '<button type="button" class="dlink" data-fk="clear">Clear owner and lane</button>' : ''}</div>`;
|
|
327
|
-
const d = $('#bdFilter .bd-fdot'); if (d) d.hidden = !(F.owners.size || F.lanes.size);
|
|
328
|
-
}
|
|
329
|
-
$('#bdFilter').addEventListener('click', (e) => { e.stopPropagation(); drawFilter(); togglePop('popFilter', $('#bdFilter')); });
|
|
330
|
-
$('#popFilter').addEventListener('click', (e) => {
|
|
331
|
-
const b = e.target.closest('[data-fk]'); if (!b) return;
|
|
332
|
-
if (b.dataset.fk === 'clear') { F.owners.clear(); F.lanes.clear(); } else { const S = b.dataset.fk === 'o' ? F.owners : F.lanes, v = b.dataset.fv; if (S.has(v)) S.delete(v); else S.add(v); }
|
|
333
|
-
shown = 25; drawFilter(); drawInit();
|
|
334
|
-
});
|
|
575
|
+
/* ── the tools the Agreed design draws but has no frame for: plain versions with a "Waiting for design" tag (pm/bd-acts.js) ─────────── */
|
|
576
|
+
$('#bdFind').addEventListener('click', (e) => Acts.open.find(e.currentTarget));
|
|
577
|
+
$('#bdFilter').addEventListener('click', (e) => Acts.open.filter(e.currentTarget));
|
|
578
|
+
$('#newIni').addEventListener('click', (e) => Acts.open.new(e.currentTarget));
|
|
579
|
+
$('#bdBell').addEventListener('click', (e) => { if (M) Acts.open.bell(e.currentTarget); });
|
|
335
580
|
|
|
336
|
-
/* ── tabs: Initiatives and Documents
|
|
581
|
+
/* ── tabs: Initiatives and Documents (Documents has no frame yet: a plain list) ──────────────────────────────────────────────────────── */
|
|
337
582
|
function setTab(t) {
|
|
338
583
|
tab = t;
|
|
339
584
|
$('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabDocs').setAttribute('aria-selected', String(t === 'docs'));
|
|
340
585
|
$('#cIni').hidden = t !== 'ini'; $('#cDocs').hidden = t !== 'docs';
|
|
341
|
-
|
|
342
|
-
if (t === 'docs' && $('#dmF')) pillOf($('#dmF')); // the filter's pill is placed once the tab shows
|
|
586
|
+
if (t === 'docs') { closePeek(); drawDocs(); loadDocMeta(); }
|
|
343
587
|
}
|
|
344
588
|
$('#tabIni').onclick = () => setTab('ini');
|
|
345
589
|
$('#tabDocs').onclick = () => setTab('docs');
|
|
346
|
-
$('.
|
|
347
|
-
|
|
348
|
-
/* ── sprint, release, documents ─────────────────────────────────────────────────────────────────────────── */
|
|
349
|
-
function drawSide() {
|
|
350
|
-
const S = M.sprint, R = M.release;
|
|
351
|
-
$('#hSpr').textContent = S.name || 'Sprint';
|
|
352
|
-
$('#sprCap').textContent = S.cap || '';
|
|
353
|
-
$('#sprBody').innerHTML = S.name
|
|
354
|
-
? `<button type="button" class="spr sprb" data-open="board:sprint" aria-haspopup="dialog" aria-label="${esc(S.name)}, ${esc(S.cap || '')}. Open the sprint"><span class="sbar" aria-hidden="true"><i class="d" style="width:${S.pct.done}%"></i><i class="g" style="width:${S.pct.doing}%"></i></span>`
|
|
355
|
-
+ `<span class="cnt"><span><b>${S.counts.done}</b> done</span><span><b>${S.counts.doing}</b> doing</span><span><b>${S.counts.todo}</b> to do</span></span>`
|
|
356
|
-
+ `${S.goal ? `<span class="goal2">Goal: ${esc(S.goal)}</span>` : ''}${S.review ? `<span class="sum3">${esc(S.review)}</span>` : ''}</button>`
|
|
357
|
-
: `<p class="mut">${esc(S.why)}</p>`;
|
|
358
|
-
$('#hRel').textContent = 'Next release';
|
|
359
|
-
$('#relCap').textContent = R.at ? '' : R.cap || 'none';
|
|
360
|
-
$('#relBody').innerHTML = R.rel && R.rel.length
|
|
361
|
-
? `${R.at ? '' : `<p class="empty3 plain">${esc(R.why)}</p>`}<div class="rels">${R.rel.map((r) => `<button type="button" class="rel" data-open="board:release" aria-haspopup="dialog"><span class="rh"><b>${esc(r.name)}</b><em class="rtag">${esc(r.tag)}</em><time>${esc(r.at)}${r.away ? ' · ' + esc(r.away) : ''}</time></span>${r.ini.map((i) => `<span class="ri"><i class="hd ${i.tone}"></i>${esc(i.title)}${i.status ? ' · ' + esc(i.status) : ''}</span>`).join('')}</button>`).join('')}</div>`
|
|
362
|
-
: `<p class="empty3 plain">${esc(R.why)}</p>`;
|
|
363
|
-
}
|
|
364
|
-
$('#cSpr').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) { closePops(); openRow(rowOf(b.dataset.open)); } });
|
|
365
|
-
$('#cSpr').addEventListener('click', (e) => { if (e.target.closest('[data-open="board:sprint"]')) backlogBtn(); }); // after openRow: the sprint dialog's own detail gets "Open the backlog" (premium-viewer R10)
|
|
366
|
-
$('#cRel').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) { closePops(); openRow(rowOf(b.dataset.open)); } });
|
|
367
|
-
function docRow(d) {
|
|
368
|
-
const act = !d.act ? '' : d.act.kind === 'draft' ? `<button class="dmcta alt" data-draft="${esc(d.key)}"${d.running ? ' disabled' : ''}>${d.running ? '<span class="cz-dot m-info" aria-hidden="true"></span>' : ICO('<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>')}${esc(d.act.label)}</button>` : `<button class="dmcta alt" data-tab="${esc(d.act.tab)}">${esc(d.act.label)}</button>`;
|
|
369
|
-
return `<div class="dmr ${esc(d.st || '')}" role="listitem">${d.path ? `<button class="dmo" data-doc="${esc(d.key)}" aria-haspopup="dialog">` : '<span class="dmo">'}<span class="dmi c-Board">${ICO(DOCI)}</span><span class="dmn"><b>${esc(d.title)}</b><small>${esc(d.what)}</small><span class="dmm"><span class="s ${esc(d.st || 'live')}">${ICO(STATE_ICO[d.state] || STATE_ICO['Not started'])}${esc(d.state)}</span>${d.added ? `<span>${ICO('<rect x="3" y="5" width="18" height="16" rx="3"/><path d="M3 10h18M8 3v4M16 3v4"/>')}added ${esc(d.added)}</span>` : ''}${d.cadence ? `<span>${ICO('<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>')}${esc(d.cadence)}</span>` : ''}${d.by ? `<span>${ICO('<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>')}${esc(d.by)}</span>` : ''}</span></span>${d.path ? '</button>' : '</span>'}<span class="dmq">${act}</span></div>`;
|
|
370
|
-
}
|
|
371
|
-
let docFilter = 'all', docQuery = '';
|
|
372
|
-
const draftable = () => (M.docs.rows || []).filter((d) => d.st === 'missing' && d.act && d.act.kind === 'draft' && !d.running);
|
|
373
|
-
const docMatch = (d) => (docFilter === 'all' || (docFilter === 'none' ? d.st === 'missing' : docFilter === 'draft' ? d.st === 'draft' : d.st === 'ok')) && (!docQuery.trim() || (d.title + ' ' + d.what).toLowerCase().includes(docQuery.trim().toLowerCase()));
|
|
374
|
-
function drawDocList() {
|
|
375
|
-
const D = M.docs, L = D.rows.filter(docMatch);
|
|
376
|
-
$('#docBody').innerHTML = L.length ? L.map(docRow).join('') : `<div class="dmem"><p>No document matches${docQuery.trim() ? ' “' + esc(docQuery.trim()) + '”' : ''}.</p></div>`;
|
|
377
|
-
$$('#dmF button').forEach((b) => b.setAttribute('aria-pressed', b.dataset.dmf === docFilter)); if ($('#dmF')) pillOf($('#dmF'));
|
|
378
|
-
}
|
|
379
|
-
function drawDocs() {
|
|
380
|
-
const D = M.docs, c = D.counts;
|
|
381
|
-
$('#addDoc').hidden = !D.scope;
|
|
382
|
-
$('#docCap').textContent = D.rows.length ? String(c.all) : '';
|
|
383
|
-
if (!D.rows.length) { $('#docTop').innerHTML = ''; $('#docBody').innerHTML = `<p class="empty3 plain">${D.missing ? 'The core documents could not be read, so none is shown.' : 'No core documents are on record for this board.'}</p>`; $('#docNote').textContent = ''; return; }
|
|
384
|
-
const dot = { ok: 'ok', draft: 'warn', missing: 'mut' };
|
|
385
|
-
const hadQ = $('#dmQ') && document.activeElement === $('#dmQ');
|
|
386
|
-
$('#docTop').innerHTML = `<p class="dsum"><span><b>${c.draft}</b> ${c.draft === 1 ? 'draft' : 'drafts'} to review</span><span><b>${c.none}</b> not started</span><span><b>${c.ok}</b> up to date</span>${c.linked ? `<span><b>${c.linked}</b> linked</span>` : ''}${draftable().length > 1 ? `<button class="dlink" data-draftall="1">${ICO('<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>')}Draft the ${draftable().length} not started</button>` : ''}</p>
|
|
387
|
-
<div class="dprog" role="img" aria-label="${c.ok} of ${c.all} up to date">${D.rows.map((d) => `<i class="${dot[d.st] || (d.st === 'live' ? 'ok' : 'mut')}"></i>`).join('')}</div>
|
|
388
|
-
<div class="dtool"><div class="seg" id="dmF" role="group" aria-label="Filter documents"><i class="pill"></i>${[['all', 'All', c.all], ['none', 'Not started', c.none], ['draft', 'Draft', c.draft], ['ok', 'Up to date', c.ok]].map(([k, l, n]) => `<button data-dmf="${k}" aria-pressed="${docFilter === k}">${l}<em>${n}</em></button>`).join('')}</div>
|
|
389
|
-
<label class="dmsr">${ICO('<circle cx="11" cy="11" r="6.5"/><path d="m20 20-4-4"/>')}<input id="dmQ" type="search" placeholder="Find a document" aria-label="Find a document" value="${esc(docQuery)}"></label></div>`;
|
|
390
|
-
drawDocList();
|
|
391
|
-
if (hadQ) { const q = $('#dmQ'); q.focus(); q.setSelectionRange(q.value.length, q.value.length); }
|
|
392
|
-
$('#docNote').textContent = 'Draft it starts a read-only agent run that writes a draft for you to read. Nothing is sent. Press a document to read it; a draft has Issue it, which marks it issued and sends nothing. Dropping a document is not built on this page.';
|
|
393
|
-
}
|
|
394
|
-
$('#docTop').addEventListener('click', async (e) => {
|
|
395
|
-
const f = e.target.closest('[data-dmf]'); if (f) { docFilter = f.dataset.dmf; drawDocList(); return; }
|
|
396
|
-
const all = e.target.closest('[data-draftall]'); if (!all || all.disabled) return;
|
|
397
|
-
all.disabled = true; let n = 0;
|
|
398
|
-
for (const d of draftable()) { const res = await pmPost('/api/core-docs/draft', { ws: M.board.ws, scope: M.docs.scope, key: d.key }); if (res && res.ok === true) n++; else { toast((res && res.error) || 'A draft could not be started.'); break; } }
|
|
399
|
-
if (n) toast('The agent is drafting ' + n + ' ' + (n === 1 ? 'document' : 'documents') + '. They run in the background and send nothing.');
|
|
400
|
-
await load();
|
|
401
|
-
});
|
|
402
|
-
$('#docTop').addEventListener('input', (e) => { if (e.target.id === 'dmQ') { docQuery = e.target.value; drawDocList(); } });
|
|
403
|
-
/* A document's Open stays on the premium pages (premium-rows-stay-premium): the board's own views, the release dialog, Insights for a report, Home's Horizon scan. */
|
|
404
|
-
const GOTAB = {
|
|
405
|
-
rep: () => location.assign('/premium-insights.html' + wsQ('?')),
|
|
406
|
-
init: () => { setTab('ini'); const f = $('#ibBody button'); if (f) f.focus(); },
|
|
407
|
-
asks: () => { setTab('ini'); togglePop('popAsks', $('#chAsks')); },
|
|
408
|
-
rel: () => { const r = rowOf('board:release'); if (r) openRow(r); else togglePop('popSpr', $('#chSprint')); },
|
|
409
|
-
scan: () => location.assign('/premium.html?around=scan' + wsQ('&')),
|
|
410
|
-
};
|
|
411
|
-
$('#docBody').addEventListener('click', async (e) => {
|
|
412
|
-
const o = e.target.closest('[data-doc]'); if (o) { docSheet.open(M.docs.rows.find((x) => x.key === o.dataset.doc)); return; }
|
|
413
|
-
const t = e.target.closest('[data-tab]'); if (t) { (GOTAB[t.dataset.tab] || GOTAB.init)(); return; }
|
|
414
|
-
const b = e.target.closest('[data-draft]'); if (!b || b.disabled) return;
|
|
415
|
-
const key = b.dataset.draft, d = M.docs.rows.find((x) => x.key === key);
|
|
416
|
-
b.disabled = true;
|
|
417
|
-
const res = await pmPost('/api/core-docs/draft', { ws: M.board.ws, scope: M.docs.scope, key });
|
|
418
|
-
if (!res || res.ok !== true) { b.disabled = false; toast((res && res.error) || 'The draft could not be started.'); return; }
|
|
419
|
-
toast('The agent is drafting “' + (d ? d.title : key) + '”. It runs in the background and sends nothing.');
|
|
420
|
-
await load();
|
|
421
|
-
});
|
|
422
|
-
$('#addDoc').onclick = () => openAddDoc({ ws: M.board.ws, scope: M.docs.scope, sub: M.board.name, onAdded: load });
|
|
590
|
+
$('.bd-tabs').addEventListener('keydown', (e) => { if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') return; const n = tab === 'ini' ? 'docs' : 'ini'; setTab(n); $(n === 'ini' ? '#tabIni' : '#tabDocs').focus(); });
|
|
423
591
|
|
|
424
|
-
|
|
425
|
-
function
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
592
|
+
/** Documents (BdDocs): the kind chips, the rows and their history; a row opens the document's panel (pm/bd-acts.js). */
|
|
593
|
+
function drawDocs() { if (M) $('#docBody').innerHTML = V.docsHtml(); }
|
|
594
|
+
$('#docBody').addEventListener('click', (e) => { const k = e.target.closest('[data-dkind]'); if (k) { V.setDocKind(k.dataset.dkind); drawDocs(); const b = $(`#docBody [data-dkind="${k.dataset.dkind}"]`); if (b) b.focus(); } });
|
|
595
|
+
/** The history of the documents on screen (GET /api/board-docs): when each last changed, by whom, its last commits. Read-only. */
|
|
596
|
+
async function loadDocMeta(paths) {
|
|
597
|
+
if (!M) return;
|
|
598
|
+
const P = (paths || V.docRows().map((x) => x.path)).filter((p) => p && !DM[p]).slice(0, 40);
|
|
599
|
+
if (!P.length) return;
|
|
600
|
+
let r = null; try { r = await (await fetch('/api/board-docs?ws=' + encodeURIComponent(M.board.ws || '') + '&paths=' + P.map(encodeURIComponent).join(','), { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
601
|
+
if (!r || !r.ok) return;
|
|
602
|
+
for (const p of P) DM[p] = r.docs[p] || { none: true };
|
|
603
|
+
if (tab === 'docs') drawDocs();
|
|
604
|
+
}
|
|
605
|
+
const docMeta = (p) => { const d = DM[p]; return d && !d.none ? d : null; };
|
|
431
606
|
|
|
432
|
-
/* ── the
|
|
607
|
+
/* ── the shell's bell sits before New initiative, as the design orders the tools; Escape closes a popover, then the panel ──────── */
|
|
608
|
+
/* the ⋯ menu ("More: sources, archived, export" in AgBoard and BdHead): the Board adds Metrics and Cancelled and archived */
|
|
433
609
|
{
|
|
434
|
-
const
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
on('#miSpr', () => togglePop('popSpr', $('#chSprint')));
|
|
439
|
-
on('#miMet', () => togglePop('popMet', $('#moreBtn'), true));
|
|
440
|
-
on('#miGone', () => { setTab('ini'); if (view === 'stages' || view === 'time') view = 'track'; showGone = true; drawInit(); const g = $('#goneT'); if (g) g.focus(); else toast('No initiative of this board is cancelled or archived.'); });
|
|
441
|
-
on('#theme2m', () => $('#theme2').click());
|
|
442
|
-
// the shell's bell sits before New initiative, as the design orders the tools
|
|
443
|
-
const bell = $('#pvBell'); if (bell) $('#newIni').before(bell);
|
|
610
|
+
const st = $('#settingsBtn'), mb = $('#moreBtn');
|
|
611
|
+
if (mb) { mb.setAttribute('aria-label', 'More: sources, archived, export'); mb.title = 'More: sources, archived, export'; }
|
|
612
|
+
if (st) st.insertAdjacentHTML('beforebegin', ['metrics', 'gone'].map((k) => `<button role="menuitem" id="${k === 'metrics' ? 'bdMetrics' : 'bdGone'}" aria-haspopup="dialog" data-open="${k}">${k === 'metrics' ? 'Metrics' : 'Cancelled and archived'}</button>`).join(''));
|
|
613
|
+
$$('#moreMenu [data-open]').forEach((b) => { b.onclick = () => { if (M) Acts.open[b.dataset.open]($('#moreBtn')); }; });
|
|
444
614
|
}
|
|
445
|
-
$('#popSteps').innerHTML = stepsHelpHtml();
|
|
446
|
-
// the Escape that closes the record dialog must not also close the panel under it: the dialog can close before this listener runs, so a close later than the key press means this press closed it
|
|
447
|
-
let dlgShut = 0, dlgOn = false;
|
|
448
|
-
new MutationObserver(() => { const on = $('#dlg').classList.contains('on'); if (dlgOn && !on) dlgShut = performance.now(); dlgOn = on; }).observe($('#dlg'), { attributes: true, attributeFilter: ['class'] });
|
|
449
615
|
window.addEventListener('keydown', (e) => {
|
|
450
|
-
if (e.key !== 'Escape' ||
|
|
616
|
+
if (e.key !== 'Escape' || document.querySelector('.pv-ov:not([hidden]), #moreMenu:not([hidden]), #crMenu:not([hidden]), #czMenu:not([hidden]), #bdPop:not([hidden])')) return;
|
|
451
617
|
if ($$('.bd-pop').some((p) => !p.hidden)) { closePops(true); return; }
|
|
452
618
|
if (!$('#peek').hidden) closePeek();
|
|
453
619
|
}, true);
|
|
454
620
|
|
|
455
|
-
/* ── dock (hidden in the Agreed design; its counts stay for the read-only agent) ───────────────────────────────────── */
|
|
456
|
-
function drawDock() { $('#dN').textContent = M.dock.needs; $('#dLab').textContent = M.dock.label; $('#dNext').innerHTML = (M.dock.next ? `First <b>${esc(M.dock.next)}</b>` : 'Nothing is late or at risk') + (M.dock.release ? ` · Next release <b>${esc(M.dock.release.at)}</b> ${esc(M.dock.release.name)}` : ''); }
|
|
457
|
-
|
|
458
|
-
/* ── the record dialog: the initiative's record, no press, the read-only agent beside it ──────────────────────────── */
|
|
459
|
-
function cardHtml(r) { return `<div class="acard" id="card"><p class="ct">What this page can do</p><p class="nodef" id="holdWhy">${esc(r.dialog.hold)}</p></div>`; }
|
|
460
|
-
function paneHtml(r) {
|
|
461
|
-
const p = r.dialog.pane;
|
|
462
|
-
return `<article class="paper doc">${p.file ? `<p class="dpath">${esc(p.file)}</p>` : ''}${p.rows.length ? `<div class="kv2">${p.rows.map(([a, b]) => `<span>${esc(a)}</span><span>${esc(b)}</span>`).join('')}</div>` : ''}<p class="xn">${esc(p.note || 'The initiative as the board holds it.')}</p>${r.id && r.dialog.eye === 'Initiative' ? recordPress() : ''}</article>`;
|
|
463
|
-
}
|
|
464
|
-
function openRow(r) {
|
|
465
|
-
if (!r) return;
|
|
466
|
-
const d = r.dialog;
|
|
467
|
-
openDlg({ eye: d.eye + ' · real data', title: r.title, sub: r.sub + (r.statusLabel ? ' · ' + r.statusLabel : ''), say: d.say, stream: turnA(logHtml(d)) + turnA(ptx(d.say)) + cardHtml(r), noteKey: r.key, pane: paneHtml(r), label: d.pane.label });
|
|
468
|
-
const vb = $('#oMain [data-vwopen]'); if (vb) vb.onclick = () => openWorkItem({ kind: 'initiative', id: r.id, title: r.title, ws: M.board.ws, board: M.board.id }); // its record, checks, tasks and links as a viewer tab (premium-viewer S7)
|
|
469
|
-
loadThread(r.key);
|
|
470
|
-
if (r.key === 'board:sprint') openSprint({ ws: M.board.ws, board: M.board.id, name: r.title }); // the sprint as a board by status, beside its facts (premium-viewer S5)
|
|
471
|
-
setTimeout(() => { const b = $('#dBody'); b.scrollTop = b.scrollHeight; }, 120);
|
|
472
|
-
}
|
|
473
|
-
/* the sprint dialog opens the board's Jira backlog beside it, as a viewer tab (premium-viewer R10); the button is added to #oMain, never re-rendering it */
|
|
474
|
-
function backlogBtn() {
|
|
475
|
-
const at = $('#oMain .paper'); if (!at || !M.board.id) return;
|
|
476
|
-
const w = document.createElement('div'); w.className = 'cact';
|
|
477
|
-
const b = document.createElement('button'); b.type = 'button'; b.className = 'cta alt'; b.id = 'openBacklog'; b.textContent = 'Open the backlog';
|
|
478
|
-
b.onclick = () => openBacklog({ ws: M.board.ws, board: M.board.id, title: 'Backlog' });
|
|
479
|
-
w.append(b); at.append(w);
|
|
480
|
-
}
|
|
481
|
-
$('#dBody').addEventListener('click', (e) => { const lt = e.target.closest('#logT'); if (lt) { const c = $('#alog').classList.toggle('col'); lt.setAttribute('aria-expanded', !c); } });
|
|
482
|
-
|
|
483
621
|
/* ── load: the routes derive the initiatives in the background, so the first answers are "reading" ───────────── */
|
|
622
|
+
/* ── the trail (GET /api/board-trail): merged into the rows each time the model or the trail lands ──────────────────────── */
|
|
623
|
+
/** Adds to each row what the trail holds: days in the step, the skipped steps and why, the parts of the output and the next one, and what
|
|
624
|
+
* waits on you. Tickets stay the output of Build and Deliver; the parts replace the record's single progress for the other steps. */
|
|
625
|
+
function mergeTrail() {
|
|
626
|
+
if (!M || !TR || !TR.items) return;
|
|
627
|
+
const G = M.initiatives.gone || {}, all = [...(M.rows || []), ...M.initiatives.list.rows, ...(G.cancelled || []), ...(G.archived || [])]; // separate copies after JSON
|
|
628
|
+
for (const r of all) {
|
|
629
|
+
const it = r.id ? TR.items[r.id] : null; r.trail = it || null;
|
|
630
|
+
const t = r.track; if (!it || !t || t.trailed) continue;
|
|
631
|
+
t.trailed = true;
|
|
632
|
+
if (t.days == null && it.days != null) t.days = it.days;
|
|
633
|
+
const sk = new Set(t.skipped || []);
|
|
634
|
+
for (const x of it.skipped || []) { const j = (M.steps || []).findIndex((s) => s.key === x.stage); if (j >= 0) sk.add(j); }
|
|
635
|
+
t.skipped = [...sk].sort((a, b) => a - b); t.skipWhy = it.skipped || [];
|
|
636
|
+
const ticketStep = (t.key === 'build' || t.key === 'deliver') && (t.tickets || []).length;
|
|
637
|
+
if (it.parts && it.parts.length && !ticketStep) {
|
|
638
|
+
const n = it.parts.length, d = it.parts.filter((x) => x.done).length;
|
|
639
|
+
t.segs = it.parts.map((x) => ({ cls: x.done ? 'dn' : x.you ? 'yo' : '', name: x.name.charAt(0).toUpperCase() + x.name.slice(1), st: x.done ? 'done' : x.you ? 'waiting on you' : 'not yet' }));
|
|
640
|
+
t.pct = null; t.count = d + ' of ' + n + ' parts'; t.next = it.next || null;
|
|
641
|
+
t.line = it.next ? [{ text: 'Next: ' + it.next }] : [{ text: 'Every part is done' }];
|
|
642
|
+
}
|
|
643
|
+
if (!t.you && it.you) { t.you = it.you.text; t.youWhy = it.you.why || ''; t.youKind = it.you.kind || 'you'; }
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
async function loadTrail() {
|
|
647
|
+
const ids = [...new Set((M.rows || []).filter((r) => r.id && r.track).map((r) => r.id))].slice(0, 150);
|
|
648
|
+
if (!ids.length) return;
|
|
649
|
+
const q = 'ws=' + encodeURIComponent(M.board.ws || '') + (M.board.id ? '&board=' + encodeURIComponent(M.board.id) : '') + '&ids=' + ids.map(encodeURIComponent).join(',');
|
|
650
|
+
let r = null; try { r = await (await fetch('/api/board-trail?' + q, { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
651
|
+
if (!r || !r.ok) { TR = TR || { usual: {}, themes: [], items: {}, failed: true }; return; }
|
|
652
|
+
TR = r; mergeTrail(); draw();
|
|
653
|
+
}
|
|
654
|
+
/** The first questions still open (GET /api/board-grill?ids=): an initiative started on the Board shows "N questions before the BRD". */
|
|
655
|
+
async function loadGrill() {
|
|
656
|
+
const ids = [...new Set((M.rows || []).filter((r) => r.id && r.track && r.track.k <= 1).map((r) => r.id))].slice(0, 150);
|
|
657
|
+
if (!ids.length) return;
|
|
658
|
+
let r = null; try { r = await (await fetch('/api/board-grill?ws=' + encodeURIComponent(M.board.ws || '') + '&ids=' + ids.map(encodeURIComponent).join(','), { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
659
|
+
if (!r || !r.ok) return;
|
|
660
|
+
GR = r.items || {}; draw();
|
|
661
|
+
}
|
|
662
|
+
|
|
484
663
|
function draw() {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
if (
|
|
664
|
+
mergeTrail();
|
|
665
|
+
if (!sprintSet && M.jira && M.jira.sprint) { F.chips.add('sprint'); sprintSet = true; }
|
|
666
|
+
drawHead(); drawChips(); drawInit();
|
|
667
|
+
{ const g = $('#bdGone'), G = M.initiatives.gone || { cancelled: [], archived: [] }, n = [G.cancelled.length ? G.cancelled.length + ' cancelled' : '', G.archived.length ? G.archived.length + ' archived' : ''].filter(Boolean).join(' · ');
|
|
668
|
+
if (g) g.textContent = 'Cancelled and archived' + (n ? ' · ' + n : ''); } // the ⋯ menu item counts them
|
|
669
|
+
if (tab === 'docs') drawDocs();
|
|
670
|
+
$('#docCap').textContent = String(V.docRows().length);
|
|
671
|
+
// an open panel follows the new read
|
|
672
|
+
if (peek && peek.kind !== 'acts' && !$('#peek').contains(document.activeElement)) {
|
|
673
|
+
const r = (M.rows || []).find((x) => x.key === peek.key); // a row that left the Board (cancelled, archived) closes its panel
|
|
674
|
+
if (!r) closePeek(); else if (peek.kind === 'ini') showPeek(peek.from === 'time' ? timePanel(r) : iniPanel(r));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
/** ?focus=<initiative id> (Insights links here): open that initiative's panel once, on the first read that has it. */
|
|
678
|
+
let focusDone = false;
|
|
679
|
+
function focusOnce() {
|
|
680
|
+
if (focusDone) return;
|
|
681
|
+
const id = new URLSearchParams(location.search).get('focus'); if (!id) { focusDone = true; return; }
|
|
682
|
+
const r = (M.rows || []).find((x) => x.id === id && x.track); if (!r) return;
|
|
683
|
+
focusDone = true;
|
|
684
|
+
const b = $$('#ibBody [data-key]').find((x) => x.dataset.key === r.key);
|
|
685
|
+
openIni(r, b || null, 'track');
|
|
491
686
|
}
|
|
492
687
|
async function load() {
|
|
493
688
|
const p = new URLSearchParams(location.search), q = [p.get('ws') ? 'ws=' + encodeURIComponent(p.get('ws')) : '', p.get('board') ? 'board=' + encodeURIComponent(p.get('board')) : ''].filter(Boolean).join('&');
|
|
@@ -495,70 +690,28 @@ async function load() {
|
|
|
495
690
|
try { const res = await fetch('/api/board-premium' + (q ? '?' + q : ''), { credentials: 'same-origin' }); status = res.status; r = await res.json(); } catch { r = null; }
|
|
496
691
|
clearInterval(readTimer);
|
|
497
692
|
if (r && r.state === 'reading') {
|
|
498
|
-
const t0 = Date.now(), tick = () => {
|
|
693
|
+
const t0 = Date.now(), tick = () => { const s = 'Reading the board · ' + Math.round((Date.now() - t0) / 1000) + ' s so far'; $('#snap').textContent = s; if (!M) $('#ibBody').innerHTML = `<p class="bd-msg"><b>${esc(s)}</b> The board derives each initiative from its records. This page shows nothing until it has read, rather than guess.</p>`; };
|
|
499
694
|
tick(); readTimer = setInterval(tick, 1000);
|
|
500
|
-
if (!M) { $('#ibBody').innerHTML = '<p class="empty3 plain">The board derives each initiative from its records. This page shows nothing until it has read, rather than guess.</p>'; $('#docBody').innerHTML = ''; }
|
|
501
695
|
setTimeout(load, 3000);
|
|
502
696
|
return;
|
|
503
697
|
}
|
|
504
698
|
if (!r || !r.ok) {
|
|
505
699
|
$('#snap').textContent = 'The board could not be read';
|
|
506
|
-
$('#
|
|
700
|
+
if (!M) $('#ibBody').innerHTML = `<p class="bd-msg err" role="alert"><b>The board could not be read</b>, so this page shows nothing rather than guess.${r && r.error ? ' The reason: ' + esc(r.error) : status ? ' The server answered ' + status + '.' : ' The server did not answer.'}</p>`;
|
|
507
701
|
setTimeout(load, 15000);
|
|
508
702
|
return;
|
|
509
703
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
if (
|
|
513
|
-
|
|
514
|
-
}
|
|
515
|
-
|
|
704
|
+
M = r.model; draw();
|
|
705
|
+
focusOnce();
|
|
706
|
+
if (r.stale) setTimeout(load, 2000); // a press is still being derived: ask again
|
|
707
|
+
else { loadTrail(); loadGrill(); }
|
|
708
|
+
}
|
|
709
|
+
const viewDoc = (path) => { const a = document.createElement('button'); a.dataset.doc = path; a.hidden = true; document.body.appendChild(a); a.click(); a.remove(); };
|
|
710
|
+
const anchors = async () => { try { const r = await (await fetch('/api/boards/anchors?ws=' + encodeURIComponent(M.board.ws || '') + '&board=' + encodeURIComponent(M.board.id || ''), { credentials: 'same-origin' })).json(); return r && r.ok ? r.anchors || [] : []; } catch { return []; } };
|
|
711
|
+
const openIniAny = (r) => openIni(r, $('#bdBell'), 'track');
|
|
712
|
+
V.init({ M: () => M, statusOf, usual: usualOf, trail: TI, docMeta, sel: () => (peek && peek.kind !== 'acts' ? peek.key : null), docSel: () => Acts.docSel() });
|
|
713
|
+
Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePeek, rowOf, openIni: openIniAny, openDoc: viewDoc, anchors });
|
|
714
|
+
Acts.init({ M: () => M, load, say, panel: actsPanel, close: closePeek, redraw: () => { drawChips(); drawInit(); if (tab === 'docs') drawDocs(); }, F, rowOf, statusOf, openIni: openIniAny,
|
|
715
|
+
openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, docMeta, loadDocMeta, viewDoc });
|
|
516
716
|
setTab('ini');
|
|
517
717
|
load();
|
|
518
|
-
|
|
519
|
-
/* ── the Metrics of a tenant's board (initiative briefing-premium-metrics), in the ⋯ menu's Metrics popover ──────────────────
|
|
520
|
-
* Reads GET /api/board-metrics-premium?ws= apart from the board's own answer and draws lib/board-metrics-premium.js's tiles: a number and a chart only
|
|
521
|
-
* where a record counted one, "Not read" where it could not be. A tile opens the standard dialog. Nothing here writes. */
|
|
522
|
-
let MM = null, metTimer = null; // the Metrics' model and its re-read timer
|
|
523
|
-
|
|
524
|
-
function metDraw() {
|
|
525
|
-
const card = $('#cMet'); if (!MM) { card.hidden = true; return; }
|
|
526
|
-
card.hidden = false;
|
|
527
|
-
$('#metCap').textContent = MM.header;
|
|
528
|
-
const ins = '/premium-insights.html' + (M.board.ws ? '?ws=' + encodeURIComponent(M.board.ws) + (M.board.id ? '&board=' + encodeURIComponent(M.board.id) : '') : '');
|
|
529
|
-
$('#metHint').innerHTML = (MM.lead ? `<b class="mflag">${esc(MM.lead)}</b> ` : '') + esc(MM.body || MM.hint) + ` To set a target, or for longer ranges, <a class="lk" id="metIns" href="${esc(ins)}">open Insights</a>.`;
|
|
530
|
-
$('#metBody').style.gridTemplateColumns = 'repeat(' + Math.min(4, MM.tiles.length) + ',minmax(0,1fr))';
|
|
531
|
-
$('#metBody').innerHTML = MM.tiles.map(MT.tileHtml).join('');
|
|
532
|
-
$('#metNote').textContent = MM.note;
|
|
533
|
-
$('#metLead').hidden = !MM.lead; $('#metLead').textContent = MM.lead || '';
|
|
534
|
-
pillOf($('#perTabs'));
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
function metOpenTile(i) {
|
|
538
|
-
const t = MM.tiles[i], r = MM.rows[i]; if (!t || !r) return;
|
|
539
|
-
closePops();
|
|
540
|
-
const d = r.dialog;
|
|
541
|
-
const rows = MT.factRows(t, MM.repo, MM.weeks);
|
|
542
|
-
const vals = t.ser ? H('Values') + `<div class="vtb">${t.ser.map((v, j) => `<div><span>${esc(t.wk[j])}</span><b>${v == null ? (t.since ? 'Not kept yet' : 'No runs') : esc(MT.fmt(t, v))}</b></div>`).join('')}</div>` : '';
|
|
543
|
-
const pane = `<article class="paper doc"><p class="lede" style="margin:0 0 10px">${esc(t.def)}</p>${kv(rows)}${vals}<p class="note" style="margin-top:12px">${esc(MM.note)}</p></article>`;
|
|
544
|
-
openDlg({ eye: 'Measure · real data', title: t.label, sub: MM.repo, say: d.say, stream: turnA(logHtml({ logTitle: 'Read from the repository', log: ['Read the repository\'s own records', 'Counted them by week', 'Changed nothing'] })) + turnA(ptx(d.say)), noteKey: r.key, pane, label: 'Measure' });
|
|
545
|
-
loadThread(r.key);
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
function metWire() {
|
|
549
|
-
MT.wireTiles($('#metBody'), () => MM.tiles, metOpenTile);
|
|
550
|
-
$('#perTabs').addEventListener('click', (e) => { const b = e.target.closest('[aria-disabled="true"]'); if (b) toast('PMOS counts runs and merges by week only.'); });
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
async function startMetrics(ws) {
|
|
554
|
-
clearTimeout(metTimer);
|
|
555
|
-
let r = null;
|
|
556
|
-
try { const res = await fetch('/api/board-metrics-premium?ws=' + encodeURIComponent(ws || ''), { credentials: 'same-origin' }); r = await res.json(); } catch { r = null; }
|
|
557
|
-
if (!r || !r.ok || r.state !== 'ready') {
|
|
558
|
-
MM = null; metDraw(); $('#cMet').hidden = false; $('#metCap').textContent = 'not read'; $('#metHint').textContent = 'The metrics could not be read, so none is shown.' + (r && r.error ? ' The reason: ' + r.error : ''); $('#metLead').hidden = false; $('#metLead').textContent = $('#metHint').textContent; $('#metBody').innerHTML = ''; $('#metNote').textContent = '';
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
MM = r.model; metDraw();
|
|
562
|
-
if (MM.pending) metTimer = setTimeout(() => startMetrics(ws), 4000); // the workflow engine is still deriving the Blocked and Idle tiles
|
|
563
|
-
}
|
|
564
|
-
metWire();
|