create-pmos 0.427.0 → 0.429.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.
Files changed (147) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/board-programs-test.js +16 -2
  7. package/workspace/briefing-premium-board-test.js +27 -22
  8. package/workspace/briefing-premium-insights-test.js +81 -60
  9. package/workspace/briefing-premium-metrics-test.js +5 -3
  10. package/workspace/briefing-premium-sources-test.js +5 -5
  11. package/workspace/briefing-premium-test.js +7 -5
  12. package/workspace/changelog.json +24 -0
  13. package/workspace/ev-everywhere-test.js +2 -2
  14. package/workspace/guide/briefing-premium.md +4 -2
  15. package/workspace/guide/home.md +34 -7
  16. package/workspace/guide/index.md +1 -0
  17. package/workspace/guide/metric-drafts.md +48 -0
  18. package/workspace/guide/programs.md +1 -0
  19. package/workspace/home-other-product-test.js +12 -2
  20. package/workspace/intel-report-ui-test.js +189 -0
  21. package/workspace/lib/board-metrics-premium.js +1 -1
  22. package/workspace/lib/headless.js +15 -2
  23. package/workspace/lib/insights-premium.js +5 -1
  24. package/workspace/lib/insights-records.js +14 -5
  25. package/workspace/lib/intel-report.js +419 -0
  26. package/workspace/lib/metric-draft-runs.js +193 -0
  27. package/workspace/lib/metric-drafts.js +231 -0
  28. package/workspace/lib/metrics-cli.js +104 -0
  29. package/workspace/lib/pmos-verbs.js +3 -0
  30. package/workspace/lib/report-setups.js +29 -13
  31. package/workspace/lib/route-modules.js +1 -0
  32. package/workspace/lib/routes-insights-premium.js +2 -2
  33. package/workspace/lib/routes-insights-records.js +13 -5
  34. package/workspace/lib/routes-meeting-material.js +22 -1
  35. package/workspace/lib/routes-metric-drafts.js +141 -0
  36. package/workspace/lib/routes-phone-day.js +13 -2
  37. package/workspace/lib/routes-report-setups.js +92 -3
  38. package/workspace/lib/routes-viewer.js +5 -2
  39. package/workspace/lib/settings-store.js +14 -0
  40. package/workspace/metric-drafts-ui-test.js +209 -0
  41. package/workspace/milestone-pins-test.js +13 -0
  42. package/workspace/milestone-suggest-test.js +10 -4
  43. package/workspace/package-lock.json +2 -2
  44. package/workspace/package.json +1 -1
  45. package/workspace/premium-board-actions-test.js +40 -13
  46. package/workspace/premium-phone-card-test.js +8 -5
  47. package/workspace/premium-rec-tab-test.js +8 -0
  48. package/workspace/premium-vw-item-test.js +7 -3
  49. package/workspace/premium-vw-jira-test.js +2 -1
  50. package/workspace/program-charter-test.js +1 -1
  51. package/workspace/program-leave-test.js +2 -2
  52. package/workspace/program-order-test.js +3 -2
  53. package/workspace/program-panel-test.js +2 -1
  54. package/workspace/public/pm/bd-acts.js +23 -29
  55. package/workspace/public/pm/bd-ini-panel.js +90 -32
  56. package/workspace/public/pm/bd-pin-card.css +4 -4
  57. package/workspace/public/pm/bd-pin-card.js +4 -1
  58. package/workspace/public/pm/bd-prog-panel.js +9 -4
  59. package/workspace/public/pm/bd-span.js +22 -12
  60. package/workspace/public/pm/cozy-aud.css +1 -1
  61. package/workspace/public/pm/cozy-board.css +256 -256
  62. package/workspace/public/pm/cozy-ev.css +45 -45
  63. package/workspace/public/pm/cozy-evmodel.js +1 -1
  64. package/workspace/public/pm/cozy-home-rows.css +23 -23
  65. package/workspace/public/pm/cozy-home.css +207 -207
  66. package/workspace/public/pm/cozy-insights.css +207 -108
  67. package/workspace/public/pm/cozy-live-pill.css +5 -5
  68. package/workspace/public/pm/cozy-mtg-present.css +23 -23
  69. package/workspace/public/pm/cozy-nav.js +1 -1
  70. package/workspace/public/pm/cozy-news.js +2 -2
  71. package/workspace/public/pm/cozy-panel.css +29 -29
  72. package/workspace/public/pm/cozy-pick.css +5 -5
  73. package/workspace/public/pm/cozy-rec-now.css +20 -20
  74. package/workspace/public/pm/cozy-rec-present.css +11 -11
  75. package/workspace/public/pm/cozy-rec-tab.css +13 -13
  76. package/workspace/public/pm/cozy-rec-tab.js +12 -3
  77. package/workspace/public/pm/cozy-settings.js +1 -1
  78. package/workspace/public/pm/cozy-steps.css +9 -9
  79. package/workspace/public/pm/cozy-today.css +107 -71
  80. package/workspace/public/pm/cozy-viewer.css +7 -7
  81. package/workspace/public/pm/cozy-viewer.js +157 -23
  82. package/workspace/public/pm/cozy-vw-mtg.css +81 -81
  83. package/workspace/public/pm/cozy-vw-rp.css +53 -53
  84. package/workspace/public/pm/cozy-vw-shell.css +34 -21
  85. package/workspace/public/pm/cozy-vw.css +117 -117
  86. package/workspace/public/pm/cozy-xv.css +11 -11
  87. package/workspace/public/pm/cozy.css +18 -15
  88. package/workspace/public/pm/hi-pop.css +82 -0
  89. package/workspace/public/pm/hi-pop.js +65 -0
  90. package/workspace/public/pm/home-app.js +83 -28
  91. package/workspace/public/pm/home-day.js +131 -26
  92. package/workspace/public/pm/home-ini.css +38 -108
  93. package/workspace/public/pm/home-ini.js +50 -68
  94. package/workspace/public/pm/home-line.css +7 -7
  95. package/workspace/public/pm/home-list.js +41 -4
  96. package/workspace/public/pm/home-phone-card.js +18 -15
  97. package/workspace/public/pm/home-today.js +18 -7
  98. package/workspace/public/pm/ini-more.js +67 -0
  99. package/workspace/public/pm/ini-view-model.js +3 -2
  100. package/workspace/public/pm/ini-view.css +104 -102
  101. package/workspace/public/pm/ini-view.js +16 -8
  102. package/workspace/public/pm/loose-props.css +13 -13
  103. package/workspace/public/pm/metric-drafts.css +82 -0
  104. package/workspace/public/pm/metric-drafts.js +165 -0
  105. package/workspace/public/pm/ms-suggest.css +8 -8
  106. package/workspace/public/pm/order-model.js +85 -0
  107. package/workspace/public/pm/ov-view.css +12 -12
  108. package/workspace/public/pm/premium-board.js +57 -11
  109. package/workspace/public/pm/premium-chart-tab.js +6 -6
  110. package/workspace/public/pm/premium-insights.js +306 -105
  111. package/workspace/public/pm/premium-report-intel.css +56 -0
  112. package/workspace/public/pm/premium-report-intel.js +232 -0
  113. package/workspace/public/pm/premium-shell.js +2 -2
  114. package/workspace/public/pm/premium-vw-file.js +2 -2
  115. package/workspace/public/pm/premium-vw-item.js +3 -1
  116. package/workspace/public/pm/premium-vw-jira.js +2 -0
  117. package/workspace/public/pm/premium.css +127 -128
  118. package/workspace/public/pm/prog-order.css +6 -6
  119. package/workspace/public/pm/prog-order.js +15 -2
  120. package/workspace/public/pm/program-charter.css +23 -23
  121. package/workspace/public/pm/rp-parts.js +2 -2
  122. package/workspace/public/pm/sort-order.css +17 -0
  123. package/workspace/public/pm/sort-order.js +108 -0
  124. package/workspace/public/pm/split-merge.css +15 -15
  125. package/workspace/public/pm/task-card.css +21 -21
  126. package/workspace/public/pm/tk-tasks.css +37 -37
  127. package/workspace/public/pm/tk-view.css +6 -6
  128. package/workspace/public/pm/tk-view.js +3 -2
  129. package/workspace/public/pm/wf-page.css +28 -28
  130. package/workspace/public/pm/wf-page.js +1 -1
  131. package/workspace/public/premium-board.html +1 -0
  132. package/workspace/public/premium-intelligence.html +82 -0
  133. package/workspace/server.js +38 -3
  134. package/workspace/skills/metric-draft.skill +47 -0
  135. package/workspace/sort-order-test.js +201 -0
  136. package/workspace/stage-card-test.js +1 -0
  137. package/workspace/task-card-test.js +1 -1
  138. package/workspace/test-lists/intel-report-ui.json +5 -0
  139. package/workspace/test-lists/intel-report.json +9 -0
  140. package/workspace/test-lists/metric-drafts-ui.json +5 -0
  141. package/workspace/test-lists/metric-drafts.json +9 -0
  142. package/workspace/test-lists/sort-order.json +6 -0
  143. package/workspace/test-lists/viewer-trail.json +5 -0
  144. package/workspace/test-run.js +3 -0
  145. package/workspace/tk-tasks-test.js +5 -3
  146. package/workspace/viewer-trail-test.js +145 -0
  147. package/workspace/public/premium-insights.html +0 -81
@@ -37,6 +37,8 @@ import { open as viewerOpen, current as viewerCur } from './cozy-viewer.js';
37
37
  import * as VW from './cozy-viewer.js';
38
38
  import * as PP from './bd-prog-panel.js';
39
39
  import * as PO from './prog-order.js';
40
+ import * as SO from './sort-order.js'; // the sort button and ONE order with Home and the Timeline (batch 14 item 8, canvas SoADesk, SoABoardPhone)
41
+ import { sortTop, sortInis, prodKey } from './order-model.js';
40
42
  import * as SM from './split-merge.js'; // split one initiative in two, or merge two: Claude suggests, the PM approves (batch 11 item 14)
41
43
  import * as PM from './prog-move.js'; // move an initiative out of its program, or to another (canvas LpA1More, LpA2Other)
42
44
  import * as Pop from './bd-pop.js'; // the order of a program's initiatives: the grip and Claude's order from the dates (canvas RoADrag, RoASuggest)
@@ -93,7 +95,24 @@ const PHONE = matchMedia('(max-width: 720px)');
93
95
  const goneRows = () => { const G = (M && M.initiatives && M.initiatives.gone) || {}; return [...(G.cancelled || []), ...(G.archived || [])]; };
94
96
  const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || goneRows().find((r) => r.key === key) || null;
95
97
  /** The rows on screen grouped (pm/bd-prog.js groupsOf): programs first, then the product; or By product. null when no program holds a row here. */
96
- const groups = (L) => PG.groupsOf(PGS, L, M, byProduct);
98
+ /** In the PM's sort or own order, the same as Home's (batch 14 item 8): the programs and products, then each product's initiatives. A
99
+ * program's own initiatives keep the program's order. */
100
+ const groups = (L) => {
101
+ const G = PG.groupsOf(PGS, L, M, byProduct);
102
+ if (!G) return G;
103
+ const lay = SO.layout();
104
+ for (const g of G) if (g.kind === 'product') g.rows = sortInis(prodKey(g.name), g.rows, lay, INI_ACC);
105
+ return sortTop(G, lay, TOP_ACC);
106
+ };
107
+ const youOf = (r) => statusOf(r).tone === 'you';
108
+ const minEnd = (rows) => rows.map((r) => r.end).filter(Boolean).map(String).sort()[0] || '';
109
+ const TOP_ACC = {
110
+ key: (g) => (g.kind === 'program' ? 'g:' + g.program.id : prodKey(g.name)), turn: (g) => g.rows.some(youOf), name: (g) => (g.kind === 'program' ? g.program.title : g.name),
111
+ date: (g) => (g.kind === 'program' ? ((progState(g.program) || {}).next || {}).date || '' : minEnd(g.rows)),
112
+ // a product never placed: the one pick's order with the home product first, as Home lists them (home-list.js productsOf)
113
+ base: (g) => { const P = (PKP && PKP.products) || [], i = P.findIndex((p) => String(p.name).toLowerCase() === String(g.name).toLowerCase()); return i < 0 ? Infinity : P[i].primary ? -1 : i; },
114
+ };
115
+ const INI_ACC = { id: (r) => r.id, turn: youOf, date: (r) => r.end || '', name: (r) => r.title || '', stage: (r) => (TK && TK.mode !== 'pf' ? WF.posOf(r) : r.track ? r.track.k : -1) };
97
116
  const progState = (p) => PG.stateOf(p, M, XR);
98
117
 
99
118
  /** A panel of pm/bd-acts.js or pm/bd-asks.js (New initiative, Accept ask, the first questions, a document, a release, the backlog, Metrics,
@@ -388,8 +407,8 @@ const isME = (r) => r.track && r.track.k >= 6;
388
407
  function drawTrack(L) {
389
408
  TK = trackMode(L);
390
409
  const S = TK.mode === 'pf' ? M.steps || [] : TK.steps || [];
391
- const sorted = TK.mode === 'pf' ? L.slice().sort((a, b) => ((a.track ? a.track.k : -1) < 0 ? 99 : a.track.k) - ((b.track ? b.track.k : -1) < 0 ? 99 : b.track.k))
392
- : L.slice().sort((a, b) => WF.posOf(a) - WF.posOf(b));
410
+ // one product and no program: its initiatives in the PM's sort or own order, the same as Home's (batch 14 item 8); grouped, groups() sorts each
411
+ const sorted = sortInis(prodKey((M.board && (M.board.product || M.board.name)) || ''), L, SO.layout(), INI_ACC);
393
412
  // Monitor and Evaluate fold away after the first row of each (AgBoard: "19 more in Monitor and Evaluate")
394
413
  const seen = new Set(), shown = [], folded = [];
395
414
  for (const r of sorted) { if (isME(r) && seen.has(r.track.k) && !foldOpen) folded.push(r); else { if (isME(r)) seen.add(r.track.k); shown.push(r); } }
@@ -409,20 +428,24 @@ function drawTrack(L) {
409
428
  const G = groups(sorted);
410
429
  let inGroups = 0;
411
430
  const meFold = (rs) => { const seen2 = new Set(), on = [], off = []; for (const r of rs) { if (isME(r) && seen2.has(r.track.k) && !foldOpen) off.push(r); else { if (isME(r)) seen2.add(r.track.k); on.push(r); } } return { on, off }; };
412
- const rows = G ? G.map((g) => {
431
+ // the programs and products are one list the grip arranges, and each product's initiatives another, shared with Home (batch 14 item 8)
432
+ const grp = (key, name, html) => `<div class="so-g" role="rowgroup" data-po-id="${esc(key)}">${SO.gripHtml(name)}${html}</div>`;
433
+ const own = (pk, html) => `<div role="presentation" class="po-list" data-po-list="@${esc(pk)}">${html}</div>`;
434
+ const rows = G ? `<div role="presentation" class="po-list" data-po-list="@top">${G.map((g) => {
413
435
  if (g.kind === 'program') {
414
436
  // a program's rows follow its order (option A): each product's rows are one list the grip reorders (RoADrag)
415
437
  const kids = PG.folded(g.key) ? '' : g.products.map((sub) => (g.products.length > 1 ? PG.subHtml(sub.name) : '') + `<div role="presentation" class="po-list" data-po-list="${esc(g.program.id)}">${sub.rows.map((r) => trackRow(r, ' bt-kid' + (r === g.rows[g.rows.length - 1] ? ' last' : ''), true)).join('')}</div>`).join('');
416
438
  const st = progState(g.program);
417
- return PG.bandHtml(g, st, { steps: S, plain: TK.mode !== 'pf', sug: PO.sugHtml(g.program, st) }) + kids;
439
+ return grp('g:' + g.program.id, g.program.title, PG.bandHtml(g, st, { steps: S, plain: TK.mode !== 'pf', sug: PO.sugHtml(g.program, st) }) + kids);
418
440
  }
419
- if (PG.folded(g.key)) return PG.prodHtml(g);
441
+ const pk = prodKey(g.name);
442
+ if (PG.folded(g.key)) return grp(pk, g.name, PG.prodHtml(g));
420
443
  const f = meFold(g.rows); inGroups += f.off.length;
421
- return PG.prodHtml(g) + f.on.map((r) => trackRow(r, ' bt-gr')).join('') + (f.off.length ? `<button type="button" class="dlink bt-gmore" data-mefold aria-expanded="false">${SV(I.chev)}${f.off.length} more</button>` : '');
422
- }).join('') : shown.map((r) => trackRow(r)).join('');
444
+ return grp(pk, g.name, PG.prodHtml(g) + own(pk, f.on.map((r) => trackRow(r, ' bt-gr', true)).join('')) + (f.off.length ? `<button type="button" class="dlink bt-gmore" data-mefold aria-expanded="false">${SV(I.chev)}${f.off.length} more</button>` : ''));
445
+ }).join('')}</div>` : own(prodKey((M.board && (M.board.product || M.board.name)) || ''), shown.map((r) => trackRow(r, '', true)).join(''));
423
446
  const rest = G ? Math.max(0, meTotal - sorted.filter(isME).length) : more; // grouped: the ones not loaded here
424
447
  const tf2 = !G ? tf : rest > 0 && !foldOpen && !inGroups ? `<button type="button" class="dlink" id="fold" aria-expanded="false">${SV(I.chev)}${rest} more in Monitor and Evaluate</button>` : foldOpen && meTotal > 1 ? tf : '<span></span>';
425
- return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}${rows}<div class="bt-tf">${tf2}<span class="bt-srt">Sorted by stage</span></div>${PHONE.matches ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-steps aria-haspopup="dialog">What finishes each step</button><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : ''}</div>`; // the phone has no step heads: a plain entry to the steps help
448
+ return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}${rows}<div class="bt-tf">${tf2}</div>${PHONE.matches ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-steps aria-haspopup="dialog">What finishes each step</button><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : ''}</div>`; // the phone has no step heads: a plain entry to the steps help
426
449
  }
427
450
 
428
451
  /* ── the timeline (AgBoardTimeline; TsCOpen, TsCDesk, TsAllSpans, TsCPhone) ───────────────────────────────────────── */
@@ -451,6 +474,7 @@ function drawInit() {
451
474
  if (v === 'time') TL.mount(body);
452
475
  $('#bdShowing').innerHTML = showingHtml(L.length); $('#bdShowing').hidden = !$('#bdShowing').innerHTML;
453
476
  $$('#ibTabs [data-v]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.v === v)));
477
+ { const sb = $('#bdSort'), Ls = SO.labels(); if (sb) { sb.setAttribute('aria-label', Ls.aria); sb.title = Ls.title; sb.classList.toggle('on', Ls.on); } }
454
478
  $('#bdView').innerHTML = SV(v === 'time' ? I.time : I.track); $('#bdView').setAttribute('aria-label', 'Change view. Now: ' + (v === 'time' ? 'Timeline' : 'Stage track'));
455
479
  $('#bdSpans').hidden = v !== 'time' || phone;
456
480
  $$('#bdSpans [data-sp]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.sp === span)));
@@ -890,6 +914,26 @@ function focusOnce() {
890
914
  const b = $$('#ibBody [data-key]').find((x) => x.dataset.key === r.key);
891
915
  openIni(r, b || null, 'track');
892
916
  }
917
+ /* The address follows the initiative or program open in the Viewer (?focus=, ?program=), so Back from another page comes back to it
918
+ * (batch 14 item 7). The Viewer writes it once the history has settled on the entry the Board shows. */
919
+ VW.onChange((d) => {
920
+ const q = new URLSearchParams(location.search), f = d.open && d.kind === 'Initiative' && !/^bd:/.test(d.id || '') ? d.id : null, g = d.open && /^program:/.test(d.id || '') ? d.id.slice(8) : null;
921
+ if ((q.get('focus') || null) === f && (q.get('program') || null) === g) return;
922
+ if (f) q.set('focus', f); else q.delete('focus');
923
+ if (g) q.set('program', g); else q.delete('program');
924
+ const s = q.toString(); VW.replaceUrl(location.pathname + (s ? '?' + s : ''));
925
+ });
926
+ /** ?new=initiative (Home's New → Initiative, batch 14 item 10): open New initiative once, on the first read, then drop the word from the link
927
+ * so a reload does not open it again. */
928
+ let newDone = false;
929
+ function newOnce() {
930
+ if (newDone) return;
931
+ newDone = true;
932
+ const q = new URLSearchParams(location.search); if (q.get('new') !== 'initiative') return;
933
+ q.delete('new'); const s = q.toString();
934
+ history.replaceState(history.state, '', location.pathname + (s ? '?' + s : ''));
935
+ Acts.open.new($('#newIni'));
936
+ }
893
937
  /** One board's model (GET /api/board-premium); { r, status }. */
894
938
  async function readBoard(q) {
895
939
  let r = null, status = 0;
@@ -932,7 +976,7 @@ async function load() {
932
976
  return;
933
977
  }
934
978
  M = r.model; holdNames(); draw();
935
- focusOnce(); programOnce(); loadOthers(); loadWorkflows();
979
+ focusOnce(); programOnce(); newOnce(); loadOthers(); loadWorkflows();
936
980
  if (r.stale) setTimeout(load, 2000); // a press is still being derived: ask again
937
981
  else { loadTrail(); loadGrill(); }
938
982
  }
@@ -1026,7 +1070,7 @@ Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePa
1026
1070
  grouping: () => ({ on: groupingOn(), byProduct }), setGrouping, sprintFilter: sprintFilterOn, timeline: () => curView() === 'time' });
1027
1071
  BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
1028
1072
  send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
1029
- acts: (r, b) => Acts.open.row(r, b), hold: (r, i, b) => Acts.open.hold(r, i, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
1073
+ moreAct: (r, k, b) => Acts.open.more(r, k, b), hold: (r, i, b) => Acts.open.hold(r, i, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
1030
1074
  programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, toast: say, rename: renameIni, setTask, setDates, removeTask, addTask, openTask, turnProgram, moveItems, smItems, smPress, openIniId });
1031
1075
  /** Tap the title to rename (canvas RnAIni): the list, the Timeline and the panel show the new name at once; Undo is the same press.
1032
1076
  * The Jira box opens Home's chat about it with the request typed, for the PM to send (PMOS holds no Jira credential, D53). */
@@ -1050,6 +1094,8 @@ setSay(say);
1050
1094
  PO.mount({ programs: () => PGS, stateOf: (p) => progState(p), say,
1051
1095
  saved: (p) => { const i = PGS.findIndex((x) => x.id === p.id); if (i >= 0) PGS[i] = { ...PGS[i], ...p }; if (M) drawInit(); },
1052
1096
  openIni: (id, from) => { const r = (M.rows || []).find((x) => x.id === id && x.track); if (r) openIni(r, from); } });
1097
+ SO.mount({ redraw: () => { if (M) drawInit(); }, say });
1098
+ SO.load().then(() => { if (M) drawInit(); }); // the PM's sort and own order (look.order), shared with Home
1053
1099
  PP.mount({ M: () => M, programs: () => PGS, openIni: (id, from) => openIni((M.rows || []).find((x) => x.id === id && x.track), from), close: closePanel, reload: loadPrograms, say }); // the program panel (PgProgram)
1054
1100
  setTab('ini');
1055
1101
  load();
@@ -120,7 +120,7 @@ function chartHtml(t) {
120
120
  + `<p class="vz-note">${esc(base ? base.title : d.measure)}${d.range ? ' · last ' + d.range + ' readings' : ' · every reading'}${d.target != null ? ' · target ' + esc(d.target) : ''}</p>`
121
121
  + `<div class="vz-sg" role="group" aria-label="Form">${FORMS.map(([f, l]) => `<button type="button" data-ct="form|${f}" aria-pressed="${form === f}">${l}</button>`).join('')}</div>${meter}`
122
122
  + (changed ? `<div class="vz-r1">${btn('save', t.busy ? 'Saving' : s ? 'Save the change' : 'Save chart', { off: t.busy || !base || !!meter })}</div>` : '')
123
- + `<p class="vz-note">${s ? 'It shows on Insights under Your charts.' : 'Saved, it shows on Insights under Your charts and can go on a dashboard.'} Ask in the chat to change it.</p>`
123
+ + `<p class="vz-note">${s ? 'It shows on Intelligence under Your charts.' : 'Saved, it shows on Intelligence under Your charts and can go on a dashboard.'} Ask in the chat to change it.</p>`
124
124
  + (s ? `<div class="vz-r1">${btn('remove', 'Delete chart', { sec: true, off: t.busy })}</div>` : '') + '</section>';
125
125
  }
126
126
  /** A dashboard's chart as a small tile: its name, the reading now and its readings as small bars. */
@@ -142,15 +142,15 @@ function dashHtml(t) {
142
142
  const many = d.charts.length > 6 ? '<p class="vz-note">This dashboard holds more than six charts. A dashboard that serves one routine usually holds six or fewer.</p>' : '';
143
143
  return `${d.purpose ? `<p class="vz-sum">${esc(d.purpose)}</p>` : ''}<div class="vz-mx-grid">${tiles}</div>${many}`
144
144
  + `<section class="vz-blk" aria-label="${esc(eye)}"><div class="vz-r1"><h3>${esc(eye)}</h3></div>`
145
- + `<p class="vz-note">${d.charts.length} ${d.charts.length === 1 ? 'chart' : 'charts'}${s && s.main ? ' · pinned on Insights' : ''}</p>`
145
+ + `<p class="vz-note">${d.charts.length} ${d.charts.length === 1 ? 'chart' : 'charts'}${s && s.main ? ' · pinned on Intelligence' : ''}</p>`
146
146
  + (changed ? `<div class="vz-r1">${btn('save', t.busy ? 'Saving' : s ? 'Save the change' : 'Save dashboard', { off: t.busy })}</div>` : '')
147
- + `<p class="vz-note">${s ? 'It is in the list on Insights.' : 'Saved, it is in the list on Insights, where you can pin it.'} Ask in the chat to change it.</p>`
147
+ + `<p class="vz-note">${s ? 'It is in the list on Intelligence.' : 'Saved, it is in the list on Intelligence, where you can pin it.'} Ask in the chat to change it.</p>`
148
148
  + (s ? `<div class="vz-r1">${btn('remove', 'Delete dashboard', { sec: true, off: t.busy })}</div>` : '') + '</section>';
149
149
  }
150
150
  function bodyHtml(t) {
151
151
  const noun = t.block.kind;
152
152
  if (!t.loaded) return `<p class="vz-empty" role="status">Reading the ${noun}.</p>`;
153
- if (!t.M) return `<p class="vz-msg">The Insights records could not be read, so the ${noun} cannot be drawn. Try again in a moment.</p>`;
153
+ if (!t.M) return `<p class="vz-msg">The Intelligence records could not be read, so the ${noun} cannot be drawn. Try again in a moment.</p>`;
154
154
  if (t.removed) return '<p class="vz-msg">Deleted. Ask in the chat for a new one.</p>';
155
155
  if (t.gone) return `<p class="vz-msg">This ${noun} (${esc(t.block.id)}) is deleted, or it is not saved on this board.</p>`;
156
156
  if (!t.M.board.id) return '<p class="vz-msg">This workspace has no board to save on, so nothing can be saved here.</p>';
@@ -181,13 +181,13 @@ async function press(t, e) {
181
181
  question: d.question || '', form: d.form || 'line', range: d.range || null, target: d.target == null ? null : d.target, better: d.better || 'higher', note: d.note || '' });
182
182
  if (!r || !r.ok) return 'It was not saved: ' + why(r, 'the page could not reach PMOS') + '.';
183
183
  t.block = { kind, id: r.chart.id }; await load(t);
184
- return 'Saved. It shows on Insights under Your charts.';
184
+ return 'Saved. It shows on Intelligence under Your charts.';
185
185
  }
186
186
  const d = t.d;
187
187
  const r = await post('/api/premium-dashboards/save', { board, id: t.saved ? t.saved.id : undefined, name: d.name, purpose: d.purpose || d.name, charts: d.charts, main: !!(t.saved && t.saved.main) });
188
188
  if (!r || !r.ok) return 'It was not saved: ' + why(r, 'the page could not reach PMOS') + '.';
189
189
  t.block = { kind, id: r.dashboard.id }; await load(t);
190
- return 'Saved. It is in the list on Insights.';
190
+ return 'Saved. It is in the list on Intelligence.';
191
191
  });
192
192
  return;
193
193
  }