create-pmos 0.325.0 → 0.327.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 +1 -1
- 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/guide/briefing-premium.md +10 -3
- package/workspace/lib/engine/boards.js +28 -1
- package/workspace/lib/routes-boards.js +2 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-backlog-test.js +127 -0
- package/workspace/premium-vw-doc-test.js +3 -1
- package/workspace/premium-vw-meet-test.js +4 -1
- package/workspace/premium-vw-rec-test.js +209 -0
- package/workspace/public/pm/premium-board.js +10 -0
- package/workspace/public/pm/premium-meeting.js +28 -5
- package/workspace/public/pm/premium-shell.js +8 -2
- package/workspace/public/pm/premium-vw-backlog.css +30 -0
- package/workspace/public/pm/premium-vw-backlog.js +91 -0
- package/workspace/public/pm/premium-vw-doc-model.js +3 -2
- package/workspace/public/pm/premium-vw-doc.css +1 -0
- package/workspace/public/pm/premium-vw-doc.js +7 -4
- package/workspace/public/pm/premium-vw-jira.js +3 -1
- package/workspace/public/pm/premium-vw-meet.css +4 -0
- package/workspace/public/pm/premium-vw-meet.js +29 -4
- package/workspace/public/pm/premium-vw-rec.css +75 -0
- package/workspace/public/pm/premium-vw-rec.js +257 -0
- package/workspace/test-files.json +2 -0
- package/workspace/test-lists/premium-viewer.json +4 -2
- package/workspace/test-lists/premium-vw-backlog.json +13 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* premium-vw-rec-test.js — note recording in the premium viewer (initiative premium-viewer, S4; the prototype Wawan approved on 2026-10-19). Serves the real pages from the
|
|
4
|
+
* real server. The Briefing model, the calendar, the notes and Focus are answered by stand-ins, so each press can be read off the request the page sent; the recorder is a
|
|
5
|
+
* stand-in that makes the same requests the console's recorder makes (record, pause, stop) and opens no microphone. The routes' own behaviour is in their own suites.
|
|
6
|
+
* R1 the Record control · R2 the chip · R3 the Live notes tab · R4 Focus · R5 floors
|
|
7
|
+
* Every wait polls the page; no fixed sleep stands in for a state. */
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const { spawn } = require('child_process');
|
|
10
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
11
|
+
const T = require('./test-run').configure({ name: 'premium-vw-rec' });
|
|
12
|
+
const B = require('./lib/briefing-premium.js');
|
|
13
|
+
const F = require('./fixtures/briefing-premium-facts.js');
|
|
14
|
+
|
|
15
|
+
const BASE = T.BASE;
|
|
16
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
17
|
+
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
18
|
+
const results = [];
|
|
19
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
|
|
20
|
+
let srv = null; let browser = null;
|
|
21
|
+
const finish = async (code) => {
|
|
22
|
+
if (browser) await browser.close().catch(() => {});
|
|
23
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
24
|
+
T.killTmux();
|
|
25
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
26
|
+
console.log(`\n${results.length - bad}/${results.length} premium-vw-rec assertions passed`);
|
|
27
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
28
|
+
};
|
|
29
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
30
|
+
|
|
31
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
32
|
+
const dayKey = (d) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
33
|
+
const iso = (d) => { const off = -d.getTimezoneOffset(), a = Math.abs(off); return `${dayKey(d)}T${pad(d.getHours())}:${pad(d.getMinutes())}:00${off >= 0 ? '+' : '-'}${pad(Math.floor(a / 60))}:${pad(a % 60)}`; };
|
|
34
|
+
const NOW = new Date();
|
|
35
|
+
const midnight = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate());
|
|
36
|
+
const monday = () => { const d = new Date(midnight); d.setDate(d.getDate() - ((d.getDay() + 6) % 7)); return d; };
|
|
37
|
+
/* "Live review" is under way now (it starts at most 10 minutes ago, never before midnight), so the Record menu lists it. */
|
|
38
|
+
const START = new Date(Math.max(midnight.getTime(), Math.floor((NOW.getTime() - 10 * 60000) / 60000) * 60000)), END = new Date(START.getTime() + 60 * 60000);
|
|
39
|
+
const weekAnswer = () => {
|
|
40
|
+
const m = monday(), cells = [];
|
|
41
|
+
for (let i = 0; i < 7; i++) { const d = new Date(m.getFullYear(), m.getMonth(), m.getDate() + i); cells.push({ key: dayKey(d), start: dayKey(d), end: dayKey(d), events: [] }); }
|
|
42
|
+
cells.find((c) => c.key === dayKey(START)).events.push({ id: 'ev-live', at: iso(START), end: iso(END), title: 'Live review', attendees: ['Priya', 'Dara'] });
|
|
43
|
+
return { ok: true, view: 'week', range: { start: cells[0].key, end: cells[6].key }, cells, events_source: 'calendar-memory', today: dayKey(NOW), context: {}, link_boards: [], gantt: [] };
|
|
44
|
+
};
|
|
45
|
+
const FOCUS = () => ({ ok: true, now_ms: Date.now(), date: dayKey(NOW), event: { id: 'ev-live', title: 'Live review', at: iso(START), end: iso(END), attendees: ['Priya', 'Dara'] },
|
|
46
|
+
note: { id: 'n1', title: 'Live review', state: 'recording', lines: 3 }, topics: [{ id: 'capacity', text: 'Capacity', state: 'discussed', minutes: 4 }, { id: 'risks', text: 'Risks', state: 'now', minutes: 2 }],
|
|
47
|
+
runs: [{ topic: 'capacity', from_min: 0, to_min: 4 }, { topic: 'risks', from_min: 4, to_min: null }], gist: 'The room is weighing the risks to the date.', chips: [], tail: [{ who: 'Dara', text: 'Next the risks' }],
|
|
48
|
+
captured: { decisions: [{ text: 'Plan with eight people' }], actions: [], questions: [] }, material: [{ title: 'Q4 deck', kind: 'pmos-deck', ref: 'reports/q4', topic: 'Risks' }, { title: 'Wiki page', kind: 'link', url: 'https://x.example/w' }],
|
|
49
|
+
companion: { on: true, running: false, error: null } });
|
|
50
|
+
|
|
51
|
+
/* the stand-in recorder: the console's recorder makes these same requests; this one opens no microphone */
|
|
52
|
+
const RECORDER = () => {
|
|
53
|
+
window.__premiumRecorder = {
|
|
54
|
+
_id: null, _started: null, _banner: null, _hl: 0,
|
|
55
|
+
async listen(id) {
|
|
56
|
+
const r = await fetch('/api/notes/record', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id }) }).then((x) => x.json());
|
|
57
|
+
if (!r.ok) { this._banner = r.error; return false; }
|
|
58
|
+
this._id = id; this._started = Date.now() - 65000; return true;
|
|
59
|
+
},
|
|
60
|
+
async pause() { await fetch('/api/notes/pause', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: this._id }) }); this._id = null; },
|
|
61
|
+
async stop(id) { await fetch('/api/notes/stop', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id }) }); this._id = null; return { discarded: false }; },
|
|
62
|
+
highlight() { this._hl++; return true; }, highlighting() { return this._hl ? { state: 'listening', open: true } : null; },
|
|
63
|
+
listening() { return this._id; }, started() { return this._started; }, banner() { const b = this._banner; this._banner = null; return b; },
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
(async () => {
|
|
68
|
+
const exe = findBrowser();
|
|
69
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
70
|
+
let chromium;
|
|
71
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
72
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
73
|
+
await T.waitForServer(BASE);
|
|
74
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
75
|
+
|
|
76
|
+
const facts = () => { const f = F.facts(); f.meetings = [{ start: START.getTime(), end: END.getTime(), title: 'Live review', with: 'Priya, Dara', initiative: null }]; return f; };
|
|
77
|
+
const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
|
|
78
|
+
const open = async ({ w = 1280, h = 900, theme = 'light', notes = [], url = '/premium.html' } = {}) => {
|
|
79
|
+
const ctx = await browser.newContext({ viewport: { width: w, height: h } });
|
|
80
|
+
const page = await ctx.newPage();
|
|
81
|
+
const S = { errors: [], reqs: [], notes: notes.map((n) => ({ ...n })), newPosts: [], recPosts: [], pausePosts: [], stopPosts: [], savePosts: [], privPosts: [], focusGets: 0 };
|
|
82
|
+
page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
|
|
83
|
+
page.on('dialog', (d) => d.dismiss());
|
|
84
|
+
page.on('request', (r) => { if (r.url().startsWith(BASE)) S.reqs.push(r.method() + ' ' + new URL(r.url()).pathname); });
|
|
85
|
+
const noteBy = (id) => S.notes.find((n) => n.id === id);
|
|
86
|
+
const body = (r) => JSON.parse(r.request().postData() || '{}');
|
|
87
|
+
await page.route('**/api/briefing-premium*', (r) => json(r, { ok: true, state: 'ready', model: B.build(facts()), as_of: Date.now() }));
|
|
88
|
+
await page.route('**/api/calendar-views*', (r) => json(r, weekAnswer()));
|
|
89
|
+
await page.route('**/api/meeting-replay*', (r) => json(r, { ok: false, error: 'none' }, 404));
|
|
90
|
+
await page.route('**/api/meeting-material*', (r) => json(r, { ok: true, key: 'k', items: [] }));
|
|
91
|
+
await page.route('**/api/notes/one*', (r) => {
|
|
92
|
+
const n = noteBy(new URL(r.request().url()).searchParams.get('id'));
|
|
93
|
+
if (!n) return json(r, { ok: false, error: 'no such note' }, 404);
|
|
94
|
+
return json(r, { ok: true, note: { body: '', speakers: { system: 'Dara' }, transcript: [{ t: 4000, source: 'mic', text: 'Welcome everyone' }, { t: 9000, source: 'system', text: 'We plan eight people' }], highlights: [{ id: 'h1', text: 'Plan with eight people', from: 61000, cat: 'decision' }], ...n }, screen: { frames: [] } });
|
|
95
|
+
});
|
|
96
|
+
await page.route('**/api/notes/new', (r) => {
|
|
97
|
+
const b = body(r); S.newPosts.push(b);
|
|
98
|
+
const m = b.meeting || null;
|
|
99
|
+
let n = m ? S.notes.find((x) => x.meeting && x.meeting.event_id === m.event_id) : null;
|
|
100
|
+
if (!n) { n = { id: 'n' + (S.notes.length + 1), title: (m && m.title) || '', state: 'idle', updated_at: new Date().toISOString(), meeting: m ? { kind: 'event', event_id: m.event_id, start: m.start, title: m.title } : null }; S.notes.push(n); }
|
|
101
|
+
return json(r, { ok: true, note: n, reused: false });
|
|
102
|
+
});
|
|
103
|
+
await page.route('**/api/notes/record', (r) => { const b = body(r); S.recPosts.push(b); noteBy(b.id).state = 'recording'; return json(r, { ok: true }); });
|
|
104
|
+
await page.route('**/api/notes/pause', (r) => { const b = body(r); S.pausePosts.push(b); const n = noteBy(b.id); if (n) { n.state = 'paused'; n.resume_until = new Date(Date.now() + 3600000).toISOString(); } return json(r, { ok: true }); });
|
|
105
|
+
await page.route('**/api/notes/stop', (r) => { const b = body(r); S.stopPosts.push(b); const n = noteBy(b.id); if (n) n.state = 'ended'; return json(r, { ok: true }); });
|
|
106
|
+
await page.route('**/api/notes/save', (r) => { const b = body(r); S.savePosts.push(b); const n = noteBy(b.id); if (n) n.body = b.body; return json(r, { ok: true }); });
|
|
107
|
+
await page.route('**/api/notes/private', (r) => { const b = body(r); S.privPosts.push(b); const n = noteBy(b.id); if (n) n.private = !!b.private; return json(r, { ok: true, private: !!b.private }); });
|
|
108
|
+
await page.route(/\/api\/notes$/, (r) => json(r, { ok: true, notes: S.notes }));
|
|
109
|
+
await page.route(/\/api\/meeting-focus(\?|$)/, (r) => { S.focusGets++; return json(r, FOCUS()); });
|
|
110
|
+
await page.route('**/api/calendar-links', (r) => json(r, { ok: true }));
|
|
111
|
+
await page.addInitScript(RECORDER);
|
|
112
|
+
await page.goto(BASE + url + (url.includes('?') ? '&' : '?') + 'theme=' + theme);
|
|
113
|
+
if (url === '/premium.html') S.up = await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr').length > 0 && !!document.querySelector('#recCtl')), 20000);
|
|
114
|
+
return Object.assign(S, { ctx, page });
|
|
115
|
+
};
|
|
116
|
+
const chip = (p) => p.evaluate(() => { const c = document.querySelector('#recChip'); return c && !c.hidden ? c.textContent : null; });
|
|
117
|
+
const tabs = (p) => p.evaluate(() => [...document.querySelectorAll('#vTabs .vtab')].map((t) => t.textContent.trim()).join('|'));
|
|
118
|
+
const pane = (p, id) => p.evaluate((x) => { const e = document.querySelector(`#dOut .obody.vw[data-vw="${x}"]`); return e && !e.hidden ? e.textContent : ''; }, id);
|
|
119
|
+
|
|
120
|
+
/* R1 the Record control */
|
|
121
|
+
const A = await open();
|
|
122
|
+
ok('0 the Briefing opens with the Record control on its top bar', A.up);
|
|
123
|
+
if (!A.up) return finish(1);
|
|
124
|
+
const p = A.page;
|
|
125
|
+
ok('R1 Record says what it does before the press, and nothing was sent', await p.evaluate(() => /stay on this machine/.test(document.querySelector('#recCtl [data-rc="new"]').title)) && !A.reqs.some((r) => /^POST \/api\/notes/.test(r)));
|
|
126
|
+
await p.click('#recCtl [data-rc="menu"]');
|
|
127
|
+
const menu = await until(() => p.evaluate(() => { const m = document.querySelector('#recCtl .recm'); return m && !m.hidden ? m.textContent : ''; }));
|
|
128
|
+
if (process.env.SHOTS) await p.screenshot({ path: path.join(process.env.SHOTS, 'menu-1280.png') });
|
|
129
|
+
ok('R1 the arrow lists today\'s meeting under way, marked Now, and New note', /Live review/.test(menu) && /Now/.test(menu) && /New note/.test(menu), menu);
|
|
130
|
+
await p.click('#recCtl [data-rc="ev"]');
|
|
131
|
+
ok('R1 the first start asks "Tell everyone first" and sends nothing', await until(() => p.evaluate(() => /Tell everyone first/.test(document.querySelector('#recCtl .recm').textContent))) && A.newPosts.length === 0);
|
|
132
|
+
await p.click('#recCtl [data-rc="no"]');
|
|
133
|
+
ok('R1 Not yet closes the ask and sends nothing', await until(() => p.evaluate(() => document.querySelector('#recCtl .recm').hidden)) && A.newPosts.length === 0);
|
|
134
|
+
await p.click('#recCtl [data-rc="menu"]'); await until(() => p.evaluate(() => !!document.querySelector('#recCtl [data-rc="ev"]')));
|
|
135
|
+
await p.click('#recCtl [data-rc="ev"]'); await p.click('#recCtl [data-rc="go"]');
|
|
136
|
+
ok('R1 "I told them, start" makes the meeting\'s note and listens on it', await until(() => A.recPosts.length === 1) && A.newPosts[0].meeting && A.newPosts[0].meeting.event_id === 'ev-live' && A.recPosts[0].id === 'n1', JSON.stringify(A.newPosts));
|
|
137
|
+
ok('R1 the Record control hides while a note records', await until(() => p.evaluate(() => document.querySelector('#recCtl').hidden)));
|
|
138
|
+
|
|
139
|
+
/* R3 the Live notes tab */
|
|
140
|
+
ok('R3 the meeting\'s dialog opens with a Live notes tab beside its detail', await until(async () => /Live notes/.test(await tabs(p)) && /Live review/.test(await p.evaluate(() => document.querySelector('#dTitle').textContent))), await tabs(p));
|
|
141
|
+
const lv = await until(async () => { const t = await pane(p, 'rec:n1'); return /We plan eight people/.test(t) ? t : ''; });
|
|
142
|
+
ok('R3 the tab shows Recording with the clock, Highlight, Pause, Stop, Focus and Private', /Recording/.test(lv) && /1:0\d/.test(lv) && /Highlight/.test(lv) && /Pause/.test(lv) && /Stop/.test(lv) && /Focus/.test(lv) && /Private/.test(lv), lv.slice(0, 300));
|
|
143
|
+
ok('R3 the transcript names who spoke, and the highlight comes from the note', /You/.test(lv) && /Dara/.test(lv) && /Plan with eight people/.test(lv));
|
|
144
|
+
await p.fill('#dOut [data-rv-mine]', 'Ask Sam about the meter'); await p.click('#dOut .rvt');
|
|
145
|
+
ok('R3 your notes are saved through POST /api/notes/save when you leave the box', await until(() => A.savePosts.length === 1) && A.savePosts[0].id === 'n1' && A.savePosts[0].body === 'Ask Sam about the meter', JSON.stringify(A.savePosts));
|
|
146
|
+
await p.click('#dOut [data-rv="private"]');
|
|
147
|
+
ok('R3 Private asks first, saying what it deletes, and sends nothing yet', await until(() => p.evaluate(() => /deleted now/.test((document.querySelector('#dOut .vcf') || {}).textContent || ''))) && A.privPosts.length === 0);
|
|
148
|
+
await p.click('#dOut .vcf [data-a="0"]');
|
|
149
|
+
ok('R3 Cancel keeps the note as it was', await until(() => p.evaluate(() => !document.querySelector('#dOut .vcf'))) && A.privPosts.length === 0);
|
|
150
|
+
|
|
151
|
+
/* R2 the chip on the Briefing (the dialog sits over it, so it is closed first) */
|
|
152
|
+
await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
153
|
+
const c1 = await until(async () => { const t = await chip(p); return t && /Recording Live review/.test(t) ? t : ''; });
|
|
154
|
+
ok('R2 the chip on the Briefing has Highlight, Pause, Focus, Open and Stop', await p.evaluate(() => ['hl', 'pause', 'fv', 'open', 'stop'].every((a) => !!document.querySelector(`#recChip [data-r="${a}"]`))), c1);
|
|
155
|
+
await p.click('#recChip [data-r="hl"]');
|
|
156
|
+
ok('R2 Highlight starts the recorder\'s highlight and says so', await until(async () => /Highlighting/.test((await chip(p)) || '')) && await p.evaluate(() => window.__premiumRecorder._hl === 1));
|
|
157
|
+
|
|
158
|
+
/* R4 Focus */
|
|
159
|
+
await p.click('#recChip [data-r="fv"]');
|
|
160
|
+
const fv = await until(async () => { const t = await pane(p, 'focus:n1'); return /Risks/.test(t) ? t : ''; });
|
|
161
|
+
ok('R4 Focus opens as a tab with the topic now, the sentence, the lines, the counts and the material', /Now/.test(fv) && /weighing the risks/.test(fv) && /Next the risks/.test(fv) && /Captured so far/.test(fv) && /Q4 deck/.test(fv) && /Wiki page/.test(fv), fv.slice(0, 300));
|
|
162
|
+
ok('R4 a PMOS deck has Present and Audience view; a link has Open', await p.evaluate(() => { const li = [...document.querySelectorAll('#dOut .fvst li')]; return li.length === 2 && !!li[0].querySelector('[data-fv="present"]') && !!li[0].querySelector('[data-fv="aud"]') && !!li[1].querySelector('[data-fv="open"]') && !li[1].querySelector('[data-fv="present"]'); }));
|
|
163
|
+
const g0 = A.focusGets;
|
|
164
|
+
ok('R4 Focus reads again every 3 seconds while its tab is shown', await until(() => A.focusGets >= g0 + 2, 9000), String(A.focusGets - g0));
|
|
165
|
+
await p.click('#vTabs .vtab[data-vw="rec:n1"]');
|
|
166
|
+
const g1 = A.focusGets; await sleep(4000);
|
|
167
|
+
ok('R4 Focus stops reading while its tab is hidden', A.focusGets <= g1 + 1, String(A.focusGets - g1));
|
|
168
|
+
|
|
169
|
+
/* R3 Pause, Resume, Stop from the tab */
|
|
170
|
+
await p.click('#dOut [data-rv="pause"]');
|
|
171
|
+
ok('R3 Pause pauses through the route and the tab says Paused with Resume', await until(() => A.pausePosts.length === 1) && await until(async () => /Paused/.test(await pane(p, 'rec:n1')) && /Resume/.test(await pane(p, 'rec:n1'))));
|
|
172
|
+
await p.click('#dOut [data-rv="resume"]');
|
|
173
|
+
ok('R3 Resume listens again on the same note without asking twice', await until(() => A.recPosts.length === 2) && A.newPosts.length === 1);
|
|
174
|
+
await until(async () => /Recording/.test(await pane(p, 'rec:n1')));
|
|
175
|
+
await p.click('#dOut [data-rv="stop"]');
|
|
176
|
+
ok('R3 Stop asks first and says a stopped meeting cannot be resumed', await until(async () => /cannot be resumed/.test(await pane(p, 'rec:n1'))) && A.stopPosts.length === 0);
|
|
177
|
+
await p.click('#dOut [data-rv="stopgo"]');
|
|
178
|
+
ok('R3 Stop for good ends it through the route, and the Record control comes back', await until(() => A.stopPosts.length === 1) && await until(() => p.evaluate(() => !document.querySelector('#recCtl').hidden)));
|
|
179
|
+
ok('R5 no page error on the Briefing', A.errors.length === 0, A.errors.join(' | '));
|
|
180
|
+
await A.ctx.close();
|
|
181
|
+
|
|
182
|
+
/* R1 New note */
|
|
183
|
+
const N = await open();
|
|
184
|
+
await N.page.click('#recCtl [data-rc="new"]'); await N.page.click('#recCtl [data-rc="go"]');
|
|
185
|
+
ok('R1 New makes an untitled note with no meeting and listens on it', await until(() => N.recPosts.length === 1) && N.newPosts[0].title === '' && !N.newPosts[0].meeting);
|
|
186
|
+
ok('R1 a note with no meeting opens in a dialog of its own with its Live notes tab', await until(async () => /Live notes/.test(await tabs(N.page)) && /Untitled note/.test(await N.page.evaluate(() => document.querySelector('#dTitle').textContent))), await tabs(N.page));
|
|
187
|
+
ok('R1 the tab of a note with no meeting has no Focus', await until(async () => /Recording/.test(await pane(N.page, 'rec:n1'))) && !(await N.page.evaluate(() => !!document.querySelector('#dOut [data-rv="fv"]'))));
|
|
188
|
+
ok('R5 no page error with a new note', N.errors.length === 0, N.errors.join(' | '));
|
|
189
|
+
await N.ctx.close();
|
|
190
|
+
|
|
191
|
+
/* R2 another page */
|
|
192
|
+
const live = { id: 'n1', title: 'Live review', state: 'recording', updated_at: new Date().toISOString(), meeting: { kind: 'event', event_id: 'ev-live', start: iso(START), title: 'Live review' } };
|
|
193
|
+
const W = await open({ notes: [live], url: '/premium-work.html' });
|
|
194
|
+
ok('R2 My work shows the chip with only Open and Stop, and no Record control', await until(async () => !!(await chip(W.page))) && await W.page.evaluate(() => [...document.querySelectorAll('#recChip button')].map((b) => b.dataset.r).join() === 'open,stop' && !document.querySelector('#recCtl')), String(await chip(W.page)));
|
|
195
|
+
await W.ctx.close();
|
|
196
|
+
|
|
197
|
+
/* R5 floors: 390 px, light and dark */
|
|
198
|
+
for (const [w, th] of [[390, 'light'], [390, 'dark'], [1280, 'dark']]) {
|
|
199
|
+
const P = await open({ w, h: 844, theme: th });
|
|
200
|
+
await P.page.click('#recCtl [data-rc="new"]'); await P.page.click('#recCtl [data-rc="go"]');
|
|
201
|
+
await until(async () => /Recording/.test(await pane(P.page, 'rec:n1')));
|
|
202
|
+
if (w < 1000) await P.page.evaluate(() => { const t = document.querySelector('#dlg [data-tab="out"], #tabOut'); if (t) t.click(); });
|
|
203
|
+
const f = await P.page.evaluate(() => ({ scroll: document.documentElement.scrollWidth <= innerWidth + 1, btn: [...document.querySelectorAll('#dOut .obody.vw:not([hidden]) button, #recChip button')].filter((b) => b.offsetParent).map((b) => b.offsetHeight), who: [...document.querySelectorAll('#dOut .obody.vw:not([hidden]) button, #recChip button')].filter((b) => b.offsetParent && b.offsetHeight < 44).map((b) => b.className + ':' + b.textContent.trim()) }));
|
|
204
|
+
if (process.env.SHOTS) { await sleep(900); await P.page.screenshot({ path: path.join(process.env.SHOTS, `live-${w}-${th}.png`) }); await P.page.evaluate(() => { const b = document.querySelector('#dOut [data-rv="fv"]'); if (b) b.click(); }); await until(() => P.page.evaluate(() => !!document.querySelector('#dOut .fvnow'))); await P.page.screenshot({ path: path.join(process.env.SHOTS, `focus-${w}-${th}.png`) }); }
|
|
205
|
+
ok(`R5 at ${w} px (${th}) the Live notes tab has no sideways scroll and every press is at least 44 px`, f.scroll && f.btn.length && f.btn.every((n) => n >= 43.5), JSON.stringify(f));
|
|
206
|
+
await P.ctx.close();
|
|
207
|
+
}
|
|
208
|
+
return finish();
|
|
209
|
+
})().catch((e) => { console.error(e); finish(1); });
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* hold, cancel, archive and their Undo). Issue it on a document draft, read in a dialog, is POST /api/core-docs/issue (initiative premium-core-doc-issue). */
|
|
6
6
|
import { openWorkItem, recordPress } from './premium-vw-item.js';
|
|
7
7
|
import { pmPost } from './http.js';
|
|
8
|
+
import { openBacklog } from './premium-vw-backlog.js';
|
|
8
9
|
import { $, $$, esc, openDlg, closeDlg, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, CHECK, AI, store, crumbHtml, wireCrumb, kv, H, openAddDoc, setPageGaps } from './premium-shell.js';
|
|
9
10
|
import { issueBody } from './premium-doc-edit.js';
|
|
10
11
|
import { mountDocSheet } from './premium-doc-sheet.js';
|
|
@@ -116,6 +117,7 @@ function drawSide() {
|
|
|
116
117
|
: `<p class="empty3 plain">${esc(R.why)}</p>`;
|
|
117
118
|
}
|
|
118
119
|
$('#cSpr').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) openRow(rowOf(b.dataset.open)); });
|
|
120
|
+
$('#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)
|
|
119
121
|
$('#cRel').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) openRow(rowOf(b.dataset.open)); });
|
|
120
122
|
function docRow(d) {
|
|
121
123
|
const act = !d.act ? '' : d.act.kind === 'draft' ? `<button class="dmcta alt" data-draft="${esc(d.key)}"${d.running ? ' disabled' : ''}>${d.running ? '<span class="spin"></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>`;
|
|
@@ -194,6 +196,14 @@ function openRow(r) {
|
|
|
194
196
|
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)
|
|
195
197
|
setTimeout(() => { const b = $('#dBody'); b.scrollTop = b.scrollHeight; }, 120);
|
|
196
198
|
}
|
|
199
|
+
/* 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 */
|
|
200
|
+
function backlogBtn() {
|
|
201
|
+
const at = $('#oMain .paper'); if (!at || !M.board.id) return;
|
|
202
|
+
const w = document.createElement('div'); w.className = 'cact';
|
|
203
|
+
const b = document.createElement('button'); b.type = 'button'; b.className = 'cta alt'; b.id = 'openBacklog'; b.textContent = 'Open the backlog';
|
|
204
|
+
b.onclick = () => openBacklog({ ws: M.board.ws, board: M.board.id, title: 'Backlog' });
|
|
205
|
+
w.append(b); at.append(w);
|
|
206
|
+
}
|
|
197
207
|
$('#dBody').addEventListener('click', (e) => { const lt = e.target.closest('#logT'); if (lt) { const c = $('#alog').classList.toggle('col'); lt.setAttribute('aria-expanded', !c); } });
|
|
198
208
|
|
|
199
209
|
/* ── load: the routes derive the initiatives in the background, so the first answers are "reading" ───────────── */
|
|
@@ -121,6 +121,7 @@ export function meetingView(row, replay, material, extra) {
|
|
|
121
121
|
people,
|
|
122
122
|
notes, notesState: S ? 'ok' : replay ? replay.state : 'none', sheet: S || null,
|
|
123
123
|
notesLine: S ? '' : !replay ? 'Reading the notes.' : replay.state === 'error' ? 'The notes could not be read: ' + clip(replay.error, 120) : replay.state === 'none' ? 'No notes for this meeting.' : '',
|
|
124
|
+
brief: (extra && extra.brief) || null,
|
|
124
125
|
replay: rep && (rep.audio || heard) ? { minutes: heard, keyPoints: keys.length, lines: Array.isArray(rep.lines) ? rep.lines.length : 0 } : null,
|
|
125
126
|
material: material && material.state === 'ok' ? (material.items || []).map((i, n) => ({ n, title: clip(i.title || i.ref || i.url, 120), kind: i.kind || '', topic: clip(i.topic, 80), scope: i.scope === 'series' ? 'every meeting of this series' : 'this meeting', removable: i.from === 'you' && (i.scope === 'series' || i.scope === 'meeting'), line: removeLine(i) })) : null,
|
|
126
127
|
...prepOf(row, people, material, extra, aboutOf(row.level)),
|
|
@@ -388,6 +389,7 @@ export function mountMeeting(d) {
|
|
|
388
389
|
const ctx = { state: { wsId: d.ws() }, setState: bump, FIXTURE: ST.FIXTURE };
|
|
389
390
|
R = {
|
|
390
391
|
listen: (id) => V.listenNow(ctx, id), pause: () => V.pauseListening(ctx), listening: () => V.listeningId(), started: () => V.liveStarted(), banner: () => V.takeBanner(),
|
|
392
|
+
highlight: (id) => V.highlightNow(ctx, id), highlighting: () => V.highlightBusy(),
|
|
391
393
|
async stop(id) {
|
|
392
394
|
const one = await d.pmGet('/api/notes/one?id=' + encodeURIComponent(id)), note = one && one.ok ? one.note : null;
|
|
393
395
|
const { discardable } = await import('./note-dock.js');
|
|
@@ -406,6 +408,19 @@ export function mountMeeting(d) {
|
|
|
406
408
|
if (!made || made.ok !== true) return { ok: false, error: (made && made.error) || 'The note was not made.' };
|
|
407
409
|
return ctl.resume(made.note.id);
|
|
408
410
|
},
|
|
411
|
+
/** New in the Record control: an untitled note with no meeting, listened to at once (the console's recordNew). */
|
|
412
|
+
async fresh() {
|
|
413
|
+
if (HOLD || liveRows(NR).some((n) => n.state === 'recording')) return { ok: false, error: 'A meeting is recording. Pause or stop it first.' };
|
|
414
|
+
const made = await d.pmPost('/api/notes/new', { title: '' });
|
|
415
|
+
if (!made || made.ok !== true) return { ok: false, error: (made && made.error) || 'The note was not made.' };
|
|
416
|
+
const res = await ctl.resume(made.note.id); return res.ok ? { ok: true, id: made.note.id } : res;
|
|
417
|
+
},
|
|
418
|
+
/** Highlight: the last 30 seconds and the next ones, made into a highlight from the transcript when the window closes (the console's highlightNow). */
|
|
419
|
+
async highlight() {
|
|
420
|
+
if (!HOLD) return { ok: false, error: 'This page is not recording.' };
|
|
421
|
+
const rec = await recorder(); const ok = rec.highlight ? rec.highlight(HOLD.id) : false;
|
|
422
|
+
return ok === false ? { ok: false, error: 'The highlight was not started.' } : { ok: true };
|
|
423
|
+
},
|
|
409
424
|
async resume(id) {
|
|
410
425
|
const rec = await recorder(); const ok = await rec.listen(id);
|
|
411
426
|
await readNotes();
|
|
@@ -422,7 +437,14 @@ export function mountMeeting(d) {
|
|
|
422
437
|
return res && res.ok === true ? { ok: true } : { ok: false, error: (res && res.error) || 'The meeting was not stopped.' };
|
|
423
438
|
},
|
|
424
439
|
};
|
|
425
|
-
|
|
440
|
+
/** Today's meetings the Record menu lists: of today, not ended more than 10 minutes ago (recordable), from the week the card read. */
|
|
441
|
+
async function todayRows() {
|
|
442
|
+
if (!W || W.state !== 'ok') await readWeek();
|
|
443
|
+
return W && W.state === 'ok' ? W.days.flatMap((x) => x.rows).filter((r) => recordable(r)) : [];
|
|
444
|
+
}
|
|
445
|
+
window.__premiumRec = { pause: ctl.pause, resume: ctl.resume, stop: ctl.stop, record: ctl.record, fresh: ctl.fresh, highlight: ctl.highlight, today: todayRows,
|
|
446
|
+
highlighting: () => { const r = window.__premiumRecorder || R; return r && r.highlighting ? r.highlighting() : null; }, started: () => { const r = window.__premiumRecorder || R; return r ? r.started() : null; }, notes: () => NR,
|
|
447
|
+
note: (id) => NR.find((n) => n.id === id) || null, refresh: readNotes, open: (id) => openNote(id) };
|
|
426
448
|
/* Leaving the Briefing while it holds the recorder: the browser asks first, and if the PM leaves, the meeting is paused (it stays open for an hour) so the record never says "recording" for audio nobody is capturing. */
|
|
427
449
|
addEventListener('beforeunload', (e) => { if (HOLD) { e.preventDefault(); e.returnValue = ''; } });
|
|
428
450
|
addEventListener('pagehide', () => { if (HOLD) d.pmPost('/api/notes/pause', { id: HOLD.id }, { keepalive: true }); });
|
|
@@ -495,7 +517,7 @@ export function mountMeeting(d) {
|
|
|
495
517
|
const tops = secH('Topics', v.planned.length ? 'planned' : '') + (v.planned.length ? `<div class="tops">${v.planned.map((t, i) => `<div class="tp plan"><i>${i + 1}</i><span>${esc(clip(t.text, 120))}</span><small>planned</small></div>`).join('')}</div>` : '<p class="mut">The meeting has no topics yet.</p>');
|
|
496
518
|
/* After: from the note's own record when the meeting has one (premium-vw-meet.js), else the decisions, steps and questions the replay answer holds */
|
|
497
519
|
const task = { has: (i) => ui.tasked.has(i) };
|
|
498
|
-
const sx = { esc, tasked: task, replayBtn: !!v.replay, where: 'meeting', id: S ? S.id : null };
|
|
520
|
+
const sx = { esc, tasked: task, replayBtn: !!v.replay, where: 'meeting', id: S ? S.id : null, brief: v.brief };
|
|
499
521
|
const after = S ? stageHtml('after', S, sx)
|
|
500
522
|
: secH('Notes', v.notesLine ? '' : 'from the meeting note') + (v.notesLine ? `<p class="mut">${esc(v.notesLine)}</p>` : (n.title ? `<p><b>${esc(n.title)}</b></p>` : '') + notesTablesHtml(n, esc, task) + ((n.decisions.length + n.actions.length + n.questions.length) ? '' : '<p class="mut">The note holds no decisions, next steps or questions yet.</p>'))
|
|
501
523
|
+ (v.replay ? secH('Replay', 'kept on this machine') + `<p>A recording is kept: ${v.replay.minutes ? v.replay.minutes + ' min, ' : ''}${v.replay.keyPoints} key ${v.replay.keyPoints === 1 ? 'point' : 'points'}.</p><div class="mtg-foot"><button class="addb pri" data-m3="replay">Replay</button><span class="note">Plays the note’s audio kept on this machine, with the transcript and the key points.</span></div>` : '');
|
|
@@ -543,7 +565,7 @@ export function mountMeeting(d) {
|
|
|
543
565
|
const pane = $('#dOut'), top = pane ? pane.scrollTop : 0, same = ui.last === ui.view; ui.last = ui.view;
|
|
544
566
|
$('#oMain').innerHTML = ({ add: () => sheetHtml(row), focus: focusHtml, replay: replayHtml }[ui.view] || (() => detailHtml(view(), boards, inis, saved, ui)))();
|
|
545
567
|
if (ui.view === 'add') paintSheet();
|
|
546
|
-
else if (ui.view === 'detail') { const S = view().sheet, sx = { esc, tasked: { has: (i) => ui.tasked.has(i) }, replayBtn: !!view().replay, where: 'meeting', id: S ? S.id : null, reread: async () => { await readSheet(); paint(); } }; for (const [k] of PHASES) wireStage(k, $(`#oMain .vm-body[data-part="${k}"]`), S, sx); }
|
|
568
|
+
else if (ui.view === 'detail') { const S = view().sheet, sx = { esc, tasked: { has: (i) => ui.tasked.has(i) }, replayBtn: !!view().replay, where: 'meeting', id: S ? S.id : null, brief: extra.brief || null, reread: async () => { await readSheet(); paint(); } }; for (const [k] of PHASES) wireStage(k, $(`#oMain .vm-body[data-part="${k}"]`), S, sx); }
|
|
547
569
|
if (pane && same) pane.scrollTop = top;
|
|
548
570
|
};
|
|
549
571
|
const alive = (v) => ui.view === v && $('#dlg').classList.contains('on') && $('#dTitle').textContent === row.title;
|
|
@@ -729,9 +751,10 @@ export function mountMeeting(d) {
|
|
|
729
751
|
if ($('#dTitle').textContent !== row.title) return;
|
|
730
752
|
pickPhase(); paint(); if (HOLD) tickClock(); mark();
|
|
731
753
|
{
|
|
732
|
-
|
|
754
|
+
/* the meeting prep for Before: the brief the console's Calendar card shows (GET /api/meeting-focus, lib/calendar-layers.js briefOf) */
|
|
755
|
+
const sk = (noteOfRow(NR, row) || {}).series, [sr, tp, mf] = await Promise.all([sk && sk.key ? d.pmGet('/api/notes/series?key=' + encodeURIComponent(sk.key)) : null, d.pmGet(matPath() + '&topics=1'), d.pmGet('/api/meeting-focus?event=' + encodeURIComponent(row.id) + '&date=' + row.day)]);
|
|
733
756
|
if ($('#dTitle').textContent !== row.title) return;
|
|
734
|
-
extra = { ...extra, prev: prevOf(sr, row), topics: tp && tp.ok && Array.isArray(tp.topics) ? tp.topics.filter((t) => t && t.text).slice(0, 8) : [] };
|
|
757
|
+
extra = { ...extra, prev: prevOf(sr, row), topics: tp && tp.ok && Array.isArray(tp.topics) ? tp.topics.filter((t) => t && t.text).slice(0, 8) : [], brief: mf && mf.ok === true && mf.brief ? mf.brief : null };
|
|
735
758
|
if (ui.view === 'detail') paint();
|
|
736
759
|
}
|
|
737
760
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { pmGet, pmPost } from './http.js';
|
|
3
3
|
import { recChipView, STOP_LINE } from './premium-meeting.js';
|
|
4
4
|
import { vwReset } from './premium-viewer.js';
|
|
5
|
+
import { chipActs, openLive, openFocus, mountRecord, HL_LINE } from './premium-vw-rec.js';
|
|
5
6
|
import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words.js';
|
|
6
7
|
export const $ = (s, r = document) => r.querySelector(s);
|
|
7
8
|
export const $$ = (s, r = document) => [...r.querySelectorAll(s)];
|
|
@@ -295,17 +296,21 @@ function mountRecChip(here) {
|
|
|
295
296
|
if (!v) { c.hidden = true; c.innerHTML = ''; ask = false; return; }
|
|
296
297
|
c.hidden = false; c.dataset.mode = v.mode;
|
|
297
298
|
if (ask) { c.innerHTML = `<span>Stop “${esc(v.title)}” for good? ${esc(STOP_LINE)}</span><button data-r="no">Cancel</button>${v.held ? '<button data-r="pause">Pause instead</button>' : ''}<button data-r="stopgo">Stop for good</button>`; return; }
|
|
298
|
-
|
|
299
|
+
const L = { hl: 'Highlight', pause: 'Pause', fv: 'Focus', open: 'Open', resume: 'Resume', stop: 'Stop' }; // the presses premium-vw-rec.js gives this page
|
|
300
|
+
c.innerHTML = `<i${v.mode === 'paused' ? ' class="paused"' : ''}></i><span>${esc(msg || v.text)}</span>${chipActs(v, here).map((a) => `<button data-r="${a}"${a === 'hl' ? ` title="${esc(HL_LINE)}"` : ''}>${L[a]}</button>`).join('')}`;
|
|
299
301
|
};
|
|
300
302
|
const read = async () => { const r = await pmGet('/api/notes'); if (r && r.ok === true && Array.isArray(r.notes)) rows = r.notes; draw(); };
|
|
301
303
|
c.addEventListener('click', async (e) => {
|
|
302
304
|
const b = e.target.closest('button'); if (!b) return;
|
|
303
305
|
const v = recChipView(rows, { holdingId: holding(), here }); if (!v) return;
|
|
304
306
|
const act = b.dataset.r; msg = '';
|
|
305
|
-
|
|
307
|
+
const d = { openDlg, toast, pmGet, pmPost };
|
|
308
|
+
if (act === 'open') { if (here === 'brief' && window.__premiumRec) openLive(v.id, d); else location.assign('/premium.html?meeting=' + encodeURIComponent(v.id)); return; }
|
|
309
|
+
if (act === 'fv') { openFocus(v.id, d); return; }
|
|
306
310
|
if (act === 'stop') { ask = true; draw(); const g = c.querySelector('[data-r="no"]'); if (g) g.focus(); return; }
|
|
307
311
|
if (act === 'no') { ask = false; draw(); return; }
|
|
308
312
|
b.disabled = true;
|
|
313
|
+
if (act === 'hl') { const r = window.__premiumRec ? await window.__premiumRec.highlight() : { ok: false }; msg = r.ok ? 'Highlighting the last 30 seconds and the next ones.' : (r.error || 'The highlight was not started.'); draw(); setTimeout(() => { msg = ''; draw(); }, 6000); return; }
|
|
309
314
|
if (act === 'pause') { ask = false; const r = window.__premiumRec ? await window.__premiumRec.pause() : { ok: false }; msg = r.ok ? '' : (r.error || 'It was not paused.'); }
|
|
310
315
|
else if (act === 'resume') { const r = window.__premiumRec ? await window.__premiumRec.resume(v.id) : { ok: false }; msg = r.ok ? '' : (r.error || 'It was not resumed.'); }
|
|
311
316
|
else if (act === 'stopgo') {
|
|
@@ -317,6 +322,7 @@ function mountRecChip(here) {
|
|
|
317
322
|
});
|
|
318
323
|
addEventListener('premium-rec', read);
|
|
319
324
|
read(); setInterval(read, 20000);
|
|
325
|
+
mountRecord(here, { openDlg, toast, pmGet, pmPost });
|
|
320
326
|
}
|
|
321
327
|
export function wireRail(here) {
|
|
322
328
|
mountRecChip(here);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
:root{--fs-1:11px;--fs-2:12px;--fs-3:14px;--fs-4:16px;--fs-5:20px;--fs-6:28px}
|
|
2
|
+
/* pm/premium-vw-backlog.css — the Jira backlog as a viewer tab (initiative premium-viewer, R10; premium-vw-backlog.js).
|
|
3
|
+
* Loaded once by vwStyle('backlog'). Sizes are only var(--fs-1..6), weights 400/500/600 (premium-console-type.test.js). */
|
|
4
|
+
.vbl .bl{display:grid;gap:14px}
|
|
5
|
+
.vbl .bl-src{margin:0;font-size:var(--fs-2);color:var(--ink-3)}
|
|
6
|
+
.vbl .bl-f{display:flex;gap:4px;flex-wrap:wrap;padding:4px;border-radius:8px;background:var(--well);width:max-content;max-width:100%}
|
|
7
|
+
.vbl .bl-f button{min-height:44px;padding:0 16px;border-radius:6px;font-size:var(--fs-2);font-weight:600;color:var(--ink-2)}
|
|
8
|
+
.vbl .bl-f button[aria-pressed="true"]{background:var(--solid);color:var(--on-solid)}
|
|
9
|
+
.vbl .bl-s{background:var(--card-solid);border:1px solid var(--hair);border-radius:8px;box-shadow:var(--card-shadow);overflow:hidden}
|
|
10
|
+
.vbl .bl-h{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px 14px;border-bottom:1px solid var(--hair)}
|
|
11
|
+
.vbl .bl-h b{font-size:var(--fs-3);font-weight:600}
|
|
12
|
+
.vbl .bl-h small{font-size:var(--fs-2);color:var(--ink-3)}
|
|
13
|
+
.vbl .bl-gap{flex:1}
|
|
14
|
+
.vbl .bl-rws{list-style:none;margin:0;padding:0}
|
|
15
|
+
.vbl .bl-rw{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:4px 14px;border-top:1px solid var(--hair)}
|
|
16
|
+
.vbl .bl-rw:first-child{border-top:0}
|
|
17
|
+
.vbl .bl-rw.risk{box-shadow:inset 3px 0 0 var(--bad)}
|
|
18
|
+
.vbl .bl-t{flex:1 1 220px;min-width:0;min-height:44px;display:flex;align-items:center;gap:10px;text-align:left;font-size:var(--fs-3);color:var(--ink)}
|
|
19
|
+
.vbl .bl-t b{font-weight:500;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
20
|
+
@media (hover:hover){.vbl .bl-t:hover b{text-decoration:underline;text-underline-offset:3px}}
|
|
21
|
+
.vbl .bl-k{font:500 var(--fs-2) var(--mono);color:var(--ink-3);flex:none}
|
|
22
|
+
.vbl .bl-m{display:flex;align-items:center;gap:8px;flex:none}
|
|
23
|
+
.vbl .bl-st{font-size:var(--fs-1);font-weight:600;padding:2px 8px;border-radius:6px;background:var(--well);color:var(--ink-2)}
|
|
24
|
+
.vbl .bl-st.doing{color:var(--ember-ink)}
|
|
25
|
+
.vbl .bl-p{font:500 var(--fs-2) var(--mono);min-width:24px;text-align:center;padding:1px 6px;border-radius:6px;border:1px solid var(--hair);color:var(--ink-2)}
|
|
26
|
+
.vbl .bl-in{font-size:var(--fs-2);color:var(--ink-3);max-width:16ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
27
|
+
.vbl .bl-why{flex-basis:100%;margin:-6px 0 6px;font-size:var(--fs-2);color:var(--bad)}
|
|
28
|
+
.vbl .bl-none,.vbl .bl-empty{margin:0;padding:12px 14px;font-size:var(--fs-2);color:var(--ink-3)}
|
|
29
|
+
.vbl .bl-f button:focus-visible,.vbl .bl-t:focus-visible{outline:2px solid var(--ember);outline-offset:2px}
|
|
30
|
+
@media (max-width:560px){.vbl .bl-in{display:none}}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* pm/premium-vw-backlog.js — the Jira backlog of a board as a viewer tab (initiative premium-viewer, R10).
|
|
2
|
+
* The open sprints first (active, then the next ones), then the Backlog: the board's tickets in no sprint and not done. Each row shows
|
|
3
|
+
* its key, title, status, points and initiative; a blocked ticket says why. A row opens its ticket (the Jira ticket tab when that view
|
|
4
|
+
* is on the page, else its Jira page).
|
|
5
|
+
*
|
|
6
|
+
* WHERE EACH PART COMES FROM. GET /api/boards/sprints?ws&board answers { source, readAt, sprints, backlog } (lib/routes-boards.js;
|
|
7
|
+
* scripts/boards.js sprintsOf and backlogOf), read from the Jira status check's saved readings. Nothing is invented. What the records
|
|
8
|
+
* do not hold is not drawn, and the tab says so once:
|
|
9
|
+
* - only the tickets PMOS knows: the ones the board's initiatives pushed, or the children of their linked epics. The rest of the Jira
|
|
10
|
+
* backlog is not read.
|
|
11
|
+
* - no rank (the list goes by key), no assignee, no sprint capacity: the readings hold none of them.
|
|
12
|
+
* - read-only: moving a ticket between sprints or ranking it happens in Jira (Jira owns sprint and rank, D88). */
|
|
13
|
+
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
14
|
+
|
|
15
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
16
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
17
|
+
const dm = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(d || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
|
|
18
|
+
const pts = (n) => (Math.round(n * 10) / 10) + (n === 1 ? ' point' : ' points');
|
|
19
|
+
const STATE = { active: 'Active', future: 'Next' };
|
|
20
|
+
|
|
21
|
+
/** The tab's model from the answer of /api/boards/sprints: { readAt, sections: [{ id, name, sub, items, points, rows }], links, empty } or null. */
|
|
22
|
+
export function backlogModel(r) {
|
|
23
|
+
if (!r || r.ok !== true) return null;
|
|
24
|
+
const bl = r.backlog || { issues: [], points: null, links: {}, readAt: null };
|
|
25
|
+
const row = (i) => ({ key: i.key, title: i.summary || i.key, status: i.status || '', cat: i.category || 'todo', points: typeof i.points === 'number' ? i.points : null,
|
|
26
|
+
type: i.type || null, initiative: i.initiative || null, blocked: i.flagged ? (i.reason || 'Blocked') : null, stale: !!i.stale, url: (bl.links || {})[i.key] || null });
|
|
27
|
+
const sum = (p, n) => (p ? pts(p.committed) + (p.unestimated ? ', ' + p.unestimated + ' not estimated' : '') : n ? 'Not estimated' : '');
|
|
28
|
+
const open = (Array.isArray(r.sprints) ? r.sprints : []).filter((s) => s.state === 'active' || s.state === 'future');
|
|
29
|
+
const sections = open.map((s) => ({
|
|
30
|
+
id: 'sp:' + s.name, name: s.name, state: s.state,
|
|
31
|
+
sub: [STATE[s.state], [dm(s.start), dm(s.end)].filter(Boolean).join(' – ')].filter(Boolean).join(' · '),
|
|
32
|
+
items: (s.issues || []).length, points: sum(s.points, (s.issues || []).length), rows: (s.issues || []).map(row),
|
|
33
|
+
}));
|
|
34
|
+
const rows = (bl.issues || []).map(row);
|
|
35
|
+
sections.push({ id: 'backlog', name: 'Backlog', state: 'backlog', sub: '', items: rows.length, points: sum(bl.points, rows.length), rows });
|
|
36
|
+
const readAt = [r.readAt, bl.readAt].filter(Boolean).sort()[0] || null; // the oldest read is the honest age
|
|
37
|
+
return { readAt, sections, empty: r.source !== 'jira' && !rows.length, bugs: sections.some((s) => s.rows.some((x) => /bug/i.test(x.type || ''))) };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Which rows a filter keeps: '' all, 'blocked', 'bug'. */
|
|
41
|
+
export const keep = (f) => (x) => (!f ? true : f === 'blocked' ? !!x.blocked : f === 'bug' ? /bug/i.test(x.type || '') : true);
|
|
42
|
+
|
|
43
|
+
const ago = (iso) => { const t = new Date(iso); if (!Number.isFinite(t.getTime())) return ''; return 'read ' + dm(t.toISOString()) + ' ' + String(t.getHours()).padStart(2, '0') + ':' + String(t.getMinutes()).padStart(2, '0'); };
|
|
44
|
+
const chip = (x) => `<span class="bl-st ${x.cat}">${esc(x.status || (x.cat === 'doing' ? 'In progress' : 'To do'))}</span>`;
|
|
45
|
+
function rowHtml(x) {
|
|
46
|
+
return `<li class="bl-rw${x.blocked ? ' risk' : ''}"><button type="button" class="bl-t" data-tk="${esc(x.key)}"${x.url ? ` data-url="${esc(x.url)}"` : ''}${x.initiative ? ` data-ini="${esc(x.initiative)}"` : ''}><span class="bl-k">${esc(x.key)}</span><b>${esc(x.title)}</b></button>`
|
|
47
|
+
+ `<span class="bl-m">${chip(x)}${x.points != null ? `<span class="bl-p" title="Story points">${esc(x.points)}</span>` : ''}${x.initiative ? `<span class="bl-in">${esc(x.initiative)}</span>` : ''}</span>`
|
|
48
|
+
+ (x.blocked ? `<span class="bl-why">${esc(x.blocked)}</span>` : '') + (x.stale ? '<span class="bl-why">Not in the last read</span>' : '') + '</li>';
|
|
49
|
+
}
|
|
50
|
+
export function backlogHtml(m, f = '') {
|
|
51
|
+
if (!m) return '<p class="bl-empty">The backlog could not be read. Try again in a moment.</p>';
|
|
52
|
+
if (m.empty) return '<p class="bl-empty">No Jira reading for this board yet. The backlog appears once the Jira status check has read the initiatives\' tickets.</p>';
|
|
53
|
+
const opts = [['', 'All'], ['blocked', 'Blocked']].concat(m.bugs ? [['bug', 'Bugs']] : []);
|
|
54
|
+
const secs = m.sections.map((s) => {
|
|
55
|
+
const rows = s.rows.filter(keep(f));
|
|
56
|
+
return `<section class="bl-s" data-sec="${esc(s.id)}"><div class="bl-h"><b>${esc(s.name)}</b>${s.sub ? `<small>${esc(s.sub)}</small>` : ''}<span class="bl-gap"></span><small>${s.items} ${s.items === 1 ? 'item' : 'items'}${s.points ? ' · ' + esc(s.points) : ''}</small></div>`
|
|
57
|
+
+ (rows.length ? `<ul class="bl-rws">${rows.map(rowHtml).join('')}</ul>` : `<p class="bl-none">${s.items ? 'None match this filter.' : s.state === 'backlog' ? 'No ticket of this board is outside a sprint.' : 'No ticket in this sprint.'}</p>`) + '</section>';
|
|
58
|
+
}).join('');
|
|
59
|
+
return `<div class="bl"><p class="bl-src">From Jira${m.readAt ? ' · ' + esc(ago(m.readAt)) : ''}. Only the tickets this board's initiatives pushed or hold under their epics, by key. Ranking and moving between sprints happen in Jira.</p>`
|
|
60
|
+
+ `<div class="bl-f" role="group" aria-label="Show">${opts.map((o) => `<button type="button" data-f="${o[0]}" aria-pressed="${f === o[0]}">${o[1]}</button>`).join('')}</div>${secs}</div>`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Opens one ticket: the Jira ticket tab when its view is on the page, else the ticket's Jira page. */
|
|
64
|
+
async function openTicket({ ws, board, initiative, key, url }) {
|
|
65
|
+
if (initiative) { try { const J = await import('./premium-vw-jira.js'); if (J && typeof J.openTicket === 'function') { J.openTicket({ ws, board, initiative, ref: key }); return; } } catch { /* no ticket view on this page */ } }
|
|
66
|
+
if (url) window.open(url, '_blank', 'noopener');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Opens the backlog of a board as a viewer tab. */
|
|
70
|
+
export function openBacklog({ ws, board, title } = {}) {
|
|
71
|
+
vwStyle('backlog');
|
|
72
|
+
let m = null; let f = '';
|
|
73
|
+
const draw = (el) => { el.innerHTML = `<div class="vbl">${m === undefined ? '<p class="bl-empty">Reading the backlog…</p>' : backlogHtml(m, f)}</div>`; };
|
|
74
|
+
return vwOpen({
|
|
75
|
+
id: 'backlog:' + (board || ''), title: title || 'Backlog', icon: 'list',
|
|
76
|
+
render: async (el) => {
|
|
77
|
+
m = undefined; draw(el);
|
|
78
|
+
const q = new URLSearchParams(); if (ws) q.set('ws', ws); if (board) q.set('board', board);
|
|
79
|
+
let r = null;
|
|
80
|
+
try { const res = await fetch('/api/boards/sprints?' + q, { credentials: 'same-origin' }); r = await res.json(); } catch { r = null; }
|
|
81
|
+
m = backlogModel(r); draw(el);
|
|
82
|
+
},
|
|
83
|
+
wire: (el) => {
|
|
84
|
+
el.onclick = (e) => { // delegated: the pane's content is drawn again on each filter
|
|
85
|
+
const b = e.target.closest('[data-f]'); if (b) { f = b.dataset.f; draw(el); return; }
|
|
86
|
+
const t = e.target.closest('[data-tk]'); if (t) openTicket({ ws, board, initiative: t.dataset.ini || null, key: t.dataset.tk, url: t.dataset.url || null });
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (typeof window !== 'undefined') window.__premiumVwBacklog = { openBacklog };
|
|
@@ -48,6 +48,7 @@ export function bodyHtml(src, o = {}) {
|
|
|
48
48
|
while (i < L.length) {
|
|
49
49
|
const l = L[i];
|
|
50
50
|
if (!l.trim()) { i++; continue; }
|
|
51
|
+
if (/^\s*<!--.*-->\s*$/.test(l)) { out.push(`<div class="vwcm" hidden contenteditable="false" data-cm="${esc(l)}"${i && L[i - 1].trim() ? ' data-tight="1"' : ''}></div>`); i++; continue; } // a whole-line HTML comment (pmos:note, pmos:slide): kept, never drawn
|
|
51
52
|
if (/^```/.test(l)) { const lang = l.slice(3).trim(), buf = []; i++; while (i < L.length && !/^```/.test(L[i])) buf.push(L[i++]); i++; out.push(codeBlock(lang, buf.join('\n'))); continue; }
|
|
52
53
|
const h = /^(#{1,6})\s+(.*)$/.exec(l);
|
|
53
54
|
if (h) { const lv = Math.min(4, Math.max(2, h[1].length)), id = 'vwh' + (start + heads.length); heads.push([lv, h[2].replace(/[*_`]/g, ''), id]); out.push(`<h${lv} id="${id}" data-md="${h[1].length}">${inl(h[2])}</h${lv}>`); i++; continue; }
|
|
@@ -82,7 +83,7 @@ export function bodyHtml(src, o = {}) {
|
|
|
82
83
|
const b = bodyHtml(buf.join('\n'), { start: start + heads.length }); heads.push(...b.heads);
|
|
83
84
|
out.push(`<details class="xp"><summary>${inl(sm ? sm[1] : 'Details')}</summary><div>${b.html}</div></details>`); continue;
|
|
84
85
|
}
|
|
85
|
-
const buf = []; while (i < L.length && L[i].trim() && !/^(#{1,6}\s|>|\s*\||```|<details|(-{3,}|\*{3,}|_{3,})\s*$)/.test(L[i]) && !isList(L[i])) buf.push(L[i++].trim());
|
|
86
|
+
const buf = []; while (i < L.length && L[i].trim() && !/^(#{1,6}\s|>|\s*\||```|<details|(-{3,}|\*{3,}|_{3,})\s*$|\s*<!--.*-->\s*$)/.test(L[i]) && !isList(L[i])) buf.push(L[i++].trim());
|
|
86
87
|
if (!buf.length) buf.push(L[i++]);
|
|
87
88
|
out.push(`<p>${inl(buf.join(' '))}</p>`);
|
|
88
89
|
}
|
|
@@ -173,7 +174,7 @@ export function mergeEdit(orig, base, now) {
|
|
|
173
174
|
const out = { fmRaw: O.fmRaw, pre: B.pre.trim() === N.pre.trim() ? O.pre : N.pre, sections: [] };
|
|
174
175
|
for (const s of N.sections) {
|
|
175
176
|
const b = bOf.get(s.name), o = oOf.get(s.name);
|
|
176
|
-
out.sections.push(same(s, b) && o ? o : { name: s.name, head: s.head, body: '\n' + s.body.trim() + '\n' });
|
|
177
|
+
out.sections.push(same(s, b) && o ? o : { name: s.name, head: s.head, body: (/^\S/.test(s.body) ? '' : '\n') + s.body.trim() + '\n' });
|
|
177
178
|
}
|
|
178
179
|
let t = joinDoc(out);
|
|
179
180
|
if (/\n$/.test(orig) && !/\n$/.test(t)) t += '\n';
|
|
@@ -169,3 +169,4 @@
|
|
|
169
169
|
.vwcp a{color:var(--vw-lnk);font-size:var(--fs-2)}
|
|
170
170
|
@media (max-width:640px){.vwchip,.vwli>button{min-height:44px}}
|
|
171
171
|
@media (hover:hover){.vwbtn:hover{background:var(--well)}.cf a:hover{text-decoration:underline}.vwtb:hover{background:var(--well);color:var(--ink)}.vwpop button:hover{background:var(--well)}.vwxmn a:hover{background:var(--well)}.vwli>button:hover{background:var(--well)}}
|
|
172
|
+
.cfb .vwcm{display:none}
|
|
@@ -38,12 +38,15 @@ function inlineMd(n) {
|
|
|
38
38
|
return s;
|
|
39
39
|
}).join('');
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
const TIGHT = '\u0000'; // marks a comment that sat on the line right after the block before it
|
|
42
|
+
export function domToMd(root) { return mdOf(root).replace(/\n\n\u0000/g, '\n').replace(/\u0000/g, ''); }
|
|
43
|
+
function mdOf(root) {
|
|
42
44
|
const B = [];
|
|
43
45
|
for (const c of root.children) {
|
|
44
46
|
const t = c.tagName, cl = c.classList;
|
|
45
|
-
if (cl.contains('vwchg')) { if (!c.dataset.hidden) { const inner = $('.vwcb', c); if (inner) B.push(
|
|
47
|
+
if (cl.contains('vwchg')) { if (!c.dataset.hidden) { const inner = $('.vwcb', c); if (inner) B.push(mdOf(inner)); } continue; }
|
|
46
48
|
if (cl.contains('vwbefore') || cl.contains('vwcl')) continue;
|
|
49
|
+
if (cl.contains('vwcm')) { B.push((c.dataset.tight ? TIGHT : '') + c.dataset.cm); continue; } // a whole-line HTML comment goes back as it was
|
|
47
50
|
if (cl.contains('pnl')) B.push(`> [!${String(c.dataset.k || 'note').toUpperCase()}]\n` + [...$('.pc', c).children].map((x) => '> ' + inlineMd(x).trim()).join('\n>\n'));
|
|
48
51
|
else if (cl.contains('tw') || t === 'TABLE') {
|
|
49
52
|
const rows = [...c.querySelectorAll('tr')].map((r) => '| ' + [...r.children].map((x) => inlineMd(x).trim().replace(/\|/g, '\\|')).join(' | ') + ' |');
|
|
@@ -54,8 +57,8 @@ export function domToMd(root) {
|
|
|
54
57
|
else if (t === 'UL' || t === 'OL') B.push([...c.children].map((li, k) => `${t === 'OL' ? k + 1 + '.' : '-'} ${inlineMd(li).trim()}`).join('\n'));
|
|
55
58
|
else if (t === 'BLOCKQUOTE') B.push('> ' + inlineMd(c).trim());
|
|
56
59
|
else if (t === 'HR') B.push('---');
|
|
57
|
-
else if (t === 'DETAILS') { const sm = $('summary', c); B.push(`<details><summary>${sm ? sm.textContent.trim() : 'Details'}</summary>\n\n${
|
|
58
|
-
else if (t === 'DIV') { const s =
|
|
60
|
+
else if (t === 'DETAILS') { const sm = $('summary', c); B.push(`<details><summary>${sm ? sm.textContent.trim() : 'Details'}</summary>\n\n${mdOf($('div', c) || c)}\n\n</details>`); }
|
|
61
|
+
else if (t === 'DIV') { const s = mdOf(c); if (s.trim()) B.push(s); }
|
|
59
62
|
else { const s = inlineMd(c).trim(); if (s) B.push(s); }
|
|
60
63
|
}
|
|
61
64
|
return B.join('\n\n');
|