create-pmos 0.470.0 → 0.472.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 +27 -27
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/board-publish-ui-test.js +9 -0
- package/workspace/board-shared-ui-test.js +155 -0
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/published-board.md +31 -6
- package/workspace/lib/board-pack-route.js +2 -2
- package/workspace/lib/board-pack.js +3 -1
- package/workspace/lib/boards-host.js +6 -3
- package/workspace/lib/boards-teams.js +99 -0
- package/workspace/lib/routes-board-publish.js +22 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-publish.css +1 -0
- package/workspace/public/pm/bd-publish.js +5 -4
- package/workspace/public/pm/bd-shared.css +31 -0
- package/workspace/public/pm/bd-shared.js +153 -0
- package/workspace/public/pm/premium-board.js +18 -7
- package/workspace/public/pm/readonly.js +5 -2
- package/workspace/public/premium-board.html +2 -0
- package/workspace/test-lists/board-publish-b.json +4 -2
- package/workspace/test-lists/board-publish-d.json +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.472.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -32,6 +32,32 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.472.0",
|
|
37
|
+
"at": "2026-11-01T00:41:46.421Z",
|
|
38
|
+
"f": 3,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 1126,
|
|
42
|
+
"t": "Popover in view, published copy opens on the publisher's view, stage track opens initiatives",
|
|
43
|
+
"s": "Popover in view, published copy opens on the publisher's view, stage track opens initiatives",
|
|
44
|
+
"k": "fix"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"v": "0.471.0",
|
|
50
|
+
"at": "2026-10-31T13:21:46.914Z",
|
|
51
|
+
"f": 3,
|
|
52
|
+
"prs": [
|
|
53
|
+
{
|
|
54
|
+
"n": 1124,
|
|
55
|
+
"t": "The Shared tab on the Board — join a team, read its boards, open one (board-publish slice 4)",
|
|
56
|
+
"s": "The Shared tab on the Board — join a team, read its boards, open one (board-publish slice 4)",
|
|
57
|
+
"k": "new"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
35
61
|
{
|
|
36
62
|
"v": "0.470.0",
|
|
37
63
|
"at": "2026-10-31T12:11:04.375Z",
|
|
@@ -271,32 +297,6 @@
|
|
|
271
297
|
"k": "new"
|
|
272
298
|
}
|
|
273
299
|
]
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
"v": "0.452.0",
|
|
277
|
-
"at": "2026-10-29T12:12:01.657Z",
|
|
278
|
-
"f": 3,
|
|
279
|
-
"prs": [
|
|
280
|
-
{
|
|
281
|
-
"n": 1098,
|
|
282
|
-
"t": "Settings > Claude: API key and Claude profile",
|
|
283
|
-
"s": "Settings > Claude: API key and Claude profile",
|
|
284
|
-
"k": "new"
|
|
285
|
-
}
|
|
286
|
-
]
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
"v": "0.451.0",
|
|
290
|
-
"at": "2026-10-29T08:45:28.582Z",
|
|
291
|
-
"f": 3,
|
|
292
|
-
"prs": [
|
|
293
|
-
{
|
|
294
|
-
"n": 1097,
|
|
295
|
-
"t": "Catch up to Claude Code 2.1.312",
|
|
296
|
-
"s": "Catch up to Claude Code 2.1.312",
|
|
297
|
-
"k": "x"
|
|
298
|
-
}
|
|
299
|
-
]
|
|
300
300
|
}
|
|
301
301
|
]
|
|
302
302
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
kernel-source: pmos@
|
|
2
|
-
assembled: 2026-
|
|
1
|
+
kernel-source: pmos@68660133
|
|
2
|
+
assembled: 2026-11-01
|
|
3
3
|
mode: vendor
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-01T00:41:42Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-01T00:41:42Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-01T00:41:42Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/payload/state/log.md
CHANGED
|
@@ -72,6 +72,15 @@ const ok = (name, cond, extra = '') => { n++; if (!cond) bad++; console.log(`${c
|
|
|
72
72
|
await ctx.close();
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
{
|
|
76
|
+
W.links = []; W.host = 'boards.test';
|
|
77
|
+
const s6 = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf');
|
|
78
|
+
await s6.p.locator('#bdPublish').click(); await s6.p.waitForSelector('.bppop', { timeout: 5000 }).catch(() => {}); await s6.p.waitForTimeout(300);
|
|
79
|
+
const g = await s6.p.evaluate(() => { const m = document.querySelector('.bppop').getBoundingClientRect(), b = document.querySelector('#bdPublish').getBoundingClientRect(); return { top: m.top, bottom: m.bottom, right: m.right, left: m.left, btnBottom: b.bottom, h: innerHeight, w: innerWidth }; });
|
|
80
|
+
ok('A6 the popover opens under the button and inside the viewport, not below the fold', g.top >= g.btnBottom && g.top < g.btnBottom + 40 && g.bottom <= g.h && g.left >= 0 && g.right <= g.w, JSON.stringify(g));
|
|
81
|
+
await s6.ctx.close();
|
|
82
|
+
}
|
|
83
|
+
|
|
75
84
|
console.log('B no host');
|
|
76
85
|
W.links = []; W.host = null; W.settings = []; W.settingsAnswer = null;
|
|
77
86
|
s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#bdPublish'); await s.p.waitForSelector('#bpHost');
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* board-shared-ui — the Shared tab of the Board (initiative board-publish, slice 4; planning/prd/board-publish-prd.md T1 to T6; design
|
|
4
|
+
* prototype/board-publish/shared-view-design.html). Serves the real page from the real server. The workspace's /api/board-publish answers are served by
|
|
5
|
+
* the test (the server side is tested in board-publish-teams.test.js against the real host), so each press is checked on what the page SENDS and draws.
|
|
6
|
+
* A the tab and its number · B join · C the list · D a team that cannot be read · E leave · F reads happen on open and on Refresh only · G a phone */
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const { spawn } = require('child_process');
|
|
9
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
10
|
+
const T = require('./test-run').configure({ name: 'board-shared-ui' });
|
|
11
|
+
const BP = require('./lib/board-premium.js');
|
|
12
|
+
const F = require('./fixtures/board-premium-facts.js');
|
|
13
|
+
const Pack = require('./lib/board-pack.js');
|
|
14
|
+
|
|
15
|
+
let n = 0; let bad = 0;
|
|
16
|
+
const ok = (name, cond, extra = '') => { n++; if (!cond) bad++; console.log(`${cond ? ' ✓' : ' ✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 300) : ''}`); };
|
|
17
|
+
const iso = (ms) => new Date(Date.now() + ms).toISOString();
|
|
18
|
+
|
|
19
|
+
(async () => {
|
|
20
|
+
const { chromium } = require('playwright-core');
|
|
21
|
+
const srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
22
|
+
const finish = async (browser, code) => { try { if (browser) await browser.close(); } catch { /* gone */ } try { srv.kill('SIGKILL'); } catch { /* gone */ } T.killTmux(); console.log(`\n${n - bad}/${n} board-shared-ui assertions passed`); process.exit(code !== undefined ? code : (bad ? 1 : 0)); };
|
|
23
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(null, 1); });
|
|
24
|
+
await T.waitForServer(T.BASE);
|
|
25
|
+
const browser = await chromium.launch({ executablePath: findBrowser() });
|
|
26
|
+
const model = BP.build(F.programFacts('idpf'));
|
|
27
|
+
const BOARD = '/api/board-premium?ws=idpf&board=idpf';
|
|
28
|
+
|
|
29
|
+
const MINE = [{ id: 'mine0000000000000001', url: 'https://boards.test/b/mine0000000000000001', team: 'Product', name: 'IDPF', kind: 'product', by: 'Wawan', made: iso(-86400000), ends: iso(6 * 86400000), views: 3 },
|
|
30
|
+
{ id: 'mine0000000000000002', url: 'https://boards.test/b/mine0000000000000002', team: 'Product', name: 'Project Ascent', kind: 'program', by: 'Wawan', made: iso(-2 * 86400000), ends: iso(20 * 3600000), views: 11 }];
|
|
31
|
+
const TEAM_OK = { team: 'Product', host: 'boards.test', ok: true, links: [
|
|
32
|
+
{ id: 'team0000000000000001', name: 'Descope feature parity', kind: 'initiative', by: 'Dimas', made: iso(-3 * 86400000), ends: iso(20 * 3600000), views: 7 },
|
|
33
|
+
{ id: 'team0000000000000002', name: 'Payments redesign', kind: 'program', by: 'Anya', made: iso(-4 * 86400000), ends: iso(5 * 86400000), views: 4 },
|
|
34
|
+
{ id: 'team0000000000000003', name: 'Legacy IdP sunset', kind: 'initiative', by: 'Mei', made: iso(-12 * 86400000), ends: iso(-86400000), views: 9 },
|
|
35
|
+
Object.assign({}, { id: 'mine0000000000000001', name: 'IDPF', kind: 'product', by: 'Wawan', made: iso(-86400000), ends: iso(6 * 86400000), views: 3 })] };
|
|
36
|
+
const W = { yours: [], teams: [], names: [], posts: [], reads: 0, joinAnswer: null, popup: null };
|
|
37
|
+
const open = async (w, h, url, init) => {
|
|
38
|
+
const ctx = await browser.newContext({ viewport: { width: w, height: h } });
|
|
39
|
+
await ctx.route((u) => /\/api\/board-premium/.test(u.toString()), (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model, as_of: 1 }) }));
|
|
40
|
+
await ctx.route((u) => new URL(u).pathname === '/api/programs', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, programs: F.programs() }) }));
|
|
41
|
+
await ctx.route((u) => new URL(u).pathname === '/api/board-publish', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, host: 'boards.test', days: [1, 7, 30], password: 'x', links: W.yours, teams: W.names, choices: null }) }));
|
|
42
|
+
await ctx.route((u) => new URL(u).pathname === '/api/board-publish/shared', (r) => { W.reads++; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, readAt: new Date().toISOString(), yours: W.yours, teams: W.teams }) }); });
|
|
43
|
+
await ctx.route((u) => /\/api\/board-publish\/(join|leave|open|republish|off)$/.test(new URL(u).pathname), (r) => {
|
|
44
|
+
const p = new URL(r.request().url()).pathname; const body = JSON.parse(r.request().postData() || '{}'); W.posts.push({ p, body });
|
|
45
|
+
if (p.endsWith('/join')) { const a = W.joinAnswer; if (a) return r.fulfill({ contentType: 'application/json', status: a.status || 400, body: JSON.stringify(a.body) }); W.names = ['Product']; W.teams = [JSON.parse(JSON.stringify(TEAM_OK))]; return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, team: 'Product' }) }); }
|
|
46
|
+
if (p.endsWith('/open')) return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, url: 'https://boards.test/b/' + body.id + '?t=ONETIME' }) });
|
|
47
|
+
if (p.endsWith('/leave')) { W.names = []; W.teams = []; }
|
|
48
|
+
if (p.endsWith('/off')) { W.yours = W.yours.filter((l) => l.id !== body.id); W.teams.forEach((t) => { if (t.links) t.links = t.links.filter((l) => l.id !== body.id); }); }
|
|
49
|
+
return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true }) });
|
|
50
|
+
});
|
|
51
|
+
await ctx.route('https://boards.test/**', (r) => r.fulfill({ contentType: 'text/html', body: '<title>host</title><p>the board</p>' }));
|
|
52
|
+
const errs = []; const p = await ctx.newPage(); p.on('pageerror', (e) => errs.push(e.message));
|
|
53
|
+
const reqs = []; ctx.on('request', (r) => reqs.push(new URL(r.url()).pathname));
|
|
54
|
+
await p.addInitScript(() => { try { localStorage.setItem('pmos.board.view', 'list'); localStorage.setItem('pmos.board.grouping', 'program'); } catch (e) { /* none */ } });
|
|
55
|
+
await p.goto(T.BASE + url); await p.waitForSelector('#tabShared', { timeout: 15000 }).catch(() => {}); await p.waitForTimeout(700);
|
|
56
|
+
return { ctx, p, errs, reqs };
|
|
57
|
+
};
|
|
58
|
+
const reset = (o = {}) => { Object.assign(W, { yours: [], teams: [], names: [], posts: [], reads: 0, joinAnswer: null }, o); };
|
|
59
|
+
|
|
60
|
+
console.log('A the tab and its number');
|
|
61
|
+
reset();
|
|
62
|
+
let s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf');
|
|
63
|
+
ok('A1 Shared is a tab beside Initiatives and Documents, and has no number when there is nothing', await s.p.locator('#tabShared').isVisible() && /^Shared\s*$/.test((await s.p.locator('#tabShared').textContent()).trim()));
|
|
64
|
+
ok('A2 opening the tab with nothing joined asks nothing of any host beyond the read, and shows one sentence and the invite field', await (async () => { await s.p.click('#tabShared'); await s.p.waitForSelector('#shInvite'); return /Join a team to see its boards/.test(await s.p.locator('#cShared').textContent()) && (await s.p.locator('#cShared .bd-dt').count()) === 0; })());
|
|
65
|
+
ok('A3 the other tabs are hidden while it is open, and Initiatives comes back', await s.p.locator('#cIni').isHidden() && await s.p.locator('#cDocs').isHidden() && (await (async () => { await s.p.click('#tabIni'); return s.p.locator('#cShared').isHidden(); })()));
|
|
66
|
+
await s.ctx.close();
|
|
67
|
+
reset({ yours: MINE, names: ['Product'] }); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf');
|
|
68
|
+
ok('A4 at load the number is your own open links, from this computer only (no host was asked)', (await s.p.locator('#nShared').textContent()) === '2' && W.reads === 0, await s.p.locator('#nShared').textContent());
|
|
69
|
+
await s.ctx.close();
|
|
70
|
+
{
|
|
71
|
+
const pack = Pack.buildPack({ ws: 'idpf', board: 'idpf', selection: [{ kind: 'product', id: 'idpf' }], meta: { by: 'W', at: 'x', ends: 'y', viewer: 'test' }, answers: { [BOARD]: { ok: true, state: 'ready', model, as_of: 1 }, '/api/programs': { ok: true, programs: F.programs() } } });
|
|
72
|
+
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } }); const reqs = []; ctx.on('request', (r) => reqs.push(new URL(r.url()).pathname));
|
|
73
|
+
await ctx.route((u) => new URL(u).pathname === '/__pack/p.json', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(pack) }));
|
|
74
|
+
const p = await ctx.newPage(); await p.goto(T.BASE + '/premium-board.html?ws=idpf&board=idpf&pack=/__pack/p.json'); await p.waitForSelector('.tg-n.ini2', { timeout: 15000 }).catch(() => {}); await p.waitForTimeout(600);
|
|
75
|
+
ok('A5 the read-only Board does not draw the tab and asks nothing of /api/board-publish', (await p.locator('#tabShared').isHidden()) && !reqs.some((u) => /board-publish/.test(u)));
|
|
76
|
+
await ctx.close();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
console.log('B join');
|
|
80
|
+
reset(); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#tabShared'); await s.p.waitForSelector('#shInvite');
|
|
81
|
+
W.joinAnswer = { status: 400, body: { ok: false, error: 'This is not an invite link. It looks like https://boards.example.com/join#Team.password.' } };
|
|
82
|
+
await s.p.fill('#shInvite', 'hello'); await s.p.click('[data-sh="join"]'); await s.p.waitForSelector('[role="alert"]');
|
|
83
|
+
ok('B1 a refused invite shows the sentence under the field and keeps what was pasted', /not an invite link/.test(await s.p.locator('#cShared [role="alert"]').textContent()) && (await s.p.inputValue('#shInvite')) === 'hello' && W.posts[0].body.invite === 'hello');
|
|
84
|
+
await s.p.click('[data-sh="typed"]'); await s.p.waitForSelector('#shHost');
|
|
85
|
+
W.joinAnswer = { status: 429, body: { ok: false, kind: 'locked', error: 'Too many wrong tries. Try again in 12 minutes.' } };
|
|
86
|
+
await s.p.fill('#shHost', 'https://boards.pm-os.app'); await s.p.fill('#shTeam', 'Product'); await s.p.fill('#shPass', 'harbor-lime-47'); await s.p.click('[data-sh="join"]'); await s.p.waitForFunction(() => /12 minutes/.test((document.querySelector('#cShared [role="alert"]') || {}).textContent || ''));
|
|
87
|
+
const last = W.posts[W.posts.length - 1].body;
|
|
88
|
+
ok('B2 the typed way sends the host, team and password, and a lockout is shown with its minutes', last.host === 'https://boards.pm-os.app' && last.team === 'Product' && last.password === 'harbor-lime-47');
|
|
89
|
+
W.joinAnswer = null; await s.p.click('[data-sh="paste"]'); await s.p.fill('#shInvite', 'https://boards.test/join#Product.harbor-lime-47'); await s.p.click('[data-sh="join"]'); await s.p.waitForSelector('.bdsh-table');
|
|
90
|
+
ok('B3 a join that works reads the team and shows its list; the tab gets its number', (await s.p.locator('#nShared').textContent()) === '3' && /Joined Product/.test(await s.p.locator('#cShared').textContent()), await s.p.locator('#nShared').textContent());
|
|
91
|
+
await s.ctx.close();
|
|
92
|
+
|
|
93
|
+
console.log('C the list');
|
|
94
|
+
reset({ yours: MINE, names: ['Product'], teams: [JSON.parse(JSON.stringify(TEAM_OK))] }); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#tabShared'); await s.p.waitForSelector('.bdsh-table');
|
|
95
|
+
const chips = await s.p.locator('#cShared .bd-dchips .bd-chip').allTextContents();
|
|
96
|
+
ok('C1 the chips are All, Yours and one per team; counts leave out an ended copy, and your own link published to a team is one copy, not two', JSON.stringify(chips.map((x) => x.trim())) === JSON.stringify(['All 4', 'Yours 2', 'Product 4']), JSON.stringify(chips));
|
|
97
|
+
const names = await s.p.locator('#cShared .bdsh-table .bd-dlink').allTextContents();
|
|
98
|
+
ok('C2 your own links come first, then the team\'s, and an ended copy last; your link in the team list is not drawn twice', JSON.stringify(names) === JSON.stringify(['IDPF', 'Project Ascent', 'Descope feature parity', 'Payments redesign', 'Legacy IdP sunset']), JSON.stringify(names));
|
|
99
|
+
ok('C3 an ended copy is dimmed and is not a button; a copy that ends within a day and a half shows the Board\'s warning dot', (await s.p.locator('#cShared .bdsh-table .bdsh-gone').count()) === 1 && (await s.p.locator('#cShared .bdsh-table .bdsh-gone button.bd-dlink').count()) === 0 && (await s.p.locator('#cShared .bdsh-table .s-risk').count()) === 2);
|
|
100
|
+
ok('C4 the line under the table says where and when it was read', /Read from boards\.test just now/.test(await s.p.locator('#cShared .bdsh-fine').last().textContent()), await s.p.locator('#cShared .bdsh-fine').last().textContent());
|
|
101
|
+
const popup = s.p.waitForEvent('popup'); await s.p.locator('#cShared .bdsh-table [data-sh-open="team0000000000000001"]').click(); const pg = await popup; await pg.waitForURL(/ONETIME/, { timeout: 8000 }).catch(() => {});
|
|
102
|
+
const o = W.posts.find((x) => x.p.endsWith('/open'));
|
|
103
|
+
ok('C5 a press on a team\'s board asks for a one-time address and opens it in a new tab', o && o.body.team === 'Product' && o.body.id === 'team0000000000000001' && /boards\.test\/b\/team0000000000000001\?t=ONETIME/.test(pg.url()), pg.url());
|
|
104
|
+
await pg.close();
|
|
105
|
+
await s.p.locator('#cShared .bdsh-table [data-sh-re]').first().click(); await s.p.waitForTimeout(500);
|
|
106
|
+
ok('C6 Republish sends the link\'s id and the list is read again', W.posts.some((x) => x.p.endsWith('/republish') && x.body.id === MINE[0].id) && /Republished/.test(await s.p.locator('#cShared').textContent()));
|
|
107
|
+
await s.p.locator('#cShared .bdsh-table [data-sh-off]').first().click();
|
|
108
|
+
ok('C7 the first Turn off press asks "Sure?" and sends nothing', /Sure\? Turn off/.test(await s.p.locator('#cShared [data-sh-off]').first().textContent()) && !W.posts.some((x) => x.p.endsWith('/off')));
|
|
109
|
+
await s.p.locator('#cShared .bdsh-table [data-sh-off]').first().click(); await s.p.waitForTimeout(500);
|
|
110
|
+
ok('C8 the second press turns it off and the row goes', W.posts.some((x) => x.p.endsWith('/off') && x.body.id === MINE[0].id) && !(await s.p.locator('#cShared .bdsh-table').textContent()).includes('IDPF'));
|
|
111
|
+
await s.p.click('[data-sh-sel="mine"]');
|
|
112
|
+
ok('C9 the Yours chip shows only your own links', (await s.p.locator('#cShared .bdsh-table .bd-dlink').count()) === 1);
|
|
113
|
+
await s.ctx.close();
|
|
114
|
+
|
|
115
|
+
console.log('D a team that cannot be read');
|
|
116
|
+
const BAD = { team: 'Growth', host: 'boards.test', ok: false, kind: 'password', error: 'The team password no longer works. Ask for a new invite link.' };
|
|
117
|
+
reset({ yours: [], names: ['Product', 'Growth'], teams: [JSON.parse(JSON.stringify(TEAM_OK)), BAD] }); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#tabShared'); await s.p.waitForSelector('.bdsh-ban');
|
|
118
|
+
ok('D1 the failing team shows one line that says why and what to do, no old rows, and the other team still draws', /Growth: The team password no longer works/.test(await s.p.locator('.bdsh-ban').textContent()) && (await s.p.locator('#cShared .bdsh-table .bd-dlink').count()) === 4 && /Paste a new invite link/.test(await s.p.locator('.bdsh-ban .bd-btn').textContent()));
|
|
119
|
+
ok('D2 its chip has no count', (await s.p.locator('[data-sh-sel="Growth"]').textContent()).trim() === 'Growth');
|
|
120
|
+
await s.p.click('.bdsh-ban .bd-btn'); await s.p.waitForSelector('#shInvite');
|
|
121
|
+
ok('D3 Paste a new invite link opens the invite field', await s.p.locator('#shInvite').isVisible());
|
|
122
|
+
W.teams = [JSON.parse(JSON.stringify(TEAM_OK)), { team: 'Growth', host: 'boards.test', ok: false, kind: 'locked', error: 'Too many wrong tries. Try again in 9 minutes.' }];
|
|
123
|
+
await s.p.click('[data-sh="closejoin"]'); await s.p.click('[data-sh="refresh"] >> nth=0').catch(() => {}); await s.p.waitForTimeout(400);
|
|
124
|
+
ok('D4 a locked team says the minutes and offers Refresh', /9 minutes/.test(await s.p.locator('.bdsh-ban').textContent()) && /Refresh/.test(await s.p.locator('.bdsh-ban .bd-btn').textContent()));
|
|
125
|
+
await s.ctx.close();
|
|
126
|
+
|
|
127
|
+
console.log('E leave');
|
|
128
|
+
reset({ yours: [], names: ['Product'], teams: [JSON.parse(JSON.stringify(TEAM_OK))] }); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#tabShared'); await s.p.waitForSelector('.bdsh-table'); await s.p.click('[data-sh-sel="Product"]');
|
|
129
|
+
ok('E1 a team\'s chip adds Refresh, Paste a new invite link and Leave team', (await s.p.locator('.bdsh-tl .bd-btn').allTextContents()).map((x) => x.trim()).join('|') === 'Refresh|Paste a new invite link|Leave team');
|
|
130
|
+
await s.p.click('[data-sh-leave="Product"]');
|
|
131
|
+
ok('E2 the first press asks "Sure?", says what leaving does, and sends nothing', /Sure\? Leave Product/.test(await s.p.locator('[data-sh-leave]').textContent()) && /only forgets the team's password on this computer/.test(await s.p.locator('#cShared').textContent()) && !W.posts.some((x) => x.p.endsWith('/leave')));
|
|
132
|
+
await s.p.click('[data-sh-leave="Product"]'); await s.p.waitForSelector('#shInvite');
|
|
133
|
+
ok('E3 the second press leaves: the team is gone and the tab asks to join again', W.posts.some((x) => x.p.endsWith('/leave') && x.body.team === 'Product') && await s.p.locator('#shInvite').isVisible());
|
|
134
|
+
await s.ctx.close();
|
|
135
|
+
|
|
136
|
+
console.log('F reads');
|
|
137
|
+
reset({ yours: [], names: ['Product'], teams: [JSON.parse(JSON.stringify(TEAM_OK))] }); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf');
|
|
138
|
+
ok('F1 nothing is read from a host at load', W.reads === 0);
|
|
139
|
+
await s.p.click('#tabShared'); await s.p.waitForSelector('.bdsh-table'); const first = W.reads; await s.p.waitForTimeout(1500);
|
|
140
|
+
ok('F2 opening the tab reads once and nothing polls', first === 1 && W.reads === 1, W.reads);
|
|
141
|
+
await s.p.locator('#cShared .bdsh-lk').click(); await s.p.waitForTimeout(500);
|
|
142
|
+
ok('F3 Refresh reads again', W.reads === 2, W.reads);
|
|
143
|
+
await s.ctx.close();
|
|
144
|
+
|
|
145
|
+
console.log('G a phone');
|
|
146
|
+
reset({ yours: MINE, names: ['Product'], teams: [JSON.parse(JSON.stringify(TEAM_OK))] }); s = await open(390, 844, '/premium-board.html?ws=idpf&board=idpf');
|
|
147
|
+
ok('G1 on a phone Shared is a chip after Docs, and it opens the tab', await (async () => { await s.p.waitForSelector('#chShared'); const after = await s.p.evaluate(() => document.getElementById('chShared').previousElementSibling && document.getElementById('chShared').previousElementSibling.id); await s.p.click('#chShared'); await s.p.waitForSelector('.bdsh-cards .bdsh-card'); return after === 'chDocs'; })());
|
|
148
|
+
const g = await s.p.evaluate(() => ({ side: document.documentElement.scrollWidth > innerWidth + 1, table: getComputedStyle(document.querySelector('.bdsh-table')).display, cards: document.querySelectorAll('.bdsh-card').length }));
|
|
149
|
+
ok('G2 a row is a card: the table is not drawn, there is no sideways scroll', g.table === 'none' && g.cards === 5 && !g.side, JSON.stringify(g));
|
|
150
|
+
const small = await s.p.locator('#cShared button:visible').evaluateAll((els) => els.filter((e) => e.getBoundingClientRect().height < 34).map((e) => e.className + ':' + Math.round(e.getBoundingClientRect().height)));
|
|
151
|
+
ok('G3 every control on the phone is at least 34 px high', small.length === 0, small.join(' '));
|
|
152
|
+
ok('G4 no page error in any section', s.errs.length === 0, s.errs.join(' | '));
|
|
153
|
+
await s.ctx.close();
|
|
154
|
+
await finish(browser);
|
|
155
|
+
})();
|
|
@@ -435,7 +435,7 @@ const IVREAD = () => {
|
|
|
435
435
|
const R = await open({ w: 390, h: 844, theme, model: BP.build(FJ.facts()) }), q = R.page;
|
|
436
436
|
const m = await q.evaluate(() => { const small = [...document.querySelectorAll('#ibTabs button, #ibBody .bt-nm, #bdChipset .bd-chip, .bd-tab, #newIni, #bdFind, #bdView')].filter((b) => !b.closest('[hidden]') && b.getBoundingClientRect().height > 0 && b.getBoundingClientRect().height < 44).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().height)); const fab = document.querySelector('#czFab').getBoundingClientRect(); return { over: document.documentElement.scrollWidth > innerWidth + 1, small, fabRight: Math.round(innerWidth - fab.right), top: Math.round(document.querySelector('.bd-hd').getBoundingClientRect().height), chips: [...document.querySelectorAll('#bdChipset .bd-chip')].map((b) => b.textContent.replace(/\s+/g, ' ').trim()), title: getComputedStyle(document.querySelector('.bd-title')).display }; });
|
|
437
437
|
ok(`B13 at 390 px (${theme}) the page has no sideways scroll, the top bar is one line with "Board", the menu sits bottom right, and every control is 44 px`, !m.over && m.small.length === 0 && m.fabRight < 40 && m.top <= 56 && m.title !== 'none', JSON.stringify(m));
|
|
438
|
-
ok(`B13 at 390 px (${theme}) the chips lead with This sprint, then the Jira read time and the new asks, and end with the documents`, m.chips[0] === 'Sprint 24 only' && /^Jira \d+ days$/.test(m.chips[1]) && m.chips[2] === '1 new ask' && m.chips[m.chips.length -
|
|
438
|
+
ok(`B13 at 390 px (${theme}) the chips lead with This sprint, then the Jira read time and the new asks, and end with the documents and Shared`, m.chips[0] === 'Sprint 24 only' && /^Jira \d+ days$/.test(m.chips[1]) && m.chips[2] === '1 new ask' && m.chips[m.chips.length - 2] === 'Docs 6' && m.chips[m.chips.length - 1] === 'Shared', JSON.stringify(m.chips));
|
|
439
439
|
const pl = await q.evaluate(() => ({ groups: [...document.querySelectorAll('#ibBody .bd-ghd')].map((g) => g.textContent.replace(/\s+/g, ' ').trim()), seg: [...document.querySelectorAll('#ibBody [data-pv]')].map((b) => b.textContent + (b.getAttribute('aria-pressed') === 'true' ? '*' : '')).join(), note: /Timeline needs a wider screen/.test(document.querySelector('#ibBody').textContent), small: [...document.querySelectorAll('#ibBody [data-pv], #ibBody .bd-lrow')].filter((b) => b.getBoundingClientRect().height < 44).length }));
|
|
440
440
|
ok(`B13 at 390 px (${theme}) the phone opens on the List, grouped your turn first, with List, By stage, Track and Timeline (BdPhone, TsCPhone)`, pl.groups.join('|') === 'At risk or late4|On track3' && pl.seg === 'List*,By stage,Track,Timeline' && !pl.note && pl.small === 0, JSON.stringify(pl));
|
|
441
441
|
await q.click('#bdView'); const s2 = await q.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1 && document.querySelectorAll('#ibBody .bd-scols.ph .bd-scol').length + (((document.querySelector('#ibBody .bd-sempty') || {}).textContent || '').replace(/^Nothing on screen in /, '').match(/[A-Z][a-z]+/g) || []).length === 8);
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.472.0",
|
|
4
|
+
"at": "2026-11-01T00:41:46.421Z",
|
|
5
|
+
"f": 3,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1126,
|
|
9
|
+
"t": "Popover in view, published copy opens on the publisher's view, stage track opens initiatives",
|
|
10
|
+
"s": "Popover in view, published copy opens on the publisher's view, stage track opens initiatives",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.471.0",
|
|
17
|
+
"at": "2026-10-31T13:21:46.914Z",
|
|
18
|
+
"f": 3,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1124,
|
|
22
|
+
"t": "The Shared tab on the Board — join a team, read its boards, open one (board-publish slice 4)",
|
|
23
|
+
"s": "The Shared tab on the Board — join a team, read its boards, open one (board-publish slice 4)",
|
|
24
|
+
"k": "new"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.470.0",
|
|
4
30
|
"at": "2026-10-31T12:11:04.375Z",
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Published board: a read-only copy of a Board"
|
|
4
4
|
description: "What a published board is, how to publish one from the Board, what a reader sees and cannot do, and how to preview one."
|
|
5
|
-
timestamp: 2026-
|
|
5
|
+
timestamp: 2026-11-01
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Published board: a read-only copy of a Board
|
|
9
9
|
|
|
10
10
|
A **published board** is a copy of the Board that a teammate can read. It shows the Timeline of the products, programs or initiatives that you pick. It is a snapshot. It does not change after it is taken.
|
|
11
11
|
|
|
12
|
-
This version has the **Publish** button on the Board, the read-only Board and the **data pack** that feeds it. The shared host must be set up first.
|
|
12
|
+
This version has the **Publish** button on the Board, the **Shared** tab, the read-only Board and the **data pack** that feeds it. The shared host must be set up first.
|
|
13
13
|
|
|
14
14
|
## Publish a board
|
|
15
15
|
|
|
16
|
-
Press the share icon on the Board's toolbar. A popover opens under it. The button shows a number when you have open links. It shows nothing when you have none.
|
|
16
|
+
Press the share icon on the Board's toolbar. A popover opens under it, inside the window. The button shows a number when you have open links. It shows nothing when you have none.
|
|
17
17
|
|
|
18
18
|
The button is not on a narrow screen (720 px or less) and not on the All products page. Open one product to publish from it.
|
|
19
19
|
|
|
@@ -35,12 +35,37 @@ Under the form, **Open links** lists each link that has not ended. It shows the
|
|
|
35
35
|
|
|
36
36
|
Only you can publish, republish or turn off a link, with a press on the page. An agent session cannot.
|
|
37
37
|
|
|
38
|
+
## The Shared tab
|
|
39
|
+
|
|
40
|
+
**Shared** is a tab of the Board, beside **Initiatives** and **Documents**. It lists the boards that people published to your teams, and your own links. On a phone it is a chip after **Docs**. The tab shows a number when there are open copies. Before you read a team, the number is your own open links.
|
|
41
|
+
|
|
42
|
+
**Join a team.** The person who makes a team gets an invite link and sends it to you. It looks like `https://boards.example.com/join#Team.password`. Open **Shared**, paste the link in the field and press **Join**. PMOS asks the host first. It keeps the team only if the password works. You do not need to set the host address first: the invite link has it.
|
|
43
|
+
|
|
44
|
+
To join without the link, press **Type the team name and password instead**. Write the host address, the team name and the team password.
|
|
45
|
+
|
|
46
|
+
PMOS keeps the team and its password on this computer only. It does not show the password again.
|
|
47
|
+
|
|
48
|
+
**Read the list.** PMOS reads each team from its host when you open the tab and when you press **Refresh**. It does not read in between. The line under the table says which host and when.
|
|
49
|
+
|
|
50
|
+
The chips are **All**, **Yours** and one for each team. **Yours** shows only when you have open links. A chip shows how many open copies the team has.
|
|
51
|
+
|
|
52
|
+
- **A board.** Press the name of a board to open its copy in a new browser tab. You do not type the password of the link. A copy that has ended is dimmed and does not open.
|
|
53
|
+
- **Yours.** Your own links have **Republish** and **Turn off**, the same as in the Publish popover. **Turn off** asks you to press a second time.
|
|
54
|
+
- **A date in red.** The copy ends within a day and a half.
|
|
55
|
+
|
|
56
|
+
**A team that cannot be read.** One line shows in its place. It says if the team password was changed, if the host locked the team after too many wrong tries, or if the host did not answer. Press **Paste a new invite link** or **Refresh**. The other teams still show. PMOS shows no old rows for a team it cannot read.
|
|
57
|
+
|
|
58
|
+
**Leave a team.** Press the chip of the team. Then press **Leave team**, and press it a second time. PMOS forgets the team and its password on this computer. The copies that you published stay on the host. Join again with the invite link.
|
|
59
|
+
|
|
60
|
+
The tab is not in the read-only Board. A reader sees no Shared tab.
|
|
61
|
+
|
|
38
62
|
## What a reader sees
|
|
39
63
|
|
|
40
|
-
- The
|
|
64
|
+
- The view that you were in when you published: the stage track or the Timeline. A reader can switch between the two with the buttons on the toolbar. A copy made before this change opens on the stage track. Republish a link to give it your view. By stage and List are not offered.
|
|
65
|
+
- On the Timeline, the view opens on today.
|
|
41
66
|
- The span picker, the Deliveries lane, and the folds of a program and a product.
|
|
42
67
|
- One line above the Board. It names the selection, the date of the copy, who shared it and when the link ends.
|
|
43
|
-
- A viewer for each initiative. Press the name of an initiative to open it. The viewer shows the stage card, About and Tasks. Tasks show as a List or as a Timeline, grouped by stage, owner or status.
|
|
68
|
+
- A viewer for each initiative. Press the name of an initiative to open it, on the stage track or on the Timeline. The viewer shows the stage card, About and Tasks. Tasks show as a List or as a Timeline, grouped by stage, owner or status.
|
|
44
69
|
- The panel divider and the panel layout: full screen, split or slide over.
|
|
45
70
|
|
|
46
71
|
While a viewer is open, the Timeline shows only the name of each initiative. The Stage, Status, Start and Next milestone columns are not shown.
|
|
@@ -49,7 +74,7 @@ While a viewer is open, the Timeline shows only the name of each initiative. The
|
|
|
49
74
|
|
|
50
75
|
A reader can only look. Nothing that a reader presses or types changes anything.
|
|
51
76
|
|
|
52
|
-
- The Board has no
|
|
77
|
+
- The Board has no board picker, no filters, no drag grips on the stage track and no **New initiative**.
|
|
53
78
|
- A viewer has no rename, no **More**, no **Discuss in chat**, and no **+** to add a task or a person.
|
|
54
79
|
- A task has no tick, no status and no date to change.
|
|
55
80
|
- A viewer lists no documents and no links. It has no offer of Claude's help.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* board-pack-route.js — GET /api/board-pack?ws=<id>&board=<id>&select=<kind>:<id>[,<kind>:<id>…][&by=&at=&ends=&hub=&viewer=]
|
|
2
|
+
/* board-pack-route.js — GET /api/board-pack?ws=<id>&board=<id>&select=<kind>:<id>[,<kind>:<id>…][&by=&at=&ends=&hub=&viewer=&view=]
|
|
3
3
|
* (initiative board-publish, planning/prd/board-publish-prd.md R1; slice 1). Answered by routes-board-premium.js, which lists the prefix and hands the request here:
|
|
4
4
|
* the pack is made from that route's own answer (the Board's model), so it is the Board's route that serves it.
|
|
5
5
|
*
|
|
@@ -51,7 +51,7 @@ module.exports = {
|
|
|
51
51
|
const t = await via(Trail, tk, req, ctx); if (t.body && t.body.ok) answers[tk] = t.body;
|
|
52
52
|
for (const id of rows) { const lk = '/api/initiative-layout?initiative=' + encodeURIComponent(id) + '&ws=' + encodeURIComponent(ws); const l = await via(Layout, lk, req, ctx); if (l.body && l.body.ok) answers[lk] = l.body; }
|
|
53
53
|
}
|
|
54
|
-
const meta = { by: q.get('by') || '', at: q.get('at') || '', ends: q.get('ends') || '', viewer: q.get('viewer') || '', hub: q.get('hub') || '' };
|
|
54
|
+
const meta = { by: q.get('by') || '', at: q.get('at') || '', ends: q.get('ends') || '', viewer: q.get('viewer') || '', hub: q.get('hub') || '', view: q.get('view') || '' };
|
|
55
55
|
ctx.json(res, { ok: true, pack: Pack.buildPack({ ws, board, selection, answers, meta }) });
|
|
56
56
|
} catch (e) { return bad(String((e && e.message) || e).slice(0, 240), /not on this board|Pick at least|at most 2 MB|product, a program/.test(String(e && e.message)) ? 400 : 500); }
|
|
57
57
|
return true;
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
const SCHEMA = 'board-pack/1';
|
|
20
20
|
const MAX_BYTES = 2 * 1024 * 1024;
|
|
21
21
|
const KINDS = ['product', 'program', 'initiative'];
|
|
22
|
+
const VIEWS = ['track', 'stages', 'time', 'list']; // the Board's views a pack can open on
|
|
22
23
|
|
|
23
24
|
// the parts of the Board's model that the Timeline and the viewer draw
|
|
24
25
|
const MODEL_KEYS = ['pending', 'workflows', 'today', 'header', 'board', 'initiatives', 'steps', 'rows'];
|
|
@@ -135,9 +136,10 @@ function buildPack({ ws, board, selection, answers, meta }) {
|
|
|
135
136
|
const m = meta || {};
|
|
136
137
|
const pack = { schema: SCHEMA, viewer: m.viewer || '', scope, by: m.by || '', at: m.at || '', ends: m.ends || '' };
|
|
137
138
|
if (m.hub) pack.hub = m.hub;
|
|
139
|
+
if (VIEWS.includes(m.view)) pack.view = m.view; // the publisher's view: the copy opens on it (board-publish R21)
|
|
138
140
|
pack.responses = sorted;
|
|
139
141
|
assertSize(pack);
|
|
140
142
|
return pack;
|
|
141
143
|
}
|
|
142
144
|
|
|
143
|
-
module.exports = { SCHEMA, MAX_BYTES, KINDS, MODEL_KEYS, buildPack, assertSize };
|
|
145
|
+
module.exports = { VIEWS, SCHEMA, MAX_BYTES, KINDS, MODEL_KEYS, buildPack, assertSize };
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
* and sent only to the host as the bearer. It is never returned to the browser, never logged, never written to a record (D08).
|
|
12
12
|
* The host holds the key's hash; a key can publish and remove its own links only.
|
|
13
13
|
*
|
|
14
|
+
* THE TEAMS this workspace joined (lib/boards-teams.js) are kept in state.json too: { name, host, password }. The team password is a secret on this computer
|
|
15
|
+
* like the publish key: mode 0600, never returned to the browser, never logged (D08).
|
|
16
|
+
*
|
|
14
17
|
* THE LINKS. state.json also keeps, for each open link: { id, url, team, name, kind, selection, ws, board, by, made, ends, views }. The link's
|
|
15
18
|
* password is NOT kept: it is shown once at publish. Republish keeps the same link and password (the host owns it).
|
|
16
19
|
*
|
|
@@ -46,8 +49,8 @@ function hostOrigin(env = process.env) {
|
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
function readState(dir) {
|
|
49
|
-
try { const s = JSON.parse(fs.readFileSync(fileOf(dir), 'utf8')); return { key: typeof s.key === 'string' ? s.key : null, host: typeof s.host === 'string' ? s.host : '', links: Array.isArray(s.links) ? s.links : [] }; }
|
|
50
|
-
catch { return { key: null, host: '', links: [] }; }
|
|
52
|
+
try { const s = JSON.parse(fs.readFileSync(fileOf(dir), 'utf8')); return { key: typeof s.key === 'string' ? s.key : null, host: typeof s.host === 'string' ? s.host : '', teams: Array.isArray(s.teams) ? s.teams : [], links: Array.isArray(s.links) ? s.links : [] }; }
|
|
53
|
+
catch { return { key: null, host: '', teams: [], links: [] }; }
|
|
51
54
|
}
|
|
52
55
|
/** The address the PM saved on the Publish popover ('' when none). The environment variable PMOS_BOARDS_HOST wins over it (see addressOf). */
|
|
53
56
|
function savedHost(dir) { return readState(dir).host || ''; }
|
|
@@ -147,4 +150,4 @@ async function turnOff(dir, id, opts = {}) {
|
|
|
147
150
|
return { ok: true };
|
|
148
151
|
}
|
|
149
152
|
|
|
150
|
-
module.exports = { DAYS, TEAM_RX, MAX_PACK, hostOrigin, savedHost, setHost, addressOf, readState, links, publish, republish, turnOff };
|
|
153
|
+
module.exports = { DAYS, TEAM_RX, MAX_PACK, hostOrigin, savedHost, setHost, addressOf, readState, writeState, links, publish, republish, turnOff };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* boards-teams.js — the teams this workspace joined, and the Shared view's reads (initiative board-publish, slice 4; PRD T1 to T6; D103).
|
|
3
|
+
*
|
|
4
|
+
* A TEAM is { name, host, password }, kept in <runtime state>/board-publish/state.json (lib/boards-host.js): the host it lives on, and the team password.
|
|
5
|
+
* The password is a secret on this computer: mode 0600, never returned to the browser, never logged (D08). Every function here takes the state folder.
|
|
6
|
+
*
|
|
7
|
+
* THE CONTRACT with the host (board-host/src/core.js):
|
|
8
|
+
* GET <host>/api/teams/<team>/links X-Team-Password -> { ok, links: [{ id, name, kind, by, made, ends, views, url }] }
|
|
9
|
+
* POST <host>/api/teams/<team>/open/<id> X-Team-Password -> { ok, url } one-time, 5 minutes
|
|
10
|
+
* A refusal is { ok: false, error } with a plain sentence. 403 is a wrong password, 429 a lockout (the sentence names the minutes), 404 an unknown team.
|
|
11
|
+
*
|
|
12
|
+
* parseInvite(text) -> { host, team, password } | { error } "<host>/join#<team>.<password>", each part percent-encoded
|
|
13
|
+
* join(dir, { invite | host, team, password }, { fetch }) -> { ok, team } | { ok: false, error } verifies with the host before it keeps anything
|
|
14
|
+
* leave(dir, team) -> { ok } forgets the password here; the host is not told
|
|
15
|
+
* names(dir) -> [string]
|
|
16
|
+
* readAll(dir, { fetch }) -> [{ team, host, ok: true, links } | { team, host, ok: false, kind, error }] all teams at once; one failing never hides another
|
|
17
|
+
* open(dir, team, id, { fetch }) -> { ok, url } | { ok: false, error }
|
|
18
|
+
* kind of a failure: 'password' | 'locked' | 'missing' | 'unreachable' | 'other'. Nothing from a read is kept: an unreadable team has no old rows. */
|
|
19
|
+
const Host = require('./boards-host.js');
|
|
20
|
+
|
|
21
|
+
const TIMEOUT_MS = 15000;
|
|
22
|
+
const MAX_TEAMS = 20;
|
|
23
|
+
|
|
24
|
+
function parseInvite(text) {
|
|
25
|
+
let u; try { u = new URL(String(text || '').trim()); } catch { return { error: 'This is not an invite link. It looks like https://boards.example.com/join#Team.password.' }; }
|
|
26
|
+
const host = u.username || u.password ? null : Host.hostOrigin({ PMOS_BOARDS_HOST: u.origin });
|
|
27
|
+
const m = /^#([^.]+)\.(.+)$/.exec(u.hash || '');
|
|
28
|
+
if (!host || u.pathname !== '/join' || !m) return { error: 'This is not an invite link. It looks like https://boards.example.com/join#Team.password.' };
|
|
29
|
+
let team; let password; try { team = decodeURIComponent(m[1]); password = decodeURIComponent(m[2]); } catch { return { error: 'This is not an invite link. It looks like https://boards.example.com/join#Team.password.' }; }
|
|
30
|
+
if (!Host.TEAM_RX.test(team)) return { error: 'The team name in this link is not valid.' };
|
|
31
|
+
if (password.length < 8 || password.length > 100) return { error: 'The password in this link is not valid.' };
|
|
32
|
+
return { host, team, password };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** One call to a host with the team password. Never throws. { ok, status, body } | { ok: false, kind, error } */
|
|
36
|
+
async function call(host, method, p, password, fetchFn) {
|
|
37
|
+
const f = fetchFn || (typeof fetch === 'function' ? fetch : null);
|
|
38
|
+
if (!f) return { ok: false, kind: 'unreachable', error: 'This computer cannot reach the host (no network client).' };
|
|
39
|
+
const ctl = typeof AbortController === 'function' ? new AbortController() : null; const timer = ctl ? setTimeout(() => ctl.abort(), TIMEOUT_MS) : null;
|
|
40
|
+
try {
|
|
41
|
+
const res = await f(host + p, { method, redirect: 'error', signal: ctl ? ctl.signal : undefined, headers: { 'X-Team-Password': password, Accept: 'application/json' } });
|
|
42
|
+
let j = null; try { j = await res.json(); } catch { /* not JSON */ }
|
|
43
|
+
if (res.ok && j && j.ok !== false) return { ok: true, status: res.status, body: j };
|
|
44
|
+
const say = (j && typeof j.error === 'string' && j.error.slice(0, 240)) || '';
|
|
45
|
+
if (res.status === 403) return { ok: false, kind: 'password', error: 'The team password does not work. Ask for a new invite link.' };
|
|
46
|
+
if (res.status === 429) return { ok: false, kind: 'locked', error: say || 'Too many wrong tries. Try again in a few minutes.' };
|
|
47
|
+
if (res.status === 404) return { ok: false, kind: 'missing', error: say || 'There is no such team on that host.' };
|
|
48
|
+
return { ok: false, kind: 'other', error: say || 'The host refused the request (' + res.status + ').' };
|
|
49
|
+
} catch (e) {
|
|
50
|
+
return { ok: false, kind: 'unreachable', error: e && e.name === 'AbortError' ? 'The host did not answer in time. Try again.' : 'The host could not be reached. Check the connection.' };
|
|
51
|
+
} finally { if (timer) clearTimeout(timer); }
|
|
52
|
+
}
|
|
53
|
+
const teamPath = (team) => '/api/teams/' + encodeURIComponent(team);
|
|
54
|
+
|
|
55
|
+
async function join(dir, o, opts = {}) {
|
|
56
|
+
let host; let team; let password;
|
|
57
|
+
if (o.invite != null && String(o.invite).trim() !== '') {
|
|
58
|
+
const p = parseInvite(o.invite); if (p.error) return { ok: false, error: p.error };
|
|
59
|
+
({ host, team, password } = p);
|
|
60
|
+
} else {
|
|
61
|
+
host = Host.hostOrigin({ PMOS_BOARDS_HOST: String(o.host || '').trim() }); team = String(o.team || '').trim(); password = String(o.password || '');
|
|
62
|
+
if (!host) return { ok: false, error: 'Use an https address for the host, such as https://boards.example.com.' };
|
|
63
|
+
if (!Host.TEAM_RX.test(team)) return { ok: false, error: 'A team name is letters, numbers, spaces, dots, dashes and underscores, up to 40.' };
|
|
64
|
+
if (password.length < 8 || password.length > 100) return { ok: false, error: 'A team password is 8 to 100 characters.' };
|
|
65
|
+
}
|
|
66
|
+
const st = Host.readState(dir);
|
|
67
|
+
if (!st.teams.some((t) => t.name === team && t.host === host) && st.teams.length >= MAX_TEAMS) return { ok: false, error: 'This computer has joined 20 teams. Leave one first.' };
|
|
68
|
+
const r = await call(host, 'GET', teamPath(team) + '/links', password, opts.fetch);
|
|
69
|
+
if (!r.ok) return { ok: false, error: r.error, kind: r.kind };
|
|
70
|
+
const cur = Host.readState(dir);
|
|
71
|
+
cur.teams = cur.teams.filter((t) => !(t.name === team && t.host === host)).concat([{ name: team, host, password }]);
|
|
72
|
+
Host.writeState(dir, cur);
|
|
73
|
+
return { ok: true, team };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function leave(dir, team) { const st = Host.readState(dir); const had = st.teams.some((t) => t.name === team); st.teams = st.teams.filter((t) => t.name !== team); Host.writeState(dir, st); return { ok: had }; }
|
|
77
|
+
const names = (dir) => Host.readState(dir).teams.map((t) => t.name);
|
|
78
|
+
|
|
79
|
+
async function readAll(dir, opts = {}) {
|
|
80
|
+
const teams = Host.readState(dir).teams;
|
|
81
|
+
return Promise.all(teams.map(async (t) => {
|
|
82
|
+
const r = await call(t.host, 'GET', teamPath(t.name) + '/links', t.password, opts.fetch);
|
|
83
|
+
if (!r.ok) return { team: t.name, host: new URL(t.host).host, ok: false, kind: r.kind, error: r.kind === 'password' ? 'The team password no longer works. Ask for a new invite link.' : r.error };
|
|
84
|
+
const links = (Array.isArray(r.body.links) ? r.body.links : []).filter((l) => l && typeof l.id === 'string' && typeof l.url === 'string' && l.url.startsWith(t.host + '/'))
|
|
85
|
+
.map((l) => ({ id: l.id, name: String(l.name || ''), kind: String(l.kind || ''), by: String(l.by || ''), made: l.made || '', ends: l.ends || '', views: Number(l.views) || 0 }));
|
|
86
|
+
return { team: t.name, host: new URL(t.host).host, ok: true, links };
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function open(dir, team, id, opts = {}) {
|
|
91
|
+
const t = Host.readState(dir).teams.find((x) => x.name === team);
|
|
92
|
+
if (!t) return { ok: false, error: 'This computer has not joined that team.' };
|
|
93
|
+
const r = await call(t.host, 'POST', teamPath(team) + '/open/' + encodeURIComponent(id), t.password, opts.fetch);
|
|
94
|
+
if (!r.ok) return { ok: false, error: r.kind === 'password' ? 'The team password no longer works. Ask for a new invite link.' : r.error };
|
|
95
|
+
const url = r.body.url; if (typeof url !== 'string' || !url.startsWith(t.host + '/b/')) return { ok: false, error: 'The host sent an address this workspace does not accept.' };
|
|
96
|
+
return { ok: true, url };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
module.exports = { parseInvite, join, leave, names, readAll, open, MAX_TEAMS };
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
* POST /api/board-publish/republish { id } -> { ok, ends } the same selection, as the board is now; same link, same password
|
|
7
7
|
* POST /api/board-publish/off { id } -> { ok } the host deletes the copy at once
|
|
8
8
|
* POST /api/board-publish/host { host } -> { ok, host } save the host address ('' clears it); PMOS_BOARDS_HOST wins over it
|
|
9
|
+
* GET /api/board-publish/shared -> { ok, readAt, yours, teams } the Shared view: your links, and each joined team read now (lib/boards-teams.js)
|
|
10
|
+
* POST /api/board-publish/join { invite } or { host, team, password } -> { ok, team } verified with the host first; the password stays on this computer
|
|
11
|
+
* POST /api/board-publish/leave { team } -> { ok } forgets the team here
|
|
12
|
+
* POST /api/board-publish/open { team, id } -> { ok, url } a one-time address for a team member, opened in a browser tab
|
|
9
13
|
*
|
|
10
14
|
* EVERY POST IS A PAGE PRESS (pm-guard requirePagePress): only a press on the page publishes, not a request an agent session makes (PRD P2, D97 S3).
|
|
11
15
|
* THE SECRET SCAN runs on the finished pack before anything leaves (P3): a hit blocks the publish and the answer names the rule, never the text (D08).
|
|
@@ -18,6 +22,7 @@ const guard = require('./pm-guard.js');
|
|
|
18
22
|
const Host = require('./boards-host.js');
|
|
19
23
|
const shareStore = require('./share-store.js');
|
|
20
24
|
const secretScan = require('./secret-scan.js');
|
|
25
|
+
const Teams = require('./boards-teams.js');
|
|
21
26
|
|
|
22
27
|
const PUBLIC = path.join(__dirname, '..', 'public');
|
|
23
28
|
let versionMemo = null;
|
|
@@ -68,7 +73,7 @@ module.exports = {
|
|
|
68
73
|
prefixes: ['/api/board-publish'],
|
|
69
74
|
handle: async (req, res, url, ctx) => {
|
|
70
75
|
const p = url.pathname;
|
|
71
|
-
if (
|
|
76
|
+
if (!/^\/api\/board-publish(\/(republish|off|host|shared|join|leave|open))?$/.test(p)) return false;
|
|
72
77
|
const send = (obj, code) => { ctx.json(res, obj, code); return true; };
|
|
73
78
|
const dir = stateDir(ctx);
|
|
74
79
|
if (!dir) return send({ ok: false, error: 'No state folder.' }, 500);
|
|
@@ -78,7 +83,12 @@ module.exports = {
|
|
|
78
83
|
const origin = Host.hostOrigin(env);
|
|
79
84
|
const ws = url.searchParams.get('ws'); let choices = null;
|
|
80
85
|
if (ws) { try { choices = await require('./board-publish-choices.js').choicesOf(req, ctx, ws, url.searchParams.get('board') || ws); } catch { choices = null; } }
|
|
81
|
-
return send({ ok: true, host: origin ? new URL(origin).host : null, days: Host.DAYS, password: shareStore.newPassword(), choices, links: Host.links(dir).map((l) => ({ id: l.id, url: l.url, team: l.team, name: l.name, kind: l.kind, by: l.by, made: l.made, ends: l.ends, views: l.views })) });
|
|
86
|
+
return send({ ok: true, host: origin ? new URL(origin).host : null, days: Host.DAYS, password: shareStore.newPassword(), choices, teams: Teams.names(dir), links: Host.links(dir).map((l) => ({ id: l.id, url: l.url, team: l.team, name: l.name, kind: l.kind, by: l.by, made: l.made, ends: l.ends, views: l.views })) });
|
|
87
|
+
}
|
|
88
|
+
// the Shared view's read (slice 4): your own links and every joined team's list, read now from each host. Nothing is kept from the read.
|
|
89
|
+
if (req.method === 'GET' && p === '/api/board-publish/shared') {
|
|
90
|
+
const teams = await Teams.readAll(dir);
|
|
91
|
+
return send({ ok: true, readAt: new Date().toISOString(), yours: Host.links(dir).map((l) => ({ id: l.id, url: l.url, team: l.team, name: l.name, kind: l.kind, by: l.by, made: l.made, ends: l.ends, views: l.views })), teams });
|
|
82
92
|
}
|
|
83
93
|
if (req.method !== 'POST') return send({ ok: false, error: 'GET or POST only' }, 405);
|
|
84
94
|
|
|
@@ -89,6 +99,15 @@ module.exports = {
|
|
|
89
99
|
// D103 point 6 and PRD P2: a copy leaves this computer only on a press by the person. D98 lets an agent session take PM-only acts; this one it does not.
|
|
90
100
|
if (g.actor && /^agent/.test(String(g.actor.by || ''))) return send({ ok: false, error: 'Publishing is a press on the page. An agent session cannot publish, republish or turn off a board.' }, 403);
|
|
91
101
|
|
|
102
|
+
if (p === '/api/board-publish/join') { // a team is joined by a pasted invite link, or by host, team and password typed
|
|
103
|
+
const r = await Teams.join(dir, { invite: body.invite, host: body.host, team: body.team, password: body.password });
|
|
104
|
+
return send(r.ok ? { ok: true, team: r.team } : { ok: false, error: r.error, kind: r.kind }, r.ok ? 200 : (r.kind === 'locked' ? 429 : 400));
|
|
105
|
+
}
|
|
106
|
+
if (p === '/api/board-publish/leave') { const r = Teams.leave(dir, String(body.team || '')); return send(r.ok ? { ok: true } : { ok: false, error: 'This computer has not joined that team.' }, r.ok ? 200 : 404); }
|
|
107
|
+
if (p === '/api/board-publish/open') { // the one-time address of a team's board, to open in a browser tab
|
|
108
|
+
const r = await Teams.open(dir, String(body.team || ''), String(body.id || ''));
|
|
109
|
+
return send(r.ok ? { ok: true, url: r.url } : { ok: false, error: r.error }, r.ok ? 200 : 502);
|
|
110
|
+
}
|
|
92
111
|
if (p === '/api/board-publish/host') { // the address of the host, saved from the popover: a page press like the rest
|
|
93
112
|
const r = Host.setHost(dir, body.host);
|
|
94
113
|
return send(r.ok ? { ok: true, host: r.host } : { ok: false, error: r.error }, r.ok ? 200 : 400);
|
|
@@ -111,7 +130,7 @@ module.exports = {
|
|
|
111
130
|
if (!Host.DAYS.includes(days)) return send({ ok: false, error: 'Ends in 1, 7 or 30 days.' }, 400);
|
|
112
131
|
sel = { ws: body.ws, board: body.board || body.ws, select: Array.isArray(body.select) ? body.select.map((s) => s.kind + ':' + s.id).join(',') : String(body.select || ''), by: String(body.shared_by || '').slice(0, 60) || sharedBy(), ends: new Date(now + days * 86400000).toISOString() };
|
|
113
132
|
}
|
|
114
|
-
const pk = await makePack(req, ctx, Object.assign({}, sel, { at: new Date(now).toISOString(), viewer: viewerVersion() }));
|
|
133
|
+
const pk = await makePack(req, ctx, Object.assign({}, sel, { at: new Date(now).toISOString(), viewer: viewerVersion(), view: body.view }));
|
|
115
134
|
if (!pk.ok) return send({ ok: false, error: pk.error }, pk.status || 502);
|
|
116
135
|
const hits = secretScan.scan(JSON.stringify(pk.pack));
|
|
117
136
|
if (hits.length) return send({ ok: false, error: 'This board holds what looks like a secret (' + hits.join(', ') + '). Remove it, then publish again.', secrets: hits }, 422);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.472.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.472.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -40,5 +40,6 @@
|
|
|
40
40
|
.bppop .bprow em{font-style:normal;color:var(--ink-3);font-size:12px}.bppop .bprow em.soon{color:var(--bad)}
|
|
41
41
|
.bppop .bpempty{display:grid;gap:10px;padding:12px 8px 10px;justify-items:start}.bppop .bpempty p{margin:0;color:var(--ink-2)}
|
|
42
42
|
.bppop :focus-visible{outline:2px solid var(--ember);outline-offset:2px}
|
|
43
|
+
.bd-tools:has(.bppop){position:relative}
|
|
43
44
|
#bdPublish{position:relative}#bdPublish .bpn{position:absolute;top:2px;right:0;min-width:16px;padding:0 5px;border-radius:99px;background:var(--solid);color:var(--on-solid);font:600 11px var(--mono);text-align:center;line-height:16px}
|
|
44
45
|
@media (max-width:640px){.bppop{position:fixed;left:0;right:0;bottom:0;top:auto;width:auto;max-width:none;max-height:85vh;border-radius:16px 16px 0 0;border-width:1px 0 0;padding:12px 12px calc(18px + env(safe-area-inset-bottom,0px));box-shadow:0 -8px 30px rgb(0 0 0 / .18)}}
|
|
@@ -31,7 +31,7 @@ export function publishHtml(S) {
|
|
|
31
31
|
if (S.phase === 'loading') return '<p class="bpnote">Reading your board…</p>';
|
|
32
32
|
if (!S.host) {
|
|
33
33
|
return `<div class="bpempty"><b>Publishing needs a board host</b><p>Ask whoever runs it for its address and add it here once. Nothing is sent before that.</p></div>`
|
|
34
|
-
+ `<div class="bpfield"><label for="bpHost">Board host address</label><div class="bpinp2"><input id="bpHost" type="url" inputmode="url" spellcheck="false" autocomplete="off" placeholder="
|
|
34
|
+
+ `<div class="bpfield"><label for="bpHost">Board host address</label><div class="bpinp2"><input id="bpHost" type="url" inputmode="url" spellcheck="false" autocomplete="off" placeholder="Paste the host address" value="${esc(S.hostIn || '')}"><button type="button" class="bpbtn sm pri" data-bp="savehost">Save</button></div></div>`
|
|
35
35
|
+ (S.err ? `<p class="bperr" role="alert">${esc(S.err)}</p>` : '');
|
|
36
36
|
}
|
|
37
37
|
const list = S.links && S.links.length
|
|
@@ -65,7 +65,7 @@ export function publishHtml(S) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
function css() {
|
|
68
|
-
for (const href of ['
|
|
68
|
+
for (const href of [new URL('./premium-vw-doc.css', import.meta.url).href, new URL('./bd-publish.css', import.meta.url).href]) {
|
|
69
69
|
if (document.querySelector(`link[href="${href}"]`)) continue;
|
|
70
70
|
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.appendChild(l);
|
|
71
71
|
}
|
|
@@ -76,6 +76,7 @@ export async function refreshCount(btn) {
|
|
|
76
76
|
const n = btn && btn.querySelector('.bpn'); if (!n) return;
|
|
77
77
|
const r = await pmGet('/api/board-publish').catch(() => null); const c = r && r.ok ? COUNT(r.links) : 0;
|
|
78
78
|
n.textContent = c ? String(c) : ''; n.hidden = !c;
|
|
79
|
+
document.dispatchEvent(new CustomEvent('bd:links', { detail: { n: c } })); // the Shared tab's number follows your own links until it has read the teams
|
|
79
80
|
btn.setAttribute('aria-label', 'Publish a read-only copy of the board' + (c ? '. ' + c + (c === 1 ? ' open link' : ' open links') : ''));
|
|
80
81
|
}
|
|
81
82
|
|
|
@@ -129,13 +130,13 @@ export function open(btn, ctx) {
|
|
|
129
130
|
if (act === 'make') {
|
|
130
131
|
draw(); if (S.busy) return; S.busy = true; S.err = ''; draw();
|
|
131
132
|
const select = [...S.sel].map((k) => { const i = k.indexOf(':'); return { kind: k.slice(0, i), id: k.slice(i + 1) }; });
|
|
132
|
-
const r = await pmPost('/api/board-publish', { ws: ctx.ws, board: ctx.board || ctx.ws, select, team: S.team.trim(), password: S.pw ? S.pass : '', days: S.days }).catch(() => null);
|
|
133
|
+
const r = await pmPost('/api/board-publish', { ws: ctx.ws, board: ctx.board || ctx.ws, select, team: S.team.trim(), password: S.pw ? S.pass : '', days: S.days, view: ctx.view }).catch(() => null);
|
|
133
134
|
S.busy = false;
|
|
134
135
|
if (r && r.ok) { const l = (await pmGet('/api/board-publish').catch(() => null)) || {}; S.links = l.links || S.links; S.made = { url: r.url, pass: S.pw ? S.pass : '', ends: r.ends, team: S.team.trim(), name: (S.links.find((x) => x.id === r.id) || {}).name || 'Board' }; S.pass = ''; S.err = ''; draw('[data-bp="copy"]'); return refreshCount(btn); }
|
|
135
136
|
S.err = (r && r.error) || 'The workspace did not answer. Try again.'; return draw();
|
|
136
137
|
}
|
|
137
138
|
if (b.dataset.bpRe) {
|
|
138
|
-
S.busy = true; S.err = ''; draw(); const r = await pmPost('/api/board-publish/republish', { id: b.dataset.bpRe }).catch(() => null); S.busy = false;
|
|
139
|
+
S.busy = true; S.err = ''; draw(); const r = await pmPost('/api/board-publish/republish', { id: b.dataset.bpRe, view: ctx.view }).catch(() => null); S.busy = false;
|
|
139
140
|
S.err = r && r.ok ? '' : (r && r.error) || 'The workspace did not answer. Try again.'; const l = await pmGet('/api/board-publish').catch(() => null); if (l && l.ok) S.links = l.links; return draw();
|
|
140
141
|
}
|
|
141
142
|
if (b.dataset.bpOff) {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* pm/bd-shared.css — the Shared tab of the Board (pm/bd-shared.js). The chips row, the table, the pills, the avatars and the buttons are the Board's own
|
|
2
|
+
* (cozy-board.css: .bd-dchips, .bd-dtw, .bd-dt, .bd-pill, .bd-av, .bd-btn); this file only sets the columns of the table and the join form. */
|
|
3
|
+
#cShared .bd-dt { grid-template-columns: 40px minmax(0, 1.5fr) 96px 96px minmax(0, 1fr) 84px 70px 130px 190px; }
|
|
4
|
+
#cShared .bd-dby { display: flex; gap: 6px; justify-content: flex-end; overflow: visible; }
|
|
5
|
+
#cShared .bdsh-gone { opacity: .5; }
|
|
6
|
+
#cShared .bdsh-cards { display: none; }
|
|
7
|
+
#cShared .bd-btn.on { border-color: var(--bad); color: var(--bad); }
|
|
8
|
+
#cShared .bdsh-join { display: grid; gap: 12px; padding: 22px 8px 14px; justify-items: start; max-width: 560px; }
|
|
9
|
+
#cShared .bdsh-join > b { font-size: var(--fs-4); font-weight: 800; }
|
|
10
|
+
#cShared .bdsh-join p { margin: 0; }
|
|
11
|
+
#cShared .bdsh-fr { display: flex; gap: 8px; width: 100%; max-width: 520px; }
|
|
12
|
+
#cShared .bdsh-in { flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; border: 1px solid var(--hair); border-radius: 12px; background: var(--card-solid); color: var(--ink); font: inherit; width: 100%; max-width: 520px; }
|
|
13
|
+
#cShared .bdsh-fr .bdsh-in { width: auto; }
|
|
14
|
+
#cShared .bdsh-go { min-height: 44px; background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
|
|
15
|
+
#cShared .bdsh-go:disabled { opacity: .6; }
|
|
16
|
+
#cShared .bdsh-alt, #cShared .bdsh-lk { border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; min-height: 36px; padding: 0 2px; }
|
|
17
|
+
#cShared .bdsh-fine { font-size: var(--fs-1); margin: 8px 4px 0; }
|
|
18
|
+
#cShared .bdsh-pad { padding: 24px 8px; margin: 0; max-width: 560px; }
|
|
19
|
+
#cShared .bdsh-ban { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 16px; margin: 8px 0; border: 1px solid var(--hair); border-radius: 14px; background: var(--card-solid); }
|
|
20
|
+
#cShared .bdsh-ban > span { flex: 1 1 240px; min-width: 0; }
|
|
21
|
+
#cShared .bdsh-tl { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
|
|
22
|
+
#cShared :focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
|
|
23
|
+
@media (max-width: 720px) {
|
|
24
|
+
#cShared .bdsh-table { display: none; }
|
|
25
|
+
#cShared .bdsh-cards { display: block; }
|
|
26
|
+
#cShared .bdsh-card { padding: 10px 4px; border-bottom: 1px solid var(--hair); display: grid; gap: 2px; }
|
|
27
|
+
#cShared .bdsh-l1 { display: flex; gap: 8px; align-items: baseline; }
|
|
28
|
+
#cShared .bdsh-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
|
|
29
|
+
#cShared .bdsh-act { display: flex; gap: 8px; padding-top: 6px; }
|
|
30
|
+
#cShared .bdsh-fr { flex-wrap: wrap; }
|
|
31
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/* pm/bd-shared.js — the Shared tab of the Board (initiative board-publish, slice 4; planning/prd/board-publish-prd.md T1 to T6; D103).
|
|
2
|
+
* Design: prototype/board-publish/shared-view-design.html (drawn inside the real Board; PM approved 2026-10-31). It is the Documents tab's own pattern:
|
|
3
|
+
* a chips row, the button on the right, and the Board's .bd-dtw table with pills and avatars (a card per row on a phone).
|
|
4
|
+
*
|
|
5
|
+
* All · Yours · one chip per joined team Yours only when you have open links. A team's chip shows its count, or no count when it cannot be read.
|
|
6
|
+
* a board a press opens that copy in a new browser tab, signed in (POST /api/board-publish/open: a one-time address)
|
|
7
|
+
* Yours Republish (same link, same password) and Turn off (a second press confirms)
|
|
8
|
+
* a team that cannot be read one line in its place (password changed, locked, host down): the other teams still draw, and no old rows
|
|
9
|
+
* a team selected Refresh · Paste a new invite link · Leave team (a second press; forgets only the password on this computer)
|
|
10
|
+
* nothing joined one sentence and one field for the invite link; "type the team name and password instead" is the second way
|
|
11
|
+
*
|
|
12
|
+
* Reads: GET /api/board-publish (local: your links and the team names, no host is asked) for the number on the tab at load;
|
|
13
|
+
* GET /api/board-publish/shared (reads each joined team's host now) when the tab opens and on Refresh. Nothing is polled and nothing from a read is kept.
|
|
14
|
+
* loadCount(cb) cb(n): the number of your own open links, from this computer only
|
|
15
|
+
* show(el, { onCount }) draw the tab into el and read the teams. onCount(n) gets the total of open copies after a read
|
|
16
|
+
* viewHtml(S) the tab's inside as HTML. Pure. */
|
|
17
|
+
import { pmGet, pmPost } from './http.js';
|
|
18
|
+
|
|
19
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
20
|
+
const ICON = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 4h16v16H4zM4 9h16M9 9v11"></path></svg>';
|
|
21
|
+
const KIND = { product: 'Product', program: 'Program', initiative: 'Initiative', multi: 'Several' };
|
|
22
|
+
const SOON = 36 * 3600 * 1000;
|
|
23
|
+
const day = (iso) => { try { return new Date(iso).toLocaleDateString(undefined, { day: 'numeric', month: 'short' }); } catch { return ''; } };
|
|
24
|
+
|
|
25
|
+
export function css() {
|
|
26
|
+
const href = new URL('./bd-shared.css', import.meta.url).href;
|
|
27
|
+
if (document.querySelector(`link[href="${href}"]`)) return;
|
|
28
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.appendChild(l);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The number of open copies: yours, plus each readable team's, without counting your own twice. */
|
|
32
|
+
export function totalOf(S) { return rowsOf(S).filter((r) => !r.ended).length; }
|
|
33
|
+
|
|
34
|
+
function rowsOf(S, now = S.now || Date.now()) {
|
|
35
|
+
const mine = new Set((S.yours || []).map((l) => l.id));
|
|
36
|
+
const rows = (S.yours || []).map((l) => Object.assign({}, l, { mine: true }));
|
|
37
|
+
for (const t of S.teams || []) if (t.ok) for (const l of t.links) if (!mine.has(l.id)) rows.push(Object.assign({}, l, { team: t.team }));
|
|
38
|
+
for (const r of rows) { r.ended = !!r.ends && Date.parse(r.ends) <= now; r.soon = !r.ended && !!r.ends && Date.parse(r.ends) - now < SOON; }
|
|
39
|
+
return rows;
|
|
40
|
+
}
|
|
41
|
+
const endText = (r) => (r.ended ? 'Ended' : r.soon ? 'Tomorrow' : day(r.ends));
|
|
42
|
+
const agoText = (S) => { const m = Math.max(0, Math.round(((S.now || Date.now()) - Date.parse(S.readAt)) / 60000)); return m < 1 ? 'just now' : m === 1 ? 'a minute ago' : m + ' minutes ago'; };
|
|
43
|
+
const init = (n) => esc(String(n || '?').slice(0, 2));
|
|
44
|
+
const who = (r) => `<span class="bd-pt"><span class="bd-av" aria-hidden="true">${init(r.by)}</span><span class="bd-ell">${esc(r.by)}</span></span>`;
|
|
45
|
+
const openable = (S, r) => !r.ended && (r.team ? (S.teams || []).some((t) => t.team === r.team && t.ok) || (S.names || []).includes(r.team) : false);
|
|
46
|
+
|
|
47
|
+
function row(S, r) {
|
|
48
|
+
const act = r.mine ? `<button type="button" class="bd-btn sm" data-sh-re="${esc(r.id)}">Republish</button><button type="button" class="bd-btn sm${S.off === r.id ? ' on' : ''}" data-sh-off="${esc(r.id)}">${S.off === r.id ? 'Sure? Turn off' : 'Turn off'}</button>` : '';
|
|
49
|
+
const nm = r.ended || !openable(S, r) ? `<span class="bd-dlink" role="rowheader">${esc(r.name)}</span>` : `<button type="button" class="bd-dlink" role="rowheader" data-sh-open="${esc(r.id)}" data-sh-team="${esc(r.team)}">${esc(r.name)}</button>`;
|
|
50
|
+
const end = `<span role="cell" class="${r.soon ? 'cs s-risk' : r.ended ? 'bd-amut' : ''}">${r.soon ? '<i class="cz-dot risk m-warn"></i>' : ''}${esc(endText(r))}</span>`;
|
|
51
|
+
const table = `<div class="bd-dt${r.ended ? ' bdsh-gone' : ''}" role="row"><span class="bd-dic" aria-hidden="true">${ICON}</span>${nm}<span role="cell"><span class="bd-pill">${esc(KIND[r.kind] || 'Board')}</span></span><span role="cell" class="bd-amut">${esc(r.team || '—')}</span>${who(r)}<span role="cell">${esc(day(r.made))}</span><span role="cell">${r.views || 0}</span>${end}<span role="cell" class="bd-dby">${act}</span></div>`;
|
|
52
|
+
const card = `<div class="bdsh-card${r.ended ? ' bdsh-gone' : ''}"><div class="bdsh-l1">${nm.replace('bd-dlink', 'bdsh-nm bd-dlink')}<span class="${r.soon ? 'cs s-risk' : 'bd-amut'}">${r.soon ? '<i class="cz-dot risk m-warn"></i>' : ''}${esc(endText(r))}</span></div><span class="bd-amut">${esc(KIND[r.kind] || 'Board')}${r.team ? ' · ' + esc(r.team) : ''} · ${r.mine ? 'you' : esc(r.by)} · ${esc(day(r.made))} · ${r.views || 0} views</span>${act ? `<div class="bdsh-act">${act}</div>` : ''}</div>`;
|
|
53
|
+
return { table, card };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function joinHtml(S) {
|
|
57
|
+
const J = S.join || {}; const first = !(S.teams || []).length && !(S.yours || []).length;
|
|
58
|
+
const inp = (id, ph, v, type) => `<input id="${id}" type="${type || 'text'}" class="bdsh-in" placeholder="${esc(ph)}" value="${esc(v || '')}" spellcheck="false" autocomplete="off" aria-label="${esc(ph)}">`;
|
|
59
|
+
const body = J.typed
|
|
60
|
+
? `<b>Join a team</b><p class="bd-amut">Type what the person who made the team gave you.</p>${inp('shHost', 'Board host address', J.host)}${inp('shTeam', 'Team name', J.team)}<div class="bdsh-fr">${inp('shPass', 'Team password', J.password, 'password')}<button type="button" class="bd-btn bdsh-go" data-sh="join"${J.busy ? ' disabled' : ''}>${J.busy ? 'Joining…' : 'Join'}</button></div>`
|
|
61
|
+
: `<b>${first ? 'Join a team to see its boards' : 'Join another team'}</b><p class="bd-amut">Ask whoever made the team for its invite link, then paste it here.</p><div class="bdsh-fr">${inp('shInvite', 'Paste the invite link', J.invite)}<button type="button" class="bd-btn bdsh-go" data-sh="join"${J.busy ? ' disabled' : ''}>${J.busy ? 'Joining…' : 'Join'}</button></div>`;
|
|
62
|
+
return `<div class="bdsh-join">${body}${J.err ? `<p class="cs s-risk" role="alert"><i class="cz-dot risk m-warn"></i>${esc(J.err)}</p>` : ''}<button type="button" class="bdsh-alt" data-sh="${J.typed ? 'paste' : 'typed'}">${J.typed ? 'Paste an invite link instead' : 'Type the team name and password instead'}</button><p class="bd-amut bdsh-fine">The team and its password are kept on this computer only.</p></div>`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The tab's inside. S = { phase, yours, teams:[{team,host,ok,links|kind,error}], names, readAt, now, sel, join, off, status, leave } */
|
|
66
|
+
export function viewHtml(S) {
|
|
67
|
+
if (S.phase === 'loading') return '<p class="bd-amut bdsh-pad">Reading the teams…</p>';
|
|
68
|
+
const teams = S.teams || []; const rows = rowsOf(S);
|
|
69
|
+
const showJoin = S.join && S.join.open;
|
|
70
|
+
if (!teams.length && !(S.yours || []).length) return joinHtml(Object.assign({}, S, { join: Object.assign({ open: true }, S.join) }));
|
|
71
|
+
const count = (f) => rows.filter((r) => !r.ended && f(r)).length;
|
|
72
|
+
const sel = S.sel === 'mine' && (S.yours || []).length ? 'mine' : teams.some((t) => t.team === S.sel) ? S.sel : 'all';
|
|
73
|
+
const chip = (k, label, n) => `<button type="button" class="bd-chip${sel === k ? ' on' : ''}" data-sh-sel="${esc(k)}" aria-pressed="${sel === k}">${esc(label)}${n ? ' ' + n : ''}</button>`;
|
|
74
|
+
const chipsHtml = chip('all', 'All', count(() => true)) + ((S.yours || []).length ? chip('mine', 'Yours', count((r) => r.mine)) : '') + teams.map((t) => chip(t.team, t.team, t.ok ? count((r) => r.team === t.team) : 0)).join('');
|
|
75
|
+
const failing = teams.filter((t) => !t.ok && (sel === 'all' || sel === t.team));
|
|
76
|
+
const banners = failing.map((t) => `<div class="bdsh-ban" role="alert"><span class="cs s-risk"><i class="cz-dot risk m-warn"></i>${esc(t.team)}: ${esc(t.error)}</span><button type="button" class="bd-btn" data-sh="${t.kind === 'password' ? 'repaste' : 'refresh'}" data-sh-team="${esc(t.team)}">${t.kind === 'password' ? 'Paste a new invite link' : 'Refresh'}</button></div>`).join('');
|
|
77
|
+
const shown = rows.filter((r) => (sel === 'all' ? true : sel === 'mine' ? r.mine : r.team === sel)).sort((a, b) => Number(a.ended) - Number(b.ended) || (b.mine ? 1 : 0) - (a.mine ? 1 : 0) || String(b.made).localeCompare(String(a.made)));
|
|
78
|
+
const built = shown.map((r) => row(S, r));
|
|
79
|
+
const teamSel = teams.find((t) => t.team === sel);
|
|
80
|
+
const teamLine = teamSel ? `<div class="bdsh-tl"><button type="button" class="bd-btn sm" data-sh="refresh">Refresh</button><button type="button" class="bd-btn sm" data-sh="repaste" data-sh-team="${esc(teamSel.team)}">Paste a new invite link</button><button type="button" class="bd-btn sm${S.leave === teamSel.team ? ' on' : ''}" data-sh-leave="${esc(teamSel.team)}">${S.leave === teamSel.team ? 'Sure? Leave ' + esc(teamSel.team) : 'Leave team'}</button></div><p class="bd-amut bdsh-fine">${S.leave === teamSel.team ? 'Leaving only forgets the team\'s password on this computer. Copies you published stay. Join again with the invite link.' : ''}</p>` : '';
|
|
81
|
+
const empty = !built.length && !failing.length ? `<p class="bd-amut bdsh-pad">${sel === 'all' ? 'Nothing is shared yet.' : sel === 'mine' ? 'You have no open links.' : 'Nobody has shared a board with ' + esc(sel) + ' yet. Press the share button on the Board to publish one.'}</p>` : '';
|
|
82
|
+
const head = '<div class="bd-dt h" role="row"><span></span><span role="columnheader">Board</span><span role="columnheader">Selection</span><span role="columnheader">Team</span><span role="columnheader">Shared by</span><span role="columnheader">Published</span><span role="columnheader">Views</span><span role="columnheader">Ends</span><span></span></div>';
|
|
83
|
+
const hosts = [...new Set(teams.filter((t) => t.ok).map((t) => t.host))];
|
|
84
|
+
const readLine = S.readAt ? `<p class="bd-amut bdsh-fine">Read${hosts.length ? ' from ' + hosts.map(esc).join(', ') : ''} ${agoText(S)}. Press a board to open its copy in a new tab. <button type="button" class="bdsh-lk" data-sh="refresh">Refresh</button></p>` : '';
|
|
85
|
+
return `<div class="bd-dchips" role="group" aria-label="Shared">${chipsHtml}<span class="bd-sp"></span><button type="button" class="bd-btn" data-sh="${showJoin ? 'closejoin' : 'openjoin'}">${showJoin ? 'Close' : 'Join another team'}</button></div>`
|
|
86
|
+
+ (showJoin ? joinHtml(S) : '') + (S.status ? `<p class="bd-amut bdsh-fine" role="status">${esc(S.status)}</p>` : '') + banners + teamLine
|
|
87
|
+
+ (built.length ? `<div class="bd-dtw bdsh-table" role="table" aria-label="Shared boards">${head}${built.map((b) => b.table).join('')}</div><div class="bdsh-cards">${built.map((b) => b.card).join('')}</div>` : '') + empty + readLine;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export async function loadCount(cb) {
|
|
91
|
+
const r = await pmGet('/api/board-publish').catch(() => null);
|
|
92
|
+
if (r && r.ok) cb((r.links || []).length);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function show(el, opts = {}) {
|
|
96
|
+
css();
|
|
97
|
+
const S = el.__sh || (el.__sh = { phase: 'loading', yours: [], teams: [], names: [], readAt: '', now: Date.now(), sel: 'all', join: { open: false, typed: false }, off: null, leave: null, status: '' });
|
|
98
|
+
const draw = (focus) => {
|
|
99
|
+
const keep = { invite: el.querySelector('#shInvite'), host: el.querySelector('#shHost'), team: el.querySelector('#shTeam'), pass: el.querySelector('#shPass') };
|
|
100
|
+
if (keep.invite) S.join.invite = keep.invite.value; if (keep.host) S.join.host = keep.host.value; if (keep.team) S.join.team = keep.team.value; if (keep.pass) S.join.password = keep.pass.value;
|
|
101
|
+
el.innerHTML = '<h2 class="vh">Shared</h2><div id="shBody">' + viewHtml(S) + '</div>';
|
|
102
|
+
const f = focus && el.querySelector(focus); if (f) f.focus();
|
|
103
|
+
};
|
|
104
|
+
const read = async (keepPhase) => {
|
|
105
|
+
if (!keepPhase) { S.phase = 'loading'; draw(); }
|
|
106
|
+
const r = await pmGet('/api/board-publish/shared').catch(() => null);
|
|
107
|
+
S.phase = 'ready'; S.now = Date.now();
|
|
108
|
+
if (r && r.ok) { S.yours = r.yours || []; S.teams = r.teams || []; S.names = S.teams.map((t) => t.team); S.readAt = r.readAt; } else S.status = (r && r.error) || 'The workspace did not answer. Try again.';
|
|
109
|
+
if (opts.onCount) opts.onCount(totalOf(S)); draw();
|
|
110
|
+
};
|
|
111
|
+
if (!el.__shBound) {
|
|
112
|
+
el.__shBound = true;
|
|
113
|
+
el.addEventListener('click', async (e) => {
|
|
114
|
+
const b = e.target.closest('button'); if (!b) return;
|
|
115
|
+
if (b.dataset.shSel) { S.sel = b.dataset.shSel; S.leave = null; S.off = null; return draw(`[data-sh-sel="${CSS.escape(S.sel)}"]`); }
|
|
116
|
+
const a = b.dataset.sh;
|
|
117
|
+
if (a === 'refresh') { S.status = ''; S.leave = null; return read(false); }
|
|
118
|
+
if (a === 'openjoin') { S.join = { open: true, typed: false }; return draw('#shInvite'); }
|
|
119
|
+
if (a === 'closejoin') { S.join = { open: false, typed: false }; return draw(); }
|
|
120
|
+
if (a === 'repaste') { S.join = { open: true, typed: false, team: b.dataset.shTeam }; return draw('#shInvite'); }
|
|
121
|
+
if (a === 'typed') { S.join.typed = true; S.join.err = ''; return draw('#shHost'); }
|
|
122
|
+
if (a === 'paste') { S.join.typed = false; S.join.err = ''; return draw('#shInvite'); }
|
|
123
|
+
if (a === 'join') {
|
|
124
|
+
const J = S.join; const body = J.typed ? { host: J.host || '', team: J.team || '', password: J.password || '' } : { invite: J.invite || '' };
|
|
125
|
+
const fresh = { invite: (el.querySelector('#shInvite') || {}).value, host: (el.querySelector('#shHost') || {}).value, team: (el.querySelector('#shTeam') || {}).value, password: (el.querySelector('#shPass') || {}).value };
|
|
126
|
+
if (J.typed) { body.host = fresh.host || ''; body.team = fresh.team || ''; body.password = fresh.password || ''; } else body.invite = fresh.invite || '';
|
|
127
|
+
J.busy = true; J.err = ''; draw();
|
|
128
|
+
const r = await pmPost('/api/board-publish/join', body).catch(() => null); J.busy = false;
|
|
129
|
+
if (r && r.ok) { S.join = { open: false, typed: false }; S.sel = r.team; S.status = 'Joined ' + r.team + '.'; return read(false); }
|
|
130
|
+
J.err = (r && r.error) || 'The workspace did not answer. Try again.'; return draw(J.typed ? '#shHost' : '#shInvite');
|
|
131
|
+
}
|
|
132
|
+
if (b.dataset.shLeave) {
|
|
133
|
+
if (S.leave !== b.dataset.shLeave) { S.leave = b.dataset.shLeave; return draw(`[data-sh-leave="${CSS.escape(S.leave)}"]`); }
|
|
134
|
+
const r = await pmPost('/api/board-publish/leave', { team: S.leave }).catch(() => null); const was = S.leave; S.leave = null; S.sel = 'all';
|
|
135
|
+
S.status = r && r.ok ? 'Left ' + was + '. Copies you published stay.' : (r && r.error) || 'Not saved.'; return read(true);
|
|
136
|
+
}
|
|
137
|
+
if (b.dataset.shRe) { S.status = ''; const r = await pmPost('/api/board-publish/republish', { id: b.dataset.shRe }).catch(() => null); S.status = r && r.ok ? 'Republished. The link and the password stay the same.' : (r && r.error) || 'The workspace did not answer. Try again.'; return read(true); }
|
|
138
|
+
if (b.dataset.shOff) {
|
|
139
|
+
if (S.off !== b.dataset.shOff) { S.off = b.dataset.shOff; return draw(`[data-sh-off="${CSS.escape(S.off)}"]`); }
|
|
140
|
+
const r = await pmPost('/api/board-publish/off', { id: S.off }).catch(() => null); S.off = null;
|
|
141
|
+
S.status = r && r.ok ? 'Turned off. The copy is deleted from the host.' : (r && r.error) || 'The link could not be turned off.'; return read(true);
|
|
142
|
+
}
|
|
143
|
+
if (b.dataset.shOpen) {
|
|
144
|
+
// the tab is opened by the press itself (a popup blocker allows that), then pointed at the one-time address
|
|
145
|
+
const w = window.open('about:blank', '_blank'); if (w) { try { w.opener = null; } catch { /* none */ } }
|
|
146
|
+
const r = await pmPost('/api/board-publish/open', { team: b.dataset.shTeam, id: b.dataset.shOpen }).catch(() => null);
|
|
147
|
+
if (r && r.ok && w) { w.location.href = r.url; S.status = 'Opened ' + (b.textContent || 'the board') + ' in a new tab.'; } else { if (w) w.close(); S.status = (r && r.error) || 'The workspace did not answer. Try again.'; }
|
|
148
|
+
return draw(`[data-sh-open="${CSS.escape(b.dataset.shOpen)}"]`);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return read(false);
|
|
153
|
+
}
|
|
@@ -58,10 +58,13 @@ import * as BP2 from './bd-pane.js'; // the Board as the first panel: fit(), t
|
|
|
58
58
|
const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUPING_KEY = 'pmos.board.grouping';
|
|
59
59
|
let M = null; // the model
|
|
60
60
|
let TR = null; // the trail (GET /api/board-trail): { usual, themes, items: { [id]: item } }
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const PACK_VIEW = window.PMOS_READONLY && window.PMOS_READONLY.view; // a published copy opens on the view the publisher was in (board-publish R21)
|
|
62
|
+
const VIEWS = ['track', 'stages', 'time', 'list'];
|
|
63
|
+
let view = window.PMOS_READONLY ? (VIEWS.includes(PACK_VIEW) ? PACK_VIEW : 'track') : VIEWS.includes(store.get(VIEW_KEY)) ? store.get(VIEW_KEY) : 'track';
|
|
64
|
+
let pview = window.PMOS_READONLY ? (view === 'time' ? 'time' : 'track') : ['list', 'stages', 'track', 'time'].includes(store.get(PVIEW_KEY)) ? store.get(PVIEW_KEY) : 'list'; // a phone's view (BdPhone)
|
|
63
65
|
let span = SPANS.some(([k]) => k === store.get(SPAN_KEY)) ? store.get(SPAN_KEY) : 'quarter';
|
|
64
66
|
let tab = 'ini';
|
|
67
|
+
let SH_N = 0; let SH_FULL = false; let SH_LOADED = false; // the Shared tab's number, whether it has read the teams, whether the first count was asked
|
|
65
68
|
let readTimer = null;
|
|
66
69
|
let readTries = 0; // reads that answered "reading" in a row: the next ask waits longer each time
|
|
67
70
|
let foldOpen = false; // the Monitor and Evaluate rows under the table
|
|
@@ -232,6 +235,7 @@ function drawHead() {
|
|
|
232
235
|
$('#snap').textContent = M.header.text;
|
|
233
236
|
// PMOS-self: new work starts at the pmos-router skill. All products: New asks which product the initiative is for
|
|
234
237
|
$('#newIni').hidden = ALL ? (M.board.products || []).every((p) => p.self) : !!M.board.self;
|
|
238
|
+
if (!window.PMOS_READONLY && !SH_LOADED) { SH_LOADED = true; import('./bd-shared.js').then((S) => S.loadCount(setSharedCount)); }
|
|
235
239
|
{ const pb = $('#bdPublish'); const was = pb.hidden; pb.hidden = ALL || !M.board.ws || !!window.PMOS_READONLY; if (was && !pb.hidden) import('./bd-publish.js').then((P) => P.refreshCount(pb)); }
|
|
236
240
|
setPageGaps(((M.header && M.header.missing) || []).length);
|
|
237
241
|
}
|
|
@@ -256,7 +260,7 @@ function drawChips() {
|
|
|
256
260
|
const askChip = `<button type="button" class="bd-chip" id="chAsks" aria-haspopup="dialog">${asks ? esc(asks) : `<i class="cz-dot you${C.asks ? ' m-info' : ''}"></i><b>${C.asks}</b> new ${plural(C.asks, 'ask', 'asks')}`}</button>`;
|
|
257
261
|
if (phone) {
|
|
258
262
|
const docs = M.docs && M.docs.rows ? M.docs.rows.length : 0;
|
|
259
|
-
$('#bdChipset').innerHTML = thisSprint + jiraChip + askChip + flt(['late', 'risk', 'blocked', 'idle']) + `<button type="button" class="bd-chip" id="chDocs">Docs ${docs}</button>`;
|
|
263
|
+
$('#bdChipset').innerHTML = thisSprint + jiraChip + askChip + flt(['late', 'risk', 'blocked', 'idle']) + `<button type="button" class="bd-chip" id="chDocs">Docs ${docs}</button><button type="button" class="bd-chip" id="chShared">Shared${SH_N ? ' ' + SH_N : ''}</button>`;
|
|
260
264
|
return;
|
|
261
265
|
}
|
|
262
266
|
// the timeline's legend sits at the end of the chip row (PgTimeline), with a program milestone only where a program is drawn and "On hold" only
|
|
@@ -280,6 +284,7 @@ $('#bdChipset').addEventListener('click', (e) => {
|
|
|
280
284
|
else if (b.id === 'chSprint') Acts.open.sprint(b);
|
|
281
285
|
else if (b.id === 'chAsks') Acts.open.asks(b);
|
|
282
286
|
else if (b.id === 'chDocs') setTab('docs');
|
|
287
|
+
else if (b.id === 'chShared') setTab('shared');
|
|
283
288
|
});
|
|
284
289
|
/** Read Jira again: the Jira source's own refresh (POST /api/sources/refresh), the one the Sources list runs. It starts a read and changes no record. */
|
|
285
290
|
async function refreshJira(btn) {
|
|
@@ -847,18 +852,24 @@ $('#bdFilter').addEventListener('click', (e) => Acts.open.filter(e.currentTarget
|
|
|
847
852
|
$('#newIni').addEventListener('click', (e) => { if (e.isTrusted) Asks.openNewMenu(e.currentTarget); else Acts.open.new(e.currentTarget); });
|
|
848
853
|
$('#bdBell').addEventListener('click', (e) => { if (M) Acts.open.bell(e.currentTarget); });
|
|
849
854
|
// Publish a read-only copy (initiative board-publish, slice 2): one board at a time, so it is not drawn on the All products page
|
|
850
|
-
$('#bdPublish').addEventListener('click', (e) => { const btn = e.currentTarget; if (M && !ALL && M.board.ws) import('./bd-publish.js').then((P) => P.open(btn, { ws: M.board.ws, board: M.board.id || M.board.ws })); });
|
|
855
|
+
$('#bdPublish').addEventListener('click', (e) => { const btn = e.currentTarget; if (M && !ALL && M.board.ws) import('./bd-publish.js').then((P) => P.open(btn, { ws: M.board.ws, board: M.board.id || M.board.ws, view })); });
|
|
851
856
|
|
|
852
857
|
/* ── tabs: Initiatives and Documents (Documents has no frame yet: a plain list) ──────────────────────────────────────────────────────── */
|
|
853
858
|
function setTab(t) {
|
|
854
859
|
tab = t;
|
|
855
|
-
$('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabDocs').setAttribute('aria-selected', String(t === 'docs'));
|
|
856
|
-
$('#cIni').hidden = t !== 'ini'; $('#cDocs').hidden = t !== 'docs';
|
|
860
|
+
$('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabDocs').setAttribute('aria-selected', String(t === 'docs')); $('#tabShared').setAttribute('aria-selected', String(t === 'shared'));
|
|
861
|
+
$('#cIni').hidden = t !== 'ini'; $('#cDocs').hidden = t !== 'docs'; $('#cShared').hidden = t !== 'shared';
|
|
857
862
|
if (t === 'docs') { closePanel(); drawDocs(); loadDocMeta(); }
|
|
863
|
+
// Shared (initiative board-publish, slice 4): reads each joined team's host now, on opening the tab and on Refresh, and never in between
|
|
864
|
+
if (t === 'shared') { closePanel(); import('./bd-shared.js').then((S) => { SH_FULL = true; S.show($('#cShared'), { onCount: setSharedCount }); }); }
|
|
858
865
|
}
|
|
859
866
|
$('#tabIni').onclick = () => setTab('ini');
|
|
860
867
|
$('#tabDocs').onclick = () => setTab('docs');
|
|
861
|
-
$('
|
|
868
|
+
$('#tabShared').onclick = () => setTab('shared');
|
|
869
|
+
$('.bd-tabs').addEventListener('keydown', (e) => { if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') return; const ord = ['ini', 'docs', 'shared']; const n = ord[(ord.indexOf(tab) + (e.key === 'ArrowRight' ? 1 : ord.length - 1)) % ord.length]; setTab(n); $('#' + { ini: 'tabIni', docs: 'tabDocs', shared: 'tabShared' }[n]).focus(); });
|
|
870
|
+
/** The number on the Shared tab and on the phone's Shared chip: nothing when there is nothing (zero is silence). Your own open links at load, every open copy after a read. */
|
|
871
|
+
function setSharedCount(n) { SH_N = n; $('#nShared').textContent = n ? String(n) : ''; const c = $('#chShared'); if (c) c.textContent = 'Shared' + (n ? ' ' + n : ''); }
|
|
872
|
+
document.addEventListener('bd:links', (e) => { if (!SH_FULL && e.detail) setSharedCount(e.detail.n); });
|
|
862
873
|
|
|
863
874
|
/** Documents (BdDocs): the kind chips, the rows and their history; a row opens the document's panel (pm/bd-acts.js). */
|
|
864
875
|
function drawDocs() { if (M) $('#docBody').innerHTML = V.docsHtml(); }
|
|
@@ -19,6 +19,8 @@ export const RO = !!PACK;
|
|
|
19
19
|
export const VIEW_CONTROLS = [
|
|
20
20
|
// the Timeline: the span, a column's sort, back to today, the Deliveries lane, the folds, an initiative's name (opens its viewer)
|
|
21
21
|
'#bdSpans button', '.tg-chd', '.tg-tback', '.dl-fb', '.dl-dn', '.dl-e[aria-label*="press to open"]', '.bd-fold', '.bd-prdb', 'label.tg-n', 'button.tg-n.ini2',
|
|
22
|
+
// the stage track: the switch between it and the Timeline (the two views a publisher shares), an initiative's name, the Monitor and Evaluate fold
|
|
23
|
+
'#ibTabs [data-v="track"]', '#ibTabs [data-v="time"]', 'button.bt-nm', '#fold',
|
|
22
24
|
// the viewer: the layout, the close, the folds, the Tasks view menu, a stage's fold and its done tasks
|
|
23
25
|
'.cz-vw-ib[aria-label="Arrange"]', '.cz-vw-ib[aria-label="Close the viewer"]', '.cz-pn-menu', '[class*="cz-dv"]',
|
|
24
26
|
'.iv-mctg', '.iv-gx-t', '.iv-ws', '.iv-grp', '.iv-ab-h', '.iv-fr', '.ivx-vb', '.tkc-pop [data-ivs-view]', '.tkc-pop [data-ivs-by]', '.tkc-pop [data-ivs-zoom]',
|
|
@@ -27,16 +29,17 @@ export const VIEW_CONTROLS = [
|
|
|
27
29
|
].join(',');
|
|
28
30
|
|
|
29
31
|
/** The Board's static toolbar and chips: hidden, so the page's own script keeps the elements it holds. */
|
|
30
|
-
const HIDE = ['
|
|
32
|
+
const HIDE = ['#ibTabs [data-v="stages"]', '#ibTabs [data-v="list"]', '#bdView', '#bdSpanPick', '.bd-title', '.bd-vr', '.bd-tabs', '#crumbHost', '#bdFind', '#bdColsw', '#bdSort', '#bdFilter', '#bdBell', '#bdPublish', '#chShared', '#newIni', '.tools-top', '#bdGrpw', '#czFab'];
|
|
31
33
|
/** Controls the code draws that write, or lead to something a share does not hold: removed. */
|
|
32
34
|
const REMOVE = [
|
|
35
|
+
'.po-grip', '.bd-nxa',
|
|
33
36
|
'#bdChipset > :not(.tg-lgd)', '#askDates', '.tg-ft',
|
|
34
37
|
'.cz-vw-ib[aria-label="Discuss in chat"]', '.cz-vw-ib[aria-label="More"]', '.iv-addp', '.iv-prog', '.iv-plus', '.iv-car', '.iv-scgn', '.iv-gx-a',
|
|
35
38
|
'.ab-lk', '[data-ivs-view="kanban"]', '.ivs-cols', '.ivs-h:has(+ .ivs-cols)', '[data-ivs-more]', '.iv-tasks:has(.iv-q)', '.iv-th .iv-ib', '.iv-th .iv-plus',
|
|
36
39
|
];
|
|
37
40
|
/** Controls whose words are the content (a title, a date, a name, a program's milestone in the Deliveries lane): set as plain text, same look. A program's
|
|
38
41
|
* milestone opens the program's charter in the workspace; a share does not hold the charter. */
|
|
39
|
-
const PLAIN = ['button.dl-e[aria-label*="Program milestone"]:not([aria-label*="press to open"])', 'button.cz-vw-rn', 'button.iv-tt', 'button.iv-dc', 'button.iv-stc', 'button.iv-dtc', 'button.iv-wf', 'button.iv-cb', 'button.tg-pgo', 'button.tg-end'];
|
|
42
|
+
const PLAIN = ['button.dl-e[aria-label*="Program milestone"]:not([aria-label*="press to open"])', 'button.cz-vw-rn', 'button.iv-tt', 'button.iv-dc', 'button.iv-stc', 'button.iv-dtc', 'button.iv-wf', 'button.iv-cb', 'button.tg-pgo', 'button.bt-pgo', 'button.tg-end'];
|
|
40
43
|
/** A fold whose body goes with it: Documents and Linked are not listed. */
|
|
41
44
|
const WITH_BODY = ['[data-iv-fold="docs"]', '[data-iv-docs]', '[data-iv-fold="linked"]'];
|
|
42
45
|
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
<div class="bd-tabs" role="tablist" aria-label="Board">
|
|
56
56
|
<button type="button" role="tab" class="bd-tab" id="tabIni" aria-selected="true" aria-controls="cIni">Initiatives <span class="n" id="nIni"></span></button>
|
|
57
57
|
<button type="button" role="tab" class="bd-tab" id="tabDocs" aria-selected="false" aria-controls="cDocs">Documents <span class="n" id="docCap"></span></button>
|
|
58
|
+
<button type="button" role="tab" class="bd-tab" id="tabShared" aria-selected="false" aria-controls="cShared">Shared <span class="n" id="nShared"></span></button>
|
|
58
59
|
</div>
|
|
59
60
|
<div class="bd-seg bd-spans" id="bdSpans" role="group" aria-label="Span" hidden>
|
|
60
61
|
<button type="button" data-sp="sprint" aria-pressed="false">Sprint</button><button type="button" data-sp="quarter" aria-pressed="true">Quarter</button><button type="button" data-sp="half" aria-pressed="false">Half</button><button type="button" data-sp="year" aria-pressed="false">Year</button><button type="button" data-sp="y2" aria-pressed="false">2 yr</button><button type="button" data-sp="y5" aria-pressed="false">5 yr</button>
|
|
@@ -71,6 +72,7 @@
|
|
|
71
72
|
<h2 class="vh" id="hDocs">Documents</h2>
|
|
72
73
|
<div id="docBody"></div>
|
|
73
74
|
</section>
|
|
75
|
+
<section class="bd-sec" id="cShared" role="tabpanel" aria-labelledby="tabShared" hidden></section>
|
|
74
76
|
|
|
75
77
|
<!-- the help frame: what finishes each step (the step heads open it) -->
|
|
76
78
|
<div class="bd-pop bd-pop-xw" id="popSteps" role="dialog" aria-labelledby="hSteps" hidden></div>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_comment": "Initiative board-publish, slice 2 (planning/prd/board-publish-prd.md P1 to P5; D103): the workspace's side of publishing to the central host (lib/boards-host.js, lib/routes-board-publish.js), run against a stand-in host that follows the contract.",
|
|
3
3
|
"modules": [
|
|
4
|
-
"board-publish-host.test.js"
|
|
4
|
+
"board-publish-host.test.js",
|
|
5
|
+
"board-publish-teams.test.js"
|
|
5
6
|
],
|
|
6
7
|
"seconds": {
|
|
7
|
-
"board-publish-host.test.js": 3
|
|
8
|
+
"board-publish-host.test.js": 3,
|
|
9
|
+
"board-publish-teams.test.js": 3
|
|
8
10
|
}
|
|
9
11
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_comment": "Initiative board-publish, slice 2 page side (planning/prd/board-publish-prd.md P1 to P5; design prototype/board-publish/publish-popover-design.html): the Publish popover on the Board (pm/bd-publish.js, pm/bd-publish.css, the toolbar button).",
|
|
2
|
+
"_comment": "Initiative board-publish, slice 2 page side (planning/prd/board-publish-prd.md P1 to P5; design prototype/board-publish/publish-popover-design.html): the Publish popover on the Board (pm/bd-publish.js, pm/bd-publish.css, the toolbar button). Slice 4 adds the Shared tab (pm/bd-shared.js, pm/bd-shared.css; design prototype/board-publish/shared-view-design.html).",
|
|
3
3
|
"panels": [
|
|
4
|
-
"board-publish-ui-test.js"
|
|
4
|
+
"board-publish-ui-test.js",
|
|
5
|
+
"board-shared-ui-test.js"
|
|
5
6
|
],
|
|
6
7
|
"seconds": {
|
|
7
|
-
"board-publish-ui-test.js": 40
|
|
8
|
+
"board-publish-ui-test.js": 40,
|
|
9
|
+
"board-shared-ui-test.js": 45
|
|
8
10
|
}
|
|
9
11
|
}
|