{#- A rule at the contribution boundary, stated where it acts (ADR-0104). Maintenance is the first kind and today the only one: a pin on a node, or on one of its lines. The block is the one statement of it wherever it shows — who put it in maintenance, until when and what is left, its note in full, and for an admin *Edit* and *Clear* — and a pin is edited where its block stands. *Edit* is the browser's own disclosure, so every editor works without script and pinned stays a read state (ADR-0014 decision 16); the stylesheet is what makes the open editor stand in for the note and the buttons. **On the wall the block is the button** (ADR-0147 decision 7, `wall_block`): its mark and its sentence, one link to its node's *Notes* tab at it, where its note, *Edit* and *Clear* stand in the drawer — and only while *◇ details* is on (decision 6). A node's page and the *Handled* page state it whole. Every block's edge is dashed — nothing else on the wall has one — and only a rule that paints its node fills its block. **The kind is data** (decision 8): `data-rule` on the block picks its tint in the stylesheet, `rule_mark` draws its mark, and a rule an admin set is the one that carries buttons — a viewer, and one day a rule the configuration declares, gets the block without them. A second kind is a second value of each and a row beside this one, never a second component. `path` and `slug` address the pin as `POST /pins/maintenance` reads them (`slug` empty for the node's own), and `prefix` keeps an editor's field ids unique on a page that may carry hundreds of them. Imported `with context`, for the deployment's default window and its timezone that the fields print. **A block in a branch's head stands in what the refresh swaps** (decision 7), so the refresh waits while one of these editors is open: what `poll.js` looks for is an open disclosure around a `form.maintenance-editor-form`, which is the shape both macros below write. Each such form opens on a line that says the pause where its cause is, *updates paused*, which the stylesheet shows while the form's editor stands open in what `poll.js` swaps — the stamp keeps its width (ADR-0147 decision 4). -#} {% from '_maintenance_fields.html' import maintenance_fields, schedule_fields, silence_fields, done_fields with context %} {#- The kind's mark: maintenance pauses, ‖, a failure accepted — *seen* — is a ringed check (ADR-0135 decision 2, ADR-0142), and a configured rule is §, which says where a rule is written rather than what it does (ADR-0135 decision 1, ADR-0137), drawn as a path to the cues' height. A failure silenced is a bell struck through (ADR-0143 decision 2, ADR-0144). -#} {% macro rule_mark(kind) -%} {%- if kind == 'silenced' -%} {%- elif kind in ('seen', 'done') -%} {%- elif kind == 'maintenance' -%} {%- elif kind == 'aggregation' -%} {%- endif -%} {%- endmacro %} {#- What is handled beneath a closed node, the index of it (ADR-0135 decisions 6 and 8) and the kiosk's door (ADR-0147 decision 1): a ringed diamond, in `currentColor` as the marks are; decorative, its words in the tooltip and the accessible name of what carries it. -#} {% macro handled_mark() -%} {%- endmacro %} {#- A note's mark, a speech bubble: the *Notes* tab's own kind, *Note*, in its form's choice. Decorative; the choice's word says it. -#} {% macro note_mark() -%} {%- endmacro %} {#- The marks of a head's own buttons (ADR-0127 decision 3), drawn from `currentColor` as the rule mark is, so they hold on every surface in every theme: ↗ for the node's page, the healthy fold's funnel, ▤ for the children as chips, ◇ for the node's door to its *Notes* tab (ADR-0147), and ⋯ for the node's actions that did not fit the head's row. Decorative; each button's `aria-label` says what it does. A page draws the shapes once, `icon_sprite`, outside the grid the refresh swaps, and each mark refers to its shape — three buttons on every open head would otherwise carry a kilobyte of paths each in every fragment. -#} {% macro icon_sprite() -%} {%- endmacro %} {% macro icon_mark(kind) -%} {%- endmacro %} {#- **One door, ◇** (ADR-0147 decisions 1 and 2): a link to a node's *Notes* tab, where every kind is set and a standing pin changed, for every reader — whoever may set nothing (`may` false) reading what it opens, its words saying so. On a head it is lit with the number of parts handled at and beneath the node, `door` (`tree.DoorCount`), whose words are its tooltip and its accessible name, and plain where nothing is; the tab opens at its top. A line's door, `slug`, stands in the line's seat for whoever may set something on it, opens the tab's form on that line and is never lit: where something handles the line, its mark is its door (`line_mark`). `cls` is the control's look, a head's square or a line's seat. A mark that is a door says so with `data-door` (`line_mark`, `head_marks`), ◇ with `data-control="door"` — and a lit ◇ that stands in the state cluster with the marks, as it does under the looks whose toolbar shows only under the pointer (`state_door`), with both (`mark`). -#} {% macro door_link(path, name, door=none, slug='', cls='node-icon', may=false, mark=false) -%} {%- set lit = door.count if door else 0 -%} {%- set words = door.words if door else '' -%} {%- if slug -%} {%- set href = url_for('notes', path=path | url_branch, reason=slug) ~ '#add-note' -%} {%- set title = 'Handle this line' -%} {%- set label = 'handle this line of ' ~ name -%} {%- else -%} {%- set href = url_for('notes', path=path | url_branch) -%} {%- set title = ('Handle it' if may else 'Notes') ~ (' — ' ~ words if words else '') -%} {%- set label = ('handle ' if may else 'the notes of ') ~ name ~ (' — ' ~ words if words else '') -%} {%- endif -%} {{ icon_mark('door') }}{% if lit %}{{ lit }}{% endif %} {%- endmacro %} {#- The door on the kiosk, which draws no controls (ADR-0147 decision 1): ◇ lit with its number where something is handled at or beneath the node, a mark and no button, its words its tooltip and its hidden text; nothing where nothing is. -#} {% macro door_mark(door=none) -%} {%- if door and door.count -%} {{ handled_mark() }}{{ door.count }} — {{ door.words }} {%- endif -%} {%- endmacro %} {#- The line at the top of an editor's form that says the page waits for it, *updates paused* (ADR-0147 decision 4): the stylesheet shows it while the editor stands open in what `poll.js` swaps, in the frame it opens in, and never on a page that nothing refreshes. -#} {% macro paused_line() -%}
updates paused
{%- endmacro %} {#- An instant in the block's words, each word of it kept whole: the date and the time of day, or whatever the deployment's `time_format` writes between spaces. A block's sentence wraps where it must — a card on the wall is narrow — and a hyphen is a place for a line to end: *until 2026-10-*, and the day on the next line with the time. Between the words a line may end, as anywhere in a sentence, so nothing here is wider than what it stands in. -#} {% macro instant(value) -%} {%- for word in (value | localtime).split() -%} {{ word }}{% if not loop.last %} {% endif %} {%- endfor -%} {%- endmacro %} {#- Who pinned it, and who changed it last where that is somebody else's write: the block's sentence names only the last. An acknowledgment was marked, in its kind's word (ADR-0142), and a silence silenced (ADR-0144). -#} {% macro pin_record(entry) -%} {% if entry.kind == 'maintenance' %}Pinned{% elif entry.kind == 'silenced' %}Silenced{% else %}Marked {{ entry.kind }}{% endif %} by {{ entry.created_by or 'unknown' }} {{ instant(entry.created_at) }}. {%- if entry.set_at != entry.created_at %} Last changed by {{ entry.set_by or 'unknown' }} {{ instant(entry.set_at) }}.{% endif %} {%- endmacro %} {#- A pin, stated. `scope` is what it holds — `node` or `line` — and `also` marks a line's pin under its node's: the line stays quiet when the node's pin ends, which is the one thing the block has to add there. `tag` is `li` where the block is a row of a node's rule list. Where the block stands says what it covers, so what its sentence opens with is the place's to say (`subject`): on a node's own page it is *This node* or *This line*, and on *Handled*, where the block stands under a path and away from its line, *The whole node* or the line itself. There `record` puts the pin's authors under the note for everyone — the page has room for the whole reading, and a viewer has no editor to find it in — `next` brings a saved edit back to the page, and `of` names the node in the buttons' names: a page of many blocks is a page of many Edits. A card on the wall is the third place: its head names the node already, so the sentence opens with what was done to it (`bare`) — *In maintenance by* — and says nothing twice. `wall` is every block the wall draws, a box's beside a card's: the button that opens the drawer at it (`wall_block`), its note and its buttons the drawer's. The stored placeholder `maintenance` is the absence of a note, not a note somebody wrote, so it is neither shown nor offered as the source to edit; a blank note on an edit keeps the stored text (ADR-0014 decision 15), so leaving it blank writes the placeholder back. `source` is the node a pin **above** this one stands on, which holds it with everything else beneath that node (ADR-0041): the block is stated where it acts as well as where it was set — *This node is in maintenance from /nexus/qnap* — linked to that node's page, and `pins_above_stated` states it without buttons, since a pin is edited where it stands (ADR-0104 decision 2). **An acknowledgment is the same block in its kind's words** (ADR-0142 decision 6, ADR-0144, ADR-0104 decision 8): `data-rule` its kind, which takes no fill, its mark the ringed check or the bell struck through, its sentence `ack_said`, its record *Marked seen by* or *Silenced by*, and its editor the ringed check's, `ack_forms`, where the kind may change — to *done* as well, where the part is a line whose failure is an event that fails now, its occurrence `event` (ADR-0146). Its note's mark is keyed by its kind beside its part, so that a part's maintenance and its acknowledgment each open their own. `at` is the block a *Notes* tab was asked at, `?at=` its kind on the line `?reason=` names (ADR-0147 decision 3): a mark's door lands there, so the block carries the page's one anchor `at`, and its editor stands open for whoever may change it. `ran` is what has run of a series, which its note counts and a *Notes* tab hands in (`notes_tab.Ran`, ADR-0150): its schedule's row ends in it — *· 3 windows ran, the last closed by hand, by pan*. -#} {% macro pin_block(entry, scope, path, slug, prefix, editable, also=false, tag='div', subject='', record=false, next='', of='', bare=false, source='', wall=false, fails=true, event='', at=false, ran=none) -%} {%- if wall -%} {{ wall_block(entry, scope, path, slug, bare=bare, source=source) }} {%- else -%} {%- set kept_kind = entry.kind == 'maintenance' -%} {%- set series = kept_kind and entry.schedule is not none and not entry.schedule.is_one_off -%} {%- set opened = entry | series_open if series else none -%} {%- set ends = entry | ends -%} {%- set note = entry.note if entry.note != 'maintenance' or not kept_kind else '' -%} {%- set named %} this {{ scope }}'s {{ 'schedule' if series else entry.kind }}{% if of %}, {{ of }}{% endif %}{% endset -%} {%- set window_named %} this {{ scope }}'s window{% if of %}, {{ of }}{% endif %}{% endset -%} <{{ tag }}{% if at %} id="at"{% endif %} class="rule-block rule-block--{{ scope }}{{ ' rule-block--series' if series }}{{ ' is-at' if at }}" data-rule="{{ entry.kind }}">{{ pin_record(entry) }}
{%- endif %} {{ tag }}> {%- endif -%} {%- endmacro %} {#- What has run of a series that stands, at the end of its row (ADR-0150): how many of its windows closed, and how the last closed — *· 3 windows ran, the last closed by hand, by pan* — where a *Notes* tab hands it in (`notes_tab.Ran`). -#} {% macro windows_ran(ran) -%} {%- if ran %} · {{ ran.windows }} ran, the last closed{% if ran.how %} {{ ran.how }}{% endif %}{% if ran.by %}, by {{ ran.by }}{% endif %}{% endif -%} {%- endmacro %} {#- Who has a maintenance window open, until when, and what is left (ADR-0104 decision 1): the pin's last writer, or for a series the one who set it — whose schedule the window is — and, where the window open was extended, who extended it (#35's note, decision 5): *by anna until 2026-11-01 07:00, extended by lex · 1h 20m left*. The time left is the window's alone; the schedule's end stands in its sentence and never counts down. -#} {% macro window_by(entry, opened, ends) -%} {%- set series = opened is not none or (entry.schedule is not none and not entry.schedule.is_one_off) -%} by {{ (entry.created_by if series else entry.set_by) or 'an admin' }} until {{ instant(ends) }}{% if opened is not none and opened.extended_by %}, extended by {{ opened.extended_by }}{% endif %} · {{ ends | time_left }} {%- endmacro %} {#- A maintenance entry's editor in its block (ADR-0104 decision 4; ADR-0150, landing 4): the browser's own disclosure, *Edit*, holding the entry's editor with every field filled (`schedule_fields`, `app._editor_of`) — a one-off's, a series', and one planned — and *Save changes*. A series' shapes the windows to come: the window open now keeps its end, which only *Extend* and *End now* change. `described` is the row it stands in, the block's sentence or its schedule's. -#} {% macro entry_edit(entry, path, slug, prefix, named, next, described, at=false) -%}{{ pin_record(entry) }}
{%- endif %} {{ tag }}> {%- endmacro %} {#- **A block on the wall is the button that opens the drawer at it** (ADR-0147 decision 7): one link to the *Notes* tab of the node its pin stands on, at that pin — `?at=` its kind, `?reason=` its line — the drawer with script, the tab without; a door as every mark is (`data-door`). Its sentence is its name, so that what a screen reader hears is what the block says and what a click opens is what it describes, and it ends in a chevron. The note, *Edit* and *Clear* are the drawer's, where the block stands whole. The source of a pin set above is named in it and not linked: the drawer it opens is that node's, whose head names it and links to its page. On the kiosk, which has nothing to be clicked, it is its sentence alone. It stands on the wall only while *◇ details* is on (decision 6): the route leaves it out of what it draws otherwise (`handled_details`). -#} {% macro wall_block(entry, scope, path, slug, bare=false, source='') -%} {%- set kept_kind = entry.kind == 'maintenance' -%} {%- set door = layout != 'kiosk' and path | url_branch -%} {%- set href = url_for('notes', path=path | url_branch, reason=slug, at=entry.kind) if slug else url_for('notes', path=path | url_branch, at=entry.kind) -%} <{{ 'a' if door else 'div' }} class="rule-block rule-block--{{ scope }} rule-block--wall{{ ' rule-block--door' if door }}" data-rule="{{ entry.kind }}"{% if door %} data-door href="{{ href }}#at"{% endif %}> {{ rule_mark(entry.kind) }}{% if not kept_kind %}{{ ack_said(entry, scope, '', bare, path) }}{% else %}{% if bare %}In maintenance{% else %}This {{ scope }} is in maintenance{% endif %}{% if source %} from {{ source }}{% endif %} {{ window_by(entry, entry | series_open, entry | ends) }}{% endif %} {%- if door %}{% endif %} {{ 'a' if door else 'div' }}> {%- endmacro %} {#- Where a configured rule is written and since when it stands (ADR-0137): who set it is its file, in its root, and its history the repository's. -#} {% macro config_record(rule) -%} Configured in{{ rule.file }} since {{ rule.since.isoformat() }}.
{%- endmacro %}
{#- A configured rule, stated where it acts (ADR-0137, ADR-0104 decision 8): its
mark, §, and its sentence — what it makes of its part at `place`, while fewer
than its count fail and how many do, by which rule — its note and where it is
written. Its kind is data as a pin's is: `data-rule="aggregation"`, no fill of
its own, the node's color running through it under the dashed edge (ADR-0135
decision 5), and **no buttons**: a configured rule is changed in the
configuration, the program never writing `config/`, so the block says where.
`place` is `node` — what the node passes up — `lines`, `children`, or
`counted`, how its parent counts it among its children (`parent` names that
node). On the wall (`wall`) the block stands only while its rule changes a
count, the button that opens the drawer at it as a pin's is, and the sentence
names no node, the box's head doing so; on a node's page and in *Handled* it
stands always,
whole, `this` naming the node, and says *changes nothing now* where its rule
does not act. `others` are the rules written for the same place that the first
one written decides over (ADR-0137 decision 3). In *Handled* (`index`) the
sentence names the part the rule picks by its path, and no one part's count.
`here` is the block a *Notes* tab was asked at, as a pin's `at` is. -#}
{% macro config_block(at, place, path, prefix, wall=false, this='', tag='div',
parent='', others=(), index=false, here=false) -%}
{%- set said = rule_said(at.rule, place, failing=none if index else at.failing, this=this, path=at.rule.selector if index else '', parent=parent) -%}
{%- if wall -%}
{#- On the wall a configured rule's block is the button that opens the drawer at it,
as a person's is (ADR-0147 decision 7): one link to its node's *Notes* tab at its
block under what stands (`?at=rule`, the rule by its key, `?rule=`), its sentence
its name, a chevron at its end; its note is the drawer's. -#}
{%- set door = layout != 'kiosk' and path | url_branch -%}
<{{ 'a' if door else 'div' }} class="rule-block rule-block--node rule-block--wall{{ ' rule-block--door' if door }}{{ ' rule-block--idle' if not at.changes }}" data-rule="aggregation" data-rule-name="{{ at.rule.name }}"{% if door %} data-door href="{{ url_for('notes', path=path | url_branch, at='rule', rule=at.rule.key) }}#at"{% endif %}>
{{ rule_mark('aggregation') }}{{ said | markdown_inline(node=path) }}{% if not at.changes %} · changes nothing now{% endif %}
{%- if door %}{% endif %}
{{ 'a' if door else 'div' }}>
{%- else -%}
<{{ tag }}{% if here %} id="at"{% endif %} class="rule-block rule-block--{{ 'line' if place == 'lines' and not this else 'node' }}{{ ' rule-block--idle' if not at.changes }}{{ ' is-at' if here }}" data-rule="aggregation" data-rule-name="{{ at.rule.name }}">
{{ config_record(at.rule) }}{% if others %} Written for this place too, and decided over by it as the first written: {% for other in others %}{{ other.name }} in {{ other.file }}{{ ', ' if not loop.last }}{% endfor %}.{% endif %}
{{ rule_mark('seen') }}Mark seen or silence {% if what %}{{ what }}{% elif scope == 'line' %}this line{% else %}this node's own failure{% endif %}.
{{ ack_parts(parts) }} {{ ack_forms(scope, path, slug, prefix, digest=digest, next=next) }}