Commit 46ef924e authored by jan.koester's avatar jan.koester
Browse files

test

parent b2a6fe01
Loading
Loading
Loading
Loading
+15 −2
Changes for www/modules/containers.js: 15 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -137,11 +137,20 @@
    }
    data = r;
    jobs.report('containers', data.jobs);
    // an installed app's log tells where it answers
    for (const [id, container] of installing) {
      const job = (data.jobs || []).find(j => j.id === id);
      if (job && job.state === 'running') continue;
      installing.delete(id);
      if (job && job.state === 'done') logDialog(container, true);
    }
    if (tab === 'apps') await loadApps();
    draw();
    schedule();
  }

  const installing = new Map();  // job id -> container name

  async function refreshApps() {
    storeError = '';
    const r = await run(() => call('containers', 'refreshApps'));
@@ -232,7 +241,8 @@
    load();
  }

  async function logDialog(name) {
  // follow: the container has just started, its first lines are on their way
  async function logDialog(name, follow) {
    const pre = h('pre', {class: 'log'}, t('Loading …'));
    const fill = async () => {
      const r = await run(() => call('containers', 'log', {name, lines: 500}));
@@ -241,6 +251,7 @@
      pre.scrollTop = pre.scrollHeight;
    };
    fill();
    if (follow) for (const ms of [1000, 3000, 6000, 10000]) setTimeout(fill, ms);
    dialog({
      title: t('Log of {0}', name), submit: t('Close'), wide: true,
      fields: () => [pre, h('button', {type: 'button', onclick: fill}, t('Refresh'))],
@@ -499,7 +510,9 @@
          readOnly: d.readOnly, boot: d.boot,
        };
        if (app) {
          jobs.started(await call('containers', 'install', {container}));
          const r = await call('containers', 'install', {container});
          jobs.started(r);
          if (r.job) installing.set(r.job.id, container.name);
          load();
          return;
        }