create-pmos 0.313.0 → 0.315.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/briefing-premium-insights-test.js +1 -1
- package/workspace/briefing-premium-metrics-test.js +41 -3
- package/workspace/briefing-premium-work-test.js +47 -35
- package/workspace/guide/briefing-premium.md +11 -10
- package/workspace/lib/board-metric-records.js +101 -0
- package/workspace/lib/board-metrics-premium.js +56 -25
- package/workspace/lib/my-work-premium.js +37 -23
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-board-metric-targets.js +33 -0
- package/workspace/lib/routes-board-premium.js +4 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-work-depth-test.js +21 -18
- package/workspace/public/pm/premium-board.js +6 -45
- package/workspace/public/pm/premium-insights.js +53 -1
- package/workspace/public/pm/premium-metric-tiles.js +68 -0
- package/workspace/public/pm/premium-work.js +48 -49
- package/workspace/public/pm/premium.css +15 -0
- package/workspace/public/premium-insights.html +8 -2
- package/workspace/public/premium-work.html +16 -26
|
@@ -60,12 +60,15 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
60
60
|
await page.route('**/api/pm-items/**', rec); await page.route('**/api/pm-jobs/**', rec); await page.route('**/api/my-work/**', rec);
|
|
61
61
|
await page.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false }) }));
|
|
62
62
|
await page.goto(BASE + '/premium-work.html?theme=' + theme);
|
|
63
|
-
const up = await until(() => page.evaluate(() => document.querySelectorAll('#
|
|
63
|
+
const up = await until(() => page.evaluate(() => document.querySelectorAll('#qBody .wrow').length > 0), 20000);
|
|
64
64
|
return { ctx, page, errors, posts, up, replies, setModel: (m) => { current = m; }, refuse: (f) => { fail = f; }, last: () => posts[posts.length - 1] };
|
|
65
65
|
};
|
|
66
66
|
const dlgOn = (p) => until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
|
|
67
67
|
const dlgOff = (p) => until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
68
|
-
|
|
68
|
+
/* the Work queue shows one tab at a time: bring up the tab that holds a row before pressing it (each press redraws the tab row, so the button is found again) */
|
|
69
|
+
const showKey = (p, key) => p.evaluate((key) => { const has = () => document.querySelector(`#qBody .wrow[data-key="${key}"], #waitBody .wrow[data-key="${key}"]`); if (has()) return true; for (const k of [...document.querySelectorAll('#qTabs .qtb')].map((b) => b.dataset.tab)) { document.querySelector(`#qTabs [data-tab="${k}"]`).click(); if (has()) return true; } return false; }, key);
|
|
70
|
+
const qTab = (p, k) => p.click(`#qTabs [data-tab="${k}"]`);
|
|
71
|
+
const openKey = async (p, key) => { await showKey(p, key); await p.locator(`.wrow[data-key="${key}"] .wrh`).first().click(); await dlgOn(p); await sleep(700); };
|
|
69
72
|
const undoOf = async (p, direct) => { await until(() => p.evaluate(() => /Undo/.test(document.querySelector('#toast').textContent))); if (direct) { /* the Undo window is 8 s; on a loaded runner the real-server steps before this can outlast it, so press the button itself rather than race the toast's fade */ await p.evaluate(() => document.querySelector('#toast .undo').click()); } else await p.locator('#toast .undo').click(); await sleep(250); };
|
|
70
73
|
|
|
71
74
|
const A = await open();
|
|
@@ -232,7 +235,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
232
235
|
await R.ctx.close(); }
|
|
233
236
|
|
|
234
237
|
/* W8 keys */
|
|
235
|
-
await p.locator('#
|
|
238
|
+
await showKey(p, 'work:item-bbbbbbbbbbb2'); await p.locator('#qBody .wrow[data-key="work:item-bbbbbbbbbbb2"] .wrh').focus();
|
|
236
239
|
const desc = await p.evaluate(() => document.activeElement.getAttribute('aria-description'));
|
|
237
240
|
ok('W8 a row names what the arrows do and that J and K move', /Right arrow: Done\. Left arrow: Tomorrow\. J and K move between rows\./.test(desc || ''), desc);
|
|
238
241
|
await p.keyboard.press('j');
|
|
@@ -240,32 +243,32 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
240
243
|
await p.keyboard.press('ArrowRight');
|
|
241
244
|
ok('W8 Right arrow on a Today row posts done, with Undo', await wait(() => A.last().path === '/api/pm-items/done' && A.last().body.id === 'item-bbbbbbbbbbb2') && await until(() => p.evaluate(() => /Undo/.test(document.querySelector('#toast').textContent))), JSON.stringify(A.last()));
|
|
242
245
|
await sleep(300);
|
|
243
|
-
await p.locator('#
|
|
246
|
+
await showKey(p, 'work:item-bbbbbbbbbbb2'); await p.locator('#qBody .wrow[data-key="work:item-bbbbbbbbbbb2"] .wrh').focus(); await p.keyboard.press('ArrowLeft');
|
|
244
247
|
ok('W8 Left arrow on a Today row puts it off to tomorrow (defer to the next day)', await wait(() => A.last().path === '/api/pm-items/defer' && A.last().body.id === 'item-bbbbbbbbbbb2' && A.last().body.until === '2026-10-17'), JSON.stringify(A.last()));
|
|
245
248
|
await sleep(300);
|
|
246
|
-
await p.locator('#
|
|
249
|
+
await showKey(p, 'work:item-aaaaaaaaaaa1'); await p.locator('#qBody .wrow[data-key="work:item-aaaaaaaaaaa1"] .wrh').focus(); await p.keyboard.press('ArrowRight');
|
|
247
250
|
ok('W8 Right arrow on an Inbox row moves it to Today (flag)', await wait(() => A.last().path === '/api/pm-items/flag' && A.last().body.id === 'item-aaaaaaaaaaa1' && A.last().body.flagged === true), JSON.stringify(A.last()));
|
|
248
251
|
await sleep(300);
|
|
249
|
-
await p.locator('#
|
|
252
|
+
await showKey(p, 'work:item-aaaaaaaaaaa2'); await p.locator('#qBody .wrow[data-key="work:item-aaaaaaaaaaa2"] .wrh').focus(); await p.keyboard.press('ArrowLeft');
|
|
250
253
|
ok('W8 Left arrow on an Inbox row sends it to Someday', await wait(() => A.last().path === '/api/pm-items/someday' && A.last().body.id === 'item-aaaaaaaaaaa2'), JSON.stringify(A.last()));
|
|
251
254
|
await sleep(300);
|
|
252
|
-
const n2 = pc(); await p.locator('#
|
|
255
|
+
const n2 = pc(); await showKey(p, 'work:item-eeeeeeeeeee1'); await p.locator('#qBody .wrow[data-key="work:item-eeeeeeeeeee1"] .wrh').focus(); await p.keyboard.press('ArrowLeft'); await sleep(250);
|
|
253
256
|
ok('W8 a Someday row has no left action, and posts nothing', pc() === n2);
|
|
254
257
|
await p.locator('#waitBody .wrh').first().focus(); await p.keyboard.press('ArrowRight'); await sleep(250);
|
|
255
258
|
ok('W8 a Waiting row has no arrow actions, and posts nothing', pc() === n2);
|
|
256
|
-
await p.locator('#
|
|
259
|
+
await showKey(p, 'work:wbs:alpha:4.2'); await p.locator('#qBody .wrow[data-key="work:wbs:alpha:4.2"] .wrh').focus();
|
|
257
260
|
ok('W8 a Today row whose draft is ready offers Review on the right, not Done', /Right arrow: Review/.test(await p.evaluate(() => document.activeElement.getAttribute('aria-description'))));
|
|
258
261
|
await p.keyboard.press('ArrowRight'); await dlgOn(p);
|
|
259
262
|
ok('W8 …and Review opens the dialog without posting', pc() === n2 + 0 || A.last().path !== '/api/pm-items/done');
|
|
260
263
|
await p.keyboard.press('Escape'); await dlgOff(p);
|
|
261
264
|
{ const r = await open(); const t = r.page;
|
|
262
|
-
await t.locator('#
|
|
263
|
-
ok('W8 the keys work on a
|
|
265
|
+
await showKey(t, 'work:item-aaaaaaaaaaa4'); await t.locator('#qBody .wrow[data-key="work:item-aaaaaaaaaaa4"] .wrh').focus(); await t.keyboard.press('ArrowRight');
|
|
266
|
+
ok('W8 the keys work on a row you added too (flag)', await until(() => r.last() && r.last().path === '/api/pm-items/flag' && r.last().body.id === 'item-aaaaaaaaaaa4'), JSON.stringify(r.last()));
|
|
264
267
|
await r.ctx.close(); }
|
|
265
268
|
|
|
266
269
|
/* W8 swipe */
|
|
267
270
|
const drag = async (pg, key, dx, hold = false) => {
|
|
268
|
-
const loc = pg.locator(`#
|
|
271
|
+
await showKey(pg, key); const loc = pg.locator(`#qBody .wrow[data-key="${key}"] .wrh`); await loc.evaluate((e) => e.scrollIntoView({ block: 'center' })); await sleep(150); // centred, so the Undo toast at the foot of the screen does not cover the row
|
|
269
272
|
const b = await loc.boundingBox(); const y = b.y + b.height / 2, x = b.x + b.width / 2;
|
|
270
273
|
await pg.mouse.move(x, y); await pg.mouse.down(); await pg.mouse.move(x + dx / 3, y, { steps: 4 }); await pg.mouse.move(x + dx, y, { steps: 6 });
|
|
271
274
|
const seen = await pg.evaluate(() => { const rv = document.querySelector('.xrv'); return rv ? { text: rv.textContent.trim(), op: +getComputedStyle(rv).opacity, tr: getComputedStyle(rv.parentElement.querySelector('.wrow')).transform } : null; });
|
|
@@ -279,7 +282,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
279
282
|
ok('W8 a drag of 50 px snaps back and posts nothing', r.posts.length === n3 && s2 && s2.op < 0.7, JSON.stringify([s2, r.posts.length - n3]));
|
|
280
283
|
const s3 = await drag(t, 'work:item-bbbbbbbbbbb3', -130); await sleep(300);
|
|
281
284
|
ok('W8 dragging left shows "Tomorrow" and posts defer to the next day', s3 && s3.text === 'Tomorrow' && await until(() => r.last().path === '/api/pm-items/defer' && r.last().body.until === '2026-10-17'), JSON.stringify([s3, r.last()]));
|
|
282
|
-
const n4 = r.posts.length; await t.locator('#
|
|
285
|
+
const n4 = r.posts.length; await showKey(t, 'work:item-aaaaaaaaaaa3'); await t.locator('#qBody .wrow[data-key="work:item-aaaaaaaaaaa3"] .wrh').click(); await dlgOn(t);
|
|
283
286
|
ok('W8 an ordinary click still opens the row and posts nothing', r.posts.length === n4);
|
|
284
287
|
await r.ctx.close(); }
|
|
285
288
|
{ const r = await open({ rm: true }); const t = r.page;
|
|
@@ -310,7 +313,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
310
313
|
}
|
|
311
314
|
ok(`W12 at 390 px (${theme}) the edit, steps and Not before panels have no sideways scroll and every control is 44 px`, ['edit', 'steps', 'defer'].every((k) => !g[k].over && g[k].small.length === 0), JSON.stringify(g));
|
|
312
315
|
await q2.keyboard.press('Escape'); await dlgOff(q2);
|
|
313
|
-
await R.page.locator('#
|
|
316
|
+
await showKey(R.page, 'work:wbs:alpha:4.2'); await R.page.locator('#qBody .wrow[data-key="work:wbs:alpha:4.2"] .wrh').click(); await dlgOn(q2); await sleep(500); await q2.click('#dTabs [data-t="chat"]'); await sleep(900);
|
|
314
317
|
const ag = await q2.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1 || document.querySelector('#dlg').scrollWidth > document.querySelector('#dlg').clientWidth + 1, small: [...document.querySelectorAll('.agblk button')].filter((b) => b.getBoundingClientRect().height < 43.5).map((b) => b.textContent.trim()) }));
|
|
315
318
|
ok(`W12 at 390 px (${theme}) the agent block has no sideways scroll and its buttons are 44 px`, !ag.over && ag.small.length === 0, JSON.stringify(ag));
|
|
316
319
|
await R.ctx.close();
|
|
@@ -335,7 +338,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
335
338
|
await undoOf(pg, true); await sleep(300);
|
|
336
339
|
it = (await get('/api/pm-items')).items.find((i) => i.id === it.id);
|
|
337
340
|
ok('E3 Undo writes the old values back (the title the parser made, no day, P1)', it.title === 'Reply to Rina about SSO !' && !it.due && it.priority === 'P1', JSON.stringify(it));
|
|
338
|
-
await pg.locator('#
|
|
341
|
+
await pg.locator('#qBody .wrh').first().click(); await dlgOn(pg); await sleep(700);
|
|
339
342
|
await more(pg); await pg.click('[data-p="xt"][data-k="steps"]');
|
|
340
343
|
await pg.fill('#xsIn', 'Send the SSO plan to Rina'); await pg.click('[data-p="xsadd"]');
|
|
341
344
|
ok('E4 a step is added through the real route', await until(async () => ((await get('/api/pm-items')).items.find((i) => i.id === it.id) || {}).steps && (await get('/api/pm-items')).items.find((i) => i.id === it.id).steps.length === 1, 8000));
|
|
@@ -349,16 +352,16 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
349
352
|
await undoOf(pg, true); await sleep(300);
|
|
350
353
|
it = (await get('/api/pm-items')).items.find((i) => i.id === it.id);
|
|
351
354
|
ok('E7 Undo clears it', !it.defer, JSON.stringify(it));
|
|
352
|
-
await pg.locator('.wrow, #
|
|
353
|
-
await pg.locator('#
|
|
355
|
+
await pg.locator('.wrow, #qBody .wrh').first().click({ trial: true }).catch(() => {});
|
|
356
|
+
await pg.locator('#qBody .wrh').first().click(); await dlgOn(pg); await sleep(700);
|
|
354
357
|
await more(pg); await pg.click('[data-p="xt"][data-k="someday"]'); await dlgOff(pg);
|
|
355
358
|
ok('E8 Someday parks the real record', (await get('/api/pm-items')).work.someday.some((i) => i.id === it.id));
|
|
356
359
|
await undoOf(pg, true); await sleep(300);
|
|
357
360
|
ok('E9 Undo brings it back (unpark)', !(await get('/api/pm-items')).work.someday.some((i) => i.id === it.id));
|
|
358
|
-
await pg.locator('#
|
|
361
|
+
await pg.locator('#qBody .wrh').first().click(); await dlgOn(pg); await sleep(700); await pg.click('[data-p="flag"]'); await dlgOff(pg);
|
|
359
362
|
ok('E10 once the item is in Today, Focus suggests it and the bar says why', await until(() => pg.evaluate(() => /Suggested · /.test(document.querySelector('#xFocus').textContent)), 8000));
|
|
360
363
|
await pg.click('#xFocus [data-xf="acc"]');
|
|
361
|
-
ok('E11 Accept writes the group to today\'s Focus, and the Today row carries the Focus tag', await until(async () => (await get('/api/pm-items')).focus.accepted.length === 1, 8000) && await until(() => pg.evaluate(() => !!document.querySelector('#
|
|
364
|
+
ok('E11 Accept writes the group to today\'s Focus, and the Today row carries the Focus tag', await until(async () => (await get('/api/pm-items')).focus.accepted.length === 1, 8000) && (await qTab(pg, 'today'), await until(() => pg.evaluate(() => !!document.querySelector('#qBody .xfc')), 8000)));
|
|
362
365
|
await pg.click('#xFocus [data-xf="more"]'); await dlgOn(pg); await sleep(500);
|
|
363
366
|
await pg.fill('#xjIn', 'when a launch slips, I want the owner named, so the date holds'); await pg.click('[data-fx="jadd"]');
|
|
364
367
|
ok('E12 Add a job writes it, and the dialog lists it with its open count', await until(async () => (await get('/api/pm-items')).jobs.length === 1, 8000) && await until(() => pg.evaluate(() => /the owner named/.test(document.querySelector('#oMain').textContent) && /0 open items/.test(document.querySelector('#oMain').textContent)), 8000));
|
|
@@ -7,6 +7,7 @@ import { pmPost } from './http.js';
|
|
|
7
7
|
import { $, $$, esc, openDlg, closeDlg, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, CHECK, AI, store, crumbHtml, wireCrumb, kv, H, openAddDoc } from './premium-shell.js';
|
|
8
8
|
import { issueBody } from './premium-doc-edit.js';
|
|
9
9
|
import { mountDocSheet } from './premium-doc-sheet.js';
|
|
10
|
+
import * as MT from './premium-metric-tiles.js';
|
|
10
11
|
import { dotsBtn, openMenu, closeMenu, menuKey, asksHtml, onAsks, openIniForm } from './premium-acts.js';
|
|
11
12
|
|
|
12
13
|
const MODE_KEY = 'pmos.premium.openAs';
|
|
@@ -227,44 +228,15 @@ load();
|
|
|
227
228
|
* Reads GET /api/board-metrics-premium?ws= apart from the board's own answer and draws lib/board-metrics-premium.js's tiles: a number and a chart only
|
|
228
229
|
* where a record counted one, "Not read" where it could not be. A tile opens the standard dialog. Nothing here writes. */
|
|
229
230
|
let MM = null, metTimer = null; // the Metrics card's model and its re-read timer
|
|
230
|
-
const MET_GEO = { W: 220, H: 60, P: 5 };
|
|
231
|
-
const metGeo = (m) => { const n = m.ser.length, { W, H: Ht, P } = MET_GEO, vs = m.ser.filter((v) => v != null), lo = Math.min(...vs), hi = Math.max(...vs), sp = hi - lo || 1; return { n, W, H: Ht, P, X: (j) => P + j * (W - 2 * P) / (n - 1), Y: (v) => P + (1 - (v - lo) / sp) * (Ht - 2 * P) }; };
|
|
232
|
-
const metFmt = (m, v) => (+v).toFixed(m.dec) + (m.suf || '');
|
|
233
|
-
|
|
234
|
-
function metTileHtml(t, i) {
|
|
235
|
-
if (t.absent) return `<div class="mt1" data-m="${i}" data-op="m:${i}" tabindex="0" role="button" aria-label="${esc(t.label)}: ${esc(t.absent)}. ${esc(t.why)}"><span>${esc(t.label)}</span><b class="mval">${esc(t.absent)}</b><em class="mwk">${esc(t.why)}</em></div>`;
|
|
236
|
-
const lab = t.look ? `<span class="mlab">${esc(t.label)}<i class="mchip warn">Needs a look</i></span>` : `<span>${esc(t.label)}</span>`, off = t.look ? ' off' : '';
|
|
237
|
-
const chg = t.change ? `<span class="mchg ${t.change.d === 0 ? '' : t.change.good ? 'good' : 'bad'}">${t.change.d === 0 ? '' : t.change.d > 0 ? '▲ ' : '▼ '}${esc(t.change.txt)}</span>` : '';
|
|
238
|
-
if (!t.ser) return `<div class="mt1 ${t.kind}${off}" data-m="${i}" data-op="m:${i}" tabindex="0" role="button" aria-label="${esc(t.label)}, ${esc(t.value)}, ${esc(t.text)}${t.look ? ', needs a look' : ''}">${lab}<b class="mval">${esc(t.value)}</b><em class="mwk">${esc(t.text)}</em></div>`;
|
|
239
|
-
const g = metGeo(t); let ln = '', op = false;
|
|
240
|
-
t.ser.forEach((v, j) => { if (v == null) { op = false; return; } ln += (op ? 'L' : 'M') + g.X(j).toFixed(1) + ',' + g.Y(v).toFixed(1); op = true; });
|
|
241
|
-
const f = Math.max(0, t.ser.findIndex((v) => v != null)), gap = t.ser.slice(f).some((v) => v == null), n1 = g.n - 1, lastJ = t.ser.reduce((a, v, j) => (v != null ? j : a), f);
|
|
242
|
-
return `<div class="mt1 mch ${t.kind}${off}" data-m="${i}" data-op="m:${i}" tabindex="0" role="button" aria-label="${esc(t.label)} over eight weeks, now ${esc(t.value)}${t.look ? ', needs a look' : ''}. Use the arrow keys to read each week.">${lab}<b class="mval">${esc(t.value)}</b><em class="mwk">${esc(t.text)}</em>${chg}`
|
|
243
|
-
+ `<svg viewBox="0 0 ${g.W} ${g.H}">${f > 0 ? `<line class="gp" x1="${g.X(0)}" x2="${g.X(f)}" y1="${g.H - g.P}" y2="${g.H - g.P}"/>` : ''}${gap ? '' : `<path class="ar" d="${ln}L${g.X(n1)},${g.H}L${g.X(f)},${g.H}Z"/>`}<path class="ln2" d="${ln}"/><line class="cx" x1="0" x2="0" y1="0" y2="${g.H}"/><circle class="dt" cx="${g.X(lastJ)}" cy="${g.Y(t.ser[lastJ])}" r="3.5"/></svg>`
|
|
244
|
-
+ `<span class="mfoot"><i>${esc(t.wk[0])}</i><i>${esc(t.wk[t.wk.length - 1])}</i></span></div>`;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/** Read one week of a chart tile: the guide line and dot move, the value and caption change. */
|
|
248
|
-
function metChartAt(el, j) {
|
|
249
|
-
const t = MM.tiles[+el.dataset.m]; if (!t || !t.ser) return;
|
|
250
|
-
const g = metGeo(t); j = j == null ? t.ser.reduce((a, v, k) => (v != null ? k : a), 0) : Math.max(0, Math.min(g.n - 1, j));
|
|
251
|
-
const v = t.ser[j], has = v != null, x = g.X(j), y = has ? g.Y(v) : 0, now = j === t.ser.reduce((a, w, k) => (w != null ? k : a), 0);
|
|
252
|
-
const cx = $('.cx', el), dt = $('.dt', el);
|
|
253
|
-
cx.setAttribute('x1', x); cx.setAttribute('x2', x); dt.setAttribute('cx', x); dt.setAttribute('cy', y); dt.style.opacity = has ? '' : '0';
|
|
254
|
-
el.classList.toggle('hv', !now); el.dataset.j = j;
|
|
255
|
-
const val = now ? t.value : has ? metFmt(t, v) : 'No runs', cap = now ? t.text : 'Week to ' + t.wk[j] + (t.nt[j] ? ' · ' + t.nt[j] : '');
|
|
256
|
-
$('.mval', el).textContent = val; $('.mwk', el).textContent = cap;
|
|
257
|
-
el.setAttribute('aria-label', t.label + ', ' + (now ? 'now ' : '') + val + ', ' + cap + '. Use the arrow keys to read each week.');
|
|
258
|
-
}
|
|
259
231
|
|
|
260
232
|
function metDraw() {
|
|
261
233
|
const card = $('#cMet'); if (!MM) { card.hidden = true; return; }
|
|
262
234
|
card.hidden = false;
|
|
263
235
|
$('#metCap').textContent = MM.header;
|
|
264
236
|
const ins = '/premium-insights.html' + (M.board.ws ? '?ws=' + encodeURIComponent(M.board.ws) + (M.board.id ? '&board=' + encodeURIComponent(M.board.id) : '') : '');
|
|
265
|
-
$('#metHint').innerHTML = (MM.lead ? `<b class="mflag">${esc(MM.lead)}</b> ` : '') + esc(MM.body || MM.hint) + `
|
|
237
|
+
$('#metHint').innerHTML = (MM.lead ? `<b class="mflag">${esc(MM.lead)}</b> ` : '') + esc(MM.body || MM.hint) + ` To set a target, or for longer ranges, <a class="lk" id="metIns" href="${esc(ins)}">open Insights</a>.`;
|
|
266
238
|
$('#metBody').style.gridTemplateColumns = 'repeat(' + Math.min(4, MM.tiles.length) + ',minmax(0,1fr))';
|
|
267
|
-
$('#metBody').innerHTML = MM.tiles.map(
|
|
239
|
+
$('#metBody').innerHTML = MM.tiles.map(MT.tileHtml).join('');
|
|
268
240
|
$('#metNote').textContent = MM.note;
|
|
269
241
|
pillOf($('#perTabs'));
|
|
270
242
|
}
|
|
@@ -272,26 +244,15 @@ function metDraw() {
|
|
|
272
244
|
function metOpenTile(i) {
|
|
273
245
|
const t = MM.tiles[i], r = MM.rows[i]; if (!t || !r) return;
|
|
274
246
|
const d = r.dialog;
|
|
275
|
-
const rows =
|
|
276
|
-
|
|
277
|
-
const vals = t.ser ? H('Values') + `<div class="vtb">${t.ser.map((v, j) => `<div><span>${esc(t.wk[j])}</span><b>${v == null ? 'No runs' : esc(metFmt(t, v))}</b></div>`).join('')}</div>` : '';
|
|
247
|
+
const rows = MT.factRows(t, MM.repo, MM.weeks);
|
|
248
|
+
const vals = t.ser ? H('Values') + `<div class="vtb">${t.ser.map((v, j) => `<div><span>${esc(t.wk[j])}</span><b>${v == null ? (t.since ? 'Not kept yet' : 'No runs') : esc(MT.fmt(t, v))}</b></div>`).join('')}</div>` : '';
|
|
278
249
|
const pane = `<article class="paper doc"><p class="lede" style="margin:0 0 10px">${esc(t.def)}</p>${kv(rows)}${vals}<p class="note" style="margin-top:12px">${esc(MM.note)}</p></article>`;
|
|
279
250
|
openDlg({ eye: 'Measure · real data', title: t.label, sub: MM.repo, say: d.say, stream: turnA(logHtml({ logTitle: 'Read from the repository', log: ['Read the repository\'s own records', 'Counted them by week', 'Changed nothing'] })) + turnA(ptx(d.say)), noteKey: r.key, pane, label: 'Measure' });
|
|
280
251
|
loadThread(r.key);
|
|
281
252
|
}
|
|
282
253
|
|
|
283
|
-
const metIdx = (e) => { const t = e.target.closest('[data-m]'); return t ? t : null; };
|
|
284
|
-
const metBody = () => $('#metBody');
|
|
285
254
|
function metWire() {
|
|
286
|
-
|
|
287
|
-
metBody().addEventListener('keydown', (e) => {
|
|
288
|
-
const t = metIdx(e); if (!t) return;
|
|
289
|
-
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); metOpenTile(+t.dataset.m); return; }
|
|
290
|
-
if (!t.classList.contains('mch') || !/^Arrow(Left|Right)$/.test(e.key)) return;
|
|
291
|
-
e.preventDefault(); const m = MM.tiles[+t.dataset.m], now = t.dataset.j == null ? m.ser.length - 1 : +t.dataset.j; metChartAt(t, now + (e.key === 'ArrowLeft' ? -1 : 1));
|
|
292
|
-
});
|
|
293
|
-
metBody().addEventListener('pointermove', (e) => { const t = metIdx(e); if (!t || !t.classList.contains('mch')) return; const s = $('svg', t).getBoundingClientRect(), m = MM.tiles[+t.dataset.m], g = metGeo(m); metChartAt(t, Math.round(((e.clientX - s.left) / s.width * g.W - g.P) / (g.W - 2 * g.P) * (g.n - 1))); });
|
|
294
|
-
metBody().addEventListener('pointerout', (e) => { const t = metIdx(e); if (t && t.classList.contains('mch') && !t.contains(e.relatedTarget)) metChartAt(t, null); });
|
|
255
|
+
MT.wireTiles($('#metBody'), () => MM.tiles, metOpenTile);
|
|
295
256
|
$('#perTabs').addEventListener('click', (e) => { const b = e.target.closest('[aria-disabled="true"]'); if (b) toast('PMOS counts runs and merges by week only.'); });
|
|
296
257
|
}
|
|
297
258
|
|
|
@@ -10,6 +10,7 @@ import { $, $$, esc, openDlg, closeDlg, toast, loadThread, onScroll, wireRail, l
|
|
|
10
10
|
import { pmPost, pmGet } from './http.js';
|
|
11
11
|
import { openStudio } from './premium-studio.js';
|
|
12
12
|
import { openReport } from './premium-report-read.js';
|
|
13
|
+
import * as MT from './premium-metric-tiles.js';
|
|
13
14
|
|
|
14
15
|
let M = null; // the model
|
|
15
16
|
let dash = 'all'; // the dashboard on screen
|
|
@@ -363,6 +364,57 @@ function openChart(c) {
|
|
|
363
364
|
}
|
|
364
365
|
$('#dBody').addEventListener('click', (e) => { const lt = e.target.closest('#logT'); if (lt) { const c = $('#alog').classList.toggle('col'); lt.setAttribute('aria-expanded', !c); } });
|
|
365
366
|
|
|
367
|
+
/* ── the Board measures card (initiative briefing-premium-metrics, option C) ─────────────────────────────────────────
|
|
368
|
+
* The Board's four measures from GET /api/board-metrics-premium?ws=&weeks=, drawn with the Board's own tiles over 8, 26 or 52 weeks. A measure's dialog
|
|
369
|
+
* holds the page's one target press: POST /api/board-metric-targets/save, which the Board then draws as the chip, the dashed line and the outline. */
|
|
370
|
+
let BM = null, bmWeeks = 8, bmTimer = null;
|
|
371
|
+
const BM_KEY = 'pmos.premium.bmWeeks';
|
|
372
|
+
try { const w = Number(localStorage.getItem(BM_KEY)); if ([8, 26, 52].includes(w)) bmWeeks = w; } catch { /* a blocked store keeps 8 weeks */ }
|
|
373
|
+
function bmDraw() {
|
|
374
|
+
const card = $('#cBm'); card.hidden = false;
|
|
375
|
+
$$('#bmRange button').forEach((b) => b.setAttribute('aria-pressed', String(+b.dataset.w === bmWeeks))); pillOf($('#bmRange'));
|
|
376
|
+
if (!BM) return;
|
|
377
|
+
$('#bmCap').textContent = BM.header;
|
|
378
|
+
$('#bmHint').innerHTML = (BM.lead ? `<b class="mflag">${esc(BM.lead)}</b> ` : '') + esc(BM.body) + ' Press a measure to set its target. The Board draws the same target.';
|
|
379
|
+
$('#bmBody').style.gridTemplateColumns = 'repeat(' + Math.min(4, BM.tiles.length) + ',minmax(0,1fr))';
|
|
380
|
+
$('#bmBody').innerHTML = BM.tiles.map(MT.tileHtml).join('');
|
|
381
|
+
$('#bmNote').textContent = BM.note;
|
|
382
|
+
}
|
|
383
|
+
async function bmLoad() {
|
|
384
|
+
clearTimeout(bmTimer);
|
|
385
|
+
if (!M || !M.board || !M.board.ws) { $('#cBm').hidden = true; return; }
|
|
386
|
+
let r = null;
|
|
387
|
+
try { const res = await fetch('/api/board-metrics-premium?ws=' + encodeURIComponent(M.board.ws) + '&weeks=' + bmWeeks, { credentials: 'same-origin' }); r = await res.json(); } catch { r = null; }
|
|
388
|
+
if (!r || !r.ok || r.state !== 'ready') { BM = null; bmDraw(); $('#bmCap').textContent = 'not read'; $('#bmHint').textContent = 'The Board measures could not be read, so none is shown.' + (r && r.error ? ' The reason: ' + r.error : ''); $('#bmBody').innerHTML = ''; $('#bmNote').textContent = ''; return; }
|
|
389
|
+
BM = r.model; bmDraw();
|
|
390
|
+
if (BM.pending) bmTimer = setTimeout(bmLoad, 4000); // the workflow engine is still deriving Blocked and Idle
|
|
391
|
+
}
|
|
392
|
+
function bmOpen(i) {
|
|
393
|
+
const t = BM && BM.tiles[i]; if (!t) return;
|
|
394
|
+
const vals = t.ser ? `<h3 class="sh">Values</h3><div class="vtb">${t.ser.map((v, j) => `<div><span>${esc(t.wk[j])}</span><b>${v == null ? (t.since ? 'Not kept yet' : 'No runs') : esc(MT.fmt(t, v))}</b></div>`).join('')}</div>` : '';
|
|
395
|
+
const form = t.absent ? `<p class="note" style="margin:12px 0 0">A target can be set once this measure is counted.</p>`
|
|
396
|
+
: `<div class="addf" style="margin-top:14px"><label>Target (${t.lowBetter ? 'at most' : 'at least'})<input id="bmT" inputmode="decimal" maxlength="12" value="${t.tg != null ? esc(String(t.tg)) : ''}" placeholder="For example: ${t.key === 'corrections' ? '10' : t.key === 'merges' ? '5' : '0'}"></label>
|
|
397
|
+
<p class="note" id="bmM" role="status" style="margin:0;min-height:1.2em"></p><div class="cact"><button class="cta" id="bmGo">Save target</button>${t.tg != null ? '<button class="cta alt" id="bmClr">Clear target</button>' : ''}</div></div>`;
|
|
398
|
+
const pane = `<article class="paper doc"><p class="lede" style="margin:0 0 10px">${esc(t.def)}</p>${kv(MT.factRows(t, BM.repo, BM.weeks))}${form}${vals}<p class="note" style="margin-top:12px">${esc(BM.note)}</p></article>`;
|
|
399
|
+
const say = t.tg != null ? `The target is ${t.tg}. Change it or clear it here; the Board draws it too.` : 'No target is set. Type one and save it; the Board draws it too.';
|
|
400
|
+
openDlg({ eye: 'Board measure · real data', title: t.label, sub: BM.repo, say, stream: turnA(ptx(say)), noteKey: null, pane, label: 'Measure' });
|
|
401
|
+
$('#askF').hidden = true;
|
|
402
|
+
$('#oMain').onchange = null;
|
|
403
|
+
$('#oMain').onclick = async (e) => {
|
|
404
|
+
const go = e.target.closest('#bmGo'), clr = e.target.closest('#bmClr'); if (!go && !clr) return;
|
|
405
|
+
const target = clr ? null : $('#bmT').value.trim();
|
|
406
|
+
if (go && target === '') { $('#bmM').textContent = 'Type a number first.'; return; }
|
|
407
|
+
(go || clr).disabled = true; $('#bmM').textContent = 'Saving.';
|
|
408
|
+
const res = await pmPost('/api/board-metric-targets/save', { ws: M.board.ws, key: t.key, target });
|
|
409
|
+
(go || clr).disabled = false;
|
|
410
|
+
if (!res || res.ok !== true) { $('#bmM').textContent = (res && res.error) || 'The target could not be saved.'; return; }
|
|
411
|
+
closeDlg(); toast(clr ? 'The target of ' + t.label + ' is cleared.' : 'The target of ' + t.label + ' is ' + target + '.');
|
|
412
|
+
bmLoad();
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
MT.wireTiles($('#bmBody'), () => (BM ? BM.tiles : []), bmOpen);
|
|
416
|
+
$('#bmRange').addEventListener('click', (e) => { const b = e.target.closest('[data-w]'); if (!b || +b.dataset.w === bmWeeks) return; bmWeeks = +b.dataset.w; try { localStorage.setItem(BM_KEY, String(bmWeeks)); } catch { /* not kept */ } bmDraw(); bmLoad(); });
|
|
417
|
+
|
|
366
418
|
/* ── load ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
367
419
|
function draw() { drawHead(); if (!M.dashboards.some((d) => d.id === dash)) dash = 'all'; drawDash(); drawReps(); drawDock(); onScroll(); }
|
|
368
420
|
async function load() {
|
|
@@ -375,7 +427,7 @@ async function load() {
|
|
|
375
427
|
setTimeout(load, 15000);
|
|
376
428
|
return;
|
|
377
429
|
}
|
|
378
|
-
M = r.model; draw();
|
|
430
|
+
M = r.model; draw(); bmLoad();
|
|
379
431
|
}
|
|
380
432
|
$('#brief').textContent = 'Reading the records.';
|
|
381
433
|
load();
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* pm/premium-metric-tiles.js — the tiles of the Board's four measures (initiative briefing-premium-metrics), drawn the same way on the Board's Metrics
|
|
2
|
+
* card and on the Insights page's Board measures card. It draws lib/board-metrics-premium.js's tiles: a number and a chart only where a record counted
|
|
3
|
+
* one, "Not read" where it could not be, and a target's chip, dashed line and outline only where the PM set one on Insights. Nothing here writes.
|
|
4
|
+
*
|
|
5
|
+
* tileHtml(t, i) → one tile's HTML
|
|
6
|
+
* chartAt(el, t, j) → read week j of a chart tile (null: the latest week)
|
|
7
|
+
* wireTiles(body, tiles, open) → pointer and arrow-key reading, Enter and press to open(i) */
|
|
8
|
+
import { $, esc } from './premium-shell.js';
|
|
9
|
+
|
|
10
|
+
const GEO = { W: 220, H: 60, P: 5 };
|
|
11
|
+
export function geo(m) {
|
|
12
|
+
const n = m.ser.length, { W, H, P } = GEO, vs = m.ser.filter((v) => v != null).concat(m.tg != null ? [m.tg] : []);
|
|
13
|
+
const lo = Math.min(...vs), hi = Math.max(...vs), sp = hi - lo || 1;
|
|
14
|
+
return { n, W, H, P, X: (j) => (n > 1 ? P + j * (W - 2 * P) / (n - 1) : W / 2), Y: (v) => P + (1 - (v - lo) / sp) * (H - 2 * P) };
|
|
15
|
+
}
|
|
16
|
+
export const fmt = (m, v) => (+v).toFixed(m.dec) + (m.suf || '');
|
|
17
|
+
const lastJ = (t) => t.ser.reduce((a, v, j) => (v != null ? j : a), 0);
|
|
18
|
+
|
|
19
|
+
export function tileHtml(t, i) {
|
|
20
|
+
if (t.absent) return `<div class="mt1" data-m="${i}" data-op="m:${i}" tabindex="0" role="button" aria-label="${esc(t.label)}: ${esc(t.absent)}. ${esc(t.why)}"><span>${esc(t.label)}</span><b class="mval">${esc(t.absent)}</b><em class="mwk">${esc(t.why)}</em></div>`;
|
|
21
|
+
const chip = t.tg != null ? `<i class="mchip ${t.ok ? 'ok' : 'warn'}">${esc(t.chip)}</i>` : t.look ? '<i class="mchip warn">Needs a look</i>' : '';
|
|
22
|
+
const lab = chip ? `<span class="mlab">${esc(t.label)}${chip}</span>` : `<span>${esc(t.label)}</span>`, off = t.look ? ' off' : '';
|
|
23
|
+
const tgt = t.tg != null ? `<em class="mtg">${esc(t.targetTxt)}</em>` : '';
|
|
24
|
+
const chg = t.change ? `<span class="mchg ${t.change.d === 0 ? '' : t.change.good ? 'good' : 'bad'}">${t.change.d === 0 ? '' : t.change.d > 0 ? '▲ ' : '▼ '}${esc(t.change.txt)}</span>` : '';
|
|
25
|
+
const say = (t.look ? ', needs a look' : '') + (t.tg != null ? ', ' + t.targetTxt + ', ' + t.chip : '');
|
|
26
|
+
if (!t.ser) return `<div class="mt1 ${t.kind}${off}" data-m="${i}" data-op="m:${i}" tabindex="0" role="button" aria-label="${esc(t.label)}, ${esc(t.value)}, ${esc(t.text)}${esc(say)}">${lab}<b class="mval">${esc(t.value)}</b><em class="mwk">${esc(t.text)}</em>${tgt}</div>`;
|
|
27
|
+
const g = geo(t); let ln = '', op = false;
|
|
28
|
+
t.ser.forEach((v, j) => { if (v == null) { op = false; return; } ln += (op ? 'L' : 'M') + g.X(j).toFixed(1) + ',' + g.Y(v).toFixed(1); op = true; });
|
|
29
|
+
const f = Math.max(0, t.ser.findIndex((v) => v != null)), gap = t.ser.slice(f).some((v) => v == null), n1 = g.n - 1, lj = lastJ(t);
|
|
30
|
+
const tgl = t.tg != null ? `<line class="tg" x1="${g.P}" x2="${g.W - g.P}" y1="${g.Y(t.tg).toFixed(1)}" y2="${g.Y(t.tg).toFixed(1)}"/>` : '';
|
|
31
|
+
return `<div class="mt1 mch ${t.kind}${off}" data-m="${i}" data-op="m:${i}" tabindex="0" role="button" aria-label="${esc(t.label)} over ${t.ser.length} weeks, now ${esc(t.value)}${esc(say)}. Use the arrow keys to read each week.">${lab}<b class="mval">${esc(t.value)}</b><em class="mwk">${esc(t.text)}</em>${tgt}${chg}`
|
|
32
|
+
+ `<svg viewBox="0 0 ${g.W} ${g.H}">${f > 0 ? `<line class="gp" x1="${g.X(0)}" x2="${g.X(f)}" y1="${g.H - g.P}" y2="${g.H - g.P}"/>` : ''}${gap || f === n1 ? '' : `<path class="ar" d="${ln}L${g.X(n1)},${g.H}L${g.X(f)},${g.H}Z"/>`}${tgl}<path class="ln2" d="${ln}"/><line class="cx" x1="0" x2="0" y1="0" y2="${g.H}"/><circle class="dt" cx="${g.X(lj)}" cy="${g.Y(t.ser[lj])}" r="3.5"/></svg>`
|
|
33
|
+
+ `<span class="mfoot"><i>${esc(t.wk[0])}</i>${t.tg != null ? '<i class="tgl">dashed line is the target</i>' : ''}<i>${esc(t.wk[t.wk.length - 1])}</i></span></div>`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Read one week of a chart tile: the guide line and dot move, the value and caption change. */
|
|
37
|
+
export function chartAt(el, t, j) {
|
|
38
|
+
if (!t || !t.ser) return;
|
|
39
|
+
const g = geo(t), lj = lastJ(t); j = j == null ? lj : Math.max(0, Math.min(g.n - 1, j));
|
|
40
|
+
const v = t.ser[j], has = v != null, x = g.X(j), y = has ? g.Y(v) : 0, now = j === lj;
|
|
41
|
+
const cx = $('.cx', el), dt = $('.dt', el);
|
|
42
|
+
cx.setAttribute('x1', x); cx.setAttribute('x2', x); dt.setAttribute('cx', x); dt.setAttribute('cy', y); dt.style.opacity = has ? '' : '0';
|
|
43
|
+
el.classList.toggle('hv', !now); el.dataset.j = j;
|
|
44
|
+
const none = t.since ? 'Not kept yet' : 'No runs';
|
|
45
|
+
const val = now ? t.value : has ? fmt(t, v) : none, cap = now ? t.text : 'Week to ' + t.wk[j] + (t.nt[j] ? ' · ' + t.nt[j] : '') + (has && t.tg != null ? ' · ' + t.targetTxt : '');
|
|
46
|
+
$('.mval', el).textContent = val; $('.mwk', el).textContent = cap;
|
|
47
|
+
el.setAttribute('aria-label', t.label + ', ' + (now ? 'now ' : '') + val + ', ' + cap + '. Use the arrow keys to read each week.');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Pointer and arrow-key reading of the chart tiles in `body`, and Enter, Space or a press to open(i). tiles() gives the tiles drawn now. */
|
|
51
|
+
export function wireTiles(body, tiles, open) {
|
|
52
|
+
const at = (e) => e.target.closest('[data-m]');
|
|
53
|
+
body.addEventListener('click', (e) => { const t = at(e); if (t) open(+t.dataset.m); });
|
|
54
|
+
body.addEventListener('keydown', (e) => {
|
|
55
|
+
const t = at(e); if (!t) return;
|
|
56
|
+
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); open(+t.dataset.m); return; }
|
|
57
|
+
if (!t.classList.contains('mch') || !/^Arrow(Left|Right)$/.test(e.key)) return;
|
|
58
|
+
e.preventDefault(); const m = tiles()[+t.dataset.m], now = t.dataset.j == null ? lastJ(m) : +t.dataset.j; chartAt(t, m, now + (e.key === 'ArrowLeft' ? -1 : 1));
|
|
59
|
+
});
|
|
60
|
+
body.addEventListener('pointermove', (e) => { const t = at(e); if (!t || !t.classList.contains('mch')) return; const s = $('svg', t).getBoundingClientRect(), m = tiles()[+t.dataset.m], g = geo(m); chartAt(t, m, Math.round(((e.clientX - s.left) / s.width * g.W - g.P) / (g.W - 2 * g.P) * (g.n - 1))); });
|
|
61
|
+
body.addEventListener('pointerout', (e) => { const t = at(e); if (t && t.classList.contains('mch') && !t.contains(e.relatedTarget)) chartAt(t, tiles()[+t.dataset.m], null); });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** The rows of a measure's dialog: what it is now, its target and gap where one is set, how it changed, and where it was counted. */
|
|
65
|
+
export function factRows(t, repo, weeks) {
|
|
66
|
+
return t.absent ? [['Now', t.absent], ['Why', t.why], ['Counted from', repo]]
|
|
67
|
+
: [['Now', t.value], ['Counted', t.text], ['Target', t.tg != null ? fmt(t, t.tg) : 'None set. Set one on Insights'], ['Gap', t.tg != null ? (t.ok ? 'On target' : t.chip + ' the target') : ''], ['Change', t.change ? t.change.txt : ''], ['Better when', t.lowBetter ? 'Lower' : t.lowBetter === false ? 'Higher' : ''], ['Period', 'Week · last ' + (weeks || 8) + ' weeks'], ['Source', repo]].filter((r) => r[1] !== '');
|
|
68
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* pm/premium-work.js — the premium My work page (initiative briefing-premium-work, slice 4). Reads GET /api/my-work-premium and draws the model
|
|
2
|
-
* lib/my-work-premium.js builds from the list the Work page reads: the hero,
|
|
2
|
+
* lib/my-work-premium.js builds from the list the Work page reads: the hero, the Work queue, Waiting on others, the dock and the standard dialog.
|
|
3
3
|
* Every press goes to the Work page's own route under /api/pm-items, /api/pm-jobs or /api/my-work; this file adds no writer. A control with nothing honest to write stays off and says why.
|
|
4
4
|
* My work depth (initiative premium-work-depth): the dialog's tool row (Edit, Who does each step, Not before, Someday), the Focus bar and its jobs, the agent on an item
|
|
5
5
|
* (draft, stop, edit, post after a confirm, send back, try again), and keys and swipe on the rows. */
|
|
@@ -39,9 +39,9 @@ function drawHero() {
|
|
|
39
39
|
}
|
|
40
40
|
function drawDock() { $('#dN').textContent = M.dock.needs; $('#dLab').textContent = M.dock.needs === 0 ? 'to clear' : M.dock.label; $('#dNext').innerHTML = M.dock.next ? `<i></i>Next <b>${esc(M.dock.next)}</b>` : 'Nothing more on your list'; }
|
|
41
41
|
|
|
42
|
-
/* ── the
|
|
42
|
+
/* ── the Work queue ─────────────────────────────────────────────────────────────────────────────────────── */
|
|
43
43
|
function rowHtml(r, o = {}) {
|
|
44
|
-
const inbox = r.list === 'inbox' || r.list === 'tray', sm = o.sm;
|
|
44
|
+
const inbox = r.list === 'inbox' || r.list === 'tray' || r.list === 'done', sm = o.sm;
|
|
45
45
|
const sd = sm ? null : sideOf(r);
|
|
46
46
|
const desc = sd ? ` aria-description="${esc((sd.r ? 'Right arrow: ' + sd.r.label + '. ' : '') + (sd.l ? 'Left arrow: ' + sd.l.label + '. ' : '') + 'J and K move between rows.')}"` : '';
|
|
47
47
|
let lead;
|
|
@@ -55,49 +55,50 @@ function rowHtml(r, o = {}) {
|
|
|
55
55
|
const sug = !sm && r.sug ? `<span class="wsg">${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"/>')}<span><b>${esc(r.sug.b)}</b> ${esc(r.sug.t)}</span></span>` : '';
|
|
56
56
|
return `<div class="wrw"><div class="wrow${sm ? ' sm' : ''}${inbox ? ' inb' : ''}${o.first ? ' first' : ''}" data-key="${esc(r.key)}">${lead}<button class="wrh" aria-haspopup="dialog"${desc}><span class="wtx"><span class="wtit">${esc(r.title)}${o.first ? '<em class="tgf">Do this first</em>' : ''}${r.focus ? '<em class="xfc">Focus</em>' : ''}</span><span class="ws">${esc(r.sub)}${esc(state)}</span>${sug}</span>${meta}</button></div></div>`;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
$('#plateCap').innerHTML = `<b>${P.n}</b> to clear`;
|
|
61
|
-
$('#plateNote').textContent = P.note;
|
|
62
|
-
let h = '';
|
|
63
|
-
for (const s of P.sections) {
|
|
64
|
-
if (!s.n) {
|
|
65
|
-
h += `<div class="wsec" data-lane="${s.key}"><span class="label">${esc(s.label)}</span><em>empty</em></div>` + (s.key === 'inbox' ? `<p class="empty3">${CHECK}Nothing waits to be sorted.</p>` : '<p class="empty3 plain">Nothing here.</p>');
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
h += `<div class="wsec" data-lane="${s.key}"><span class="label">${esc(s.label)}</span><em>${s.n} open</em></div>`;
|
|
69
|
-
const first = s.key === 'today' ? s.rows.find((r) => r.overdue) || null : null;
|
|
70
|
-
h += s.rows.map((r) => rowHtml(r, { first: first && r.key === first.key })).join('');
|
|
71
|
-
if (s.more) h += `<p class="note">${s.more} more ${s.more === 1 ? 'item is' : 'items are'} not shown here.</p>`;
|
|
72
|
-
}
|
|
73
|
-
$('#plateBody').innerHTML = h;
|
|
74
|
-
}
|
|
75
|
-
let shelfTab = null;
|
|
76
|
-
function drawTray() {
|
|
77
|
-
const T = M.tray, Sh = M.shelf;
|
|
78
|
-
$('#trayCap').textContent = T.cap;
|
|
79
|
-
const tabs = Sh.tabs;
|
|
80
|
-
if (!shelfTab || !tabs.some((t) => t.key === shelfTab)) shelfTab = (tabs.find((t) => t.n) || tabs[0]).key;
|
|
81
|
-
const cur = tabs.find((t) => t.key === shelfTab);
|
|
82
|
-
$('#trayTabs').innerHTML = tabs.map((t) => `<button type="button" role="tab" class="stb" data-tab="${t.key}" aria-selected="${t.key === shelfTab}">${esc(t.label)} <b>${t.n}</b></button>`).join('');
|
|
83
|
-
$('#trayBody').innerHTML = cur.rows.length ? cur.rows.map((r) => rowHtml(r)).join('') + (cur.more ? `<p class="note">${cur.more} more not shown here.</p>` : '') : `<p class="empty3 plain">${cur.key === 'place' ? 'Nothing in your tray. Add a line above and it lands here first.' : 'Nothing here.'}</p>`;
|
|
84
|
-
$('#trayNote').textContent = T.note + ' ' + Sh.note;
|
|
85
|
-
}
|
|
86
|
-
$('#trayTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-tab]'); if (!b) return; shelfTab = b.dataset.tab; drawTray(); const n = $(`#trayTabs [data-tab="${shelfTab}"]`); if (n) n.focus(); });
|
|
87
|
-
/* the three counts filter the list under them: a press shows one state, a second press on the same tile shows all again */
|
|
58
|
+
/* One card, one tab for each place a thing waits. A tab draws its groups in two columns; the Agents tab keeps the three counts, which filter its list. */
|
|
59
|
+
let qTab = null;
|
|
88
60
|
const AG_TILES = [['running', 'Running'], ['failed', 'Failed'], ['ready', 'To review']];
|
|
89
61
|
const AG_EMPTY = { running: 'No agent is running right now.', failed: 'No agent run has failed.', ready: 'No draft waits for your review.' };
|
|
62
|
+
const Q_EMPTY = { today: 'Nothing is placed for today.', inbox: 'Nothing waits to be sorted. Add a line above and it lands here first.', agents: 'No agent is working on your items.', upcoming: 'Nothing has a later date.', someday: 'Nothing is parked.', kept: 'Nothing kept yet.', done: 'Nothing done this week.' };
|
|
90
63
|
let agTile = null;
|
|
91
|
-
function
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
$('#
|
|
64
|
+
function groupHtml(g, tab) {
|
|
65
|
+
const ag = tab === 'agents', first = tab === 'today' ? g.rows.find((r) => r.overdue) || null : null;
|
|
66
|
+
return g.rows.map((r) => rowHtml(r, { sm: ag ? 'ag' : undefined, first: first && r.key === first.key })).join('') + (g.more ? `<p class="note">${g.more} more ${g.more === 1 ? 'item is' : 'items are'} not shown here.</p>` : '');
|
|
67
|
+
}
|
|
68
|
+
function drawQueue() {
|
|
69
|
+
const Q = M.queue, tabs = Q.tabs;
|
|
70
|
+
if (!qTab || !tabs.some((t) => t.key === qTab)) qTab = Q.start;
|
|
71
|
+
const cur = tabs.find((t) => t.key === qTab);
|
|
72
|
+
$('#qCap').innerHTML = `<b>${Q.n}</b> to clear` + Q.cap.map((c) => ' · ' + esc(c)).join('');
|
|
73
|
+
$('#qTabs').innerHTML = tabs.map((t) => `<button type="button" role="tab" class="qtb" id="qt-${t.key}" data-tab="${t.key}" aria-selected="${t.key === qTab}" aria-controls="qBody" tabindex="${t.key === qTab ? 0 : -1}">${esc(t.label)}<em>${t.n}</em></button>`).join('');
|
|
74
|
+
$('#qBody').setAttribute('aria-labelledby', 'qt-' + qTab);
|
|
75
|
+
const pipe = $('#qPipe');
|
|
76
|
+
pipe.hidden = qTab !== 'agents';
|
|
77
|
+
let h = '';
|
|
78
|
+
if (qTab === 'agents') {
|
|
79
|
+
const c = cur.counts;
|
|
80
|
+
if (agTile && !(cur.by && cur.by[agTile])) agTile = null;
|
|
81
|
+
pipe.innerHTML = AG_TILES.map(([k, label]) => `<button type="button" class="pst${agTile === k ? ' hot' : ''}" data-ag="${k}" aria-pressed="${agTile === k}" aria-controls="qBody" title="${agTile === k ? 'Show every item again' : 'Show only the items that are ' + label.toLowerCase()}"><b>${c[k]}</b><span>${label}</span></button>`).join('');
|
|
82
|
+
const g = agTile ? cur.by[agTile] : cur.groups[0];
|
|
83
|
+
h = g.rows.length ? groupHtml(g, 'agents') : `<p class="empty3 plain">${agTile ? AG_EMPTY[agTile] : Q_EMPTY.agents}</p>`;
|
|
84
|
+
} else if (!cur.n) h = `<p class="empty3${qTab === 'inbox' ? '' : ' plain'}">${qTab === 'inbox' ? CHECK : ''}${Q_EMPTY[qTab]}</p>`;
|
|
85
|
+
else for (const g of cur.groups) {
|
|
86
|
+
if (cur.groups.length > 1) h += `<div class="wsec" data-lane="${g.key}"><span class="label">${esc(g.label)}</span><em>${g.n ? g.n + ' · ' + esc(g.hint) : 'empty'}</em></div>`;
|
|
87
|
+
h += groupHtml(g, qTab);
|
|
88
|
+
}
|
|
89
|
+
$('#qBody').innerHTML = h;
|
|
90
|
+
$('#qBody').dataset.tab = qTab;
|
|
91
|
+
$('#qNote').textContent = cur.note;
|
|
100
92
|
}
|
|
93
|
+
$('#qTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-tab]'); if (!b) return; qTab = b.dataset.tab; drawQueue(); const n = $(`#qTabs [data-tab="${qTab}"]`); if (n) n.focus(); });
|
|
94
|
+
$('#qTabs').addEventListener('keydown', (e) => {
|
|
95
|
+
if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft' && e.key !== 'Home' && e.key !== 'End') return;
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
const ks = M.queue.tabs.map((t) => t.key), i = ks.indexOf(qTab);
|
|
98
|
+
qTab = ks[e.key === 'Home' ? 0 : e.key === 'End' ? ks.length - 1 : (i + (e.key === 'ArrowRight' ? 1 : -1) + ks.length) % ks.length];
|
|
99
|
+
drawQueue(); $(`#qTabs [data-tab="${qTab}"]`).focus();
|
|
100
|
+
});
|
|
101
|
+
$('#qPipe').addEventListener('click', (e) => { const b = e.target.closest('[data-ag]'); if (!b) return; agTile = agTile === b.dataset.ag ? null : b.dataset.ag; drawQueue(); const n = $(`#qPipe [data-ag="${b.dataset.ag}"]`); if (n) n.focus(); });
|
|
101
102
|
function drawWaiting() {
|
|
102
103
|
const W = M.waiting;
|
|
103
104
|
$('#waitCap').textContent = W.cap;
|
|
@@ -143,7 +144,7 @@ function drawWeek() {
|
|
|
143
144
|
+ (x && x.rows.length ? x.rows.map((r) => `<div class="ev src-meeting${r.past || (x.today && Date.parse(r.end || r.at) < Date.now()) ? ' wkpast' : ''}" role="listitem"><time>${esc(r.time)}</time><span class="gl-t"><svg class="i" viewBox="0 0 24 24"><rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/></svg></span><span><b>${esc(r.title)}</b><span class="d">${esc([r.sub, r.about].filter(Boolean).join(' · ') || 'No other people listed')}</span></span></div>`).join('') : '<div class="empty">No meetings.</div>');
|
|
144
145
|
}
|
|
145
146
|
$('#weekBody').addEventListener('click', (e) => { const b = e.target.closest('[data-day]'); if (!b || !M) return; wkPick = b.dataset.day; drawWeek(); });
|
|
146
|
-
function draw() { drawHero(); drawWeek(); drawFriday(); drawFocus();
|
|
147
|
+
function draw() { drawHero(); drawWeek(); drawFriday(); drawFocus(); drawQueue(); drawWaiting(); drawReview(); drawDock(); onScroll(); backFocus(); }
|
|
147
148
|
const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || null;
|
|
148
149
|
|
|
149
150
|
/* ── the dialog: detail first, the presses of the Work page, the tool row, the agent, the read-only agent beside it ─────────────────── */
|
|
@@ -529,11 +530,8 @@ document.addEventListener('click', async (e) => {
|
|
|
529
530
|
});
|
|
530
531
|
|
|
531
532
|
/* ── the list: a check marks done, a row opens its dialog, keys and swipe act on a row ───────────────────────────────────── */
|
|
532
|
-
$('#
|
|
533
|
-
$('#agl').addEventListener('click', (e) => { listClick(e); });
|
|
534
|
-
$('#pipe').addEventListener('click', (e) => { const b = e.target.closest('[data-ag]'); if (!b) return; agTile = agTile === b.dataset.ag ? null : b.dataset.ag; drawAgents(); const n = $(`#pipe [data-ag="${b.dataset.ag}"]`); if (n) n.focus(); });
|
|
533
|
+
$('#qBody').addEventListener('click', async (e) => { await listClick(e); });
|
|
535
534
|
$('#waitBody').addEventListener('click', (e) => { listClick(e); });
|
|
536
|
-
$('#trayBody').addEventListener('click', (e) => { listClick(e); });
|
|
537
535
|
async function listClick(e) {
|
|
538
536
|
const ck = e.target.closest('.wck');
|
|
539
537
|
if (ck && ck.dataset.open) { openRow(rowOf(ck.dataset.open)); return; }
|
|
@@ -572,7 +570,7 @@ function backFocus() {
|
|
|
572
570
|
const L = rowsIn(f.box), el = $(`${f.box} .wrow[data-key="${f.key}"] .wrh`) || L[Math.min(f.i, L.length - 1)];
|
|
573
571
|
if (el) el.focus();
|
|
574
572
|
}
|
|
575
|
-
for (const box of ['#
|
|
573
|
+
for (const box of ['#qBody']) {
|
|
576
574
|
const root = $(box);
|
|
577
575
|
root.addEventListener('keydown', (e) => {
|
|
578
576
|
const h = e.target.closest && e.target.closest('.wrh');
|
|
@@ -629,8 +627,9 @@ $('#cap').addEventListener('submit', async (e) => {
|
|
|
629
627
|
if (!res || res.ok !== true) { $('#capHint').textContent = (res && res.error) || 'It was not added.'; return; }
|
|
630
628
|
inp.value = '';
|
|
631
629
|
const it = res.item || {};
|
|
630
|
+
if (!it.due) qTab = 'inbox'; // a line with no date waits in the inbox, so the queue opens there
|
|
632
631
|
const bits = [it.due ? 'due ' + it.due : null, it.priority].filter(Boolean);
|
|
633
|
-
$('#capHint').textContent = 'Added: ' + (it.title || line) + (bits.length ? ' (' + bits.join(', ') + ')' : '') + '. It is in your
|
|
632
|
+
$('#capHint').textContent = 'Added: ' + (it.title || line) + (bits.length ? ' (' + bits.join(', ') + ')' : '') + '. It is in your inbox until you place it.';
|
|
634
633
|
await load();
|
|
635
634
|
const fresh = it.id ? rowOf('work:' + it.id) : null; // a new item opens at once, so it can be placed
|
|
636
635
|
if (fresh) openRow(fresh);
|
|
@@ -1977,6 +1977,21 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
1977
1977
|
.mhint .lk{display:inline;font-size:12.5px;font-weight:600;color:var(--ink);text-decoration:underline;text-underline-offset:2px;padding:0}
|
|
1978
1978
|
.mhint .lk:hover{color:var(--ember-ink)}
|
|
1979
1979
|
|
|
1980
|
+
/* My work: the Work queue (PM, 2026-10-19) — one card for what On your plate, With agents and the tray held. Tabs are one pill row as the mockup's tray. */
|
|
1981
|
+
.qtabs{display:inline-flex;flex-wrap:wrap;gap:2px;padding:4px;margin:14px 0 6px;border-radius:var(--r-chip);background:var(--well);max-width:100%}
|
|
1982
|
+
.qtb{height:36px;padding:0 14px;border-radius:var(--r-chip);font-size:var(--t-small);font-weight:600;color:var(--ink-2);white-space:nowrap;transition:background .25s,color .25s}
|
|
1983
|
+
.qtb em{font-style:normal;font-weight:500;margin-left:6px;opacity:.75}
|
|
1984
|
+
.qtb:hover{color:var(--ink)}
|
|
1985
|
+
.qtb[aria-selected="true"]{background:var(--solid);color:var(--on-solid)}
|
|
1986
|
+
.qtb:focus-visible{outline:2px solid var(--ember);outline-offset:2px}
|
|
1987
|
+
.qpipe{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:8px 0 4px;max-width:520px}
|
|
1988
|
+
.qpipe[hidden]{display:none}
|
|
1989
|
+
#qCap b{color:var(--ink)}
|
|
1990
|
+
.tgrid .wsec{grid-column:1/-1}
|
|
1991
|
+
.tgrid .wsec+.wrw+.wrw{border-top:0}
|
|
1992
|
+
#qBody .wsec:first-child{padding-top:8px}
|
|
1993
|
+
@media (max-width:1000px){.tgrid .wsec+.wrw+.wrw{border-top:1px solid var(--hair)}}
|
|
1994
|
+
@media (max-width:700px){.qtabs{display:flex;border-radius:18px;width:100%}.qtb{flex:1 1 auto;min-height:44px;padding:0 10px}}
|
|
1980
1995
|
.rdbtns{display:inline-flex;gap:6px;align-items:center}
|
|
1981
1996
|
.wks .wkc{font:400 12px var(--sans);letter-spacing:0;text-transform:none;padding:12px 4px 10px}
|
|
1982
1997
|
.wkc .wkl{font:500 11px var(--mono);letter-spacing:.08em}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="pmos-nonce" content="" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
7
7
|
<title>PMOS · Insights</title>
|
|
8
|
-
<!-- The premium Insights (initiative briefing-premium-insights, slice 9). The fourth place on the rail, in the Briefing's shell. It reads GET /api/insights-premium, built from the KR metric records and the report files the console's Reports tab reads
|
|
8
|
+
<!-- The premium Insights (initiative briefing-premium-insights, slice 9). The fourth place on the rail, in the Briefing's shell. It reads GET /api/insights-premium, built from the KR metric records and the report files the console's Reports tab reads, and GET /api/board-metrics-premium for the Board measures card, whose one press sets a target (POST /api/board-metric-targets/save). -->
|
|
9
9
|
<link rel="preload" href="/vendor/geist-var.woff2" as="font" type="font/woff2" crossorigin />
|
|
10
10
|
<link rel="stylesheet" href="/pm/premium.css" />
|
|
11
11
|
<link rel="stylesheet" href="/pm/premium-insights.css" />
|
|
@@ -41,6 +41,12 @@
|
|
|
41
41
|
<button class="glass round" id="theme" aria-label="Switch light or dark"><svg class="i" viewBox="0 0 24 24"><path d="M20 14.5A8 8 0 0 1 9.5 4 8 8 0 1 0 20 14.5z"/></svg></button></div>
|
|
42
42
|
</header>
|
|
43
43
|
<section class="hero hero-slim"><p class="brief rise" style="--d:2" id="brief" aria-live="polite"></p></section>
|
|
44
|
+
<section class="card rise" style="--d:4" id="cBm" aria-labelledby="hBm" hidden>
|
|
45
|
+
<div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><path d="M4 20V10M10 20V4M16 20v-8M22 20H2"/></svg></span><h2 id="hBm">Board measures</h2><small id="bmCap"></small><div class="seg mper" id="bmRange" role="group" aria-label="Range"><i class="pill"></i><button data-w="8" aria-pressed="true">8 weeks</button><button data-w="26" aria-pressed="false">26 weeks</button><button data-w="52" aria-pressed="false">52 weeks</button></div></div>
|
|
46
|
+
<p class="mhint" id="bmHint"></p>
|
|
47
|
+
<div class="bt2 ibt" id="bmBody"></div>
|
|
48
|
+
<p class="note" id="bmNote"></p>
|
|
49
|
+
</section>
|
|
44
50
|
<div class="nl">
|
|
45
51
|
<div class="nlc">
|
|
46
52
|
<section class="card rise" style="--d:5" id="cDash" aria-labelledby="hDash">
|
|
@@ -57,7 +63,7 @@
|
|
|
57
63
|
</section>
|
|
58
64
|
</aside>
|
|
59
65
|
</div>
|
|
60
|
-
<p class="foot" id="foot">Charts read the KR metric records of this workspace and never invent a number. A press here records only what it says: a dashboard or a chart in the workspace's state folder, a report setup, request or dismissal in the report ledger, or a report's look in its design folder.
|
|
66
|
+
<p class="foot" id="foot">Charts read the KR metric records of this workspace and never invent a number. A press here records only what it says: a dashboard or a chart in the workspace's state folder, a report setup, request or dismissal in the report ledger, or a report's look in its design folder. The Board measures card counts the Board's four measures from the repository, over 8, 26 or 52 weeks; a target set there is saved in the workspace's state folder and drawn on the Board too. Left out: any measure no record holds. Nothing is sent from this page.</p>
|
|
61
67
|
</main>
|
|
62
68
|
<noscript>This page needs JavaScript.</noscript>
|
|
63
69
|
<script type="module" src="/pm/premium-insights.js"></script>
|