{#- A node's head, the parts every head shares — the state a head says, its time, its controls and its own icons — and the head of a node's page, the top of the frame that page draws its node in (ADR-0127 decision 8). One partial for the wall's grid (`_status_grid.html`) and a leaf's own page (`check.html`), so that the two pages draw the node they are about from one macro and cannot drift apart; and a partial of macros alone, since importing a template runs its body (the `_status_cue.html` lesson). Imported `with context`, for the reader's rights, the pins above the node and the line a page was asked for. -#} {% from '_status_cue.html' import status_cue %} {% from '_next_update.html' import next_update %} {% from '_rule_block.html' import pin_block, pins_above_stated, rule_mark, icon_mark, config_block, door_link, door_mark with context %} {% from '_own_lines.html' import own_lines with context %} {#- What is being silenced (ADR-0032 rule 5: a transformed contribution is visible and attributable). A card that says only "maintenance" hides the transform — *we are silencing an error* is the thing worth knowing, and before the keystone it was not merely hidden but destroyed. Shown wherever a node's own status has been derived away from a countable reading, by a node pin or by every member being pinned; a check that reported ``MAINTENANCE`` itself has nothing to add. And only where the node **shows** *maintenance*: one whose lines are all silenced shows what the nodes beneath it roll up to, and has no *maintenance* for the reading to stand under (ADR-0124) — its silenced lines and their count say it there. ``word`` includes the status word for surfaces that do not already print it. **A damping counter is the same kind of fact and takes the same slot**: the node shows what it read and its parent is still counting the quieter value, so the card says how many readings are in and how many the deployment asked for. A red leaf under a green parent is what a broken roll-up looks like, and this is the sentence that tells the two apart. Same ink as the maintenance suffix — the transform is one idea and it should not look like two. **So is a shield** (ADR-0084), at the check's mount where its marker sits: the node shows what it read, its parent counts nothing of it while the dependency it is reached through fails, and its rail says so in the undefined ink (ADR-0143) — so the words say why, beside the state: *· reached through vpn*, the dependency's name, its path and the rest of the About card's sentence in the tooltip. -#} {% macro reported_suffix(node, word=False) -%} {%- if node.code.name == 'MAINTENANCE' and node.own_code.name == 'MAINTENANCE' and node.reported_code.name not in ('MAINTENANCE', 'UNDEFINED') %} {% if word %}maintenance {% endif %}· {{ node.reported_code.name.lower() }}{% endif -%} {%- if node.damping %} · {{ node.damping.seen }} of {{ node.damping.needed }} to escalate{% endif -%} {%- if node.shielded_by %} · reached through {{ node.shielded_by.rstrip('/').rsplit('/', 1)[-1] or node.shielded_by }}{% endif -%} {%- endmacro %} {#- What acts on a node's own part, beside its head's state (ADR-0143): the job's mark — the ringed check of a person's acceptance, § of a configured rule while it changes what the node passes up or what its parent counts of it among its children — on its own tint, as a status sign is drawn, since a head stands on its box's fill, vivid where the node counts its failure for itself. Its color is what the node's own part counts as: an accepted failure as ok, or as the warning a reading past its tolerance escalates to (ADR-0142 decision 2), a silenced one as its level holds it — ok, or a warning at most — through every recovery while the silence stands, and as a warning wherever its reading went stale, recovered or not (ADR-0144), and a rule's what its table makes of the node. Maintenance has none: its state says *maintenance* already, and an acknowledgment on a node in maintenance decides nothing. Its words are its title and its hidden text. **It is a door** (ADR-0147 decision 7): a link to the node's *Notes* tab at the block it marks, `?at=` its job, where the block says it whole and is changed; on the kiosk, which has nothing to be clicked, and on the root, which has no tab, the mark alone. -#} {% macro head_marks(node) -%} {%- set door = layout != 'kiosk' and node.path | url_branch -%} {%- set tag = 'a' if door else 'span' -%} {%- if node.acknowledgment and node.code.name != 'MAINTENANCE' -%} {%- set entry = node.acknowledgment -%} {%- if entry.kind == 'silenced' -%} {%- set failing = node.own_code.name in ('WARN', 'ERROR') -%} {%- set counts = 'warn' if node.own_stale or (failing and entry.level.name == 'WARN') else 'ok' -%} {%- set said %}silenced by {{ entry.set_by or 'an admin' }} until {{ entry.expires_at | localtime }} · its own part counts as {{ counts }} above{% endset -%} {%- else -%} {%- set counts = 'warn' if node.own_stale else 'ok' -%} {%- set said %}{{ entry.kind }} by {{ entry.set_by or 'an admin' }}, until it changes{% if entry.expires_at %} or {{ entry.expires_at | localtime }}{% endif %} · its own failure counts as {{ counts }} above{% endset -%} {%- endif -%} <{{ tag }} class="ls-sign ls-sign--{{ counts }} head-mark head-ack"{% if door %} data-door href="{{ url_for('notes', path=door, at=entry.kind) }}#at"{% endif %} title="{{ said[:1] | upper }}{{ said[1:] }}">{{ rule_mark(entry.kind) }}{{ said }}{{ tag }}> {%- endif -%} {%- for at in (node.rule, node.parent_rule) if at and at.changes -%} {%- set counts = at.counts.name.lower() if at.counts else 'nothing' -%} {%- set said %}counts as {{ counts }} above by the rule {{ at.rule.name }}{% endset -%} <{{ tag }} class="ls-sign ls-sign--{{ 'undefined' if counts == 'nothing' else counts }} head-mark head-rule"{% if door %} data-door href="{{ url_for('notes', path=door, at='rule') }}#at"{% endif %} title="{{ said[:1] | upper }}{{ said[1:] }}">{{ rule_mark('aggregation') }}{{ said }}{{ tag }}> {%- endfor -%} {%- endmacro %} {#- Observation time (ADR-0027): *when* beside *what*. Shown only when the node has an unambiguous answer to "when did the check behind this node run?" — its own last write, or the run time of the single check below it — and rendered as a time of day at **minute precision** — seconds saved no information worth the row width — so a wall of cards stays scannable. A container above two or more checks has no single answer, so it shows **nothing** rather than a placeholder: absence is the signal. The time shows on the **topmost node visible in the current view** and is suppressed below, where it would be identical (ADR-0044) — safe because an ancestor carries a stamp only where a single check owns everything beneath it, so an identical value below can only be the same run; ``shown`` is the ancestor's displayed rendering, compared at display precision. It sits inside the poll fragment, so it refreshes with the grid; the freshness *alarm* stays the stale badge (ADR-0005), normalized per node against the tolerance the server applied rather than against an absolute age — a check's period implies one, and a node with no period may state one (ADR-0081). -#} {% macro card_time(node, shown="") -%} {%- if node.timestamp -%} {%- set moment = node.timestamp | localtime("%H:%M") -%} {%- if moment != shown %}{{ moment }}{{ next_update(node.run.next_run_at if node.run else none, moment) }}{% endif -%} {%- endif -%} {%- endmacro %} {#- The head's own buttons (ADR-0127 decision 3), first in its toolbar: ↗ to the node's page, the healthy fold's funnel where the node has a healthy child or line, ▤ where it has children, and last **◇, the node's door** (ADR-0147 decisions 1 and 2): a link to its *Notes* tab, where every kind is set and a standing pin changed, lit with the number of parts handled at and beneath the node (`door_of`, read from the unfiltered tree as the band's pill is) and plain where nothing is — for every reader, `may` saying whether this one may set something there, which its words follow. The server draws each as the first look has it — the funnel pressed where the node's configured fold is on (`folds`, ADR-0128) — and hands the counts a press would fold (`data-n`, the configured fold's, and `data-n-pressed`, a press's, which takes the `show_when_quiet` claims too); `tree.js` draws the one in force, the pressed state, `mixed` and `.is-changed`. A page's own node has no ↗, being that page, and the root, which has no *Notes* tab, no ◇. None on the kiosk, which has nobody to press them (decision 7): there ◇ is a mark where it is lit (`node_controls`). Under the looks whose toolbar shows only under the pointer a lit ◇ stands in the state cluster instead (`state_door`), and the toolbar carries none. -#} {% macro chips_drawn(kid_faces) -%} {%- if kid_faces | select | list | length == kid_faces | length %}true{% elif not kid_faces | select | list %}false{% else %}mixed{% endif -%} {%- endmacro %} {% macro node_icons(node, kid_faces, fold, may=false, page_root=false, folds=false) -%} {%- if layout != 'kiosk' -%} {%- endif -%} {%- endmacro %} {#- **Where a lit ◇ stands** (ADR-0147 decision 1). Under the looks whose toolbar shows only under the pointer — `pointer`, the library's, and `pointer-name` (ADR-0029) — a lit ◇ stands in the state cluster, at its start, where a card's pip stood, at rest and under the pointer alike: a door there, as everything that says handled is (decision 7), its own stop for the keyboard, and the toolbar carries no second while it is lit. A plain ◇, which says nothing at rest, stays in the toolbar and shows with it. So nothing shows twice, nothing moves under the pointer, and the toolbar still shows all or nothing. Under the other looks, whose toolbar always shows, ◇ stands in the toolbar lit or plain. A closed card, a chip in a card's place, draws its controls none, and this with them (`overview.css`): its counts say what is handled. -#} {% macro door_in_state(node) -%} {{- 'yes' if layout != 'kiosk' and look_values.head_buttons in ('pointer', 'pointer-name') and node.path | url_branch and door_of(node).count else '' -}} {%- endmacro %} {% macro state_door(node, may=false) -%} {%- if door_in_state(node) %}{{ door_link(node.path, node.path, door_of(node), cls='door-mark state-door', may=may, mark=true) }}{% endif -%} {%- endmacro %} {#- The healthy fold's count (ADR-0127 decision 4), after a node's children and lines: *✓ +N ok*, where the node has a healthy child or line, as the funnel is. `tree.js` shows it while the fold is in force, N the fold's; where the node's configured fold is on (ADR-0128) the server writes it as `tree.js` will, and `data-fold-drawn` shows it from the first paint where the page has its scripts (`overview.css`) — without them it does nothing and stays hidden. -#} {% macro ok_mark(fold, folds=false) -%} {%- if fold[1] -%} {%- if folds and fold[0] %} {%- else %}{% endif -%} {%- endif -%} {%- endmacro %} {#- The head's controls, one toolbar (decision 3): the head's own icons first — ↗, which opens the node's page, then the funnel and ▤, then ◇ — so that on every head the button that opens the node's page is the first after its name; then the node's actions, the `node.actions` slot (ADR-0034) in `.node-actions` — an action that names an icon a square like the head's own, one that names none a labelled chip (`_config_action.html`) — and ⋯, `hidden` until `tree.js` folds behind it the actions the row has no room for. The slot is offered on every node's box, open or closed, with `place` beside `surface` so a filler can tell a card's head from a nested box's and from a page's frame, and the kiosk gets no control at all (decision 7): there no toolbar is drawn, and ◇ lit with its number stands after the state as a mark (ADR-0147 decision 1), so that a kiosk's head still says what is handled at and beneath it. One control of the toolbar is its tab stop, `tree.js` moving it with the arrow keys and keeping it by node through a swap; `aria-label` names the node. The macro draws the rest of the row after the name with it, in the order the look `head_buttons` puts it in (ADR-0029): the row's middle, the title, which the caller hands over as `middle`, and the state cluster the caller draws, which is no control and stands outside the toolbar. Under `pointer`, the library's, and `pointer-name` the toolbar follows the name and the title and the state follow it; under `line` and `name` the title and the state follow the name and the toolbar comes last — at the row's end under `name`, on a line of its own beneath the row under `line` (`overview.css`). -#} {% macro node_controls(node, kid_faces, fold, place, middle='', may=false, page_root=false, surface='grid', folds=false) -%} {%- if layout == 'kiosk' -%} {{ middle }}{{ caller() }}{% if node.path | url_branch %}{{ door_mark(door_of(node)) }}{% endif %} {%- else -%} {%- set actions = slot('node.actions', node=node, surface=surface, place=place) -%} {%- set toolbar -%} {{ node_icons(node, kid_faces, fold, may=may, page_root=page_root, folds=folds) }}{{ actions }} {%- if actions | trim %}{% endif -%} {%- endset -%} {%- if look_values.head_buttons in ('pointer', 'pointer-name') %}{{ toolbar }}{{ middle }}{{ caller() }} {%- else %}{{ middle }}{{ caller() }}{{ toolbar }}{% endif -%} {%- endif -%} {%- endmacro %} {#- **The head of a node's page** (ADR-0127 decision 8): the top of the frame the page draws its node in, on a branch's page and a leaf's alike. The page is the same tree as the wall, rooted at this node, and the node itself is always open. **Its row is the row a box draws** (ADR-0127 decision 3): the cue and the name — the page's heading for the node, and no toggle, since nothing closes the node its page is about — the title in the middle, the state cluster, and the controls where the look `head_buttons` puts them: the head's icons first, the funnel where the node has a healthy child or line, ▤ where it has children and ◇, the node's door (ADR-0147) — no ↗, this being its page — then the node's actions (`place` `frame`) and ⋯. **It says what the node rolls up to** (ADR-0123 decision 1): the status its card says on the page above, so a node is one status wherever it is read; and **whose the status is, the fill says**, as a card's does (decision 2) — pale where it comes from beneath the node, `derived`, vivid where the node counts it for itself: a failure of its own, its own reading gone stale, a leaf's every status. A node that declares nothing is the plain case of the first. The head is the topmost visible node of the page, so its observation time shows here and the cards beneath suppress an identical one (ADR-0044). Beneath the row, what the head says about the node before its lines: **the rules acting on the node** — its `description`, its check's account of what it reads, stands first in its *About* card beside its facts now (ADR-0133 decision 1) — a list whose rows are its blocks (ADR-0104 decisions 2 and 8): a pin set on a node above it first, outermost first and without buttons, since it is edited where it stands, then the node's own, *also in maintenance on its own* under one. The page's frame is the border decision 8 runs round every line a pin covers, so the rows head the frame and the lines stand inside it with no border of their own. Nothing new is set here: a new pin, a seen, a silence, a done or a note is set on the node's *Notes* tab, which ◇ opens, and a standing one is changed where its block stands (ADR-0147 decision 1, ADR-0104 decision 4). `beneath` says the node has nodes beneath it, read before a filter drops one. **Its lines, as the node's own page lists them** (`own_lines`, ADR-0036 decision 12): in full rather than clamped to `reason_cap` — this is where a reader comes when the card is not enough — in the check's order, each with its record, and each with its one seat at its end, a line's ◇ or the mark of what handles it, for whoever may set something there. Its healthy ones carry `data-healthy`, which the funnel folds. And **the damping counter in words**, where the node holds a worse reading back: what it shows meanwhile and what the level above still counts — which the state's *2 of 3 to escalate* does not say. The leaf page's *Stale — last observed …* went: the state says *stale · 3 min ago*, as on every box, and the Time card when the node was last observed. -#} {% macro frame_head(node, pinning, path, kid_faces, fold, surface='grid', beneath=false, folds=false) -%} {%- set above = pins_above | length %} {%- set rail = node_rail(node) %}
Showing {{ node.damping.pending.name.lower() }} — {{ node.damping.seen }} of {{ node.damping.needed }} consecutive readings before this escalates{% if node.contribution and node.contribution.code %}, so the level above still counts {{ node.contribution.code.name.lower() }}{% endif %}.
{%- endif %}