create-pmos 0.475.0 → 0.477.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 +33 -33
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-publish-ui-test.js +11 -16
- package/workspace/board-shared-ui-test.js +34 -33
- package/workspace/changelog.json +32 -0
- package/workspace/guide/briefing-premium.md +2 -2
- package/workspace/guide/claude-proposes.md +8 -2
- package/workspace/guide/forecast.md +16 -3
- package/workspace/guide/home.md +2 -2
- package/workspace/guide/settings.md +9 -0
- package/workspace/guide/workflows.md +13 -2
- package/workspace/home-railcard-test.js +4 -4
- package/workspace/home-rows-test.js +15 -4
- package/workspace/ini-workflow-test.js +1 -1
- package/workspace/lib/board-pack.js +20 -1
- package/workspace/lib/board-trail.js +17 -1
- package/workspace/lib/boards-host.js +22 -2
- package/workspace/lib/briefing-premium-agent.js +2 -2
- package/workspace/lib/engine/boards.js +15 -3
- package/workspace/lib/engine/workflows.js +79 -10
- package/workspace/lib/forecast-offer.js +57 -0
- package/workspace/lib/grill-runs.js +1 -0
- package/workspace/lib/grill.js +1 -1
- package/workspace/lib/insight-moves.js +8 -6
- package/workspace/lib/news-for-you.js +6 -4
- package/workspace/lib/proposals.js +4 -3
- package/workspace/lib/report-chat.js +2 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-board-publish.js +7 -2
- package/workspace/lib/routes-boards.js +18 -5
- package/workspace/lib/routes-briefing-premium.js +16 -2
- package/workspace/lib/routes-forecast.js +8 -1
- package/workspace/lib/routes-grill.js +70 -0
- package/workspace/lib/routes-insight-moves.js +7 -5
- package/workspace/lib/routes-news.js +3 -1
- package/workspace/lib/routes-proposals.js +8 -6
- package/workspace/lib/routes-workflows.js +13 -0
- package/workspace/lib/wf-bridge.js +165 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/panels-test.js +1 -2
- package/workspace/public/pm/bd-fc-card.js +45 -0
- package/workspace/public/pm/bd-next.js +1 -1
- package/workspace/public/pm/bd-publish.css +22 -18
- package/workspace/public/pm/bd-publish.js +57 -48
- package/workspace/public/pm/bd-shared.css +92 -30
- package/workspace/public/pm/bd-shared.js +143 -55
- package/workspace/public/pm/bd-span.js +27 -7
- package/workspace/public/pm/cozy-board.css +15 -0
- package/workspace/public/pm/cozy-ev.css +52 -0
- package/workspace/public/pm/cozy-home.css +4 -4
- package/workspace/public/pm/cozy-insights.css +23 -0
- package/workspace/public/pm/cozy-jl.js +158 -0
- package/workspace/public/pm/cozy-news.js +56 -2
- package/workspace/public/pm/cozy-panels.js +3 -2
- package/workspace/public/pm/cozy-settings.js +35 -7
- package/workspace/public/pm/cozy-today.css +6 -0
- package/workspace/public/pm/cozy-viewer.js +19 -3
- package/workspace/public/pm/goal-forecast.js +101 -0
- package/workspace/public/pm/grill-words.js +53 -0
- package/workspace/public/pm/hi-pop.css +16 -0
- package/workspace/public/pm/home-app.js +42 -5
- package/workspace/public/pm/home-day.js +5 -3
- package/workspace/public/pm/home-list.js +14 -4
- package/workspace/public/pm/home-mentions.js +5 -0
- package/workspace/public/pm/home-task.js +1 -1
- package/workspace/public/pm/home-today.js +14 -5
- package/workspace/public/pm/ini-props.js +41 -8
- package/workspace/public/pm/ini-view-model.js +27 -14
- package/workspace/public/pm/ini-view.css +62 -37
- package/workspace/public/pm/ini-view.js +1 -1
- package/workspace/public/pm/ini-wf-model.js +76 -19
- package/workspace/public/pm/ini-wf.js +69 -18
- package/workspace/public/pm/metric-drafts.css +9 -0
- package/workspace/public/pm/metric-drafts.js +2 -2
- package/workspace/public/pm/premium-board.js +13 -3
- package/workspace/public/pm/premium-insights.js +86 -11
- package/workspace/public/pm/premium-report-tab.js +13 -3
- package/workspace/public/pm/premium-vw-item.js +1 -1
- package/workspace/public/pm/readonly.js +1 -0
- package/workspace/public/pm/report-chat.js +2 -1
- package/workspace/public/pm/task-card.js +4 -3
- package/workspace/public/pm/wf-page.css +9 -0
- package/workspace/public/pm/wf-page.js +30 -1
- package/workspace/run-tests.js +10 -2
- package/workspace/server.js +5 -2
- package/workspace/test-lists/forecast-board.json +5 -0
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* openPicker(anchor, ui, id) the Change picker under the workflow's icon: every workflow with its stage count, the current one picked,
|
|
5
5
|
* its stage chain and, when PMOS set it from the BRD, why; then New workflow…
|
|
6
|
-
* openSwitch(anchor, ui, id, wfId) Switch <name> to <workflow
|
|
7
|
-
*
|
|
6
|
+
* openSwitch(anchor, ui, id, wfId) Switch <name> to <workflow>? (A's bridge, batch 20 item 3, canvas WmB): each new stage with the old
|
|
7
|
+
* stages that go into it (Claude's proposal, or the bridge saved with the workflow; "Change where a stage goes"
|
|
8
|
+
* opens one picker per old stage), the scope This initiative / All N, "It lands in <picker>" for one, ✕ and ✓.
|
|
9
|
+
* One: POST /api/boards/ini-wf with `to` and `map`. All: POST /api/workflows/switch-all, which saves the bridge;
|
|
10
|
+
* its Undo stays open for 7 days in the picker (POST /api/workflows/switch-all/undo).
|
|
8
11
|
* openWontDo(anchor, ui, id) Won't do <name>?: No budget, Out of scope, Done another way, Other, a note (POST /api/boards/wontdo)
|
|
9
12
|
* backToTriage(ui, id) bring a Won't do back to Triage (POST /api/boards/wontdo { back: true })
|
|
10
13
|
* archive(ui, id) Archive it, with Undo (POST /api/boards/archive)
|
|
@@ -17,7 +20,10 @@ import { WONTDO_REASONS, wfIcon } from './wf-model.js';
|
|
|
17
20
|
|
|
18
21
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
19
22
|
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
20
|
-
const NEXT = 'M5 12h14M13 6l6 6-6 6', PLUS = 'M12 5v14M5 12h14', CLOSE = 'M6 6l12 12M18 6L6 18';
|
|
23
|
+
const NEXT = 'M5 12h14M13 6l6 6-6 6', PLUS = 'M12 5v14M5 12h14', CLOSE = 'M6 6l12 12M18 6L6 18', UNDO = 'M9 14L4 9l5-5M4 9h10a6 6 0 010 12h-3';
|
|
24
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
25
|
+
const shortDay = (iso) => { const d = new Date(iso); return isNaN(d) ? '' : MON[d.getMonth()] + ' ' + d.getDate(); };
|
|
26
|
+
const nameOf = (lib, wid) => ((lib || []).find((w) => w.id === wid) || {}).name || (wid === 'product-feature' || !wid ? 'Product feature' : 'the old workflow');
|
|
21
27
|
|
|
22
28
|
/* ── the library (GET /api/workflows), read again on each picker ──
|
|
23
29
|
* Settings › Workflows saves to the home workspace's library, and an initiative may sit in another workspace (a product). The picker lists both,
|
|
@@ -53,10 +59,19 @@ export async function openPicker(anchor, ui, id) {
|
|
|
53
59
|
: '<p class="hi-small hi-wfpad">The workflows could not be read.</p>')
|
|
54
60
|
+ '<div class="hi-hr"></div>'
|
|
55
61
|
+ `<button type="button" class="hi-mi" data-wf-new>${SVG(PLUS)}<span>New workflow…</span></button>`
|
|
62
|
+
+ (row.wfSwitch ? `<button type="button" class="hi-mi" data-wf-undo>${SVG(UNDO)}<span>Undo the move from ${esc(nameOf(lib, row.wfSwitch.from))}</span><em>${esc(shortDay(row.wfSwitch.at))}</em></button>` : '')
|
|
56
63
|
+ (cur ? `<p class="hi-small hi-wfpad hi-wfchain">${esc(WM.chainText(cur))}</p>` : '')
|
|
57
64
|
+ (by && by.why ? `<p class="hi-small hi-wfpad"><span class="hi-mut">Why:</span> ${esc(by.why)}</p>` : '');
|
|
58
|
-
ui.openPop(anchor, 'wf', html, (b) => {
|
|
65
|
+
ui.openPop(anchor, 'wf', html, async (b) => {
|
|
59
66
|
if ('wfNew' in b.dataset) { ui.closePop(); newWorkflow(ui, id); return; }
|
|
67
|
+
if ('wfUndo' in b.dataset) {
|
|
68
|
+
ui.closePop();
|
|
69
|
+
const u = await ui.pmPost('/api/workflows/switch-all/undo', { batch: row.wfSwitch.batch });
|
|
70
|
+
if (!u || u.ok === false) { ui.toast((u && u.error) || 'The undo did not go through.'); return; }
|
|
71
|
+
ui.toast(u.undone + ' of ' + u.of + ' undone.' + (u.kept && u.kept.length ? ' ' + plural(u.kept.length, 'initiative moved', 'initiatives moved') + ' since, so ' + (u.kept.length === 1 ? 'it stays.' : 'they stay.') : ''));
|
|
72
|
+
await ui.load();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
60
75
|
const k = b.dataset.wfPick; if (!k) return;
|
|
61
76
|
if (k === (row.wf || {}).id || (!row.wf && k === 'product-feature')) { ui.closePop(); return; }
|
|
62
77
|
openSwitch(anchor, ui, id, k);
|
|
@@ -70,39 +85,75 @@ function newWorkflow(ui, id) {
|
|
|
70
85
|
location.href = '/premium-workflows.html?new=1' + (ws ? '&ws=' + encodeURIComponent(ws) : '');
|
|
71
86
|
}
|
|
72
87
|
|
|
73
|
-
/* ── switch to another workflow (WfAChange) ── */
|
|
88
|
+
/* ── switch to another workflow (WfAChange; A's bridge, WmB) ── */
|
|
89
|
+
const CHECK = 'M5 12.5l4.5 4.5L19 7';
|
|
90
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
74
91
|
export async function openSwitch(anchor, ui, id, wfId) {
|
|
75
92
|
const row = ui.row(id) || {};
|
|
76
93
|
const lib = await library(ui, false, wsOf(ui, id));
|
|
77
94
|
const to = lib.find((w) => w.id === wfId);
|
|
78
95
|
if (!to) { ui.toast('That workflow could not be read.'); return; }
|
|
79
96
|
const title = ui.title(id), fromWf = row.wf || { name: 'Product feature', icon: 'feature' };
|
|
80
|
-
|
|
97
|
+
const fromId = (row.wf && row.wf.id) || 'product-feature';
|
|
98
|
+
const all = ((lib.find((w) => w.id === fromId) || {}).count) || 0; // how many initiatives run the old workflow (GET /api/workflows count)
|
|
99
|
+
let land = null, scope = 'one';
|
|
100
|
+
const over = {};
|
|
101
|
+
const from = WM.fromOf(row);
|
|
81
102
|
const html = () => {
|
|
82
|
-
const P = WM.switchPlan(row, to, land);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
103
|
+
const P = WM.switchPlan(row, to, land, over);
|
|
104
|
+
const now = new Set(P.rows.filter((r) => r.state === 'now').map((r) => r.from));
|
|
105
|
+
const groups = P.groups.filter((g) => g.from.length).map((g) => `<div class="hi-wfrow hi-wfgrp"><span>${g.from.map((x) => `<b>${esc(x.name)}</b>${now.has(x.name) ? '<em>now</em>' : ''}`).join('<i aria-hidden="true"> · </i>')}</span>${SVG(NEXT, 14)}<span><b>${esc(g.name)}</b></span></div>`).join('');
|
|
106
|
+
const pick = from.stages.map((s) => `<label class="hi-wfmap hi-small"><span>${esc(s.name)}</span><select data-wf-map="${esc(s.key)}" aria-label="${esc('Where ' + s.name + ' goes')}">${P.lands.map((t) => `<option value="${esc(t.key)}"${t.key === P.map[s.key] ? ' selected' : ''}>${esc(t.name)}</option>`).join('')}</select></label>`).join('');
|
|
107
|
+
const seg = all > 1 ? `<div class="hi-wfseg" role="radiogroup" aria-label="Which initiatives move">${[['one', 'This initiative'], ['all', 'All ' + all]].map(([k, l]) => `<button type="button" role="radio" class="hi-wfsegb${scope === k ? ' on' : ''}" aria-checked="${scope === k}" data-wf-scope="${k}">${esc(l)}</button>`).join('')}</div>` : '';
|
|
108
|
+
const goLabel = scope === 'all' ? 'Move all ' + all + ' to ' + to.name : 'Switch to ' + to.name;
|
|
109
|
+
return `<div class="hi-wfh">${wfIcon(fromWf, 22)}${SVG(NEXT, 14)}${wfIcon(to, 22)}<p class="hi-h3">Switch ${esc(scope === 'all' ? plural(all, 'initiative', 'initiatives') : title)} to ${esc(to.name)}?</p><button type="button" class="hi-ib sm" data-wf-x aria-label="Close">${SVG(CLOSE)}</button></div>`
|
|
110
|
+
+ seg
|
|
111
|
+
+ (groups ? `<div class="hi-wfrows">${groups}</div>` : '')
|
|
112
|
+
+ `<details class="hi-wfmore"${Object.keys(over).length ? ' open' : ''}><summary class="hi-small">Change where a stage goes</summary><div class="hi-wfmaps">${pick}</div></details>`
|
|
113
|
+
+ (scope === 'one' ? `<label class="hi-wfland hi-small"><span>It lands in</span><select id="wfLand" aria-label="The stage it lands in">${P.lands.map((s) => `<option value="${esc(s.key)}"${s.key === P.land ? ' selected' : ''}>${s.milestone ? '◆ ' : ''}${esc(s.name)}</option>`).join('')}</select></label>` : '')
|
|
114
|
+
+ `<p class="hi-small">${scope === 'all' ? 'The bridge is saved with ' + esc(to.name) + ', so a later switch uses it too. ' : ''}Each stage's tasks move with it, its ticked items carry over, and the days in the old stages stay in the log. Nothing is deleted.</p>`
|
|
115
|
+
+ `<div class="hi-acts hi-actsi"><button type="button" class="hi-ib" data-wf-x aria-label="Not now" title="Not now">${SVG(CLOSE, 18)}</button><button type="button" class="hi-ib pri" data-wf-go aria-label="${esc(goLabel)}" title="${esc(goLabel)}">${SVG(CHECK, 18, 2)}</button></div>`;
|
|
88
116
|
};
|
|
89
|
-
const el =
|
|
117
|
+
const redraw = (el) => { const f = document.activeElement && document.activeElement.dataset ? Object.keys(document.activeElement.dataset)[0] : ''; el.innerHTML = html(); const b = f && el.querySelector('[data-' + f.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()) + ']'); if (b) b.focus(); };
|
|
118
|
+
const el = ui.openPop(anchor, 'wf-switch', html(), async (b, pel) => {
|
|
90
119
|
if ('wfX' in b.dataset) { ui.closePop(); return; }
|
|
120
|
+
if (b.dataset.wfScope) { scope = b.dataset.wfScope; redraw(pel); return; }
|
|
91
121
|
if ('wfGo' in b.dataset) {
|
|
92
122
|
b.disabled = true;
|
|
93
|
-
const P = WM.switchPlan(row, to, land);
|
|
94
|
-
|
|
123
|
+
const P = WM.switchPlan(row, to, land, over);
|
|
124
|
+
if (scope === 'all') {
|
|
125
|
+
const r = await ui.pmPost('/api/workflows/switch-all', { id: to.id, from: fromId, map: P.map });
|
|
126
|
+
ui.closePop();
|
|
127
|
+
if (!r || r.ok === false) { ui.toast((r && r.error) || 'Nothing was moved.'); return; }
|
|
128
|
+
allUndo(ui, r, 'Moved ' + plural(r.moved, 'initiative', 'initiatives') + (r.tasks ? ' and ' + plural(r.tasks, 'task', 'tasks') : ''));
|
|
129
|
+
await ui.load();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const r = await ui.pmPost('/api/boards/ini-wf', { ...ui.bw(id), id, wf: to.id, to: P.land, map: P.map });
|
|
95
133
|
ui.closePop();
|
|
96
134
|
const stage = (P.lands.find((s) => s.key === P.land) || {}).name || '';
|
|
97
135
|
if (r && r.ok !== false) {
|
|
98
|
-
const
|
|
99
|
-
ui.undoToast(title + ' runs ' + to.name + ' now, in ' + stage, async () => after(ui, await ui.pmPost('/api/boards/ini-wf', { ...ui.bw(id), id, wf:
|
|
136
|
+
const back = row.wfStage ? row.wfStage.key : null;
|
|
137
|
+
ui.undoToast(title + ' runs ' + to.name + ' now, in ' + stage, async () => after(ui, await ui.pmPost('/api/boards/ini-wf', { ...ui.bw(id), id, wf: fromId, ...(back ? { to: back } : {}), undo: true }), title + ' is back on ' + fromWf.name + '.'));
|
|
100
138
|
await ui.load();
|
|
101
139
|
} else ui.toast((r && r.error) || 'The workflow did not change.');
|
|
102
140
|
}
|
|
103
141
|
}, { label: 'Switch ' + title + ' to ' + to.name, focus: '[data-wf-go]', wide: true });
|
|
104
142
|
if (!el) return;
|
|
105
|
-
el.addEventListener('change', (e) => {
|
|
143
|
+
el.addEventListener('change', (e) => {
|
|
144
|
+
if (e.target.id === 'wfLand') { land = e.target.value; return; }
|
|
145
|
+
const k = e.target.dataset && e.target.dataset.wfMap;
|
|
146
|
+
if (k) { over[k] = e.target.value; if (row.wfStage && row.wfStage.key === k) land = null; redraw(el); }
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/** The toast of a move of many (WmD): Undo puts back the workflow, each initiative's stage and its tasks; one that moved since stays. */
|
|
150
|
+
function allUndo(ui, r, text) {
|
|
151
|
+
ui.undoToast(text, async () => {
|
|
152
|
+
const u = await ui.pmPost('/api/workflows/switch-all/undo', { batch: r.batch });
|
|
153
|
+
if (!u || u.ok === false) { ui.toast((u && u.error) || 'The undo did not go through.'); return; }
|
|
154
|
+
ui.toast(u.undone + ' of ' + u.of + ' undone.' + (u.kept && u.kept.length ? ' ' + plural(u.kept.length, 'initiative moved', 'initiatives moved') + ' since, so ' + (u.kept.length === 1 ? 'it stays' : 'they stay') + ' where ' + (u.kept.length === 1 ? 'it is' : 'they are') + '.' : ''));
|
|
155
|
+
await ui.load();
|
|
156
|
+
});
|
|
106
157
|
}
|
|
107
158
|
|
|
108
159
|
/* ── Won't do (WfAWontDo) ── */
|
|
@@ -64,6 +64,15 @@
|
|
|
64
64
|
|
|
65
65
|
/* the wide Viewer (.cz-vw-w2): the part first in the panel sits above the summary, in its column */
|
|
66
66
|
.cz-vw-w2 .cz-vw-body > .md-top { grid-column: 1; max-width: none; }
|
|
67
|
+
/* batch 20 item 4: with the proposed goal on top, the left column is taller than the right one's first part, so the shared grid rows left a gap
|
|
68
|
+
* above "Waits on you". Here the two columns flow on their own: the left parts float in a 300 px column, the right parts start at the top. */
|
|
69
|
+
.cz-vw-w2 .cz-vw-body:has(> .md-top) { display: flow-root; }
|
|
70
|
+
.cz-vw-w2 .cz-vw-body:has(> .md-top) > .md-top, .cz-vw-w2 .cz-vw-body:has(> .md-top) > .czs-sum { float: left; clear: left; width: 300px; margin: 0 0 14px; }
|
|
71
|
+
.cz-vw-w2 .cz-vw-body:has(> .md-top) > :not(.md-top):not(.czs-sum) { margin-left: 320px; max-width: 75ch; }
|
|
72
|
+
/* in that 300 px column, Built from is two lines a row: what it is, then Now and Target */
|
|
73
|
+
.cz-vw-w2 .md-top .md-ru { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); row-gap: 2px; }
|
|
74
|
+
.cz-vw-w2 .md-top .md-ru > :first-child { grid-column: 1 / -1; }
|
|
75
|
+
.cz-vw-w2 .md-top .md-ru .md-pill { border-radius: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
67
76
|
|
|
68
77
|
/* a phone: 44 px touch targets; the columns tighten */
|
|
69
78
|
@media (max-width: 760px) {
|
|
@@ -80,7 +80,7 @@ const fade = (scope, id) => { const k = keyOf(scope, id); if (SEEN.has(k)) retur
|
|
|
80
80
|
/* ── the words ── */
|
|
81
81
|
const is = (r, re) => re.test(String((r && r.group) || ''));
|
|
82
82
|
const ticketText = (t) => { const s = String((t && (t.text || (t.key ? t.key + ' drafted' : ''))) || ''); return /^ticket\b/i.test(s) ? s : 'Ticket ' + s; };
|
|
83
|
-
const ticketPill = (t) => `<span class="md-pill">${esc(ticketText(t))}</span>`;
|
|
83
|
+
const ticketPill = (t) => `<span class="md-pill" title="${esc(ticketText(t))}">${esc(ticketText(t))}</span>`;
|
|
84
84
|
const nowOf = (r) => (r.now == null && !r.nowTxt ? '—' : r.nowTxt || String(r.now));
|
|
85
85
|
const homeHref = (o) => { const q = new URLSearchParams(); for (const [k, v] of Object.entries(o)) if (v) q.set(k, v); return '/premium.html?' + q.toString(); };
|
|
86
86
|
export const ib = (o) => (o.href
|
|
@@ -117,7 +117,7 @@ export function progHtml(p, ws) {
|
|
|
117
117
|
return `<div class="pp-goal md-kept md-top${fade('program', p.id)}" role="group" aria-label="Program goal"><span class="pp-per">Goal</span>${chip(goal, true)}${rolls.concat(guard).map((r) => chip(r)).join('')}`
|
|
118
118
|
+ ib({ act: 'undo', scope: 'program', id: p.id, icon: I.undo, label: 'Undo: make the goal a proposal again', title: 'Undo', busy: P.busy }) + '</div>';
|
|
119
119
|
}
|
|
120
|
-
const line = goal.name + ': ' + [goal.nowTxt, goal.targetTxt].filter(Boolean).join(' → ') + (goal.by ? ' by ' + month(goal.by) : '');
|
|
120
|
+
const line = goal.name + ': ' + [goal.nowTxt, goal.targetTxt].filter(Boolean).join(' → ') + (goal.by && !/\bby\b/i.test(goal.targetTxt || '') ? ' by ' + month(goal.by) : ''); // "Done by Aug 31, 2027" names its date once
|
|
121
121
|
const chips = ((goal.checkpoints) || []).map((c) => `<span class="md-cp"><span class="md-dm" aria-hidden="true"></span>${esc([c.target != null ? String(c.target) + (goal.type === 'Percentage' && typeof c.target === 'number' ? '%' : '') : '', c.label].filter(Boolean).join(' at '))}${c.by ? ' · ' + esc(day(c.by)) : ''}</span>`)
|
|
122
122
|
.concat(guard.map((g) => `<span class="md-cp">Guardrail: ${esc(g.name)}${g.targetTxt ? ' · ' + esc(g.targetTxt) : ''}</span>`)).join('');
|
|
123
123
|
const built = rolls.length ? `<div class="md-bt" role="table" aria-label="Built from"><div class="md-ru q" role="row"><span role="columnheader">Built from</span><span role="columnheader">Now</span><span role="columnheader">Target</span></div>`
|
|
@@ -25,7 +25,8 @@ import { mountNav } from './cozy-nav.js';
|
|
|
25
25
|
import { mountLivePill } from './cozy-live-pill.js';
|
|
26
26
|
import { stepsHelpHtml } from './bd-stages.js';
|
|
27
27
|
import { msMode } from './bd-pins.js';
|
|
28
|
-
import { timelineHtml, legendHtml, hasHold, planKeys, gapKeys, plainGaps, skipsOf, skipWords, gapWords, SPANS, md } from './bd-span.js';
|
|
28
|
+
import { timelineHtml, legendHtml, hasHold, planKeys, gapKeys, plainGaps, skipsOf, skipWords, gapWords, SPANS, md, fcRange } from './bd-span.js';
|
|
29
|
+
import * as FCC from './bd-fc-card.js'; // the forecast card under a hatched range (FcBoard)
|
|
29
30
|
import * as TL from './bd-scroll.js';
|
|
30
31
|
import './readonly.js'; // the read-only mode of a published board: nothing happens unless the page was opened with ?pack= (board-publish)
|
|
31
32
|
import * as Acts from './bd-acts.js';
|
|
@@ -265,7 +266,7 @@ function drawChips() {
|
|
|
265
266
|
}
|
|
266
267
|
// the timeline's legend sits at the end of the chip row (PgTimeline), with a program milestone only where a program is drawn and "On hold" only
|
|
267
268
|
// where a hold is drawn (feedback batch 9 item 8: zero is silence)
|
|
268
|
-
const lgd = view === 'time' && span !== 'sprint' ? '<span class="bd-sp"></span>' + legendHtml(!byProduct && !!groups(visible()), hasHold(visible()), { ...planKeys(visible()), ...gapKeys(visible()) }) : '';
|
|
269
|
+
const lgd = view === 'time' && span !== 'sprint' ? '<span class="bd-sp"></span>' + legendHtml(!byProduct && !!groups(visible()), hasHold(visible()), { ...planKeys(visible()), ...gapKeys(visible()), range: visible().some((r) => fcRange(r)) }) : '';
|
|
269
270
|
$('#bdChipset').innerHTML = jiraChip
|
|
270
271
|
+ (ALL ? '' : `<button type="button" class="bd-chip" id="chSprint" aria-haspopup="dialog">${SV(I.cal)}<span>${esc(sprint)}</span></button>`)
|
|
271
272
|
+ askChip + '<span class="bd-vr"></span>' + flt(['late', 'risk', 'blocked', 'idle'])
|
|
@@ -487,6 +488,7 @@ function drawTime(L) {
|
|
|
487
488
|
colsFit = cols ? cols.keys.length : 1;
|
|
488
489
|
const nameW = cols ? cols.nw : phone ? 0 : matchMedia('(max-width: 980px)').matches ? 180 : 250;
|
|
489
490
|
const T = timelineHtml(L, M, span, { groups: groups(L), progState, folded: PG.folded, prodHtml: (g) => PG.prodHtml(g, 'tg-prd'), prodCell: (g, dots) => PG.prodCell(g, dots), msMode: msMode(), subHtml: (n) => PG.subHtml(n, 'tg-psb'), progTile: () => PG.progTile(), productsOf: PG.productsOf,
|
|
491
|
+
progRisk: (id) => (M.programForecasts || []).find((x) => x.id === id) || null,
|
|
490
492
|
foldBtn: (g) => PG.foldBtn(g.key, g.program.title), memberIcon: (id) => PG.memberIcon(PGS, id), sel: peek && peek.kind !== 'acts' ? peek.key : null, status: statusOf, phone, cols, trackPx: bw - 2 - nameW, avatar: (n) => V.avatar(n, 'sm'),
|
|
491
493
|
askHref: (none) => askHref(null, 'Propose start and end dates for ' + none.map((r) => r.title).join(', ')),
|
|
492
494
|
lane: (c) => DL.laneHtml(c, { span, progState }) });
|
|
@@ -602,7 +604,7 @@ $('#ibBody').addEventListener('click', (e) => {
|
|
|
602
604
|
const op = e.target.closest('[data-open]'); if (op) { Acts.open[op.dataset.open](op); return; }
|
|
603
605
|
const st = e.target.closest('[data-steps]'); if (st) { togglePop('popSteps', st); return; }
|
|
604
606
|
const tk = e.target.closest('[data-tk]'); if (tk) { openTicket(tk.dataset.ini, tk.dataset.tk, tk); return; }
|
|
605
|
-
if (e.target.closest('[data-act], [data-hold], [data-ms-pick]')) return; // pm/bd-acts.js handles its own presses (a ⏸ on the timeline opens its hold there; a ◇ its milestones, pm/bd-pin-card.js)
|
|
607
|
+
if (e.target.closest('[data-act], [data-hold], [data-ms-pick], [data-fc-pick]')) return; // pm/bd-acts.js handles its own presses (a ⏸ on the timeline opens its hold there; a ◇ its milestones, pm/bd-pin-card.js)
|
|
606
608
|
const pg = e.target.closest('[data-prog]'); if (pg) { PG.openProgram(pg.dataset.prog, pg); return; }
|
|
607
609
|
// a counted milestone ◇ lists its milestones right under it; on a phone the row's bar lane opens them in a sheet (batch 11 item 3)
|
|
608
610
|
const mc = e.target.closest('[data-ms-row]'); if (mc) { msPop(mc, rowOf(mc.dataset.msRow), mc.dataset.msIds.split(' ')); return; }
|
|
@@ -1137,6 +1139,14 @@ function nextAct(b) {
|
|
|
1137
1139
|
const viewDoc = (path) => { const a = document.createElement('button'); a.dataset.doc = path; a.hidden = true; document.body.appendChild(a); a.click(); a.remove(); };
|
|
1138
1140
|
const anchors = async (ws, board) => { try { const r = await (await fetch('/api/boards/anchors?ws=' + encodeURIComponent(ws || M.board.ws || '') + '&board=' + encodeURIComponent(board || M.board.id || ''), { credentials: 'same-origin' })).json(); return r && r.ok ? r.anchors || [] : []; } catch { return []; } };
|
|
1139
1141
|
// Find and the other jumps: on the timeline the row's bar scrolls into view and the row tints for a moment (TsCEdges 4)
|
|
1142
|
+
/** The ✦ on the forecast card (FcBoard): the initiative opens and its "Claude proposes" drill-in with it (pm/ini-props.js, the Grill's findings). */
|
|
1143
|
+
function openFindings(r, from) {
|
|
1144
|
+
openIni(r, from, 'time');
|
|
1145
|
+
let n = 0;
|
|
1146
|
+
const go = () => { const V = window.czViewer, c = V && V.current(); if (c && c.id === BI.vidOf(r) && c.chip && typeof c.chip.on === 'function') { c.chip.on(); return; } if (++n < 20) setTimeout(go, 100); };
|
|
1147
|
+
setTimeout(go, 0);
|
|
1148
|
+
}
|
|
1149
|
+
FCC.init({ rowOf: (k) => rowOf(k), openFindings });
|
|
1140
1150
|
const openIniAny = (r) => { if (r && curView() === 'time') TL.reveal(r.key); openIni(r, $('#bdBell'), 'track'); };
|
|
1141
1151
|
V.init({ M: () => M, wf: wfState, statusOf, usual: usualOf, trail: TI, docMeta, sel: () => (peek && peek.kind !== 'acts' ? peek.key : null), docSel: () => Acts.docSel(),
|
|
1142
1152
|
groups: (L) => groups(L), folded: PG.folded, laneHead: (g) => PG.laneHtml(g, g.kind === 'program' ? progState(g.program) : null), subTile: (n) => PG.tileHtml(n, 'bd-ti s'),
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
* window.czViewer is feature-detected, with this page's side panel as the fallback. A report file opens in the report reader
|
|
30
30
|
* (pm/premium-report-read.js), the report panel in the Viewer card. The page has no #dlg. */
|
|
31
31
|
import { $, $$, esc, toast, wireRail, setPageGaps } from './premium-shell.js';
|
|
32
|
-
import { pmPost } from './http.js';
|
|
32
|
+
import { pmPost, pmGet } from './http.js';
|
|
33
|
+
import * as GW from './grill-words.js'; // Grill and Forecast screens (canvas FcIntel): the goal that will miss, and what Claude's grill found
|
|
33
34
|
import * as PK from './cozy-pick.js'; // the one product picker Home, Board and Insights share (batch 12 item 5)
|
|
34
35
|
import { openReport } from './premium-report-read.js';
|
|
35
36
|
import { mountNav } from './cozy-nav.js';
|
|
@@ -41,7 +42,8 @@ import * as RL from './ready-lib.js'; // the ready-made reports of every progr
|
|
|
41
42
|
import * as RI from './premium-report-intel.js'; // a report made from Intelligence (batch 15 item 4): the header icon, the ✦ proposals, the draft panel
|
|
42
43
|
import * as OK from './okr-list.js'; // Claude runs the OKRs (batch 16 item 6, 6-B): the goal list, its drafts, the ✦ line, ⋯ › Metrics, the notify choice
|
|
43
44
|
import * as IP2 from './ins-pane.js'; // Intelligence as the first panel (panels on Board and Intelligence, P-B): the narrow form, Moved by, the open row
|
|
44
|
-
import * as GC from './goals-clear.js';
|
|
45
|
+
import * as GC from './goals-clear.js';
|
|
46
|
+
import * as FCV from './goal-forecast.js'; // a goal's forecast in its Viewer (FcViewer, FcPhone): the state line, the range band, the baseline ✓ // goals made clear (batch 18 item 11, 11-B): the drafts table, the check panel, first readings, failed and held
|
|
45
47
|
|
|
46
48
|
let M = null; // the model
|
|
47
49
|
let BM = null, bmErr = ''; // the Board measures (Delivery trends)
|
|
@@ -400,11 +402,44 @@ function okrLine() {
|
|
|
400
402
|
const news = GC.lineOf(listGoals(), M.board.name) || (base.tone === 'drafts' || base.tone === 'calm' ? GC.draftsLine(tableRows(), M.board.name) : null);
|
|
401
403
|
return news ? Object.assign({}, news, { keepAll: Math.max(news.keepAll || 0, base.keepAll || 0) }) : base;
|
|
402
404
|
}
|
|
405
|
+
/* ── the forecast ✦ line (canvas FcIntel): the key result that will miss (or drifted to at risk), first. When Claude already grilled an initiative
|
|
406
|
+
* that moves it, the line says so and ✦ opens those findings (pm/ini-props.js). One line at most; a calm forecast says nothing. ── */
|
|
407
|
+
let FCG = null;
|
|
408
|
+
const FC_RANK = { 'will-miss': 0, 'at-risk': 1 };
|
|
409
|
+
async function fcGrillLoad() {
|
|
410
|
+
if (PF || !M) { FCG = null; return; }
|
|
411
|
+
const bad = listGoals().filter((g) => g.forecast && (g.forecast.state === 'will-miss' || (g.forecast.state === 'at-risk' && g.forecast.driftFrom)))
|
|
412
|
+
.sort((a, b) => FC_RANK[a.forecast.state] - FC_RANK[b.forecast.state]);
|
|
413
|
+
if (!bad.length) { FCG = null; return; }
|
|
414
|
+
const ids = [...new Set(bad.flatMap((g) => (g.moves || []).map((r) => r.id)))].slice(0, 60);
|
|
415
|
+
const r = ids.length && M.board.ws ? await pmGet('/api/grill?ws=' + encodeURIComponent(M.board.ws) + '&inis=' + ids.map(encodeURIComponent).join(',')).catch(() => null) : null;
|
|
416
|
+
const runs = (r && r.ok && r.runs) || {};
|
|
417
|
+
const withRun = (g) => (g.moves || []).map((x) => ({ ini: x, run: runs[x.id] })).filter((x) => x.run && x.run.n > 0).sort((a, b) => String(b.run.at).localeCompare(String(a.run.at)))[0] || null;
|
|
418
|
+
const g = bad.find(withRun) || bad[0], hit = withRun(g);
|
|
419
|
+
FCG = { g, ini: hit ? hit.ini : null, run: hit ? hit.run : null };
|
|
420
|
+
}
|
|
421
|
+
function fcGrillItem() {
|
|
422
|
+
if (!FCG) return null;
|
|
423
|
+
const { g, ini, run } = FCG, F = g.forecast;
|
|
424
|
+
const text = g.title + (F.state === 'will-miss' ? ' will miss the goal.' : ' is at risk.');
|
|
425
|
+
const range = typeof F.low === 'number' && typeof F.high === 'number' ? 'Likely ' + fcV(g, F.likely) + ', range ' + fcV(g, F.low) + ' to ' + fcV(g, F.high) + '.' : '';
|
|
426
|
+
const drift = F.driftFrom ? ' Was on track on ' + md(Date.parse(F.driftFrom)) + '.' : '';
|
|
427
|
+
const why = run ? 'I grilled ' + ini.title + ' ' + GW.whenWord(run.at) + ': ' + run.n + (run.n === 1 ? ' finding' : ' findings') + ' wait under ✦.' + drift : range + drift;
|
|
428
|
+
return { text, why: why.trim(), fcGrill: run ? { id: ini.id, title: ini.title, n: run.n } : null };
|
|
429
|
+
}
|
|
430
|
+
/** ✦ on the forecast line: the initiative's findings in the Viewer, the same ✓ / ✎ / ✕ as on its own page. */
|
|
431
|
+
async function openFcGrill(x) {
|
|
432
|
+
const r = await pmGet('/api/proposals?ws=' + encodeURIComponent(M.board.ws || '') + '&board=' + encodeURIComponent(M.board.id || '') + '&initiative=' + encodeURIComponent(x.id)).catch(() => null);
|
|
433
|
+
if (!r || r.ok === false) { toast((r && r.error) || 'The findings could not be read.'); return; }
|
|
434
|
+
const IP = await import('./ini-props.js');
|
|
435
|
+
IP.open({ id: x.id, title: x.title, props: r.props }, { where: () => ({ ws: M.board.ws, board: M.board.id }), reload: () => load(), toast: (m, undo) => (undo ? toast(m, { label: 'Undo', fn: undo }) : toast(m)) });
|
|
436
|
+
}
|
|
403
437
|
function stripList() {
|
|
404
438
|
const I0 = M.insight || { none: true, text: '' };
|
|
405
439
|
// Your impact (batch 16 item 7, GmA4Moments): a key result that moved after your work, as one more ✦ line, with its source to open
|
|
406
440
|
const im = PF ? null : IM.intelItem(), mine = im ? [im] : [];
|
|
407
|
-
const
|
|
441
|
+
const fcg = PF ? null : fcGrillItem();
|
|
442
|
+
const ok = PF ? [] : [Object.assign({ okr: true, text: '', why: '' }, (() => { const L = okrLine(); return { text: L.head, why: L.sub, tone: L.tone, keepAll: L.keepAll, start: !!L.start, retry: !!L.retry }; })())].concat(fcg ? [fcg] : []);
|
|
408
443
|
if (I0.none) return ok.concat(PF ? [] : RI.stripItems(), mine);
|
|
409
444
|
const finds = [{ text: I0.text, why: I0.why || '', chart: I0.chart, move: I0.move || null, calm: !!I0.calm }].concat((I0.more || []).map((x) => ({ text: x.text, why: x.why || '', chart: x.chart, move: x.move || null })));
|
|
410
445
|
// a calm finding ("Nothing stands out") says what the ✦ line already says: it is left out
|
|
@@ -438,9 +473,10 @@ function drawStrip() {
|
|
|
438
473
|
// the ✦ line's own press: ✓✓ keeps every draft (GsM1, GsM5); with nothing to read, ✦ asks Claude to draft the goals
|
|
439
474
|
const okAct = !f.okr ? '' : f.keepAll ? `<button type="button" class="cz-ib sm solid" data-okl="keep-all" aria-label="Keep all ${f.keepAll}" title="Keep all ${f.keepAll}">${OK.SV(OK.P.checks)}</button>`
|
|
440
475
|
: f.start && M.board.ws ? `<button type="button" class="cz-ib sm solid" data-okl="start" aria-label="${f.retry ? 'Try drafting again' : 'Draft them'}" title="${f.retry ? 'Try again' : 'Draft them'}">${SV(I.spark)}</button>` : '';
|
|
441
|
-
|
|
476
|
+
const fcAct = f.fcGrill ? `<button type="button" class="cz-ib sm solid" data-fcg aria-label="${esc('Open the ' + f.fcGrill.n + (f.fcGrill.n === 1 ? ' finding' : ' findings') + ' on ' + f.fcGrill.title)}" title="Open the findings">${SV(I.spark)}</button>` : '';
|
|
477
|
+
if (!f.report) $('#insAct').innerHTML = mvAct + okAct + fcAct;
|
|
442
478
|
if (open.length > 1) {
|
|
443
|
-
if (!f.report) $('#insAct').innerHTML = `<button type="button" class="cz-ib sm" id="insNo" aria-label="Not now" title="Not now">${SV(I.x)}</button>` + mvAct + okAct;
|
|
479
|
+
if (!f.report) $('#insAct').innerHTML = `<button type="button" class="cz-ib sm" id="insNo" aria-label="Not now" title="Not now">${SV(I.x)}</button>` + mvAct + okAct + fcAct;
|
|
444
480
|
$('#insPg').innerHTML = L.map((x, i) => `<button type="button" class="${i === insIdx ? 'on' : ''}" data-ins="${i}" aria-label="Finding ${i + 1} of ${L.length}" aria-pressed="${i === insIdx}"${insSkip.has(i) ? ' hidden' : ''}></button>`).join('');
|
|
445
481
|
}
|
|
446
482
|
if (f.impact && f.impact.url) $('#insAct').insertAdjacentHTML('beforeend', `<a class="cz-ib sm" href="${esc(f.impact.url)}"${/^https:/i.test(f.impact.url) ? ' target="_blank" rel="noopener noreferrer"' : ''} aria-label="Open the source: ${esc(f.impact.label)}" title="Open the source">${SV(I.open || 'M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5')}</a>`);
|
|
@@ -448,6 +484,7 @@ function drawStrip() {
|
|
|
448
484
|
$('#insHero').addEventListener('click', async (e) => {
|
|
449
485
|
if (e.target.closest('[data-rp]')) { await RI.stripPress(e); return; }
|
|
450
486
|
const k = e.target.closest('[data-okl]'); if (k) { await draftPress(k.dataset.okl, null, k); return; }
|
|
487
|
+
if (e.target.closest('[data-fcg]')) { const f = stripList()[insIdx]; if (f && f.fcGrill) await openFcGrill(f.fcGrill); return; }
|
|
451
488
|
const b = e.target.closest('[data-mv]'); if (b) { await pressMove(b); return; }
|
|
452
489
|
const d = e.target.closest('[data-ins]'); if (d) { insIdx = +d.dataset.ins; drawStrip(); return; }
|
|
453
490
|
if (e.target.closest('#insNo')) { insSkip.add(insIdx); const L = stripList(), n = L.findIndex((x, i) => i > insIdx && !insSkip.has(i)); insIdx = n >= 0 ? n : L.findIndex((x, i) => !insSkip.has(i)); drawStrip(); }
|
|
@@ -930,7 +967,8 @@ function budgetRow(b) {
|
|
|
930
967
|
+ `<div class="nm" role="cell">${R && R.over ? OK.dotHtml('broken') : ''}<span><b>${markHtml(b.title)}</b><small><span class="cz-pill q ins-type">Stay within</span><span class="ins-sub">always on${cap !== null ? ' · cap ' + pct(cap) + ' of a quarter' : ''}</span></small></span></div>`
|
|
931
968
|
+ `<div class="val" role="cell">${val}${bar}</div>`
|
|
932
969
|
+ `<div class="sofar" role="cell">${R && R.share !== null && cap !== null ? bandSvg([{ at: M.today || iso(today()), v: R.share * 100 }], cap * 100, true, R.over ? 'late' : 'ok', b.title + ': ' + pct(R.share) + ' of open initiatives, the green band is inside its ' + pct(cap) + ' cap') : ''}<span class="note">${esc(b.covers ? 'Covers ' + b.covers : 'What it covers is not declared')}</span></div>`
|
|
933
|
-
|
|
970
|
+
// its burn (lib/forecast.js budgetBurn, canvas FcIntel): the weeks left at this pace of spend, only under 8 (zero is silence)
|
|
971
|
+
+ `<div class="pace" role="cell"><b style="color:${pace[0]}">${esc(pace[1])}</b><div class="note">${esc(pace[2])}</div>${b.burn && Number.isFinite(b.burn.weeksLeft) ? `<div class="note ins-burn"><span class="cz-pill risk">${b.burn.weeksLeft === 1 ? '1 week' : b.burn.weeksLeft + ' weeks'} left</span> at this pace of spend</div>` : ''}</div>`
|
|
934
972
|
+ `<div class="mv" role="cell">${b.moves.length ? b.moves.slice(0, 3).map((r) => initRow(r)).join('') : '<span class="note">No initiative anchors to it</span>'}</div></div>` + draftsRow(b.id);
|
|
935
973
|
}
|
|
936
974
|
const GRP_PILL = (L) => {
|
|
@@ -1017,9 +1055,10 @@ const marksOf = (g) => (g.moves || []).filter((r) => r.milestone && r.endAt && r
|
|
|
1017
1055
|
* date, each reading on the line and the latest a dot, and a diamond with a dotted rule at each milestone that moves it. */
|
|
1018
1056
|
function detailSvg(g, c, W = 490, H = 150) {
|
|
1019
1057
|
const pts = c.pts, t0 = day(pts[0].at), tl = day(pts[pts.length - 1].at), by = day(g.byAt);
|
|
1020
|
-
const
|
|
1058
|
+
const fc = FCV.ranged(g), fby = fc ? day(g.forecast.by) : null; // a forecast range replaces the pace projection: one line to the date, not two
|
|
1059
|
+
const proj = fc ? (fby !== null && fby > tl ? { t: fby, v: g.forecast.likely } : null) : g.proj && by !== null && by > tl ? { t: by, v: g.proj.atDue } : null;
|
|
1021
1060
|
const marks = marksOf(g).filter((m) => m.t > t0 && m.t <= Math.max(by || 0, tl)), t1 = Math.max(proj ? proj.t : tl, ...marks.map((m) => m.t));
|
|
1022
|
-
const ys = pts.map((p) => p.v).concat(g.target !== null ? [g.target] : [], proj ? [proj.v] : []), lo = Math.min(...ys), hi = Math.max(...ys), rg = hi - lo || 1;
|
|
1061
|
+
const ys = pts.map((p) => p.v).concat(g.target !== null ? [g.target] : [], proj ? [proj.v] : [], proj && fc ? FCV.scaleVals(g) : []), lo = Math.min(...ys), hi = Math.max(...ys), rg = hi - lo || 1;
|
|
1023
1062
|
const x = (t) => 12 + (t1 > t0 ? (t - t0) / (t1 - t0) : 1) * (W - 24), y = (v) => 26 + (1 - (v - lo) / rg) * (H - 56), f = (n) => n.toFixed(1);
|
|
1024
1063
|
let out = '';
|
|
1025
1064
|
if (g.target !== null) { const ty = y(g.target); out += `<path class="tg" d="M0 ${f(ty)}H${W}"/><text class="tgl" x="${W - 2}" y="${f(ty < 18 ? ty + 14 : ty - 6)}" text-anchor="end">Target ${esc(g.targetTxt)}</text>`; }
|
|
@@ -1029,8 +1068,10 @@ function detailSvg(g, c, W = 490, H = 150) {
|
|
|
1029
1068
|
const span = (px, end, label) => { const w = String(label).length * 7.5; return end ? [px - w, px] : [px, px + w]; };
|
|
1030
1069
|
for (const m of marks) { const mx = x(m.t), end = mx > W - 120, lx = end ? mx - 9 : mx + 9; const [a, b] = span(lx, end, m.label), ly = H - 5 - 17 * laneOf(Math.min(a, mx - 6), Math.max(b, mx + 6)); out += `<path class="msr" d="M${f(mx)} 14V${H - 16}"/><path class="msd" d="M${f(mx)} ${H - 14}l5 5-5 5-5-5z"/><text class="msl" x="${f(lx)}" y="${ly}"${end ? ' text-anchor="end"' : ''}>${esc(m.label)}</text>`; }
|
|
1031
1070
|
for (const s of shipsOf(g)) { if (s.t < t0 || s.t > t1) continue; const sx = x(s.t), end = sx > W - 160, lx = end ? sx - 4 : sx + 4, ly = H - 5 - 17 * laneOf(...span(lx, end, s.label)); out += `<path class="ship" d="M${f(sx)} 20V${H - 10}"/><text class="shipl" x="${f(lx)}" y="${ly}"${end ? ' text-anchor="end"' : ''}>${esc(s.label)}</text>`; }
|
|
1032
|
-
const L = pts.map((p) => f(x(day(p.at))) + ' ' + f(y(p.v))), last = L[L.length - 1];
|
|
1033
|
-
|
|
1071
|
+
const L = pts.map((p) => f(x(day(p.at))) + ' ' + f(y(p.v))), last = L[L.length - 1], zp = pts[pts.length - 1];
|
|
1072
|
+
const FL = fc && proj ? FCV.chartLayer(g, { x, y, H, day, last: { t: day(zp.at), v: zp.v } }) : null;
|
|
1073
|
+
out = (FL ? FL.under : '') + out + `<path class="ln" d="M${L.join('L')}"/>` + (FL ? FL.over : proj ? `<path class="pj" d="M${last}L${f(x(proj.t))} ${f(y(proj.v))}"/>` : '');
|
|
1074
|
+
if (fc) out += pts.slice(0, -1).map((p) => `<circle class="pt" cx="${f(x(day(p.at)))}" cy="${f(y(p.v))}" r="2.5"/>`).join(''); // FcViewer: history as dots
|
|
1034
1075
|
out += `<circle class="pt now" cx="${f(x(day(pts[pts.length - 1].at)))}" cy="${f(y(pts[pts.length - 1].v))}" r="3.5"/>`;
|
|
1035
1076
|
const a = pts[0], z = pts[pts.length - 1];
|
|
1036
1077
|
return `<svg class="ins-gch" viewBox="0 0 ${W} ${H}" role="img" aria-label="${esc(g.title + ': readings from ' + a.txt + ' on ' + md(day(a.at)) + ' to ' + z.txt + ' on ' + md(day(z.at)) + (g.targetTxt ? ', target ' + g.targetTxt : '') + (marks.length ? ', milestones ' + marks.map((m) => m.label).join(' and ') : ''))}">${out}</svg>`;
|
|
@@ -1130,7 +1171,15 @@ function goalBodyHtml(g, o) {
|
|
|
1130
1171
|
];
|
|
1131
1172
|
const ask = `<form class="ins-askf" data-askf><input name="q" maxlength="300" autocomplete="off" placeholder="Ask about this goal" aria-label="Ask about this goal"><button type="submit" class="cz-ib sm solid" aria-label="Ask in Home" title="Ask in Home">${SV(I.up)}</button></form>`;
|
|
1132
1173
|
// GcR3Goal: the panel leads with the number and how it is counted, never with its chart; the chart follows the words
|
|
1133
|
-
|
|
1174
|
+
const fo = fcOpts(g), fcLine = FCV.stateHtml(g, fo), fcBase = FCV.baselineHtml(g, fo), legend = c && !steps ? FCV.legendHtml(g) : '';
|
|
1175
|
+
return head + form + kr + fcLine + `<div class="ins-gbig">${chart}${legend}</div>` + fcBase + whyCard + window.czViewer.czSections(rows.filter(Boolean), { key: 'goal' }) + '<p class="note ins-gmsg" data-gmsg role="status"></p>' + ask;
|
|
1176
|
+
}
|
|
1177
|
+
/** What goal-forecast.js needs from this page: its date words, the unit, the next reading, the source, and the PM's "Keep as is" on this browser. */
|
|
1178
|
+
function fcOpts(g) {
|
|
1179
|
+
const own = goalWs(g) === M.board.ws;
|
|
1180
|
+
return { md, day, today: today(), unit: (v) => unitV(g, v), next: nextReading(g), source: g.recipe && g.recipe.connector ? g.recipe.connector : g.source && g.source !== 'typed' ? SRC_NAME[g.source] || g.source : null,
|
|
1181
|
+
canRead: own && !!(g.recipe && g.recipe.connector), ws: goalWs(g), rid: goalRid(g),
|
|
1182
|
+
dismissed: (k) => { try { return localStorage.getItem(k) === '1'; } catch { return false; } } };
|
|
1134
1183
|
}
|
|
1135
1184
|
/** The goal as plain text, for Copy as text. */
|
|
1136
1185
|
function goalText(g) {
|
|
@@ -1183,6 +1232,12 @@ function openGoalDetail(id, open0) {
|
|
|
1183
1232
|
const draw = () => { const top = el.scrollTop; el.innerHTML = goalBodyHtml(g, st); el.scrollTop = top; };
|
|
1184
1233
|
const fresh = async (said) => { toast(said); await load(); if (PF) await openPortfolio(); g = goalById(id); if (g) draw(); };
|
|
1185
1234
|
draw();
|
|
1235
|
+
// FcViewer's ✓: a baseline worth offering, asked for once when the goal opens (POST /api/forecast/offer reads and writes nothing)
|
|
1236
|
+
if (FCV.ranged(g) && !g.forecast.baseline && g.forecast.offer === undefined && g.forecast.state !== 'held') {
|
|
1237
|
+
const G = g; G.forecast.offer = null;
|
|
1238
|
+
pmPost('/api/forecast/offer', { goal: { id: G.id, type: G.type, target: G.target, byAt: G.byAt, unit: G.unit, direction: G.direction, base: G.base, series: G.series }, today: M.today })
|
|
1239
|
+
.then((r) => { if (r && r.ok === true && r.offer && G === g) { G.forecast.offer = r.offer; draw(); } }, () => {});
|
|
1240
|
+
}
|
|
1186
1241
|
el.onclick = async (e) => {
|
|
1187
1242
|
// batch 18 item 11: a failed read's one fix (reconnect), a held reading's (file it, or its drafted ticket)
|
|
1188
1243
|
const gx = e.target.closest('[data-gc], [data-okd]');
|
|
@@ -1198,6 +1253,25 @@ function openGoalDetail(id, open0) {
|
|
|
1198
1253
|
if (k === 'keep') { await draftPress('keep', gx.dataset.row, gx); g = goalById(id); if (g) draw(); return; }
|
|
1199
1254
|
if (k === 'edit') { const t = heldTicket(g); location.assign(homeAsk('goal', 'Change the drafted ticket for ' + g.title + (t ? ' (“' + t.text + '”)' : '') + ': ')); return; }
|
|
1200
1255
|
}
|
|
1256
|
+
// the forecast's presses (FcViewer, FcPhone): keep the offered baseline, not now, count every reading again, read a held source now
|
|
1257
|
+
const fx = e.target.closest('[data-fc]');
|
|
1258
|
+
if (fx && !fx.disabled) {
|
|
1259
|
+
const k = fx.dataset.fc, F = g.forecast || {};
|
|
1260
|
+
if (k === 'read') { readNow(); return; }
|
|
1261
|
+
if (k === 'base-no' && F.offer) { try { localStorage.setItem(FCV.keyOf(g, F.offer), '1'); } catch { /* this browser keeps nothing: it shows again next time */ } draw(); return; }
|
|
1262
|
+
if (k === 'base' && F.offer) {
|
|
1263
|
+
fx.disabled = true;
|
|
1264
|
+
const r = await pmPost('/api/forecast/baseline', FCV.baselineBody(g, fcOpts(g)));
|
|
1265
|
+
if (!r || r.ok !== true) { fx.disabled = false; toast((r && r.error) || 'It could not be saved. Nothing changed.'); return; }
|
|
1266
|
+
await fresh('Kept. The range counts ' + F.offer.label + '.'); return;
|
|
1267
|
+
}
|
|
1268
|
+
if (k === 'base-off') {
|
|
1269
|
+
fx.disabled = true;
|
|
1270
|
+
const r = await pmPost('/api/forecast/baseline-off', { ws: goalWs(g), goal: goalRid(g) });
|
|
1271
|
+
if (!r || r.ok !== true) { fx.disabled = false; toast((r && r.error) || 'It could not be saved. Nothing changed.'); return; }
|
|
1272
|
+
await fresh('Every reading counts again.'); return;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1201
1275
|
const x = e.target.closest('[data-gx], [data-czs-act]'); if (!x || x.disabled) return;
|
|
1202
1276
|
const k = x.dataset.gx || x.dataset.czsAct, msg = el.querySelector('[data-gmsg]');
|
|
1203
1277
|
if (k === 'all') { st.more = true; st.open = 'read'; draw(); }
|
|
@@ -1978,6 +2052,7 @@ async function load() {
|
|
|
1978
2052
|
// an old tab link (Insights had Goals, Outcomes and Library): it lands on the section or the panel, once
|
|
1979
2053
|
if (first) { const t = new URLSearchParams(location.search).get('tab'); if (t === 'outcomes' || t === 'library') setTab(t); }
|
|
1980
2054
|
if (first) draftsLoad();
|
|
2055
|
+
if (!PF) fcGrillLoad().then(() => { if (M && FCG) drawStrip(); }).catch(() => {});
|
|
1981
2056
|
if (!PF) { await noteOpen(); RI.loadProposals(M.board.ws, M.board.id).then(() => { if (M) drawStrip(); }); IM.readWeek().then(() => { if (M && IM.intelItem()) drawStrip(); }).catch(() => {}); }
|
|
1982
2057
|
}
|
|
1983
2058
|
/* a report from Intelligence (batch 15 item 4): the view on screen is its first scope; a saved dashboard is its own */
|
|
@@ -157,7 +157,8 @@ export function deckOf(p) {
|
|
|
157
157
|
function newHtml(t) {
|
|
158
158
|
const p = t.block.proposal, L = deckOf(p), i = t.i = Math.max(0, Math.min(t.i, L.length - 1)), s = L[i];
|
|
159
159
|
const sum = rpSumHtml({ line: 'New · from your chat', tone: 'you', right: 'Not set up yet',
|
|
160
|
-
text: '
|
|
160
|
+
text: t.block.structure ? 'It starts with the standard sections. When you set it up, Claude reshapes them to your change, and you keep it with one press. Nothing goes out until you set it up.'
|
|
161
|
+
: 'One slide per section: ' + FRAME.map(([h]) => h).join(', ') + '. Nothing goes out until you set it up.',
|
|
161
162
|
chips: [{ icon: 'repeat', label: cadenceWords(t.sched), act: 'sched', exp: t.open }, { icon: 'file', label: OUT[p.output] || p.output || 'PDF' }],
|
|
162
163
|
primary: { act: 'setup', label: t.busy ? 'Setting it up' : 'Set it up', icon: 'check', disabled: t.busy } }, 'data-rt');
|
|
163
164
|
const bar = rpBarHtml({ view: t.nv, views: [['deck', 'Slides'], ['doc', 'Document']] }, 'data-rt');
|
|
@@ -167,7 +168,8 @@ function newHtml(t) {
|
|
|
167
168
|
const page = `<article class="vz-dkp"><h2>${esc(p.name)}</h2>${p.purpose ? `<p class="vz-note">${esc(p.purpose)}</p>` : ''}${sectionsHtml(FRAME)}</article>`;
|
|
168
169
|
const folds = czSections([
|
|
169
170
|
{ id: 'glance', title: 'At a glance', count: 'For, read by, goes out', render: () => `<div class="rp-brief">${glance(p.purpose, p.audience, esc(schedWords(t.sched)), OUT[p.output] || p.output)}</div>` },
|
|
170
|
-
{ id: 'look', title: 'Structure and look', count: 'new', render: () =>
|
|
171
|
+
{ id: 'look', title: 'Structure and look', count: t.block.structure ? 'change' : 'new', render: () => (t.block.structure ? `<div class="vz-ask"><p>Your change: <b>“${esc(t.block.structure)}”</b></p><p class="vz-note">Claude makes this change as soon as the report is set up. The first draft uses the sections below.</p></div>` : '')
|
|
172
|
+
+ `${sectionsHtml(FRAME)}<p class="vz-note">Every new report has these sections. ${t.block.structure ? '' : 'Once it is set up, ask in the chat to shape them. '}It uses the standard PMOS look until you say how it should look.</p>` },
|
|
171
173
|
], { key: 'report-new' });
|
|
172
174
|
return sum + schedMenu(t, t.sched) + bar + (t.nv === 'doc' ? page : deck) + folds;
|
|
173
175
|
}
|
|
@@ -298,8 +300,16 @@ async function setUp(t) {
|
|
|
298
300
|
if (!r || !r.ok) return 'It was not set up: ' + why(r, 'the page could not reach PMOS') + '.';
|
|
299
301
|
if (t.sched === 'off') await post('/api/report-setups/edit', { id: r.setup.id, schedule: { cadence: 'off' } });
|
|
300
302
|
// the view now shows the set-up report, under the same id, so the card stays on it
|
|
303
|
+
const shape = t.block.structure;
|
|
301
304
|
t.block = { kind: 'report', id: r.setup.id }; t.loaded = false; show(t); await load(t);
|
|
302
305
|
const d = r.drafted || {};
|
|
303
|
-
|
|
306
|
+
// the change Claude proposed with the new report: start it now, the PM keeps it with Use this (batch 20 item 9)
|
|
307
|
+
let shaping = '';
|
|
308
|
+
if (shape) {
|
|
309
|
+
const s = await post('/api/report-structure/turn', { id: r.setup.id, text: shape });
|
|
310
|
+
if (s && s.ok) { t.S = Object.assign({}, t.S, { running: true }); t.view = 'structure'; poll(t, 'structure'); shaping = ' Claude is reshaping the sections to your change now.'; }
|
|
311
|
+
else { t.block = Object.assign({}, t.block, { structure: shape }); shaping = ' The change to its sections did not start: ' + why(s, 'no answer') + '. Press Make the next version to try again.'; }
|
|
312
|
+
}
|
|
313
|
+
return 'Set up. ' + (d.path ? 'The first draft is written.' : 'The first draft was not written' + (d.error ? ': ' + d.error : '') + '.') + (t.sched === 'off' ? ' Schedule is Off, so it runs once.' : '') + shaping;
|
|
304
314
|
});
|
|
305
315
|
}
|
|
@@ -126,7 +126,7 @@ export function openWorkItem(o) {
|
|
|
126
126
|
lists.sections = ini && Array.isArray(ini.stages) && ini.stages.length ? ini.stages : null;
|
|
127
127
|
const it = items && items.ok ? (items.items || []).find((x) => x.uid === t.uid) : null;
|
|
128
128
|
const sibs = items && items.ok ? (items.items || []).filter((x) => x.ini === t.ini && x.src !== 'jira') : [];
|
|
129
|
-
placeOf(it || row, lists.sections || [], sibs).then((P) => { if (!host.isConnected) return; t.section = P.section; t.wbs = P.wbs; card.draw(); });
|
|
129
|
+
placeOf(it || row, lists.sections || [], sibs, (ini && ini.map) || null).then((P) => { if (!host.isConnected) return; t.section = P.section; t.wbs = P.wbs; card.draw(); });
|
|
130
130
|
card.draw();
|
|
131
131
|
});
|
|
132
132
|
}
|
|
@@ -35,6 +35,7 @@ const REMOVE = [
|
|
|
35
35
|
'.po-grip', '.bd-nxa',
|
|
36
36
|
'#bdChipset > :not(.tg-lgd)', '#askDates', '.tg-ft',
|
|
37
37
|
'.cz-vw-ib[aria-label="Discuss in chat"]', '.cz-vw-ib[aria-label="More"]', '.iv-addp', '.iv-prog', '.iv-plus', '.iv-car', '.iv-scgn', '.iv-gx-a',
|
|
38
|
+
'.sm-card', '.pp-p', '.lk-chip.mv', // what Claude proposes to the publisher (batch 20 item 1): the pack carries none, and none is drawn
|
|
38
39
|
'.ab-lk', '[data-ivs-view="kanban"]', '.ivs-cols', '.ivs-h:has(+ .ivs-cols)', '[data-ivs-more]', '.iv-tasks .ig-emp', '.iv-tasks .ivk-h', '.iv-tasks .ig-read', '.iv-th .iv-ib', '.iv-th .iv-plus',
|
|
39
40
|
];
|
|
40
41
|
/** Controls whose words are the content (a title, a date, a name, a program's milestone in the Deliveries lane): set as plain text, same look. A program's
|
|
@@ -55,7 +55,8 @@ export function cleanBlock(b) {
|
|
|
55
55
|
}
|
|
56
56
|
const p = b.proposal && typeof b.proposal === 'object' ? b.proposal : null;
|
|
57
57
|
if (!p || !clip(p.name, 80)) return null;
|
|
58
|
-
|
|
58
|
+
const shape = clip(b.structure, 600);
|
|
59
|
+
return { kind: 'report', ...(shape ? { structure: shape } : {}), proposal: {
|
|
59
60
|
name: clip(p.name, 80), purpose: clip(p.purpose, 400), audience: clip(p.audience, 120) || 'The team',
|
|
60
61
|
output: OUTPUTS.includes(p.output) ? p.output : 'google-doc', schedule: cleanSchedule(p.schedule) === 'off' ? null : cleanSchedule(p.schedule),
|
|
61
62
|
sources: (Array.isArray(p.sources) ? p.sources : []).map((x) => clip(x, 160)).filter(Boolean).slice(0, 8),
|
|
@@ -69,12 +69,13 @@ export function taskOf(row, extra = {}) {
|
|
|
69
69
|
/** Where a task sits: { section, wbs }. The initiative view's model (ini-view-model.js, batch 6 item 1) owns the rules: sectionOf(task, stages)
|
|
70
70
|
* resolves the PM's placement, then the stage that made the task, then its plan-tree stage; wbsOf(title) reads the breakdown code from the
|
|
71
71
|
* title ("10.5 TC to review" sits under 10). Before that model is on the page, the same rules in their simplest form: the row's section by
|
|
72
|
-
* key or name, and a numeric code's head among the initiative's other tasks. rows: the initiative's tasks, to name the breakdown item.
|
|
73
|
-
|
|
72
|
+
* key or name, and a numeric code's head among the initiative's other tasks. rows: the initiative's tasks, to name the breakdown item.
|
|
73
|
+
* map: the initiative's stage map after a workflow switch (GET /api/boards/items initiatives[].map), so an old stage's task sits in its new one. */
|
|
74
|
+
export async function placeOf(row, stages = [], rows = [], map = null) {
|
|
74
75
|
const r = row || {}, S = stages || [];
|
|
75
76
|
let IV = null; try { IV = await import('./ini-view-model.js'); } catch { IV = null; }
|
|
76
77
|
const byRef = (v) => { const x = String(v || '').trim().toLowerCase(); if (!x) return ''; const st = S.find((y) => y.key.toLowerCase() === x || String(y.name || '').toLowerCase() === x); return st ? st.key : ''; };
|
|
77
|
-
const section = IV && typeof IV.sectionOf === 'function' ? IV.sectionOf(r, S) || '' : byRef(r.section) || byRef(r.from && r.from.stage) || byRef(r.itemStage);
|
|
78
|
+
const section = IV && typeof IV.sectionOf === 'function' ? IV.sectionOf(r, S, map) || '' : byRef(r.section) || byRef(r.from && r.from.stage) || byRef(r.itemStage);
|
|
78
79
|
const code = (title) => { if (IV && typeof IV.wbsOf === 'function') return IV.wbsOf(title); const m = /^(\d+(?:\.\d+)*)\s/.exec(String(title || '')); return m ? { code: m[1], top: m[1].split('.')[0] } : null; };
|
|
79
80
|
const c = code(r.title);
|
|
80
81
|
let wbs = null;
|
|
@@ -165,3 +165,12 @@ body.wf-page { min-height: 100vh; overflow: hidden; font-family: var(--cz-sans);
|
|
|
165
165
|
.wf-stage .wf-row { flex-wrap: wrap; }
|
|
166
166
|
.wf-stage .wf-row > .wf-grow { min-width: 0; flex-basis: 100%; }
|
|
167
167
|
}
|
|
168
|
+
|
|
169
|
+
/* the bridge (batch 20 item 3, canvas WmB right): "Replaces Product feature", each old stage → this workflow's stage */
|
|
170
|
+
.wf-br { display: flex; flex-direction: column; gap: 0; }
|
|
171
|
+
.wf-brh { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 8px; }
|
|
172
|
+
.wf-brr { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--cz-hair); }
|
|
173
|
+
.wf-brr span { flex: 1; min-width: 0; }
|
|
174
|
+
.wf-brr svg { flex: none; color: var(--cz-ink3); }
|
|
175
|
+
.wf-brr select { min-width: 170px; min-height: 36px; font: inherit; font-weight: 800; color: var(--cz-blueink); background: var(--cz-bluebg); border: 0; border-radius: 12px; padding: 6px 10px; }
|
|
176
|
+
.wf-br > .wf-small:last-child { padding-top: 10px; border-top: 1px solid var(--cz-hair); margin: 0; }
|