create-pmos 0.469.0 → 0.471.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/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 +51 -3
- package/workspace/lib/board-publish-choices.js +25 -0
- package/workspace/lib/boards-host.js +20 -4
- package/workspace/lib/boards-teams.js +99 -0
- package/workspace/lib/routes-board-publish.js +44 -7
- 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 +152 -0
- 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 +16 -4
- package/workspace/public/pm/readonly.js +1 -1
- package/workspace/public/premium-board.html +3 -0
- package/workspace/test-lists/board-publish-b.json +4 -2
- package/workspace/test-lists/board-publish-d.json +11 -0
|
@@ -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 = '/pm/bd-shared.css';
|
|
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', 'https://boards.example.com/join#Team.password', 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
|
+
}
|
|
@@ -62,6 +62,7 @@ let view = ['track', 'stages', 'time', 'list'].includes(store.get(VIEW_KEY)) ? s
|
|
|
62
62
|
let pview = ['list', 'stages', 'track', 'time'].includes(store.get(PVIEW_KEY)) ? store.get(PVIEW_KEY) : 'list'; // a phone's view (BdPhone)
|
|
63
63
|
let span = SPANS.some(([k]) => k === store.get(SPAN_KEY)) ? store.get(SPAN_KEY) : 'quarter';
|
|
64
64
|
let tab = 'ini';
|
|
65
|
+
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
66
|
let readTimer = null;
|
|
66
67
|
let readTries = 0; // reads that answered "reading" in a row: the next ask waits longer each time
|
|
67
68
|
let foldOpen = false; // the Monitor and Evaluate rows under the table
|
|
@@ -232,6 +233,8 @@ function drawHead() {
|
|
|
232
233
|
$('#snap').textContent = M.header.text;
|
|
233
234
|
// PMOS-self: new work starts at the pmos-router skill. All products: New asks which product the initiative is for
|
|
234
235
|
$('#newIni').hidden = ALL ? (M.board.products || []).every((p) => p.self) : !!M.board.self;
|
|
236
|
+
if (!window.PMOS_READONLY && !SH_LOADED) { SH_LOADED = true; import('./bd-shared.js').then((S) => S.loadCount(setSharedCount)); }
|
|
237
|
+
{ 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
238
|
setPageGaps(((M.header && M.header.missing) || []).length);
|
|
236
239
|
}
|
|
237
240
|
let jiraReading = false; // a press is reading Jira again: the chip's Adler wears his glasses until the next read of the Board lands
|
|
@@ -255,7 +258,7 @@ function drawChips() {
|
|
|
255
258
|
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>`;
|
|
256
259
|
if (phone) {
|
|
257
260
|
const docs = M.docs && M.docs.rows ? M.docs.rows.length : 0;
|
|
258
|
-
$('#bdChipset').innerHTML = thisSprint + jiraChip + askChip + flt(['late', 'risk', 'blocked', 'idle']) + `<button type="button" class="bd-chip" id="chDocs">Docs ${docs}</button>`;
|
|
261
|
+
$('#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>`;
|
|
259
262
|
return;
|
|
260
263
|
}
|
|
261
264
|
// 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
|
|
@@ -279,6 +282,7 @@ $('#bdChipset').addEventListener('click', (e) => {
|
|
|
279
282
|
else if (b.id === 'chSprint') Acts.open.sprint(b);
|
|
280
283
|
else if (b.id === 'chAsks') Acts.open.asks(b);
|
|
281
284
|
else if (b.id === 'chDocs') setTab('docs');
|
|
285
|
+
else if (b.id === 'chShared') setTab('shared');
|
|
282
286
|
});
|
|
283
287
|
/** 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. */
|
|
284
288
|
async function refreshJira(btn) {
|
|
@@ -845,17 +849,25 @@ $('#bdFilter').addEventListener('click', (e) => Acts.open.filter(e.currentTarget
|
|
|
845
849
|
// and that press opens New initiative at once.
|
|
846
850
|
$('#newIni').addEventListener('click', (e) => { if (e.isTrusted) Asks.openNewMenu(e.currentTarget); else Acts.open.new(e.currentTarget); });
|
|
847
851
|
$('#bdBell').addEventListener('click', (e) => { if (M) Acts.open.bell(e.currentTarget); });
|
|
852
|
+
// 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
|
|
853
|
+
$('#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
854
|
|
|
849
855
|
/* ── tabs: Initiatives and Documents (Documents has no frame yet: a plain list) ──────────────────────────────────────────────────────── */
|
|
850
856
|
function setTab(t) {
|
|
851
857
|
tab = t;
|
|
852
|
-
$('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabDocs').setAttribute('aria-selected', String(t === 'docs'));
|
|
853
|
-
$('#cIni').hidden = t !== 'ini'; $('#cDocs').hidden = t !== 'docs';
|
|
858
|
+
$('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabDocs').setAttribute('aria-selected', String(t === 'docs')); $('#tabShared').setAttribute('aria-selected', String(t === 'shared'));
|
|
859
|
+
$('#cIni').hidden = t !== 'ini'; $('#cDocs').hidden = t !== 'docs'; $('#cShared').hidden = t !== 'shared';
|
|
854
860
|
if (t === 'docs') { closePanel(); drawDocs(); loadDocMeta(); }
|
|
861
|
+
// Shared (initiative board-publish, slice 4): reads each joined team's host now, on opening the tab and on Refresh, and never in between
|
|
862
|
+
if (t === 'shared') { closePanel(); import('./bd-shared.js').then((S) => { SH_FULL = true; S.show($('#cShared'), { onCount: setSharedCount }); }); }
|
|
855
863
|
}
|
|
856
864
|
$('#tabIni').onclick = () => setTab('ini');
|
|
857
865
|
$('#tabDocs').onclick = () => setTab('docs');
|
|
858
|
-
$('
|
|
866
|
+
$('#tabShared').onclick = () => setTab('shared');
|
|
867
|
+
$('.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(); });
|
|
868
|
+
/** 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. */
|
|
869
|
+
function setSharedCount(n) { SH_N = n; $('#nShared').textContent = n ? String(n) : ''; const c = $('#chShared'); if (c) c.textContent = 'Shared' + (n ? ' ' + n : ''); }
|
|
870
|
+
document.addEventListener('bd:links', (e) => { if (!SH_FULL && e.detail) setSharedCount(e.detail.n); });
|
|
859
871
|
|
|
860
872
|
/** Documents (BdDocs): the kind chips, the rows and their history; a row opens the document's panel (pm/bd-acts.js). */
|
|
861
873
|
function drawDocs() { if (M) $('#docBody').innerHTML = V.docsHtml(); }
|
|
@@ -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', '#chShared', '#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>
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
<div class="bd-tabs" role="tablist" aria-label="Board">
|
|
55
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>
|
|
56
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>
|
|
57
59
|
</div>
|
|
58
60
|
<div class="bd-seg bd-spans" id="bdSpans" role="group" aria-label="Span" hidden>
|
|
59
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>
|
|
@@ -70,6 +72,7 @@
|
|
|
70
72
|
<h2 class="vh" id="hDocs">Documents</h2>
|
|
71
73
|
<div id="docBody"></div>
|
|
72
74
|
</section>
|
|
75
|
+
<section class="bd-sec" id="cShared" role="tabpanel" aria-labelledby="tabShared" hidden></section>
|
|
73
76
|
|
|
74
77
|
<!-- the help frame: what finishes each step (the step heads open it) -->
|
|
75
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
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
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). Slice 4 adds the Shared tab (pm/bd-shared.js, pm/bd-shared.css; design prototype/board-publish/shared-view-design.html).",
|
|
3
|
+
"panels": [
|
|
4
|
+
"board-publish-ui-test.js",
|
|
5
|
+
"board-shared-ui-test.js"
|
|
6
|
+
],
|
|
7
|
+
"seconds": {
|
|
8
|
+
"board-publish-ui-test.js": 40,
|
|
9
|
+
"board-shared-ui-test.js": 45
|
|
10
|
+
}
|
|
11
|
+
}
|