{% from '_rule_block.html' import pin_block, planned_block, rule_mark, config_block with context %} {% from '_pin_sections.html' import suspended_pins, suspended_sentence with context %} {% set page_title = 'Handled' %} {% include '_header.html' %} {#- *Handled*, the index of every rule that stands (ADR-0135 decision 8), its sections the jobs — *In maintenance*, *Accepted* (ADR-0142), *Silenced* (ADR-0144) and *By a rule* (ADR-0137). In maintenance, **every pin** — a node's own, or one of its reasons' — with what it holds, how long is left, why, and who is behind it, read from the whole snapshot so it is depth- and filter-independent, the nodes whose pins stand longest first, so that the old ones are where the eye starts. Viewer-visible and bookmarkable; the band's pill and its popover's "+N more" link here, and `/maintenance` answers with it. A plain page (the check.html / events.html pattern), not polled — so an open editor has nothing to wait for. This page is what makes the popover's one-row-per-node summary safe: it is where *"what is in maintenance right now?"* is answered completely, so the capped surface is free to fold. **The same blocks as a node's own page** (ADR-0104 decision 6, `_rule_block.html`), grouped under each node's path: the node's own pin first, then its lines' in the check's order — which is information (severity, API order) that the order they were pinned in is not. Each is read here and, by an admin, changed here: *Edit* opens in the block, and a save or a clear comes back to this page with its node named — `?node=#pinned-node`, the shape `?reason=#pinned-reason` has on a node's own page. The named node's section, and only it, gets the id and the ring. The node travels in the query and not in the fragment because a refused write is answered *at* this page's own address: from there a link that differed only by its fragment would be a jump within the refusal, and load nothing. **Two texts, in two places.** What a pin covers is what its block's sentence opens with — *The whole node*, or the reason line itself — and why is the block's note, and they are not the same kind of thing. A line's block stands away from its line here, so it names the line and links to it on its node's page; the slug appears in neither as text: ADR-0036 makes it opaque, so it travels only in the link's `?reason=` value and in the field of the form that changes the pin. This is also the place with room for the pin's **whole** reading (ADR-0014) for everyone — *pinned by Anna three days ago, last changed by Ben an hour ago* — under the note; a node's own page keeps it in the editor. The second sentence appears only on a pin that has actually been edited; on the common untouched pin it would just repeat the first. **A pin whose node is not reported** (ADR-0109 decision 4) stands under its path like any other, and its section says so: the check stopped returning the node, or has not written it yet since the start. Such a pin holds nothing, so its block says what it will hold *when the node is reported*; the path is no link, and a line's pin names no line, the lines having gone with the node. It is read from the snapshot, which carries it beside the nearest node above it that stands (`StatusSnapshot.nodes_not_reported`), whose door, ◇, counts it, and the band's pill; it is edited and cleared here, and on the page of its path. **A pin on a line its node does not report now** — a finding that comes and goes, or every line of a node whose check failed — stands among its node's pins after the lines the node reports, the order it was set in, as *A line not reported now*, the words the node's *Notes* tab says it in: it holds nothing until the line is back, and is edited and cleared here as there. Its node's door, ◇, counts it, and the band's pill (`tree.handled_parts`). -#}

Handled

{% if pins or planned %} {%- set nodes = groups | length %}

{{ rule_mark('maintenance') }}In maintenance

{%- if pins %}

{{ pins | length }} {{ 'pin' if pins | length == 1 else 'pins' }} on {{ nodes }} {{ 'node' if nodes == 1 else 'nodes' }}, the longest standing first.

{%- else %}

Nothing is in maintenance now.

{%- endif %}
{%- for path, group in groups %} {#- Whether the node is pinned whole: its lines' blocks then say they are in maintenance on their own as well, since they stay quiet when the node's pin ends. -#} {%- set covered = group | rejectattr('slug') | list | length > 0 %} {%- set back = url_for('handled', node=path) ~ '#pinned-node' %} {%- set place = loop.index %} {%- set suspended = group[0].suspended %}

{% if suspended %}{{ path }}{% else %}{{ path }}{% endif %}{% set shown = group[0] | node_title %}{% if shown %} {{ shown | markdown_inline(node=path) }}{% endif %}

{%- if suspended %}

{{ suspended_sentence(group) }}

{%- endif %}
{%- if suspended %} {{ suspended_pins(path, group, place, back, is_admin) }} {%- endif %} {%- for pin in group if not suspended %} {%- if pin.slug %} {#- The reason line as its node writes it — rendered, and whole: a member's text is often a link, and cutting it would leave raw syntax on the page — or, where the node does not report the line now, that, in the words its *Notes* tab says it in. -#} {%- set subject %}{% if pin.unreported %}A line not reported now{% else %}{{ pin.line | markdown_inline(node=path) }} — this line{% endif %}{% endset %} {{ pin_block(pin.entry, 'line', path, pin.slug, 'pin-' ~ place ~ '-' ~ loop.index, is_admin, also=covered, subject=subject, record=true, next=back, of=path) }} {%- else %} {%- set subject %}The whole node{% endset %} {{ pin_block(pin.entry, 'node', path, '', 'pin-' ~ place ~ '-' ~ loop.index, is_admin, subject=subject, record=true, next=back, of=path) }} {%- endif %} {%- endfor %}
{%- endfor %}
{#- **Planned** (ADR-0150, decision 5 of #35's note): every maintenance entry that stands and holds nothing now — a window set ahead, a series between two of its windows, or one whose holiday list keeps every window left shut — the soonest next window first, with its own count, each its block under its path and its part, untinted, holding nothing. An entry is in one list at a time: its window opening moves it up into *In maintenance*. -#} {%- if planned %} {%- set planned_nodes = planned | map(attribute='path') | unique | list | length %}

Planned

{{ planned | planned_count }} on {{ planned_nodes }} {{ 'node' if planned_nodes == 1 else 'nodes' }}, the soonest first.

    {%- for item in planned %} {%- set path = item.path %} {%- set back = url_for('handled') ~ '#handled-planned' %} {%- set where %}{% if item.suspended %}{{ path }}{% else %}{{ path }}{% endif %}{% endset %} {%- set subject %}{{ where }} · {% if not item.slug %}The whole node{% elif item.reported %}{{ item.text | markdown_inline(node=path) }} — this line{% else %}A line not reported now{% endif %}{% endset %} {{ planned_block(item.planned, 'line' if item.slug else 'node', path, item.slug, 'planned-' ~ loop.index, is_admin, tag='li', subject=subject, record=true, next=back, of=path) }} {%- endfor %}
{%- endif %}
{% elif not by_rule and not accepted and not silenced %}

Nothing is handled: no node or line is in maintenance, done, seen, silenced or held by a rule.

{% endif %} {#- **Accepted** (ADR-0142, ADR-0146): every *seen* and every *done* that stands, grouped under its node's path as the pins are, the nodes whose acknowledgments stand longest first — each its block, with who marked it and when under its note, and for whoever may mark it *Edit* and *Clear*. A node's own is its own failure, and a line's names its line and links to it. One whose part is not reported now is listed too: it holds nothing until it is, and ends where a reading says its part is gone. -#} {%- if accepted %} {%- set every = accepted | map(attribute=1) | sum(start=[]) %} {%- set closed = every | selectattr('entry.kind', 'equalto', 'done') | list | length %} {%- set marked = every | length - closed %}

{{ rule_mark('seen') }}Accepted

{{ [(closed ~ ' done') if closed else '', (marked ~ ' seen') if marked else ''] | select | join(' and ') }} on {{ accepted | length }} {{ 'node' if accepted | length == 1 else 'nodes' }}, the longest standing first.

{%- for path, group in accepted %} {%- set back = url_for('handled', node=path) ~ '#pinned-node' %} {%- set place = loop.index %}

{{ path }}{% set shown = group[0] | node_title %}{% if shown %} {{ shown | markdown_inline(node=path) }}{% endif %}

{%- for row in group %} {%- if row.slug %} {%- set subject %}{% if row.line %}{{ row.line | markdown_inline(node=path) }} — this line{% else %}A line not reported now{% endif %}{% endset %} {{ pin_block(row.entry, 'line', path, row.slug, 'seen-' ~ place ~ '-' ~ loop.index, may_done if row.entry.kind == 'done' else may_seen, subject=subject, record=true, next=back, of=path, fails=row.fails, event=row.event) }} {%- else %} {%- set subject %}Its own failure{% endset %} {{ pin_block(row.entry, 'node', path, '', 'seen-' ~ place ~ '-' ~ loop.index, may_seen, subject=subject, record=true, next=back, of=path, fails=row.fails) }} {%- endif %} {%- endfor %}
{%- endfor %}
{%- endif %} {#- **Silenced** (ADR-0144): every silence that stands, grouped under its node's path as the acknowledgments are, the longest standing first — each its block, with its level and its deadline, who silenced it and when under its note, and for whoever may silence a failure *Edit* and *Clear*. One whose part is not reported now is listed too: it holds nothing until it is, and ends at its deadline. -#} {%- if silenced %} {%- set held = silenced | map(attribute=1) | map('length') | sum %}

{{ rule_mark('silenced') }}Silenced

{{ held }} silenced on {{ silenced | length }} {{ 'node' if silenced | length == 1 else 'nodes' }}, the longest standing first.

{%- for path, group in silenced %} {%- set back = url_for('handled', node=path) ~ '#pinned-node' %} {%- set place = loop.index %}

{{ path }}{% set shown = group[0] | node_title %}{% if shown %} {{ shown | markdown_inline(node=path) }}{% endif %}

{%- for row in group %} {%- if row.slug %} {%- set subject %}{% if row.line %}{{ row.line | markdown_inline(node=path) }} — this line{% else %}A line not reported now{% endif %}{% endset %} {{ pin_block(row.entry, 'line', path, row.slug, 'silenced-' ~ place ~ '-' ~ loop.index, may_silence, subject=subject, record=true, next=back, of=path, fails=row.fails) }} {%- else %} {%- set subject %}Its own part{% endset %} {{ pin_block(row.entry, 'node', path, '', 'silenced-' ~ place ~ '-' ~ loop.index, may_silence, subject=subject, record=true, next=back, of=path, fails=row.fails) }} {%- endif %} {%- endfor %}
{%- endfor %}
{%- endif %} {#- **By a rule** (ADR-0137): every configured rule, the longest standing first, each its block — what it makes of the part it picks, its note, where it is written and since when — and beneath it what it changes the count of now, each part linked to where it stands; or *changes nothing now* and what it missed: nothing picked, a rule written before it deciding where it picks, a path it would pick with case folded. No buttons: a configured rule is changed in the configuration. -#} {%- if by_rule %}

{{ rule_mark('aggregation') }}By a rule

{{ by_rule | length }} {{ 'rule' if by_rule | length == 1 else 'rules' }} configured, the longest standing first.

{%- for row in by_rule %}

{{ row.rule.name }}

{{ config_block(row.at, row.rule.level, '/', 'by-rule-' ~ loop.index, index=true) }}

{%- if row.acting %}It changes the count of {{ row.parts }} {{ 'part' if row.parts == 1 else 'parts' }} now: {% for path, lines in row.acting %}{{ path }}{% if lines %} — {{ lines }} {{ 'line' if lines == 1 else 'lines' }}{% endif %}{{ ', ' if not loop.last else '.' }}{% endfor %} {%- elif not row.picked and not row.folded %}It picks nothing now. {%- else %} {%- if row.picked %}It picks {{ row.picked }} {{ 'place' if row.picked == 1 else 'places' }} now and changes no count there{% if row.over %}: {% for path, name in row.over %}at {{ path }} the rule {{ name }}, written before it, decides{{ '; ' if not loop.last }}{% endfor %}{% endif %}.{% else %}It picks nothing now.{% endif %} {%- if row.folded %} With case folded it would pick {% for path in row.folded %}{{ path }}{{ ', ' if not loop.last }}{% endfor %}.{% endif %} {%- endif %}

{%- endfor %}
{%- endif %}
{% include '_page_end.html' %}