Commit 2bda8866 authored by Jan Koester's avatar Jan Koester
Browse files

visual fixes

parent 4e9916d0
Loading
Loading
Loading
Loading
+1 −0
Changes for www/app.css: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ dialog {
  border: 1px solid var(--line); border-radius: 10px; padding: 0; width: min(480px, calc(100vw - 32px));
  background: var(--panel); color: var(--text); box-shadow: 0 10px 40px rgba(30, 34, 40, .25);
}
dialog.wide { width: min(860px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(60, 66, 74, .35); }
dialog form { padding: 18px 20px 14px; }
dialog h2 { font-size: 1.1rem; }
+8 −4
Changes for www/app.js: 8 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -85,7 +85,8 @@ const webctl = (() => {
      else if (k === 'checked') el.checked = !!v;
      else el.setAttribute(k, v === true ? '' : v);
    }
    for (const c of children.flat()) {
    // nested lists (a column's [button, [button, button]]) at any depth
    for (const c of children.flat(Infinity)) {
      if (c === null || c === undefined || c === false) continue;
      el.append(c instanceof Node ? c : document.createTextNode(String(c)));
    }
@@ -111,14 +112,17 @@ const webctl = (() => {
  // may throw (or reject) -- the message is shown in the dialog, which stays
  // open. data maps input names to values (checkboxes: booleans; several
  // checkboxes with one name and a value: a list of the checked values).
  function dialog({title, fields, submit, danger = false, onSubmit}) {
  // wide: room for a table (details)
  function dialog({title, fields, submit, danger = false, wide = false, onSubmit}) {
    return new Promise(resolve => {
      const err = h('p', {class: 'dialog-error', hidden: true});
      const ok = h('button', {type: 'submit', class: danger ? 'danger' : 'primary'}, submit || t('Save'));
      const form = h('form', {method: 'dialog'});
      const dlg = h('dialog', {}, form);
      const dlg = h('dialog', {class: wide ? 'wide' : null}, form);
      const close = result => { dlg.close(); dlg.remove(); resolve(result); };
      form.append(h('h2', {}, title), err, ...[].concat(fields(form)),
      // fields may hold null/false for what doesn't apply, and nested lists
      const items = [].concat(fields(form)).flat(Infinity).filter(c => c !== null && c !== undefined && c !== false);
      form.append(h('h2', {}, title), err, ...items,
        h('div', {class: 'dialog-buttons'},
          h('button', {type: 'button', onclick: () => close(false)}, t('Cancel')), ok));
      form.addEventListener('submit', async ev => {
+4 −1
Changes for www/modules/disks.js: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -77,7 +77,9 @@
    const out = [];
    if (d.power === 'standby') out.push(h('span', {class: 'badge', title: t('The disk sleeps; it isn\'t woken up to be read.')}, t('standby')));
    if (d.problem && smart(d)) out.push(h('span', {class: 'badge warn'}, t(d.problem)));
    if (d.readAt && Date.now() / 1000 - d.readAt > 120) out.push(h('div', {class: 'muted'}, t('values from {0}', when(d.readAt))));
    // only an earlier reading has readAt (no clock comparison: the
    // server's and the browser's clocks may differ)
    if (d.readAt) out.push(h('div', {class: 'muted'}, t('values from {0}', when(d.readAt))));
    return out;
  }

@@ -129,6 +131,7 @@
    dialog({
      title: t('SMART of {0}', '/dev/' + x.name),
      submit: t('Close'),
      wide: true,
      fields: () => [
        h('div', {class: 'toolbar'}, health(x), ...freshness(x),
          x.power === 'standby' ? h('button', {type: 'button', class: 'small',