clavarium 0.2.42-next.1 → 0.2.44-next.1

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.
@@ -274,7 +274,7 @@ export class Updater {
274
274
  this.restart = restart ?? (() => this.#restart());
275
275
  /* What was seen when the server did not come up: its journal, its unit, who holds its port. */
276
276
  this.diagnose = diagnose ?? (() => this.#diagnose());
277
- this.health = health ?? ((release) => this.#health(release));
277
+ this.health = health ?? ((release, opts) => this.#health(release, opts));
278
278
  this.backup = backup ?? ((app) => this.#backup(app));
279
279
  this.restoreData = restoreData ?? ((app, archive) => this.#restoreData(app, archive));
280
280
  this.installPrivileged = installPrivileged ?? ((app) => this.#installPrivileged(app));
@@ -606,13 +606,16 @@ export class Updater {
606
606
  await this.installPrivileged(release.app);
607
607
  } catch (error) { return `it could not be put in place: ${error.message}`; }
608
608
  this.#step(action, version, 'Restarting');
609
- return this.#restartAndCheck(release);
609
+ /* Once the new server answers, the maintenance page is gone but a minute or two of
610
+ watching that it stays up is left: said as "Confirming", not "Restarting", so a page
611
+ back up does not look stuck restarting (deploy/updater.mjs, #health onUp). */
612
+ return this.#restartAndCheck(release, () => this.#step(action, version, 'Confirming'));
610
613
  }
611
614
  /* '' when it came up, or why not. */
612
- async #restartAndCheck(release) {
615
+ async #restartAndCheck(release, onUp) {
613
616
  const r = await this.restart().catch((e) => ({ code: 1, stderr: e.message }));
614
617
  if (r?.code) return `the server did not restart: ${lastLine(r)}`;
615
- const h = await this.health(release).catch((e) => e.message || 'no answer');
618
+ const h = await this.health(release, { onUp }).catch((e) => e.message || 'no answer');
616
619
  return h || '';
617
620
  }
618
621
 
@@ -802,7 +805,7 @@ export class Updater {
802
805
 
803
806
  /* Comes up (answers, from this release) within healthMs, then STAYS up: watched until watchMs after
804
807
  the restart; one restart by systemd is forgiven if it answers at the end, not two. */
805
- async #health(release) {
808
+ async #health(release, { onUp } = {}) {
806
809
  const { clock, sleep } = this.#o;
807
810
  const start = clock();
808
811
  const target = realpathSync(release.dir);
@@ -820,7 +823,8 @@ export class Updater {
820
823
  if (clock() - start > this.#o.healthMs) return said;
821
824
  await sleep(1000);
822
825
  }
823
- /* And it stays up. */
826
+ /* It answers, from this release: the maintenance page gives way. Now it must stay up. */
827
+ onUp?.();
824
828
  const until = Math.max(start + this.#o.watchMs, clock() + this.#o.settleMs);
825
829
  let restarts = 0;
826
830
  while (clock() < until) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.42-next.1",
3
+ "version": "0.2.44-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.42-next.1",
9
+ "version": "0.2.44-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.42-next.1",
3
+ "version": "0.2.44-next.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
package/web/links.js CHANGED
@@ -69,6 +69,12 @@
69
69
  let allLines = true;
70
70
  try { allLines = localStorage.getItem('clavarium-links-all') !== '0'; } catch { /* none kept */ }
71
71
  let picked = null; let pinned = null; let focus = null; let drag = null; let pop = null; let popLink = null; let drawnMany = false;
72
+ /* A box is shown only if its column's filter is empty or its name holds what was typed: so a
73
+ crowded map (many assets) is narrowed to a few boxes, their links with them. The layout is
74
+ kept while typing (no reorder), and a filter cleared brings everything back. */
75
+ const filters = { device: '', conversation: '', asset: '' };
76
+ let laidOut = null;
77
+ const matches = (n, k) => { const f = (filters[k] || '').trim().toLowerCase(); return !f || n.name.toLowerCase().includes(f) || String(n.sub || '').toLowerCase().includes(f); };
72
78
  const ph = { screen: 'list', kind: 'device', id: null, adding: false, sheet: null };
73
79
  let traceOf = '*';
74
80
 
@@ -182,27 +188,39 @@
182
188
  }
183
189
  return best;
184
190
  }
185
- function paint() {
191
+ /* `relayout` false keeps the order found last: used while typing a filter, so boxes do not jump. */
192
+ function paint(relayout = true) {
186
193
  for (const b of document.querySelectorAll('#links-tabs [data-view]')) b.setAttribute('aria-selected', String(b.dataset.view === view));
187
194
  $('links-all').checked = allLines;
188
195
  legend();
189
196
  const bd = board();
190
197
  bd.className = `lk-board ${VIEWS[view].cols.length === 3 ? 'three' : 'two'}`;
191
198
  bd.querySelectorAll('.lk-col, .lk-knob').forEach((e) => e.remove()); closePop();
192
- const lists = layout();
199
+ if (relayout || !laidOut) laidOut = layout();
200
+ const lists = laidOut;
193
201
  VIEWS[view].cols.forEach((cols, ci) => {
194
202
  const col = h('div', { class: 'lk-col' });
195
203
  cols.forEach((k, i) => {
196
204
  if (i) col.append(h('div', { class: 'lk-gap' }));
197
- col.append(h('h3', { class: 'lk-colh' }, h('span', { text: TITLES[k] }), plus(k)));
198
- const list = lists[ci][i];
205
+ col.append(h('h3', { class: 'lk-colh' }, h('span', { class: 'lk-colt', text: TITLES[k] }), find(k), plus(k)));
206
+ const whole = lists[ci][i];
207
+ const list = whole.filter((n) => matches(n, k));
199
208
  for (const n of list) col.append(nodeEl(n));
200
- if (!list.length) col.append(empty(k));
209
+ if (!list.length) col.append(whole.length ? h('p', { class: 'hint lk-none', text: 'Nothing matches.' }) : empty(k));
201
210
  });
202
211
  bd.append(col);
203
212
  });
204
213
  fit(); draw(); hint(); paintPhone();
205
214
  }
215
+ /* A box in each column's title to narrow it: it filters only what is shown, kept while typing. */
216
+ const onFind = (e) => {
217
+ const k = e.target.dataset.k; const at = e.target.selectionStart;
218
+ filters[k] = e.target.value;
219
+ paint(false);
220
+ const ni = board().querySelector(`.lk-find[data-k="${k}"]`);
221
+ if (ni) { ni.focus(); try { ni.setSelectionRange(at, at); } catch { /* a search input may refuse it */ } }
222
+ };
223
+ const find = (k) => h('input', { type: 'search', class: 'lk-find', 'data-k': k, value: filters[k], placeholder: 'Filter…', 'aria-label': `Filter ${TITLES[k]}`, oninput: onFind });
206
224
  /* How each kind is made: a device paired, a conversation created, an asset added. The same,
207
225
  from the small round "+" by each column's title (always there, however many it holds)
208
226
  and from an empty column. */
package/web/style.css CHANGED
@@ -1280,6 +1280,9 @@ select.pill { appearance: auto; }
1280
1280
  #copy-close, #files-close, #preview-close { font-size: 1.375rem; line-height: 1; min-width: 40px; padding: 4px 10px; }
1281
1281
  /* The title of a column of the map, and its round "+" (a new device, conversation, asset): always there. */
1282
1282
  .lk-col h3.lk-colh, .lk-phead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
1283
+ .lk-col h3.lk-colh .lk-colt { flex: none; }
1284
+ .lk-col h3.lk-colh .lk-find { flex: 1 1 auto; min-width: 0; width: auto; font: inherit; font-size: .72rem; letter-spacing: 0; text-transform: none; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); }
1285
+ .lk-col h3.lk-colh .lk-find::placeholder { color: var(--ink2); }
1283
1286
  .lk-col h3.lk-colh .lk-add { width: 26px; height: 26px; font-size: .95rem; letter-spacing: 0; }
1284
1287
  .lk-phead { margin: 4px 0 6px; }
1285
1288
  .as-kinds { display: flex; flex-wrap: wrap; gap: 8px; } .as-kinds button { display: inline-flex; align-items: center; gap: 8px; }