create-pmos 0.468.0 → 0.470.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 +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-publish-ui-test.js +161 -0
- package/workspace/changelog.json +26 -0
- package/workspace/guide/published-board.md +27 -3
- package/workspace/lib/board-publish-choices.js +25 -0
- package/workspace/lib/boards-host.js +17 -4
- package/workspace/lib/routes-board-publish.js +40 -12
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-publish.css +44 -0
- package/workspace/public/pm/bd-publish.js +151 -0
- package/workspace/public/pm/premium-board.js +3 -0
- package/workspace/public/pm/readonly.js +1 -1
- package/workspace/public/premium-board.html +1 -0
- package/workspace/test-lists/board-publish-d.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.470.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.470.0",
|
|
37
|
+
"at": "2026-10-31T12:11:04.375Z",
|
|
38
|
+
"f": 3,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 1123,
|
|
42
|
+
"t": "The Publish popover on the Board (board-publish slice 2, page side)",
|
|
43
|
+
"s": "The Publish popover on the Board (board-publish slice 2, page side)",
|
|
44
|
+
"k": "new"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"v": "0.469.0",
|
|
50
|
+
"at": "2026-10-31T10:43:44.457Z",
|
|
51
|
+
"f": 3,
|
|
52
|
+
"prs": [
|
|
53
|
+
{
|
|
54
|
+
"n": 1122,
|
|
55
|
+
"t": "Build and upload the Board's code for the host (board-publish slice 3, H6)",
|
|
56
|
+
"s": "Build and upload the Board's code for the host (board-publish slice 3, H6)",
|
|
57
|
+
"k": "new"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
35
61
|
{
|
|
36
62
|
"v": "0.468.0",
|
|
37
63
|
"at": "2026-10-31T09:41:17.517Z",
|
|
@@ -271,32 +297,6 @@
|
|
|
271
297
|
"k": "x"
|
|
272
298
|
}
|
|
273
299
|
]
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
"v": "0.450.0",
|
|
277
|
-
"at": "2026-10-29T08:38:00.644Z",
|
|
278
|
-
"f": 3,
|
|
279
|
-
"prs": [
|
|
280
|
-
{
|
|
281
|
-
"n": 1096,
|
|
282
|
-
"t": "Grill runs go to the Claude API; --changed narrows further",
|
|
283
|
-
"s": "Grill runs go to the Claude API; --changed narrows further",
|
|
284
|
-
"k": "new"
|
|
285
|
-
}
|
|
286
|
-
]
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
"v": "0.449.0",
|
|
290
|
-
"at": "2026-10-29T08:24:22.196Z",
|
|
291
|
-
"f": 3,
|
|
292
|
-
"prs": [
|
|
293
|
-
{
|
|
294
|
-
"n": 1095,
|
|
295
|
-
"t": "The blue Adler — replace the drawn SVG Adler with the 103-PNG set",
|
|
296
|
-
"s": "The blue Adler — replace the drawn SVG Adler with the 103-PNG set",
|
|
297
|
-
"k": "new"
|
|
298
|
-
}
|
|
299
|
-
]
|
|
300
300
|
}
|
|
301
301
|
]
|
|
302
302
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -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-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-31T12:11:00Z"}
|
|
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-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-31T12:11:00Z"}
|
|
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-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-31T12:11:00Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* board-publish-ui — the Publish popover on the Board (initiative board-publish, slice 2, page side; planning/prd/board-publish-prd.md P1 to P5; design
|
|
4
|
+
* prototype/board-publish/publish-popover-design.html). Serves the real page from the real server. The Board's model and the workspace's /api/board-publish
|
|
5
|
+
* and /api/settings answers are served by the test (the server side is tested in board-publish-host.test.js), so each press is checked on what the page SENDS.
|
|
6
|
+
* A the button: one board only, never in the read-only Board, a count only when there are open links · B no host: the address is asked in place ·
|
|
7
|
+
* C the form: chips, the initiative picker, password, ends · D publish: what is sent, working, the link ready, Done · E problems · F open links ·
|
|
8
|
+
* G a phone: a sheet, no sideways scroll · H Escape and a press outside close it */
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { spawn } = require('child_process');
|
|
11
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
12
|
+
const T = require('./test-run').configure({ name: 'board-publish-ui' });
|
|
13
|
+
const BP = require('./lib/board-premium.js');
|
|
14
|
+
const F = require('./fixtures/board-premium-facts.js');
|
|
15
|
+
const Pack = require('./lib/board-pack.js');
|
|
16
|
+
|
|
17
|
+
let n = 0; let bad = 0;
|
|
18
|
+
const ok = (name, cond, extra = '') => { n++; if (!cond) bad++; console.log(`${cond ? ' ✓' : ' ✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 300) : ''}`); };
|
|
19
|
+
|
|
20
|
+
(async () => {
|
|
21
|
+
const { chromium } = require('playwright-core');
|
|
22
|
+
const srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
23
|
+
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-publish-ui assertions passed`); process.exit(code !== undefined ? code : (bad ? 1 : 0)); };
|
|
24
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(null, 1); });
|
|
25
|
+
await T.waitForServer(T.BASE);
|
|
26
|
+
const browser = await chromium.launch({ executablePath: findBrowser() });
|
|
27
|
+
|
|
28
|
+
const model = BP.build(F.programFacts('idpf'));
|
|
29
|
+
const BOARD = '/api/board-premium?ws=idpf&board=idpf';
|
|
30
|
+
const LINKS = [{ id: 'link00000001abcdefgh', url: 'https://boards.test/b/link00000001abcdefgh', team: 'Product', name: 'IDPF', kind: 'product', made: '2026-10-31T10:00:00Z', ends: new Date(Date.now() + 6 * 86400000).toISOString(), views: 3 },
|
|
31
|
+
{ id: 'link00000002abcdefgh', url: 'https://boards.test/b/link00000002abcdefgh', team: '', name: 'Project Ascent', kind: 'program', made: '2026-10-30T10:00:00Z', ends: new Date(Date.now() + 20 * 3600000).toISOString(), views: 1 }];
|
|
32
|
+
// the workspace's answers, set by each section
|
|
33
|
+
const W = { host: 'boards.test', links: [], posts: [], settings: [], publish: null, settingsAnswer: null };
|
|
34
|
+
const open = async (w, h, url, init) => {
|
|
35
|
+
const ctx = await browser.newContext({ viewport: { width: w, height: h } });
|
|
36
|
+
const reqs = []; ctx.on('request', (r) => reqs.push({ m: r.method(), u: r.url().replace(T.BASE, '') }));
|
|
37
|
+
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 }) }));
|
|
38
|
+
await ctx.route((u) => new URL(u).pathname === '/api/programs', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, programs: F.programs() }) }));
|
|
39
|
+
await ctx.route((u) => new URL(u).pathname === '/api/board-publish', (r) => {
|
|
40
|
+
if (r.request().method() === 'GET') return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, host: W.host, days: [1, 7, 30], password: 'harbor-lime-47', links: W.links,
|
|
41
|
+
choices: { products: [{ id: 'idpf', label: 'IDPF' }], programs: [{ id: 'project-ascent', label: 'Project Ascent' }], initiatives: (model.rows || []).filter((x) => x.id).slice(0, 3).map((x) => ({ id: x.id, label: x.title || x.id })) } }) });
|
|
42
|
+
const body = JSON.parse(r.request().postData() || '{}'); W.posts.push({ p: '/api/board-publish', body });
|
|
43
|
+
return r.fulfill({ status: W.publish ? W.publish.status : 200, contentType: 'application/json', body: JSON.stringify(W.publish ? W.publish.body : { ok: true, id: 'link00000003abcdefgh', url: 'https://boards.test/b/link00000003abcdefgh', ends: new Date(Date.now() + 7 * 86400000).toISOString() }) });
|
|
44
|
+
});
|
|
45
|
+
await ctx.route((u) => /\/api\/board-publish\/(republish|off)$/.test(new URL(u).pathname), (r) => { W.posts.push({ p: new URL(r.request().url()).pathname, body: JSON.parse(r.request().postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, ends: LINKS[0].ends }) }); });
|
|
46
|
+
await ctx.route((u) => new URL(u).pathname === '/api/board-publish/host', (r) => { const b = JSON.parse(r.request().postData() || '{}'); W.settings.push({ key: 'boards.host', value: b.host }); r.fulfill({ contentType: 'application/json', status: W.settingsAnswer ? 400 : 200, body: JSON.stringify(W.settingsAnswer || { ok: true, host: b.host }) }); });
|
|
47
|
+
const errs = []; const p = await ctx.newPage(); p.on('pageerror', (e) => errs.push(e.message));
|
|
48
|
+
await p.addInitScript(() => { try { localStorage.setItem('pmos.board.view', 'time'); localStorage.setItem('pmos.board.grouping', 'program'); } catch (e) { /* none */ } });
|
|
49
|
+
await p.goto(T.BASE + url); await p.waitForSelector('.tg-n.ini2', { timeout: 15000 }).catch(() => {}); await p.waitForTimeout(500);
|
|
50
|
+
return { ctx, p, reqs, errs };
|
|
51
|
+
};
|
|
52
|
+
const pop = (p) => p.locator('.bppop');
|
|
53
|
+
|
|
54
|
+
console.log('A the button');
|
|
55
|
+
W.links = []; W.host = 'boards.test';
|
|
56
|
+
let s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf');
|
|
57
|
+
ok('A1 the Publish button is drawn on a single board, with a label that says what it does', await s.p.locator('#bdPublish').isVisible() && /Publish a read-only copy/.test(await s.p.locator('#bdPublish').getAttribute('aria-label')));
|
|
58
|
+
ok('A2 with no open links there is no count (zero is silence)', await s.p.locator('#bdPublish .bpn').isHidden());
|
|
59
|
+
await s.ctx.close();
|
|
60
|
+
W.links = LINKS; s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.waitForTimeout(600);
|
|
61
|
+
ok('A3 with open links the button shows how many, and the label says so', (await s.p.locator('#bdPublish .bpn').textContent()) === '2' && /2 open links/.test(await s.p.locator('#bdPublish').getAttribute('aria-label')), await s.p.locator('#bdPublish').getAttribute('aria-label'));
|
|
62
|
+
await s.ctx.close();
|
|
63
|
+
s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf&all=1');
|
|
64
|
+
ok('A4 the All products page does not draw it', await s.p.locator('#bdPublish').isHidden());
|
|
65
|
+
await s.ctx.close();
|
|
66
|
+
{
|
|
67
|
+
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() } } });
|
|
68
|
+
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } }); const reqs = []; ctx.on('request', (r) => reqs.push(new URL(r.url()).pathname));
|
|
69
|
+
await ctx.route((u) => new URL(u).pathname === '/__pack/p.json', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(pack) }));
|
|
70
|
+
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);
|
|
71
|
+
ok('A5 the read-only Board does not draw it and asks nothing of /api/board-publish', (await p.locator('#bdPublish').isHidden()) && !reqs.some((u) => /board-publish/.test(u)), reqs.filter((u) => /board-publish/.test(u)).join(','));
|
|
72
|
+
await ctx.close();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
console.log('B no host');
|
|
76
|
+
W.links = []; W.host = null; W.settings = []; W.settingsAnswer = null;
|
|
77
|
+
s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#bdPublish'); await s.p.waitForSelector('#bpHost');
|
|
78
|
+
ok('B1 with no host the popover says what is needed and asks for the address in place, with no Publish button', /needs a board host/.test(await pop(s.p).textContent()) && await s.p.locator('#bpHost').isVisible() && (await pop(s.p).locator('[data-bp="make"]').count()) === 0);
|
|
79
|
+
W.settingsAnswer = { ok: false, error: 'Use an https address with no path, such as https://boards.example.com.' };
|
|
80
|
+
await s.p.fill('#bpHost', 'http://example.com'); await s.p.click('[data-bp="savehost"]'); await s.p.waitForSelector('.bperr');
|
|
81
|
+
ok('B2 a refused address shows the sentence and keeps what was typed', /https address/.test(await s.p.locator('.bperr').textContent()) && (await s.p.inputValue('#bpHost')) === 'http://example.com');
|
|
82
|
+
W.settingsAnswer = null; W.host = 'boards.test';
|
|
83
|
+
await s.p.fill('#bpHost', 'https://boards.test'); await s.p.click('[data-bp="savehost"]'); await s.p.waitForSelector('[data-bp="make"]', { timeout: 5000 });
|
|
84
|
+
ok('B3 a saved address is sent to the host route and the form shows', W.settings.some((x) => x.key === 'boards.host' && x.value === 'https://boards.test'));
|
|
85
|
+
await s.p.click('[data-bp="changehost"]'); await s.p.waitForSelector('#bpHost');
|
|
86
|
+
ok('B4 the Change button on the form asks for the address again', (await pop(s.p).locator('[data-bp="make"]').count()) === 0);
|
|
87
|
+
await s.ctx.close();
|
|
88
|
+
|
|
89
|
+
console.log('C the form');
|
|
90
|
+
W.links = []; W.host = 'boards.test'; W.posts = [];
|
|
91
|
+
s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#bdPublish'); await s.p.waitForSelector('[data-bp="make"]');
|
|
92
|
+
ok('C1 the board\'s product is picked, its programs are offered, and the note names the host and what leaves', (await s.p.locator('[data-bp-sel="product:idpf"]').getAttribute('aria-pressed')) === 'true' && (await s.p.locator('[data-bp-sel="program:project-ascent"]').getAttribute('aria-pressed')) === 'false' && /boards\.test/.test(await s.p.locator('.bpnote').first().textContent()) && /titles, stages, dates, owners and task names/.test(await pop(s.p).textContent()));
|
|
93
|
+
ok('C2 the password is on with a generated one, and Ends is 7 days', (await s.p.locator('[data-bp="pw"]').getAttribute('aria-checked')) === 'true' && (await s.p.inputValue('#bpPass')) === 'harbor-lime-47' && (await s.p.locator('[data-bp-days="7"]').getAttribute('aria-pressed')) === 'true');
|
|
94
|
+
await s.p.click('[data-bp-sel="product:idpf"]');
|
|
95
|
+
ok('C3 with nothing picked Publish cannot be pressed', await s.p.locator('[data-bp="make"]').isDisabled());
|
|
96
|
+
await s.p.click('[data-bp="ini"]'); const first = await s.p.locator('[data-bp-add]').first().getAttribute('data-bp-add'); await s.p.click('[data-bp-add]');
|
|
97
|
+
ok('C4 the initiative picker adds a chip for the initiative picked', (await s.p.locator('[data-bp-sel="initiative:' + first + '"]').getAttribute('aria-pressed')) === 'true' && !(await s.p.locator('.bpmenu').count()));
|
|
98
|
+
await s.p.click('[data-bp="pw"]');
|
|
99
|
+
ok('C5 turning the password off removes its field', (await s.p.locator('#bpPass').count()) === 0 && (await s.p.locator('[data-bp="pw"]').getAttribute('aria-checked')) === 'false');
|
|
100
|
+
await s.p.click('[data-bp="pw"]'); await s.p.click('[data-bp="newpw"]');
|
|
101
|
+
ok('C6 New asks for another generated password', (await s.p.inputValue('#bpPass')).length > 0);
|
|
102
|
+
|
|
103
|
+
console.log('D publish');
|
|
104
|
+
await s.p.click('[data-bp-sel="program:project-ascent"]'); await s.p.fill('#bpTeam', 'Product'); await s.p.click('[data-bp-days="30"]'); await s.p.fill('#bpPass', 'my-own-password-1');
|
|
105
|
+
await s.p.click('[data-bp="make"]'); await s.p.waitForSelector('[data-bp="copy"]');
|
|
106
|
+
const sent = W.posts[0] && W.posts[0].body;
|
|
107
|
+
ok('D1 a press sends what was picked, the team, the typed password and the days', sent && sent.ws === 'idpf' && sent.team === 'Product' && sent.password === 'my-own-password-1' && sent.days === 30 && sent.select.some((x) => x.kind === 'program' && x.id === 'project-ascent') && sent.select.some((x) => x.kind === 'initiative' && x.id === first), JSON.stringify(sent));
|
|
108
|
+
const t = await pop(s.p).textContent();
|
|
109
|
+
ok('D2 the link is ready: the link, the password once, one Copy button, and the note says it is shown once', /boards\.test\/b\/link00000003/.test(t) && /my-own-password-1/.test(t) && /Copy link and password/.test(t) && /only time it is shown/.test(t) && /for the Product team/.test(t));
|
|
110
|
+
await s.ctx.grantPermissions(['clipboard-read', 'clipboard-write']).catch(() => {});
|
|
111
|
+
await s.p.click('[data-bp="copy"]'); await s.p.waitForTimeout(300);
|
|
112
|
+
ok('D3 Copy says it copied (or says how to copy by hand)', /Copied|Select the text/.test(await s.p.locator('.bpok').textContent()));
|
|
113
|
+
await s.p.click('[data-bp="done"]'); await s.p.waitForSelector('[data-bp="make"]');
|
|
114
|
+
ok('D4 Done returns to the form with a new generated password', (await s.p.locator('#bpPass').count()) === 1);
|
|
115
|
+
await s.p.click('[data-bp="pw"]'); await s.p.click('[data-bp="make"]'); await s.p.waitForSelector('[data-bp="copy"]');
|
|
116
|
+
ok('D5 with the password off the request carries none, and the page shows only the link', W.posts[W.posts.length - 1].body.password === '' && !/Copy link and password/.test(await pop(s.p).textContent()) && /Copy link/.test(await pop(s.p).textContent()));
|
|
117
|
+
await s.ctx.close();
|
|
118
|
+
|
|
119
|
+
console.log('E problems');
|
|
120
|
+
W.links = []; s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#bdPublish'); await s.p.waitForSelector('[data-bp="make"]');
|
|
121
|
+
W.publish = { status: 422, body: { ok: false, error: 'This board holds what looks like a secret (aws-access-key). Remove it, then publish again.', secrets: ['aws-access-key'] } };
|
|
122
|
+
await s.p.fill('#bpTeam', 'Product'); await s.p.click('[data-bp="make"]'); await s.p.waitForSelector('.bperr');
|
|
123
|
+
ok('E1 a refusal shows the plain sentence and the form stays filled', /aws-access-key/.test(await s.p.locator('.bperr').textContent()) && (await s.p.inputValue('#bpTeam')) === 'Product' && await s.p.locator('[data-bp-sel="product:idpf"]').isVisible());
|
|
124
|
+
W.publish = { status: 429, body: { ok: false, error: 'You have 20 open links. Turn one off first.' } };
|
|
125
|
+
await s.p.click('[data-bp="make"]'); await s.p.waitForFunction(() => /20 open links/.test((document.querySelector('.bperr') || {}).textContent || ''));
|
|
126
|
+
ok('E2 a limit from the host is shown as the host said it', true);
|
|
127
|
+
W.publish = null; await s.ctx.close();
|
|
128
|
+
|
|
129
|
+
console.log('F open links');
|
|
130
|
+
W.links = LINKS.map((l) => Object.assign({}, l)); W.posts = [];
|
|
131
|
+
s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#bdPublish'); await s.p.waitForSelector('[data-bp-re]');
|
|
132
|
+
ok('F1 the open links are listed under the form, each with when it ends and its views', (await s.p.locator('.bprow').count()) === 2 && /Open links · 2/.test(await pop(s.p).textContent()) && /3 views/.test(await pop(s.p).textContent()));
|
|
133
|
+
ok('F2 a link that ends within a day and a half shows its date in the warning style', (await s.p.locator('.bprow em.soon').count()) === 1);
|
|
134
|
+
await s.p.locator('[data-bp-re]').first().click(); await s.p.waitForTimeout(400);
|
|
135
|
+
ok('F3 Republish sends the link\'s id', W.posts.some((x) => /republish$/.test(x.p) && x.body.id === LINKS[0].id), JSON.stringify(W.posts));
|
|
136
|
+
await s.p.locator('[data-bp-off]').first().click();
|
|
137
|
+
ok('F4 the first Turn off press only asks "Sure?" and sends nothing', /Sure\? Turn off/.test(await s.p.locator('[data-bp-off]').first().textContent()) && !W.posts.some((x) => /off$/.test(x.p)));
|
|
138
|
+
await s.p.locator('[data-bp-off]').first().click(); await s.p.waitForTimeout(400);
|
|
139
|
+
ok('F5 the second press turns it off and the row goes', W.posts.some((x) => /off$/.test(x.p) && x.body.id === LINKS[0].id) && (await s.p.locator('.bprow').count()) === 1);
|
|
140
|
+
await s.ctx.close();
|
|
141
|
+
|
|
142
|
+
console.log('G a phone');
|
|
143
|
+
W.links = []; s = await open(390, 844, '/premium-board.html?ws=idpf&board=idpf');
|
|
144
|
+
ok('G0 the toolbar button is not drawn on a phone (the toolbar has no room); the sheet is what a narrow window shows', await s.p.locator('#bdPublish').isHidden());
|
|
145
|
+
await s.p.evaluate(() => import('/pm/bd-publish.js').then((M) => M.open(document.querySelector('#bdPublish'), { ws: 'idpf', board: 'idpf' }))); await s.p.waitForSelector('[data-bp="make"]');
|
|
146
|
+
const box = await pop(s.p).evaluate((e) => { const r = e.getBoundingClientRect(); return { l: r.left, r: r.right, b: r.bottom, w: innerWidth, h: innerHeight, side: document.documentElement.scrollWidth > innerWidth + 1 }; });
|
|
147
|
+
ok('G1 the popover is a sheet at the bottom of the screen, the screen\'s width, with no sideways scroll', box.l === 0 && Math.round(box.r) === box.w && Math.round(box.b) === box.h && !box.side, JSON.stringify(box));
|
|
148
|
+
const small = await pop(s.p).locator('button:visible, input:visible').evaluateAll((els) => els.filter((e) => e.getBoundingClientRect().height < 34 && !e.matches('input[type=hidden]')).map((e) => e.className + ':' + Math.round(e.getBoundingClientRect().height)));
|
|
149
|
+
ok('G2 every control on the phone is at least 34 px high', small.length === 0, small.join(' '));
|
|
150
|
+
await s.ctx.close();
|
|
151
|
+
|
|
152
|
+
console.log('H closing');
|
|
153
|
+
W.links = []; s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#bdPublish'); await s.p.waitForSelector('[data-bp="make"]');
|
|
154
|
+
await s.p.keyboard.press('Escape'); await s.p.waitForTimeout(200);
|
|
155
|
+
ok('H1 Escape closes it and puts the focus back on the button', (await pop(s.p).count()) === 0 && (await s.p.evaluate(() => document.activeElement && document.activeElement.id)) === 'bdPublish');
|
|
156
|
+
await s.p.click('#bdPublish'); await s.p.waitForSelector('[data-bp="make"]'); await s.p.mouse.click(5, 400); await s.p.waitForTimeout(200);
|
|
157
|
+
ok('H2 a press outside closes it', (await pop(s.p).count()) === 0);
|
|
158
|
+
ok('H3 no page error in any section', s.errs.length === 0, s.errs.join(' | '));
|
|
159
|
+
await s.ctx.close();
|
|
160
|
+
await finish(browser);
|
|
161
|
+
})();
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.470.0",
|
|
4
|
+
"at": "2026-10-31T12:11:04.375Z",
|
|
5
|
+
"f": 3,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1123,
|
|
9
|
+
"t": "The Publish popover on the Board (board-publish slice 2, page side)",
|
|
10
|
+
"s": "The Publish popover on the Board (board-publish slice 2, page side)",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.469.0",
|
|
17
|
+
"at": "2026-10-31T10:43:44.457Z",
|
|
18
|
+
"f": 3,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1122,
|
|
22
|
+
"t": "Build and upload the Board's code for the host (board-publish slice 3, H6)",
|
|
23
|
+
"s": "Build and upload the Board's code for the host (board-publish slice 3, H6)",
|
|
24
|
+
"k": "new"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.468.0",
|
|
4
30
|
"at": "2026-10-31T09:41:17.517Z",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Published board: a read-only copy of a Board"
|
|
4
|
-
description: "What a published board is, what a reader sees and cannot do, and how to preview one
|
|
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
5
|
timestamp: 2026-10-31
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -9,13 +9,37 @@ timestamp: 2026-10-31
|
|
|
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 read-only Board and the **data pack** that feeds it. The
|
|
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. Teams and the Shared view come in a later version.
|
|
13
|
+
|
|
14
|
+
## Publish a board
|
|
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.
|
|
17
|
+
|
|
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
|
+
|
|
20
|
+
1. **Set the host.** The first time, the popover asks for the address of the board host. Ask the person who runs it. Write it as `https://boards.example.com`. The **Change** button on the form sets it again. If the computer has the `PMOS_BOARDS_HOST` variable, the variable is used.
|
|
21
|
+
2. **What to share.** The product of this board is picked. Press a program to add it. Press **An initiative** to pick one initiative. Press a picked chip again to remove it. **Publish** stays off while nothing is picked.
|
|
22
|
+
3. **Team.** Type the name of a team, or leave it empty. The host tells you when there is no team with that name.
|
|
23
|
+
4. **Password.** It is on, with a password that PMOS made. Press **New** for another one, or write your own. Turn the switch off for a link with no password.
|
|
24
|
+
5. **Ends.** The link ends after 1, 7 or 30 days.
|
|
25
|
+
6. **Publish.** PMOS looks for a key or a token in the copy first. If it finds one, nothing is sent. The message names the kind of secret and never shows it. Then PMOS sends the copy to the host.
|
|
26
|
+
|
|
27
|
+
When the link is ready, the popover shows the link and the password. Press **Copy link and password**. PMOS does not keep the password. This is the only time it is shown. Send the password in a different message. Press **Done** to publish another copy.
|
|
28
|
+
|
|
29
|
+
The copy holds the titles, stages, dates, owners and task names of what you picked. The host can read them.
|
|
30
|
+
|
|
31
|
+
Under the form, **Open links** lists each link that has not ended. It shows the team, the end date and the number of views. A link that ends within a day and a half shows its date in red.
|
|
32
|
+
|
|
33
|
+
- **Republish** makes the copy again from today's board. The link and the password stay the same.
|
|
34
|
+
- **Turn off** asks you to press a second time. Then the host deletes the copy at once.
|
|
35
|
+
|
|
36
|
+
Only you can publish, republish or turn off a link, with a press on the page. An agent session cannot.
|
|
13
37
|
|
|
14
38
|
## What a reader sees
|
|
15
39
|
|
|
16
40
|
- The Timeline, as you see it in the workspace. It opens on today.
|
|
17
41
|
- The span picker, the Deliveries lane, and the folds of a program and a product.
|
|
18
|
-
- One line above the Board. It names the selection, the date of the copy, who shared it and when the link ends.
|
|
42
|
+
- One line above the Board. It names the selection, the date of the copy, who shared it and when the link ends.
|
|
19
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.
|
|
20
44
|
- The panel divider and the panel layout: full screen, split or slide over.
|
|
21
45
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* board-publish-choices.js — what can be published from a board (initiative board-publish, slice 2, page side; PRD P1): its product, the programs that hold
|
|
3
|
+
* one of its initiatives, and its initiatives. Read from the Board's own routes, the way lib/board-pack-route.js reads them.
|
|
4
|
+
* choicesOf(req, ctx, ws, board) -> { products, programs, initiatives } | null while the board is still being read */
|
|
5
|
+
const BoardPremium = require('./routes-board-premium.js');
|
|
6
|
+
const Programs = require('./routes-programs.js');
|
|
7
|
+
|
|
8
|
+
/** GET `pathAndQuery` from a route module's own handler and return its body. */
|
|
9
|
+
async function via(mod, pathAndQuery, req, ctx) {
|
|
10
|
+
let out = null;
|
|
11
|
+
const c = Object.assign({}, ctx, { json: (res, obj) => { out = obj; } });
|
|
12
|
+
const handled = await mod.handle({ method: 'GET', headers: (req && req.headers) || {} }, {}, new URL('http://local' + pathAndQuery), c);
|
|
13
|
+
return handled === false ? null : out;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async function choicesOf(req, ctx, ws, board) {
|
|
17
|
+
const b = await via(BoardPremium, '/api/board-premium?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(board), req, ctx);
|
|
18
|
+
if (!b || b.ok === false || !b.model) return null;
|
|
19
|
+
const rows = (b.model.rows || []).filter((r) => r && r.id); const have = new Set(rows.map((r) => r.id));
|
|
20
|
+
const pg = await via(Programs, '/api/programs', req, ctx);
|
|
21
|
+
const programs = ((pg && pg.programs) || []).filter((p) => p && p.id && (p.members || []).some((m) => m && m.ws === ws && have.has(m.initiative))).map((p) => ({ id: p.id, label: p.title || p.id }));
|
|
22
|
+
return { products: [{ id: board, label: (b.model.board && b.model.board.name) || board }], programs, initiatives: rows.map((r) => ({ id: r.id, label: r.title || r.id })) };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = { choicesOf };
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* 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
15
|
* password is NOT kept: it is shown once at publish. Republish keeps the same link and password (the host owns it).
|
|
16
16
|
*
|
|
17
|
-
* THE HOST ADDRESS comes from PMOS_BOARDS_HOST (an https origin; plain http only for 127.0.0.1 and localhost, for tests)
|
|
17
|
+
* THE HOST ADDRESS comes from PMOS_BOARDS_HOST (an https origin; plain http only for 127.0.0.1 and localhost, for tests), else from the address the PM saved on the
|
|
18
|
+
* Publish popover (state.json host). Neither set, nothing is sent.
|
|
18
19
|
*
|
|
19
20
|
* hostOrigin(env) -> string | null
|
|
20
21
|
* readState(dir) · links(dir) -> the state | the links newest first (ended ones dropped)
|
|
@@ -45,9 +46,21 @@ function hostOrigin(env = process.env) {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
function readState(dir) {
|
|
48
|
-
try { const s = JSON.parse(fs.readFileSync(fileOf(dir), 'utf8')); return { key: typeof s.key === 'string' ? s.key : null, links: Array.isArray(s.links) ? s.links : [] }; }
|
|
49
|
-
catch { return { key: null, links: [] }; }
|
|
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: [] }; }
|
|
50
51
|
}
|
|
52
|
+
/** The address the PM saved on the Publish popover ('' when none). The environment variable PMOS_BOARDS_HOST wins over it (see addressOf). */
|
|
53
|
+
function savedHost(dir) { return readState(dir).host || ''; }
|
|
54
|
+
/** Save the host address: '' clears it. Returns { ok, host } or { ok: false, error } with a sentence for the PM. */
|
|
55
|
+
function setHost(dir, value) {
|
|
56
|
+
const v = String(value == null ? '' : value).trim();
|
|
57
|
+
if (v === '') { const st = readState(dir); st.host = ''; writeState(dir, st); return { ok: true, host: '' }; }
|
|
58
|
+
const o = hostOrigin({ PMOS_BOARDS_HOST: v });
|
|
59
|
+
if (!o) return { ok: false, error: 'Use an https address with no path, such as https://boards.example.com.' };
|
|
60
|
+
const st = readState(dir); st.host = o; writeState(dir, st); return { ok: true, host: o };
|
|
61
|
+
}
|
|
62
|
+
/** The environment variables a call reads: the variable wins, then the saved address. */
|
|
63
|
+
const addressOf = (dir, env = process.env) => ({ PMOS_BOARDS_HOST: (env && env.PMOS_BOARDS_HOST) || savedHost(dir) });
|
|
51
64
|
function writeState(dir, st) {
|
|
52
65
|
const f = fileOf(dir);
|
|
53
66
|
fs.mkdirSync(path.dirname(f), { recursive: true, mode: 0o700 });
|
|
@@ -134,4 +147,4 @@ async function turnOff(dir, id, opts = {}) {
|
|
|
134
147
|
return { ok: true };
|
|
135
148
|
}
|
|
136
149
|
|
|
137
|
-
module.exports = { DAYS, TEAM_RX, MAX_PACK, hostOrigin, readState, links, publish, republish, turnOff };
|
|
150
|
+
module.exports = { DAYS, TEAM_RX, MAX_PACK, hostOrigin, savedHost, setHost, addressOf, readState, links, publish, republish, turnOff };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* POST /api/board-publish { ws, board, select, team, password, days, shared_by } -> { ok, id, url, ends }
|
|
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
|
+
* POST /api/board-publish/host { host } -> { ok, host } save the host address ('' clears it); PMOS_BOARDS_HOST wins over it
|
|
8
9
|
*
|
|
9
10
|
* 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).
|
|
10
11
|
* 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,14 +19,23 @@ const Host = require('./boards-host.js');
|
|
|
18
19
|
const shareStore = require('./share-store.js');
|
|
19
20
|
const secretScan = require('./secret-scan.js');
|
|
20
21
|
|
|
21
|
-
const
|
|
22
|
-
|
|
22
|
+
const PUBLIC = path.join(__dirname, '..', 'public');
|
|
23
|
+
let versionMemo = null;
|
|
24
|
+
/** The Board's version for a pack: the host serves the Board's code under it (PRD H6, immutable for a year), so it must change when ANY file the Board loads
|
|
25
|
+
* changes. It is a hash of the page and every file under public/pm, public/vendor and public/icons. Computed once per server run. */
|
|
23
26
|
function viewerVersion() {
|
|
27
|
+
if (versionMemo) return versionMemo;
|
|
24
28
|
try {
|
|
25
29
|
const h = crypto.createHash('sha256');
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
const walk = (d, rel) => fs.readdirSync(d, { withFileTypes: true }).sort((a, b) => (a.name < b.name ? -1 : 1)).forEach((e) => {
|
|
31
|
+
const r = rel + '/' + e.name; if (e.isDirectory()) return walk(path.join(d, e.name), r);
|
|
32
|
+
if (e.isFile()) { h.update(r + '\0'); h.update(fs.readFileSync(path.join(d, e.name))); }
|
|
33
|
+
});
|
|
34
|
+
h.update('premium-board.html\0'); h.update(fs.readFileSync(path.join(PUBLIC, 'premium-board.html')));
|
|
35
|
+
for (const dir of ['pm', 'vendor', 'icons']) { try { walk(path.join(PUBLIC, dir), '/' + dir); } catch { /* a folder this checkout does not have */ } }
|
|
36
|
+
versionMemo = 'v' + h.digest('hex').slice(0, 12);
|
|
37
|
+
} catch { versionMemo = 'v0'; }
|
|
38
|
+
return versionMemo;
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
/** The data pack of a selection, from the Board's own route. { ok, pack } | { ok: false, status, error } */
|
|
@@ -40,21 +50,35 @@ async function makePack(req, ctx, q) {
|
|
|
40
50
|
return { ok: true, pack: out.body.pack };
|
|
41
51
|
}
|
|
42
52
|
|
|
53
|
+
let byMemo = null;
|
|
54
|
+
/** The name shown as "shared by": PMOS_PM_NAME, else git's user.name on this computer, else the account name. The PM does not type it. */
|
|
55
|
+
function sharedBy() {
|
|
56
|
+
if (byMemo !== null) return byMemo;
|
|
57
|
+
let n = String(process.env.PMOS_PM_NAME || '').trim();
|
|
58
|
+
if (!n) { try { const r = require('child_process').spawnSync('git', ['config', '--global', 'user.name'], { encoding: 'utf8', timeout: 3000 }); n = String(r.stdout || '').trim(); } catch { /* none */ } }
|
|
59
|
+
if (!n) { try { n = require('os').userInfo().username; } catch { n = ''; } }
|
|
60
|
+
return (byMemo = n.slice(0, 60));
|
|
61
|
+
}
|
|
62
|
+
|
|
43
63
|
const kindOf = (pack) => (pack && pack.scope && pack.scope.kind) || 'multi';
|
|
44
64
|
const stateDir = (ctx) => ctx.runtimeDir;
|
|
45
65
|
|
|
46
66
|
module.exports = {
|
|
67
|
+
viewerVersion,
|
|
47
68
|
prefixes: ['/api/board-publish'],
|
|
48
69
|
handle: async (req, res, url, ctx) => {
|
|
49
70
|
const p = url.pathname;
|
|
50
|
-
if (p !== '/api/board-publish' && p !== '/api/board-publish/republish' && p !== '/api/board-publish/off') return false;
|
|
71
|
+
if (p !== '/api/board-publish' && p !== '/api/board-publish/republish' && p !== '/api/board-publish/off' && p !== '/api/board-publish/host') return false;
|
|
51
72
|
const send = (obj, code) => { ctx.json(res, obj, code); return true; };
|
|
52
73
|
const dir = stateDir(ctx);
|
|
53
74
|
if (!dir) return send({ ok: false, error: 'No state folder.' }, 500);
|
|
54
75
|
|
|
76
|
+
const env = Host.addressOf(dir); // the environment variable wins, so a computer set up by hand keeps working; else the address saved on the popover
|
|
55
77
|
if (req.method === 'GET' && p === '/api/board-publish') {
|
|
56
|
-
const origin = Host.hostOrigin();
|
|
57
|
-
|
|
78
|
+
const origin = Host.hostOrigin(env);
|
|
79
|
+
const ws = url.searchParams.get('ws'); let choices = null;
|
|
80
|
+
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 })) });
|
|
58
82
|
}
|
|
59
83
|
if (req.method !== 'POST') return send({ ok: false, error: 'GET or POST only' }, 405);
|
|
60
84
|
|
|
@@ -65,8 +89,12 @@ module.exports = {
|
|
|
65
89
|
// 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.
|
|
66
90
|
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);
|
|
67
91
|
|
|
92
|
+
if (p === '/api/board-publish/host') { // the address of the host, saved from the popover: a page press like the rest
|
|
93
|
+
const r = Host.setHost(dir, body.host);
|
|
94
|
+
return send(r.ok ? { ok: true, host: r.host } : { ok: false, error: r.error }, r.ok ? 200 : 400);
|
|
95
|
+
}
|
|
68
96
|
if (p === '/api/board-publish/off') {
|
|
69
|
-
const r = await Host.turnOff(dir, String(body.id || ''));
|
|
97
|
+
const r = await Host.turnOff(dir, String(body.id || ''), { env });
|
|
70
98
|
return send(r.ok ? { ok: true } : { ok: false, error: r.error }, r.ok ? 200 : (r.status || 502));
|
|
71
99
|
}
|
|
72
100
|
|
|
@@ -81,7 +109,7 @@ module.exports = {
|
|
|
81
109
|
} else {
|
|
82
110
|
const days = Number(body.days);
|
|
83
111
|
if (!Host.DAYS.includes(days)) return send({ ok: false, error: 'Ends in 1, 7 or 30 days.' }, 400);
|
|
84
|
-
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), ends: new Date(now + days * 86400000).toISOString() };
|
|
112
|
+
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() };
|
|
85
113
|
}
|
|
86
114
|
const pk = await makePack(req, ctx, Object.assign({}, sel, { at: new Date(now).toISOString(), viewer: viewerVersion() }));
|
|
87
115
|
if (!pk.ok) return send({ ok: false, error: pk.error }, pk.status || 502);
|
|
@@ -89,11 +117,11 @@ module.exports = {
|
|
|
89
117
|
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);
|
|
90
118
|
|
|
91
119
|
if (p === '/api/board-publish/republish') {
|
|
92
|
-
const r = await Host.republish(dir, meta.id, pk.pack);
|
|
120
|
+
const r = await Host.republish(dir, meta.id, pk.pack, { env });
|
|
93
121
|
return send(r.ok ? { ok: true, ends: r.ends } : { ok: false, error: r.error }, r.ok ? 200 : (r.status || 502));
|
|
94
122
|
}
|
|
95
123
|
const selection = Array.isArray(body.select) ? body.select.map((s) => ({ kind: String(s.kind), id: String(s.id) })) : String(body.select || '').split(',').filter(Boolean).map((s) => ({ kind: s.slice(0, s.indexOf(':')), id: s.slice(s.indexOf(':') + 1) }));
|
|
96
|
-
const r = await Host.publish(dir, { pack: pk.pack, team: body.team, name: pk.pack.scope.label, kind: kindOf(pk.pack), by: sel.by, days: Number(body.days), password: body.password == null ? '' : body.password, selection, ws: sel.ws, board: sel.board });
|
|
124
|
+
const r = await Host.publish(dir, { pack: pk.pack, team: body.team, name: pk.pack.scope.label, kind: kindOf(pk.pack), by: sel.by, days: Number(body.days), password: body.password == null ? '' : body.password, selection, ws: sel.ws, board: sel.board }, { env });
|
|
97
125
|
return send(r.ok ? { ok: true, id: r.id, url: r.url, ends: r.ends } : { ok: false, error: r.error }, r.ok ? 200 : (r.status || 502));
|
|
98
126
|
},
|
|
99
127
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.470.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.470.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* pm/bd-publish.css — the Publish popover (pm/bd-publish.js). It looks like the viewer's share popover (premium-vw-doc.css .vwshp): the same card, rows,
|
|
2
|
+
* switch, segmented control and Open links list. A bottom sheet on a phone. Design: prototype/board-publish/publish-popover-design.html. */
|
|
3
|
+
.bppop{position:absolute;right:0;top:calc(100% + 6px);z-index:30;width:360px;max-width:min(360px,calc(100vw - 32px));max-height:min(80vh,640px);overflow:auto;padding:8px;border-radius:12px;background:var(--card-solid);border:1px solid var(--hair);box-shadow:0 10px 30px rgb(0 0 0 / .14);color:var(--ink);font:inherit;text-align:left}
|
|
4
|
+
.bppop .i{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;color:var(--ink-3)}
|
|
5
|
+
.bppop .bpeye{font:500 11px var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3);padding:8px 8px 2px}
|
|
6
|
+
.bppop .bpchips{display:flex;flex-wrap:wrap;gap:6px;padding:2px 8px 6px}
|
|
7
|
+
.bppop .bpchip{display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:0 12px;border-radius:99px;border:1px solid var(--hair);background:var(--card-solid);color:inherit;font:inherit;cursor:pointer}
|
|
8
|
+
.bppop .bpchip small{font:500 11px var(--mono);color:var(--ink-3)}
|
|
9
|
+
.bppop .bpchip[aria-pressed="true"]{border-color:var(--solid);color:var(--solid);font-weight:600;background:color-mix(in srgb,var(--solid) 10%,transparent)}
|
|
10
|
+
.bppop .bpchip.add{border-style:dashed}
|
|
11
|
+
.bppop .bpmenu{display:grid;margin:0 8px 6px;border:1px solid var(--hair);border-radius:8px;max-height:180px;overflow:auto}
|
|
12
|
+
.bppop .bpmenu button{min-height:40px;padding:0 12px;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
|
|
13
|
+
.bppop .bpmenu button:hover{background:color-mix(in srgb, var(--ink) 6%, transparent)}
|
|
14
|
+
.bppop .bpfield{display:grid;gap:2px;padding:2px 8px}.bppop .bpfield>label{font-size:12px;color:var(--ink-3)}
|
|
15
|
+
.bppop .bpinp,.bppop .bpinp2{min-height:40px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid);color:inherit;font:inherit}
|
|
16
|
+
.bppop .bpinp{padding:0 12px;width:100%}
|
|
17
|
+
.bppop .bpinp2{display:flex;align-items:center;gap:8px;padding:0 6px 0 12px}.bppop .bpinp2 input{flex:1;min-width:0;border:0;background:transparent;color:inherit;font:500 12px var(--mono);outline:0;min-height:38px}
|
|
18
|
+
.bppop .bpline2{display:flex;align-items:center;gap:10px;min-height:40px;padding:2px 8px}.bppop .bpg{flex:1;min-width:0}
|
|
19
|
+
.bppop .bpsw{width:48px;height:40px;border:0;background:transparent;position:relative;cursor:pointer;flex:none;padding:0}
|
|
20
|
+
.bppop .bpsw::before{content:"";position:absolute;left:6px;top:9px;width:36px;height:22px;border-radius:99px;background:var(--hair)}
|
|
21
|
+
.bppop .bpsw::after{content:"";position:absolute;left:9px;top:12px;width:16px;height:16px;border-radius:50%;background:var(--card-solid)}
|
|
22
|
+
.bppop .bpsw[aria-checked="true"]::before{background:var(--solid)}.bppop .bpsw[aria-checked="true"]::after{left:auto;right:9px}
|
|
23
|
+
.bppop .bpseg{display:inline-flex;border:1px solid var(--hair);border-radius:8px;overflow:hidden}
|
|
24
|
+
.bppop .bpseg button{border:0;background:transparent;color:var(--ink-2);min-height:36px;padding:0 12px;font:inherit;cursor:pointer}
|
|
25
|
+
.bppop .bpseg button[aria-pressed="true"]{background:color-mix(in srgb, var(--ink) 6%, transparent);color:inherit;font-weight:600}
|
|
26
|
+
.bppop .bpbtn{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:0 14px;border-radius:8px;border:1px solid var(--hair);background:var(--card-solid);color:inherit;font:600 14px inherit;font-family:inherit;cursor:pointer;text-decoration:none}
|
|
27
|
+
.bppop .bpbtn.pri{background:var(--solid);border-color:var(--solid);color:var(--on-solid)}
|
|
28
|
+
.bppop .bpbtn.sm{min-height:34px;padding:0 10px;font-size:12px}
|
|
29
|
+
.bppop .bpbtn.bad{color:var(--bad)}.bppop .bpbtn.bad.sure{background:color-mix(in srgb,var(--bad) 12%,transparent)}
|
|
30
|
+
.bppop .bpbtn:disabled{opacity:.55;cursor:default}
|
|
31
|
+
.bppop .bpgo{margin:6px 8px 2px;width:calc(100% - 16px)}
|
|
32
|
+
.bppop .bpnote{color:var(--ink-3);font-size:12px;padding:4px 8px;margin:0}
|
|
33
|
+
.bppop .bperr{margin:4px 8px;padding:8px 10px;border-radius:8px;background:color-mix(in srgb,var(--bad) 12%,transparent);color:var(--bad);font-size:14px}
|
|
34
|
+
.bppop .bplink{display:inline-flex;align-items:center;border:0;background:transparent;color:var(--solid);font:inherit;text-decoration:underline;cursor:pointer;padding:0 8px;min-height:36px}
|
|
35
|
+
.bppop .bpsep{height:1px;background:var(--hair);margin:8px 0 2px}
|
|
36
|
+
.bppop .bplnk{margin:2px 8px;padding:10px 12px;border-radius:8px;background:color-mix(in srgb, var(--ink) 6%, transparent);display:grid;gap:8px}
|
|
37
|
+
.bppop .bpline{display:flex;align-items:center;gap:8px}.bppop .bplnk code{font:500 12px var(--mono);overflow-wrap:anywhere}
|
|
38
|
+
.bppop .bpact{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.bppop .bpok{color:var(--ink-2);font-size:14px}
|
|
39
|
+
.bppop .bprow{display:flex;align-items:center;gap:8px;padding:6px 8px}.bppop .bprow .bpg b{display:block;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
40
|
+
.bppop .bprow em{font-style:normal;color:var(--ink-3);font-size:12px}.bppop .bprow em.soon{color:var(--bad)}
|
|
41
|
+
.bppop .bpempty{display:grid;gap:10px;padding:12px 8px 10px;justify-items:start}.bppop .bpempty p{margin:0;color:var(--ink-2)}
|
|
42
|
+
.bppop :focus-visible{outline:2px solid var(--ember);outline-offset:2px}
|
|
43
|
+
#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
|
+
@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)}}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/* pm/bd-publish.js — the Publish popover on the Board (initiative board-publish, slice 2, page side; planning/prd/board-publish-prd.md P1 to P5; D103).
|
|
2
|
+
* Design: prototype/board-publish/publish-popover-design.html (PM approved 2026-10-31). It makes a read-only copy of part of the Board and puts it on
|
|
3
|
+
* the team's host through POST /api/board-publish, which is a page press: only a press here publishes, never an agent session.
|
|
4
|
+
*
|
|
5
|
+
* What to share chips: this board's product, the programs that hold one of its initiatives, and any initiatives (the picker)
|
|
6
|
+
* Team optional, typed; the host says when there is no such team (slice 4 turns it into the list of joined teams)
|
|
7
|
+
* Password on by default with a generated one (GET /api/board-publish), the PM can change it or turn it off
|
|
8
|
+
* Ends 1, 7 or 30 days
|
|
9
|
+
* Link ready the link and the password, one Copy, shown once (the workspace does not keep the password)
|
|
10
|
+
* Open links only when there are any: Republish (same link, same password) and Turn off (a second press confirms)
|
|
11
|
+
* No host before the host address is set: one sentence and the address field. The note on the form has a Change button to set it again.
|
|
12
|
+
*
|
|
13
|
+
* open(btn, { ws, board }) the popover under the button (a sheet at the bottom on a phone)
|
|
14
|
+
* publishHtml(S) the popover's inside as HTML. Pure. COUNT(links) · refreshCount(btn) */
|
|
15
|
+
import { pmGet, pmPost } from './http.js';
|
|
16
|
+
|
|
17
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
18
|
+
const day = (iso) => { try { return new Date(iso).toLocaleDateString(undefined, { day: 'numeric', month: 'short' }); } catch { return ''; } };
|
|
19
|
+
const svg = (d) => `<svg class="i" viewBox="0 0 24 24" aria-hidden="true">${d}</svg>`;
|
|
20
|
+
const LOCK = svg('<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/>');
|
|
21
|
+
const LINK = svg('<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/>');
|
|
22
|
+
const PLUS = svg('<path d="M12 5v14M5 12h14"/>');
|
|
23
|
+
const SOON_MS = 36 * 3600 * 1000;
|
|
24
|
+
|
|
25
|
+
export const COUNT = (links) => (Array.isArray(links) ? links.length : 0);
|
|
26
|
+
const keyOf = (k, id) => k + ':' + id;
|
|
27
|
+
const chip = (S, kind, c, extra = '') => `<button type="button" class="bpchip" data-bp-sel="${esc(keyOf(kind, c.id))}" aria-pressed="${S.sel.has(keyOf(kind, c.id))}">${esc(c.label)} <small>${extra || kind}</small></button>`;
|
|
28
|
+
|
|
29
|
+
/** The popover's inside. S = { phase, host, days, choices, sel:Set, team, pw, pass, err, busy, made, links, off, iniOpen, copied, now } */
|
|
30
|
+
export function publishHtml(S) {
|
|
31
|
+
if (S.phase === 'loading') return '<p class="bpnote">Reading your board…</p>';
|
|
32
|
+
if (!S.host) {
|
|
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="https://boards.example.com" value="${esc(S.hostIn || '')}"><button type="button" class="bpbtn sm pri" data-bp="savehost">Save</button></div></div>`
|
|
35
|
+
+ (S.err ? `<p class="bperr" role="alert">${esc(S.err)}</p>` : '');
|
|
36
|
+
}
|
|
37
|
+
const list = S.links && S.links.length
|
|
38
|
+
? `<div class="bpsep"></div><div class="bpeye">Open links · ${S.links.length}</div>` + S.links.map((l) => {
|
|
39
|
+
const soon = S.now && l.ends && Date.parse(l.ends) - S.now < SOON_MS;
|
|
40
|
+
return `<div class="bprow">${LOCK}<span class="bpg"><b>${esc(l.name || 'Board')}</b><em${soon ? ' class="soon"' : ''}>${l.team ? esc(l.team) + ' · ' : ''}ends ${esc(day(l.ends))}${l.views ? ' · ' + l.views + (l.views === 1 ? ' view' : ' views') : ''}</em></span>`
|
|
41
|
+
+ `<button type="button" class="bpbtn sm" data-bp-re="${esc(l.id)}"${S.busy ? ' disabled' : ''}>Republish</button>`
|
|
42
|
+
+ `<button type="button" class="bpbtn sm bad${S.off === l.id ? ' sure' : ''}" data-bp-off="${esc(l.id)}">${S.off === l.id ? 'Sure? Turn off' : 'Turn off'}</button></div>`;
|
|
43
|
+
}).join('') : '';
|
|
44
|
+
if (S.made) {
|
|
45
|
+
return `<div class="bpeye">Link ready</div><div class="bplnk"><div class="bpline">${LINK}<code>${esc(S.made.url)}</code></div>`
|
|
46
|
+
+ (S.made.pass ? `<div class="bpline">${LOCK}<code>${esc(S.made.pass)}</code></div>` : '')
|
|
47
|
+
+ `<div class="bpact"><button type="button" class="bpbtn pri" data-bp="copy">${S.made.pass ? 'Copy link and password' : 'Copy link'}</button><span class="bpok" role="status">${esc(S.copied || '')}</span></div></div>`
|
|
48
|
+
+ `<p class="bpnote">${esc(S.made.name)}${S.made.team ? ' · for the ' + esc(S.made.team) + ' team' : ''} · ends ${esc(day(S.made.ends))}.${S.made.pass ? ' Send the password in a different message. This is the only time it is shown.' : ''}</p>`
|
|
49
|
+
+ `<button type="button" class="bpbtn bpgo" data-bp="done">Done</button>` + list;
|
|
50
|
+
}
|
|
51
|
+
const c = S.choices || { products: [], programs: [], initiatives: [] };
|
|
52
|
+
const picked = c.initiatives.filter((i) => S.sel.has(keyOf('initiative', i.id)));
|
|
53
|
+
const chips = c.products.map((p) => chip(S, 'product', p)).join('') + c.programs.map((p) => chip(S, 'program', p)).join('') + picked.map((i) => chip(S, 'initiative', i)).join('')
|
|
54
|
+
+ (c.initiatives.length ? `<button type="button" class="bpchip add" data-bp="ini" aria-expanded="${!!S.iniOpen}">${PLUS}An initiative</button>` : '');
|
|
55
|
+
const menu = S.iniOpen ? `<div class="bpmenu" role="menu">${c.initiatives.filter((i) => !S.sel.has(keyOf('initiative', i.id))).map((i) => `<button type="button" role="menuitem" data-bp-add="${esc(i.id)}">${esc(i.label)}</button>`).join('') || '<p class="bpnote">Every initiative is picked.</p>'}</div>` : '';
|
|
56
|
+
return `<div class="bpeye">What to share</div><div class="bpchips">${chips}</div>${menu}`
|
|
57
|
+
+ `<div class="bpfield"><label for="bpTeam">Team</label><input id="bpTeam" class="bpinp" type="text" maxlength="40" autocomplete="off" placeholder="None" value="${esc(S.team)}"></div>`
|
|
58
|
+
+ `<div class="bpline2">${LOCK}<span class="bpg">Password</span><button type="button" class="bpsw" role="switch" aria-checked="${S.pw}" aria-label="Password" data-bp="pw"></button></div>`
|
|
59
|
+
+ (S.pw ? `<div class="bpfield"><div class="bpinp2"><input id="bpPass" type="text" spellcheck="false" autocomplete="off" aria-label="Password" value="${esc(S.pass)}"><button type="button" class="bpbtn sm" data-bp="newpw">New</button></div></div>` : '')
|
|
60
|
+
+ `<div class="bpline2"><span class="bpg">Ends</span><div class="bpseg" role="group" aria-label="Link ends after">${[1, 7, 30].map((d) => `<button type="button" data-bp-days="${d}" aria-pressed="${S.days === d}">${d === 1 ? '1 day' : d + ' days'}</button>`).join('')}</div></div>`
|
|
61
|
+
+ `<p class="bpnote">Sends a read-only copy of today's board to ${esc(S.host)}. It holds titles, stages, dates, owners and task names. <button type="button" class="bplink" data-bp="changehost">Change</button></p>`
|
|
62
|
+
+ (S.err ? `<p class="bperr" role="alert">${esc(S.err)}</p>` : '')
|
|
63
|
+
+ `<button type="button" class="bpbtn pri bpgo" data-bp="make"${S.busy || !S.sel.size ? ' disabled' : ''}>${S.busy ? 'Publishing…' : 'Publish'}</button>`
|
|
64
|
+
+ (S.busy ? '<p class="bpnote" role="status">Checking for secrets, then sending…</p>' : '') + list;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function css() {
|
|
68
|
+
for (const href of ['/pm/premium-vw-doc.css', '/pm/bd-publish.css']) {
|
|
69
|
+
if (document.querySelector(`link[href="${href}"]`)) continue;
|
|
70
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.appendChild(l);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Show the number of open links on the button, and nothing when there are none (zero is silence). */
|
|
75
|
+
export async function refreshCount(btn) {
|
|
76
|
+
const n = btn && btn.querySelector('.bpn'); if (!n) return;
|
|
77
|
+
const r = await pmGet('/api/board-publish').catch(() => null); const c = r && r.ok ? COUNT(r.links) : 0;
|
|
78
|
+
n.textContent = c ? String(c) : ''; n.hidden = !c;
|
|
79
|
+
btn.setAttribute('aria-label', 'Publish a read-only copy of the board' + (c ? '. ' + c + (c === 1 ? ' open link' : ' open links') : ''));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function open(btn, ctx) {
|
|
83
|
+
const old = document.querySelector('.bppop');
|
|
84
|
+
if (old) { old.remove(); btn.setAttribute('aria-expanded', 'false'); return; }
|
|
85
|
+
css();
|
|
86
|
+
const S = { phase: 'loading', host: null, days: 7, choices: null, sel: new Set(), team: '', pw: true, pass: '', err: '', busy: false, made: null, links: [], off: null, iniOpen: false, copied: '', now: Date.now() };
|
|
87
|
+
const m = document.createElement('div');
|
|
88
|
+
m.className = 'bppop'; m.setAttribute('role', 'dialog'); m.setAttribute('aria-label', 'Publish a read-only copy of the board'); m.dataset.escLayer = '1';
|
|
89
|
+
const close = (focus) => { document.removeEventListener('keydown', onKey, true); document.removeEventListener('pointerdown', onOut, true); m.remove(); btn.setAttribute('aria-expanded', 'false'); if (focus) btn.focus(); };
|
|
90
|
+
const onKey = (e) => { if (e.key === 'Escape' && m.isConnected) { e.stopPropagation(); close(true); } };
|
|
91
|
+
const onOut = (e) => { if (m.isConnected && !m.contains(e.target) && !btn.contains(e.target)) close(false); };
|
|
92
|
+
const draw = (focus) => {
|
|
93
|
+
const keep = { team: m.querySelector('#bpTeam'), pass: m.querySelector('#bpPass'), host: m.querySelector('#bpHost') };
|
|
94
|
+
if (keep.team) S.team = keep.team.value; if (keep.pass) S.pass = keep.pass.value; if (keep.host) S.hostIn = keep.host.value;
|
|
95
|
+
m.innerHTML = publishHtml(S);
|
|
96
|
+
const f = focus && m.querySelector(focus); if (f) f.focus();
|
|
97
|
+
};
|
|
98
|
+
const load = async () => {
|
|
99
|
+
const q = '/api/board-publish?ws=' + encodeURIComponent(ctx.ws) + '&board=' + encodeURIComponent(ctx.board || ctx.ws);
|
|
100
|
+
const r = await pmGet(q).catch(() => null);
|
|
101
|
+
if (!r || !r.ok) { S.phase = 'form'; S.err = (r && r.error) || 'The workspace did not answer. Try again.'; return draw(); }
|
|
102
|
+
S.phase = 'form'; S.host = r.host; S.links = r.links || []; S.choices = r.choices; if (!S.pass) S.pass = r.password || ''; S.now = Date.now();
|
|
103
|
+
if (!S.sel.size && S.choices && S.choices.products[0]) S.sel.add(keyOf('product', S.choices.products[0].id));
|
|
104
|
+
draw(); refreshCount(btn);
|
|
105
|
+
};
|
|
106
|
+
m.onclick = async (e) => {
|
|
107
|
+
e.stopPropagation();
|
|
108
|
+
const b = e.target.closest('button, a'); if (!b) return;
|
|
109
|
+
if (b.dataset.bpSel) { const k = b.dataset.bpSel; if (S.sel.has(k)) S.sel.delete(k); else S.sel.add(k); S.err = ''; return draw(`[data-bp-sel="${CSS.escape(k)}"]`); }
|
|
110
|
+
if (b.dataset.bpDays) { S.days = Number(b.dataset.bpDays); return draw(`[data-bp-days="${S.days}"]`); }
|
|
111
|
+
if (b.dataset.bpAdd) { S.sel.add(keyOf('initiative', b.dataset.bpAdd)); S.iniOpen = false; return draw('[data-bp="ini"]'); }
|
|
112
|
+
const act = b.dataset.bp;
|
|
113
|
+
if (act === 'changehost') { S.host = null; S.hostIn = ''; S.err = ''; return draw('#bpHost'); }
|
|
114
|
+
if (act === 'savehost') {
|
|
115
|
+
const v = ((m.querySelector('#bpHost') || {}).value || '').trim(); S.hostIn = v; S.err = '';
|
|
116
|
+
const r = await pmPost('/api/board-publish/host', { host: v }).catch(() => null);
|
|
117
|
+
if (!r || !r.ok) { S.err = (r && r.error) || 'The address was not saved.'; return draw('#bpHost'); }
|
|
118
|
+
S.phase = 'loading'; draw(); return load();
|
|
119
|
+
}
|
|
120
|
+
if (act === 'ini') { S.iniOpen = !S.iniOpen; return draw('[data-bp="ini"]'); }
|
|
121
|
+
if (act === 'pw') { S.pw = !S.pw; return draw('[data-bp="pw"]'); }
|
|
122
|
+
if (act === 'newpw') { const r = await pmGet('/api/board-publish').catch(() => null); if (r && r.ok) S.pass = r.password; return draw('#bpPass'); }
|
|
123
|
+
if (act === 'done') { S.made = null; S.err = ''; S.copied = ''; S.pass = ''; return load(); }
|
|
124
|
+
if (act === 'copy') {
|
|
125
|
+
const text = S.made.pass ? S.made.url + '\nPassword: ' + S.made.pass : S.made.url;
|
|
126
|
+
try { await navigator.clipboard.writeText(text); S.copied = 'Copied'; } catch { S.copied = 'Select the text and copy it'; }
|
|
127
|
+
return draw('[data-bp="copy"]');
|
|
128
|
+
}
|
|
129
|
+
if (act === 'make') {
|
|
130
|
+
draw(); if (S.busy) return; S.busy = true; S.err = ''; draw();
|
|
131
|
+
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
|
+
S.busy = false;
|
|
134
|
+
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
|
+
S.err = (r && r.error) || 'The workspace did not answer. Try again.'; return draw();
|
|
136
|
+
}
|
|
137
|
+
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.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
|
+
if (b.dataset.bpOff) {
|
|
142
|
+
if (S.off !== b.dataset.bpOff) { S.off = b.dataset.bpOff; return draw(`[data-bp-off="${CSS.escape(S.off)}"]`); }
|
|
143
|
+
const r = await pmPost('/api/board-publish/off', { id: S.off }).catch(() => null);
|
|
144
|
+
if (r && r.ok) S.links = S.links.filter((x) => x.id !== S.off); else S.err = (r && r.error) || 'The link could not be turned off.';
|
|
145
|
+
S.off = null; draw(); return refreshCount(btn);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
btn.parentElement.appendChild(m); btn.setAttribute('aria-expanded', 'true');
|
|
149
|
+
document.addEventListener('keydown', onKey, true); document.addEventListener('pointerdown', onOut, true);
|
|
150
|
+
draw(); load();
|
|
151
|
+
}
|
|
@@ -232,6 +232,7 @@ function drawHead() {
|
|
|
232
232
|
$('#snap').textContent = M.header.text;
|
|
233
233
|
// PMOS-self: new work starts at the pmos-router skill. All products: New asks which product the initiative is for
|
|
234
234
|
$('#newIni').hidden = ALL ? (M.board.products || []).every((p) => p.self) : !!M.board.self;
|
|
235
|
+
{ 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)); }
|
|
235
236
|
setPageGaps(((M.header && M.header.missing) || []).length);
|
|
236
237
|
}
|
|
237
238
|
let jiraReading = false; // a press is reading Jira again: the chip's Adler wears his glasses until the next read of the Board lands
|
|
@@ -845,6 +846,8 @@ $('#bdFilter').addEventListener('click', (e) => Acts.open.filter(e.currentTarget
|
|
|
845
846
|
// and that press opens New initiative at once.
|
|
846
847
|
$('#newIni').addEventListener('click', (e) => { if (e.isTrusted) Asks.openNewMenu(e.currentTarget); else Acts.open.new(e.currentTarget); });
|
|
847
848
|
$('#bdBell').addEventListener('click', (e) => { if (M) Acts.open.bell(e.currentTarget); });
|
|
849
|
+
// 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 })); });
|
|
848
851
|
|
|
849
852
|
/* ── tabs: Initiatives and Documents (Documents has no frame yet: a plain list) ──────────────────────────────────────────────────────── */
|
|
850
853
|
function setTab(t) {
|
|
@@ -27,7 +27,7 @@ export const VIEW_CONTROLS = [
|
|
|
27
27
|
].join(',');
|
|
28
28
|
|
|
29
29
|
/** The Board's static toolbar and chips: hidden, so the page's own script keeps the elements it holds. */
|
|
30
|
-
const HIDE = ['.bd-hd', '.bd-tabs', '#crumbHost', '#ibTabs', '#bdFind', '#bdView', '#bdColsw', '#bdSort', '#bdFilter', '#bdBell', '#newIni', '.tools-top', '#bdGrpw', '#czFab'];
|
|
30
|
+
const HIDE = ['.bd-hd', '.bd-tabs', '#crumbHost', '#ibTabs', '#bdFind', '#bdView', '#bdColsw', '#bdSort', '#bdFilter', '#bdBell', '#bdPublish', '#newIni', '.tools-top', '#bdGrpw', '#czFab'];
|
|
31
31
|
/** Controls the code draws that write, or lead to something a share does not hold: removed. */
|
|
32
32
|
const REMOVE = [
|
|
33
33
|
'#bdChipset > :not(.tg-lgd)', '#askDates', '.tg-ft',
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
<button type="button" class="bd-ib" id="bdSort" data-so-btn aria-haspopup="menu" aria-label="Sort. Now: My order" title="Sort · My order"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 4v16M4 17l3 3 3-3M13 6h8M13 12h6M13 18h4"/></svg></button>
|
|
46
46
|
<button type="button" class="bd-ib" id="bdFilter" aria-label="Filter by owner, kind or sprint" title="Filter by owner, kind or sprint" aria-haspopup="dialog"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5h16l-6 8v6l-4-2v-4z"/></svg></button>
|
|
47
47
|
<button type="button" class="bd-ib bd-hide-s" id="bdBell" aria-label="Notifications" title="Notifications" aria-haspopup="dialog"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 16v-5a6 6 0 0 1 12 0v5l2 2H4zM10 21h4"/></svg></button>
|
|
48
|
+
<button type="button" class="bd-ib bd-hide-s" id="bdPublish" aria-label="Publish a read-only copy of the board" title="Publish a read-only copy" aria-haspopup="dialog" aria-expanded="false" hidden><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 15V4M8 8l4-4 4 4M5 13v5a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-5"/></svg><span class="bpn" hidden></span></button>
|
|
48
49
|
<button type="button" class="bd-ib solid" id="newIni" aria-label="New program or initiative" title="New program or initiative" aria-haspopup="menu"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button>
|
|
49
50
|
<div class="tools tools-top"><span class="vh" id="snap" role="status">Reading the board</span></div>
|
|
50
51
|
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
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).",
|
|
3
|
+
"panels": [
|
|
4
|
+
"board-publish-ui-test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"board-publish-ui-test.js": 40
|
|
8
|
+
}
|
|
9
|
+
}
|