diff --git a/app/templates/runs/_launch_ask.html b/app/templates/runs/_launch_ask.html index cb6abae7..ca2a3a58 100644 --- a/app/templates/runs/_launch_ask.html +++ b/app/templates/runs/_launch_ask.html @@ -21,7 +21,7 @@ {% endif %} {%- endmacro %} -{#- One dialog for every launch: a button fills it from its launch's template (`asks`: button class -> template class), +{#- One dialog for every launch: a button fills it from its launch's template, else the page's (`asks`: button class -> template class), or from the server (the button's data-ask); ?delete= opens the Delete question on load. #} {% macro dialogs(asks={'launch-delete-btn': 'launch-ask'}) %} @@ -40,7 +40,7 @@ const r = await nulliusFetch(b.dataset.ask); if (!r.ok) { b.title = await r.text(); return; } d.innerHTML = await r.text(); - } else d.replaceChildren(l.querySelector('template.' + asks[cls]).content.cloneNode(true)); + } else d.replaceChildren((l.querySelector('template.' + asks[cls]) || document.querySelector('template.' + asks[cls])).content.cloneNode(true)); // the row's own, or the page's one d.showModal(); }; const sel = Object.keys(asks).map(c => '.' + c).join(','); diff --git a/app/templates/runs/launches.html b/app/templates/runs/launches.html index ae5ff156..474c7911 100644 --- a/app/templates/runs/launches.html +++ b/app/templates/runs/launches.html @@ -49,28 +49,37 @@ {%- elif c.key == 'size' %}{% call cell(c, sort=r.bytes, class='nowrap') %}{{ r.bytes|filesizeformat }}{% endcall %} {%- elif c.key == 'ws' %}{% call cell(c, sort=wss|map(attribute='label')|sort|join(' ')) %}{% for w in wss %}{{ open_at(w, L, w.label) }}{% if not loop.last %}
{% endif %}{% else %}none{% endfor %}{% endcall %} {%- elif c.key == 'actions' %}{% call cell(c, class='acts-col') %} - {% set others = workspaces|rejectattr('name', 'in', wss|map(attribute='name')|list)|list %} - - + {% if not r.why %}{{ delete_ask(L, none, 'launches', icon=true) }} {%- else %}{{ greyed('Delete launch ' ~ L.title, 'Delete launch', r.why, 'why-' ~ L.key) }}{% endif %} {% endcall %} {%- endif %} {% endcall %} +{#- Add, once for the page: its button fills in the launch, and drops the workspaces its row already lists. #} + {{ dialogs({'launch-delete-btn': 'launch-ask', 'launch-add-btn': 'launch-add'}) }} {% else %} diff --git a/app/templates/workspaces/_roots.html b/app/templates/workspaces/_roots.html new file mode 100644 index 00000000..4868aa78 --- /dev/null +++ b/app/templates/workspaces/_roots.html @@ -0,0 +1,23 @@ +{#- The Roots dialog of a workspace (`workspace_roots`), fetched when it opens: each root's Unlink asked here, its Delete asked of the server. #} +{% from '_tables.html' import greyed %} +

Roots of {{ ws.label }}

+ Add a root
+ diff --git a/app/templates/workspaces/workspaces.html b/app/templates/workspaces/workspaces.html index 2c273c37..b95e9c63 100644 --- a/app/templates/workspaces/workspaces.html +++ b/app/templates/workspaces/workspaces.html @@ -8,7 +8,7 @@ {% endblock %} {#- A workspace's row: the open one marked, what its search reads. #} -{% macro ws_tr(ws) %} class="{{ 'ws-current' if workspace and ws.name == workspace.name }}" data-ws="{{ ws.name }}" data-search="{{ ws.label }} {{ ws.name }}" data-holder{% endmacro %} +{% macro ws_tr(ws) %} class="{{ 'ws-current' if workspace and ws.name == workspace.name }}" data-ws="{{ ws.name }}" data-search="{{ ws.label }} {{ ws.name }}"{% endmacro %} {% block body %} {% set actions %}New workspace{% endset %} @@ -20,7 +20,7 @@ dict(key='checks', label='Checks', type='num'), dict(key='opened', label='Last opened', type='num', align='left'), dict(key='launches', label='Launches', type='num', align='right'), dict(key='roots', label='Roots', type='num', align='right'), dict(key='actions', label='Actions', blank=true)] %} {% call(ws, c) table('workspaces', cols, workspaces, ws_tr, class='ws-table', search='Search by name', noun='workspaces') %} - {%- set current = workspace and ws.name == workspace.name %}{% set rs = roots[ws.name] %}{% set clash = labels.count(ws.label) > 1 %} + {%- set current = workspace and ws.name == workspace.name %}{% set clash = labels.count(ws.label) > 1 %} {%- if c.key == 'open' %}{% call cell(c) %}{% if current %}●{% endif %}{% endcall %} {%- elif c.key == 'name' %}{% call cell(c, sort=ws.label, class='ws-name') %} @@ -39,54 +39,40 @@ {%- elif c.key == 'opened' %}{% call cell(c, sort=ws.opened[:19]|replace('-', '')|replace(':', '')|replace('T', '') or 0, class='mono faint nowrap') %}{{ ws.opened[:16]|replace('T', ' ') }}{% endcall %} {%- elif c.key == 'launches' %}{% call cell(c) %}{% set n = n_launches[ws.name] %}{% if n %}{{ n }} {%- else %}{{ greyed('Launches of ' ~ ws.label ~ ': 0', '', 'No launches in ' ~ ws.label, 'none-' ~ ws.name, icon='launches', class='btn ghost sm count-btn', text='0') }}{% endif %}{% endcall %} - {%- elif c.key == 'roots' %}{% call cell(c, sort=rs|length) %} - - + {%- elif c.key == 'roots' %}{% call cell(c, sort=ws.roots|length) %} + {% endcall %} {%- elif c.key == 'actions' %}{% call cell(c, class='acts-col') %} - - + {% endcall %} {%- endif %} {% endcall %} +{#- every row's Delete, filled from its button #} +