create-pmos 0.441.0 → 0.443.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 +25 -25
- 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/adler-seasons-art-test.js +106 -0
- package/workspace/adler-seasons-test.js +111 -0
- package/workspace/briefing-premium-board-test.js +19 -17
- package/workspace/briefing-premium-initiative-test.js +7 -4
- package/workspace/changelog.json +24 -0
- package/workspace/goals-clear-ui-test.js +249 -0
- package/workspace/guide/adler.md +10 -0
- package/workspace/guide/home.md +8 -1
- package/workspace/guide/metric-drafts.md +8 -2
- package/workspace/home-railcard-test.js +193 -0
- package/workspace/ini-workflow-test.js +6 -2
- package/workspace/intelligence-gaps-ui-test.js +16 -14
- package/workspace/lib/engine/records/index.js +9 -2
- package/workspace/lib/initiative-layout.js +3 -1
- package/workspace/lib/insights-premium.js +22 -1
- package/workspace/lib/metric-drafts.js +37 -10
- package/workspace/lib/metric-read-runs.js +20 -13
- package/workspace/lib/metric-reads.js +208 -23
- package/workspace/lib/metrics-cli.js +62 -5
- package/workspace/lib/routes-goal-status.js +89 -6
- package/workspace/lib/routes-insights-premium.js +1 -1
- package/workspace/lib/routes-metric-drafts.js +26 -3
- package/workspace/lib/settings-store.js +38 -0
- package/workspace/metric-drafts-ui-test.js +7 -4
- package/workspace/okr-goals-ui-test.js +7 -5
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +2 -1
- package/workspace/premium-chat-attach-test.js +2 -0
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +2 -2
- package/workspace/public/pm/c3-ini-ui.js +1 -1
- package/workspace/public/pm/cozy-adler.css +21 -0
- package/workspace/public/pm/cozy-adler.js +415 -8
- package/workspace/public/pm/cozy-ev.css +16 -1
- package/workspace/public/pm/cozy-home.css +8 -0
- package/workspace/public/pm/cozy-insights.css +82 -0
- package/workspace/public/pm/cozy-live-pill.css +5 -0
- package/workspace/public/pm/cozy-news.js +1 -1
- package/workspace/public/pm/cozy-seasons.js +318 -0
- package/workspace/public/pm/cozy-settings.js +88 -5
- package/workspace/public/pm/cozy-today.css +15 -0
- package/workspace/public/pm/cozy-viewer.js +50 -18
- package/workspace/public/pm/cozy-vw-shell.css +4 -0
- package/workspace/public/pm/cozy.css +65 -0
- package/workspace/public/pm/dash-view.js +4 -2
- package/workspace/public/pm/goals-clear.js +258 -0
- package/workspace/public/pm/home-app.js +59 -5
- package/workspace/public/pm/home-chat.js +1 -1
- package/workspace/public/pm/home-day.js +7 -4
- package/workspace/public/pm/home-ini.js +2 -2
- package/workspace/public/pm/home-mentions.js +1 -1
- package/workspace/public/pm/home-today.js +51 -10
- package/workspace/public/pm/impact.js +1 -1
- package/workspace/public/pm/ini-groups.js +28 -17
- package/workspace/public/pm/ini-links.js +1 -1
- package/workspace/public/pm/ini-tasks.js +246 -48
- package/workspace/public/pm/ini-view-model.js +45 -16
- package/workspace/public/pm/ini-view.css +330 -1
- package/workspace/public/pm/ini-view.js +196 -83
- package/workspace/public/pm/metric-drafts.js +4 -1
- package/workspace/public/pm/mission.js +238 -0
- package/workspace/public/pm/premium-board.js +1 -1
- package/workspace/public/pm/premium-insights.js +178 -24
- package/workspace/public/pm/premium-welcome.js +2 -2
- package/workspace/public/pm/split-merge.js +1 -1
- package/workspace/public/pm/stage-line.js +2 -2
- package/workspace/server.js +6 -2
- package/workspace/skills/metric-read.skill +7 -5
- package/workspace/split-merge-ui-test.js +1 -1
- package/workspace/stage-card-test.js +56 -11
- package/workspace/task-links-test.js +2 -0
- package/workspace/task-milestones-test.js +5 -1
- package/workspace/task-plans-test.js +3 -3
- package/workspace/task-views-test.js +279 -37
- package/workspace/test-lists/adler-seasons-art.json +13 -0
- package/workspace/test-lists/batch18-adler-seasons.json +13 -0
- package/workspace/test-lists/goals-clear.json +15 -0
- package/workspace/test-lists/home-railcard.json +9 -0
- package/workspace/test-lists/mission.json +5 -0
- package/workspace/test-lists/viewer-tasks.json +5 -0
- package/workspace/tk-tasks-test.js +27 -32
|
@@ -147,10 +147,11 @@ export function sesSheetHtml(M, o) {
|
|
|
147
147
|
* the pill lists what is in it. On a desktop the list opens right under the pill; on a phone it is a sheet (sesSheetHtml). */
|
|
148
148
|
function iniHtml(r, o, po) {
|
|
149
149
|
const on = o.ses === sesKey(r, o) && !o.phone && r.kids.length;
|
|
150
|
-
|
|
150
|
+
// in the folded rail's card (batch 18 item 14, FlA2) the sessions open in place under the row, inside the card
|
|
151
|
+
const pop = !on ? '' : o.card ? `<div class="hv-rcs" role="group" aria-label="In ${esc(r.name)}">${sesListHtml(r, o)}</div>` : `<div class="hv-spp" data-esc-layer role="dialog" aria-label="In ${esc(r.name)}">${sesListHtml(r, o)}</div>`;
|
|
151
152
|
const t = track(r.at, r.stage, r.steps);
|
|
152
153
|
return `<div class="hm-r hv-r ini st-${esc(r.state)}${o.sel === r.id ? ' sel' : ''}${on ? ' sp-on' : ''}" data-id="${esc(r.id)}"${po ? ` data-po-id="${esc(r.ini || r.id)}"` : ''}>${po ? gripHtml(r.name) : ''}<button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"${o.sel === r.id ? ' aria-current="true"' : ''} title="${esc(r.hint)}">${markHtml(r.yours && r.state !== 'blocked' ? { state: 'needs' } : r)}`
|
|
153
|
-
+ `<span class="hm-rt"><b>${esc(r.name)}</b></span></button>${pillHtml(r, o)}${t ? `<button type="button" class="hv-tk" data-hm-sel="${esc(r.id)}" tabindex="-1" aria-hidden="true">${t}</button>` : ''}${pop}</div
|
|
154
|
+
+ `<span class="hm-rt"><b>${esc(r.name)}</b></span></button>${pillHtml(r, o)}${t ? `<button type="button" class="hv-tk" data-hm-sel="${esc(r.id)}" tabindex="-1" aria-hidden="true">${t}</button>` : ''}${o.card ? '' : pop}</div>${o.card ? pop : ''}`;
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
/* ── a group (HvAC .pg, .card; PgHomePhone .psub) ── */
|
|
@@ -163,10 +164,15 @@ function productHtml(g, o) {
|
|
|
163
164
|
const say = [g.name, open ? (g.goals && g.goals.n ? g.goals.text : '') : [plural(g.count, 'initiative', 'initiatives'), yoursWords(g)].filter(Boolean).join(', ')].filter(Boolean).join(', ');
|
|
164
165
|
// the name opens the product in the Viewer, with its own chat; the rest of the header folds the group (canvas HbCProduct)
|
|
165
166
|
const head = `<div class="hv-gh hv-prg${open ? '' : ' closed'}${o.selHead === g.key ? ' sel' : ''}"><button type="button" class="hv-pt" data-hm-prodopen="${esc(g.key)}" aria-label="Open ${esc(g.name)}, a product"${o.selHead === g.key ? ' aria-current="true"' : ''}>`
|
|
166
|
-
+ `<span class="hv-tl t${g.tone}" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}">${esc(g.initials)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>`
|
|
167
|
+
+ `<span class="hv-tl t${g.tone}" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}"${o.here === g.key ? ' data-cz-rail-here' : ''}>${esc(g.initials)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>`
|
|
167
168
|
+ `<button type="button" class="hv-pf" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(say)}. ${open ? 'Close' : 'Open'} the group">${open ? dots(g) : ''}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button></div>`;
|
|
168
169
|
const sec = `<section class="hm-pg hv-g" aria-label="${esc(g.name)}" data-po-id="${esc(prodKey(g.name))}">${SO.gripHtml(g.name)}`;
|
|
169
170
|
if (!open) return `${sec}${head}</section>`;
|
|
171
|
+
return `${sec}${head}<div class="hv-card">${productBody(g, o, true)}</div></section>`;
|
|
172
|
+
}
|
|
173
|
+
/** A product's rows: its tasks, its initiatives with the quiet ones folded to "N more", the open one always shown. po: the grip arranges
|
|
174
|
+
* them (the list); the folded rail's card shows the same rows without it. */
|
|
175
|
+
function productBody(g, o, po) {
|
|
170
176
|
const pinned = (x) => (o.pin.has(x.key) ? 0 : 1);
|
|
171
177
|
const flat = g.flat.slice().sort((a, b) => pinned(a) - pinned(b)).map((r) => rowHtml(r, o)).join('');
|
|
172
178
|
const QUIET = 3;
|
|
@@ -175,10 +181,11 @@ function productHtml(g, o) {
|
|
|
175
181
|
const rest = restAll ? g.rest : g.rest.filter((r, i) => i < Math.max(0, QUIET - g.inis.length) || r.id === o.sel);
|
|
176
182
|
const more = g.rest.length - rest.length;
|
|
177
183
|
// the product's initiatives are one list the grip arranges, shared with the Board (batch 14 item 8)
|
|
178
|
-
const
|
|
184
|
+
const inis = g.inis.concat(rest).map((r) => iniHtml(r, { ...o, gk: g.key }, po)).join('');
|
|
185
|
+
const body = flat + (po ? `<div class="po-list" data-po-list="@${esc(prodKey(g.name))}">${inis}</div>` : inis)
|
|
179
186
|
+ (more > 0 ? `<button type="button" class="hv-fold" data-hm-rest="${esc(g.key)}" aria-expanded="false" aria-label="${more} more ${more === 1 ? 'initiative' : 'initiatives'} with nothing today. Show"><span class="hv-mk"></span>${more} more${svg(P.chevD, 16)}</button>`
|
|
180
187
|
: restAll && g.rest.length > QUIET ? `<button type="button" class="hv-fold" data-hm-rest="${esc(g.key)}" aria-expanded="true"><span class="hv-mk"></span>Fewer${svg(P.chevU, 16)}</button>` : '');
|
|
181
|
-
return
|
|
188
|
+
return g.inis.length + rest.length + g.flat.length ? body : `<p class="hm-none">${g.primary ? 'No initiative is open on this board.' : 'Nothing is open here.'}</p>`;
|
|
182
189
|
}
|
|
183
190
|
/** A program's group (canvas PgHomePhone, PgHomeDesk): above the products. Its header: the program tile, the name, the next milestone's
|
|
184
191
|
* diamond with its date and one small diamond per initiative it waits on (filled when that initiative is past the Deliver milestone), a chevron.
|
|
@@ -188,21 +195,55 @@ function productHtml(g, o) {
|
|
|
188
195
|
function programHtml(g, o) {
|
|
189
196
|
const open = o.pOpen(g);
|
|
190
197
|
const nx = g.st && g.st.next;
|
|
191
|
-
const ms =
|
|
192
|
-
|
|
198
|
+
const ms = msHtml(g);
|
|
199
|
+
const line = nx ? 'Next milestone ' + nx.name + (nx.day ? ', ' + nx.day : '') + (nx.late ? ', late' : '') + (nx.n ? ', ' + nx.ready + ' of ' + nx.n + (nx.n === 1 ? ' initiative' : ' initiatives') + ' ready' : '') : 'No open milestone';
|
|
193
200
|
const head = `<div class="hv-gh hv-prg${open ? '' : ' closed'}${o.selHead === g.key ? ' sel' : ''}"><button type="button" class="hv-pt" data-hm-prog="${esc(g.program.id)}" aria-label="Open ${esc(g.name)}, a program"${o.selHead === g.key ? ' aria-current="true"' : ''}>`
|
|
194
|
-
+ `<span class="hv-tl tp" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}">${svg(P.layers, 16)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>${open && g.st ? sugHtml(g.program, g.st) : ''}`
|
|
201
|
+
+ `<span class="hv-tl tp" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}"${o.here === g.key ? ' data-cz-rail-here' : ''}>${svg(P.layers, 16)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>${open && g.st ? sugHtml(g.program, g.st) : ''}`
|
|
195
202
|
+ `<button type="button" class="hv-pf" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(g.name)}. ${esc(line)}${g.yours ? '. ' + yoursWords(g) : ''}. ${open ? 'Close' : 'Open'} the group">${ms}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button></div>`;
|
|
196
203
|
const sec = `<section class="hm-pg hv-g prg" aria-label="${esc(g.name)}" data-po-id="g:${esc(g.program.id)}">${SO.gripHtml(g.name)}`;
|
|
197
204
|
if (!open) return `${sec}${head}</section>`;
|
|
198
205
|
// the program's tasks are on its panel (On the program), not on Home: Home lists no tasks (Wawan, 2026-10-25)
|
|
199
206
|
// a product's sub-heading only when the program's rows on Home come from two or more products (batch 12 item 6): one product repeated
|
|
200
207
|
// under every program said nothing
|
|
208
|
+
return `${sec}${head}<div class="hv-card">${programBody(g, o, true)}</div></section>`;
|
|
209
|
+
}
|
|
210
|
+
/** The next milestone in a program's header: its diamond and date, then one small diamond per initiative it waits on. */
|
|
211
|
+
function msHtml(g) {
|
|
212
|
+
const nx = g.st && g.st.next;
|
|
213
|
+
return nx ? `<span class="hv-msd${nx.late ? ' late' : ''}"><span class="hv-dm"></span>${esc(nx.day || nx.name)}${nx.n ? `<span class="hv-rd">${Array.from({ length: nx.n }, (_, i) => `<i${i < nx.ready ? ' class="on"' : ''}></i>`).join('')}</span>` : ''}</span>` : '';
|
|
214
|
+
}
|
|
215
|
+
/** A program's rows: its milestone row first, then its initiatives, under a product sub-heading when they come from two or more products. */
|
|
216
|
+
function programBody(g, o, po) {
|
|
201
217
|
const many = g.subs.length > 1;
|
|
202
|
-
const body = g.subs.map((x) => `${many ? `<div class="hv-psub" role="heading" aria-level="3"><span class="hv-st2 t${x.tone}" aria-hidden="true">${esc(x.initials)}</span>${esc(x.name)}</div>` : ''}
|
|
218
|
+
const body = g.subs.map((x) => { const inis = x.inis.map((r) => iniHtml(r, { ...o, gk: g.key }, po)).join(''); return `${many ? `<div class="hv-psub" role="heading" aria-level="3"><span class="hv-st2 t${x.tone}" aria-hidden="true">${esc(x.initials)}</span>${esc(x.name)}</div>` : ''}${po ? `<div class="po-list" data-po-list="${esc(g.program.id)}">${inis}</div>` : inis}`; }).join('');
|
|
203
219
|
// the program's milestone changes that wait on the PM lead its card (batch 14 item 4: they were only in Your day, which a desktop no longer has)
|
|
204
220
|
const msr = g.msRow ? `<div class="hm-r hv-r${o.sel === g.msRow.id ? ' sel' : ''}" data-id="${esc(g.msRow.id)}"><button type="button" class="hm-rm" data-hm-sel="${esc(g.msRow.id)}" aria-label="${esc(g.msRow.hint)}. Waits on you. Open the program"><span class="hv-mk"><span class="hv-d" aria-hidden="true"></span></span><span class="hm-rt"><b>${esc(g.msRow.hint)}</b></span></button></div>` : '';
|
|
205
|
-
return
|
|
221
|
+
return msr + (body || `<p class="hm-none">${(g.program.members || []).length ? 'No open initiatives' : 'No initiatives yet'}. Open the program to move some in.</p>`);
|
|
222
|
+
}
|
|
223
|
+
/** Which group holds what is open (o.sel: a row id, or 'i:<initiative>'): the folded rail marks that group's tile (batch 18 item 14, FlA4After).
|
|
224
|
+
* Nothing in a group is open: null. */
|
|
225
|
+
export function groupOfOpen(M, sel) {
|
|
226
|
+
if (!M || !sel) return null;
|
|
227
|
+
const hit = (r) => r && (r.id === sel || (r.kids || []).some((k) => k.id === sel));
|
|
228
|
+
for (const g of M.groups || []) {
|
|
229
|
+
if (g.kind === 'loose') continue;
|
|
230
|
+
const rows = g.kind === 'program' ? [g.msRow].concat(...(g.subs || []).map((x) => x.inis)) : (g.flat || []).concat(g.inis || [], g.rest || []);
|
|
231
|
+
if (rows.some(hit)) return g.key;
|
|
232
|
+
}
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
/** The folded rail's card (batch 18 item 14, FlA1–FlA5): a group's tile, name and › (opens the program or product), a program's next
|
|
236
|
+
* milestone, ×; then Home's own rows for that group (the quiet ones folded, the open one shown), the pill's sessions in place. */
|
|
237
|
+
export function railCardHtml(M, key, o) {
|
|
238
|
+
const g = M && (M.groups || []).find((x) => x.key === key && x.kind !== 'loose');
|
|
239
|
+
if (!g) return '';
|
|
240
|
+
const prog = g.kind === 'program';
|
|
241
|
+
const tile = prog ? `<span class="hv-tl tp" aria-hidden="true">${svg(P.layers, 16)}</span>` : `<span class="hv-tl t${g.tone}" aria-hidden="true">${esc(g.initials)}</span>`;
|
|
242
|
+
const go = prog ? `data-hm-prog="${esc(g.program.id)}" aria-label="Open ${esc(g.name)}, a program"` : `data-hm-prodopen="${esc(g.key)}" aria-label="Open ${esc(g.name)}, a product"`;
|
|
243
|
+
const oc = { ...o, card: true };
|
|
244
|
+
return `<div class="hv-rch"><button type="button" class="hv-pt" ${go}>${tile}<b>${esc(g.name)}</b>${svg(P.chevR, 16)}</button>${prog ? msHtml(g) : ''}`
|
|
245
|
+
+ `<button type="button" class="ut-ib hv-ib" data-hm-rcx aria-label="Close" title="Close">${svg(P.x, 18)}</button></div>`
|
|
246
|
+
+ `<div class="hv-rcb">${prog ? programBody(g, oc, false) : productBody(g, oc, false)}</div>`;
|
|
206
247
|
}
|
|
207
248
|
/** "Not in an initiative" (HvAC .lh): a line under the groups. Folded it shows a blue dot when a row waits on you, an amber square when one
|
|
208
249
|
* of your own is late, and the count; open, the rows in a card. */
|
|
@@ -177,7 +177,7 @@ export function madeHtml(x, W = W0) {
|
|
|
177
177
|
// AdH2: Adler celebrates once, on the first view of this delivery (and at most once a week), in the small win scene; every later view is calm.
|
|
178
178
|
// The diamond on the timeline stays plain and nothing is sent.
|
|
179
179
|
const joy = celebrateOnce('made.' + x.ms.name + '.' + x.ms.date), scene = joy && adPrefs()['adler.amount'] === 'full';
|
|
180
|
-
return `<section class="im im-made" aria-label="Who made it happen">${scene ? `<div class="im-win">${adlerScene('win', 'celebrating', { w: 500, h: 200, label: false })}</div>` : ''}<div class="im-mh">${scene ? '' : adler(joy ? 'celebrating' : 'handled', 44, { label: false })}<span class="im-tx"><b class="im-t">${esc(x.ms.name)} delivered on ${esc(x.ms.date)}.</b><span class="im-s">Here’s who made it happen.</span></span></div>`
|
|
180
|
+
return `<section class="im im-made" aria-label="Who made it happen">${scene ? `<div class="im-win">${adlerScene('win', 'celebrating', { w: 500, h: 200, label: false, dress: true })}</div>` : ''}<div class="im-mh">${scene ? '' : adler(joy ? 'celebrating' : 'handled', 44, { label: false })}<span class="im-tx"><b class="im-t">${esc(x.ms.name)} delivered on ${esc(x.ms.date)}.</b><span class="im-s">Here’s who made it happen.</span></span></div>`
|
|
181
181
|
+ `<div class="im-card">${x.people.map((p) => `<div class="im-row"><span class="im-av" aria-hidden="true">${initial(p.who)}</span><span class="im-tx"><b class="im-t">${esc(p.who)}</b><span class="im-s">${esc(p.what)}</span></span>`
|
|
182
182
|
+ `<a class="im-ib" href="${esc(p.url)}"${linkAttrs(p.url)} aria-label="Open ${esc(p.key || p.what)}" title="Open ${esc(p.key || 'the ticket')}">${svg(I.open, 20)}</a></div>`).join('')}</div>${LOCK}</section>`;
|
|
183
183
|
}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* itself is pure (ini-view-model.js groupBy, groupSections); this file reads what it needs, draws the presses and writes the PM's picks.
|
|
5
5
|
*
|
|
6
6
|
* view(v) → v with its Tasks grouped as the PM picked (tasks.by, tasks.sections, tasks.gsum); Stage leaves v as it is
|
|
7
|
-
* headHtml(v)
|
|
7
|
+
* headHtml(v) "Showing <stage> only ✕" in the Tasks header while the stage card filters it; nothing else (Group by is in the view sheet)
|
|
8
|
+
* api(root, H) the view sheet's Group by row (pm/ini-tasks.js): the grouping, a press on Stage, Owner or Status, and the full menu
|
|
8
9
|
* sumHtml(v) By epic's card: "N tickets are drafted, not in Jira" with Send to Jira, or "Sending to Jira" (zero is silence)
|
|
9
10
|
* toolsHtml(sec) what a group's header carries after its fold: ⋯ on the PM's own group, the send icon on an epic with drafted tickets
|
|
10
11
|
* tkRowsHtml(sec) an epic's tickets: a drafted one has no box and opens the draft (tk-draft.js); a sent one shows its key and status
|
|
@@ -17,14 +18,14 @@
|
|
|
17
18
|
* place, set), POST /api/jira/draft; reads: GET /api/initiative-layout, GET /api/jira/tickets. Every write is the PM's press, file mode. */
|
|
18
19
|
import { pmGet, pmPost } from './http.js';
|
|
19
20
|
import * as VW from './cozy-viewer.js';
|
|
20
|
-
import { groupBy, groupSections, GROUP_BY } from './ini-view-model.js';
|
|
21
|
+
import { groupBy, groupSections, GROUP_BY, linkRows, bodyOf } from './ini-view-model.js';
|
|
21
22
|
import { readLine } from './tk-model.js';
|
|
22
23
|
|
|
23
24
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
24
25
|
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
25
26
|
const P = {
|
|
26
|
-
|
|
27
|
-
check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', plus: 'M12 5v14M5 12h14', tk: '
|
|
27
|
+
send: 'M4 12l16-8-6 16-3-7zM11 13l9-9', more: 'M5 12h.01M12 12h.01M19 12h.01',
|
|
28
|
+
check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', plus: 'M12 5v14M5 12h14', tk: 'M4 7h16v3a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4z', draft: 'M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8',
|
|
28
29
|
};
|
|
29
30
|
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
30
31
|
const LAY = new Map(); // initiative id → its layout (GET /api/initiative-layout), as the last read or write answered
|
|
@@ -67,16 +68,22 @@ async function readT(id, H) {
|
|
|
67
68
|
/** Reads what the initiative shown needs, once; a redraw follows each answer. */
|
|
68
69
|
export function attach(body, H) {
|
|
69
70
|
const n = body && body.querySelector('[data-iv]'), id = n && n.dataset.iv;
|
|
70
|
-
if (!idOk(id) || !H || !body.querySelector('[data-
|
|
71
|
+
if (!idOk(id) || !H || !body.querySelector('[data-iv-vbtn]')) return; // no view button: nothing to group
|
|
71
72
|
if (!LAY.has(id)) readL(id, H);
|
|
72
73
|
if (!TK.has(id)) readT(id, H);
|
|
73
74
|
}
|
|
74
75
|
const byOf = (id) => groupBy(LAY.get(id), TK.get(id));
|
|
75
76
|
|
|
76
77
|
/* ── the view ── */
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
/** The tickets the drafted ones put in Jira, with their Jira status: a task whose title names one is linked to it (ini-view-model.js linkRows). */
|
|
79
|
+
const inJiraOf = (id) => { const T = TK.get(id); return T && T.ok === true ? (T.tickets || []).filter((t) => t && t.inJira && t.key).map((t) => ({ key: t.key, status: (t.jira && t.jira.status) || (t.jira && t.jira.category === 'done' ? 'Done' : t.jira && t.jira.category === 'doing' ? 'In progress' : 'To do') })) : []; };
|
|
80
|
+
// a row linked here takes Jira's status, so the section is split into open and done again
|
|
81
|
+
const relink = (S, tk) => S.map((s) => (s.stages ? { ...s, stages: relink(s.stages, tk) }
|
|
82
|
+
: s.top ? { ...s, ...bodyOf(linkRows([...s.top, ...(s.groups || []).flatMap((g) => g.rows), ...(s.done || [])], tk), linkRows(s.archived || [], tk)) } : s));
|
|
83
|
+
export function view(v0) {
|
|
84
|
+
const id = v0 && v0.id;
|
|
85
|
+
if (!idOk(id) || !v0.tasks || v0.tasks.empty) return v0;
|
|
86
|
+
const tk = inJiraOf(id), v = tk.length ? { ...v0, tasks: { ...v0.tasks, sections: relink(v0.tasks.sections || [], tk) } } : v0;
|
|
80
87
|
const by = byOf(id);
|
|
81
88
|
if (by === 'stage') return { ...v, tasks: { ...v.tasks, by } };
|
|
82
89
|
const f = ONLY.get(id), keep = f ? stagesOf(v.tasks.sections || [], f.key) : null;
|
|
@@ -92,12 +99,17 @@ export function view(v) {
|
|
|
92
99
|
const shown = sections.filter((s) => (s.kind === 'epic' ? withJira : !bare(s)));
|
|
93
100
|
return { ...v, tasks: { ...v.tasks, by, sections: shown, gsum: withJira ? sum : null, only: f.name } };
|
|
94
101
|
}
|
|
102
|
+
/** The stage the card showed: its name and a ✕ that shows every stage again (filters earn space: only while one is on). Group by itself
|
|
103
|
+
* lives in the view sheet (batch 18 item 1, XvpA4Sheet; pm/ini-tasks.js sheetHtml), through api() below. */
|
|
95
104
|
export function headHtml(v) {
|
|
96
|
-
if (!v || !idOk(v.id) || !v.tasks || v.tasks.empty) return '';
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
105
|
+
if (!v || !idOk(v.id) || !v.tasks || v.tasks.empty || !v.tasks.only) return '';
|
|
106
|
+
return `<button type="button" class="ig-only" data-ig-all aria-label="${esc('Showing ' + v.tasks.only + ' only. Show every stage')}" title="Show every stage">${esc(v.tasks.only)}${SVG(P.x, 14, 2)}</button>`;
|
|
107
|
+
}
|
|
108
|
+
/** What the view sheet needs for its Group by row: ok (the initiative has a record id), by() and label() the grouping, set(k) the press
|
|
109
|
+
* (→ the write's promise), more(anchor) the full menu (Epic, Your groups, the sets, New group) under the view button. */
|
|
110
|
+
export function api(root, H) {
|
|
111
|
+
const id = root && root.dataset.iv;
|
|
112
|
+
return { ok: idOk(id), by: () => byOf(id), label: () => GROUP_BY[byOf(id)] || 'Stage', set: (k) => (byOf(id) === k ? null : lay(id, H, { kind: 'by', grouping: k })), more: (a) => groupMenu(a, id, H) };
|
|
101
113
|
}
|
|
102
114
|
export function sumHtml(v) {
|
|
103
115
|
const s = v && v.tasks && v.tasks.gsum; if (!s) return '';
|
|
@@ -186,11 +198,11 @@ function groupMenu(b, id, H) {
|
|
|
186
198
|
const epics = T && T.ok === true ? new Set((T.tickets || []).map((t) => t.epic || '')).size : 0;
|
|
187
199
|
const same = (n) => n.join('|').toLowerCase() === names.join('|').toLowerCase();
|
|
188
200
|
const sets = L.sets || [];
|
|
189
|
-
const newGroup = { label: 'New group', icon: P.plus, keep: true, go: (a) => ask(a, 'Name the group', '', async (v) => { if (await lay(id, H, { kind: 'groups', names: names.concat(v) })) if (by !== 'mine') lay(id, H, { kind: 'by',
|
|
201
|
+
const newGroup = { label: 'New group', icon: P.plus, keep: true, go: (a) => ask(a, 'Name the group', '', async (v) => { if (await lay(id, H, { kind: 'groups', names: names.concat(v) })) if (by !== 'mine') lay(id, H, { kind: 'by', grouping: 'mine' }); }) };
|
|
190
202
|
menu(b, [{ head: 'Group by' }, ...Object.entries(GROUP_BY).map(([k, l]) => ({ label: l, radio: true, on: by === k,
|
|
191
|
-
sub: k === 'epic' && epics ? plural(epics, 'epic', 'epics') : k === 'mine' && names.length ? String(names.length) : '', go: () => lay(id, H, { kind: 'by',
|
|
203
|
+
sub: k === 'epic' && epics ? plural(epics, 'epic', 'epics') : k === 'mine' && names.length ? String(names.length) : '', go: () => lay(id, H, { kind: 'by', grouping: k }) })),
|
|
192
204
|
{ hr: true }, ...(sets.length ? [{ head: 'Your group sets' }] : []),
|
|
193
|
-
...sets.map((s) => ({ label: s.names.join(' · '), sub: same(s.names) ? 'this one' : '', go: async () => { if (await lay(id, H, { kind: 'groups', names: s.names })) if (by !== 'mine') lay(id, H, { kind: 'by',
|
|
205
|
+
...sets.map((s) => ({ label: s.names.join(' · '), sub: same(s.names) ? 'this one' : '', go: async () => { if (await lay(id, H, { kind: 'groups', names: s.names })) if (by !== 'mine') lay(id, H, { kind: 'by', grouping: 'mine' }); } })),
|
|
194
206
|
...(names.length && !sets.some((s) => same(s.names)) ? [{ label: 'Save these groups as a set', icon: P.plus, go: () => lay(id, H, { kind: 'set', name: names.join(' · '), names }) }] : []),
|
|
195
207
|
newGroup], 'Group tasks by');
|
|
196
208
|
}
|
|
@@ -213,7 +225,6 @@ async function openTk(id, H, tid) {
|
|
|
213
225
|
}
|
|
214
226
|
export function press(b, d, root, H) {
|
|
215
227
|
const id = root && root.dataset.iv; if (!idOk(id)) return false;
|
|
216
|
-
if ('igBy' in d) { if (POP && POP.anchor === b) closePop(); else groupMenu(b, id, H); return true; }
|
|
217
228
|
if (d.igGmore) { groupMore(b, id, H, d.igGmore); return true; }
|
|
218
229
|
if ('igAll' in d) { ONLY.delete(id); if (H.redraw) H.redraw(); return true; }
|
|
219
230
|
if (d.igSend != null) { send(id, H, { group: d.igSend }); return true; }
|
|
@@ -31,7 +31,7 @@ export const PL = {
|
|
|
31
31
|
link: 'M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1',
|
|
32
32
|
unlink: 'M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1M4 4l16 16',
|
|
33
33
|
check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', minus: 'M5 12h14', plus: 'M12 5v14M5 12h14',
|
|
34
|
-
search: 'M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zM20 20l-4-4', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', dia: 'M12 4l8 8-8 8-8-8z', jira: '
|
|
34
|
+
search: 'M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zM20 20l-4-4', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', dia: 'M12 4l8 8-8 8-8-8z', jira: 'M4 7h16v3a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4z',
|
|
35
35
|
// the four types, the two ends joined: the waited-on end on the left, the waiting end on the right
|
|
36
36
|
fs: 'M3 7h8v10h10M17 13l4 4-4 4', ss: 'M7 4v6h14M7 10v10M17 6l4 4-4 4', ff: 'M3 7h14v10H7M17 13v8', sf: 'M7 4v13h10M7 17h0M13 13l4 4-4 4',
|
|
37
37
|
};
|