{#- The two authored fields shared by every maintenance set/edit form. The note
— the pin's own text, `note` since ADR-0047's rename — is raw Markdown source,
never rendered DOM round-tripped back into a control, so it is a textarea even
when today's explanation happens to be one line.
`prefix` keeps labels unique on the member page, which may carry hundreds of
editors. The duration-or-expiry value deliberately stays one line, and the
click-opened help makes its exact grammar discoverable without a hover gesture
or a second client-side parser.
What the expiry field holds is the caller's (ADR-0104 decision 5). A **new**
pin's is empty, and blank keeps the ADR-0014 configured-default rule. An
**edit** passes the stored expiry twice — as `duration`, which fills the field,
and as `expiry_was`, which the form carries hidden — and the route keeps the
stored instant while the two still agree. The sentence under the field says so
only while it is true of what the field shows: a refusal's page may carry
`expiry_was` beside text the admin typed.
**A ringed check's fields** (`ending`, ADR-0142) are the same two, the second an
end the acknowledgment may be given: blank, it has none, and ends as what it
accepted changes.
**A window's start** (ADR-0150): where `starts` is given — the form for a new
window, and a planned window's editor — *Starts* stands before the end, in the end
field's grammar and read as it is, blank meaning now; a duration in the end field
then counts from the start, and the end is at most a year from now. A planned
window's editor passes its start twice, as `starts` and `starts_was`, as it does
its end, and the route keeps the stored instant while the two agree. A maintenance
entry's editor is `schedule_fields` below, whose *Starts* an open one-off keeps
too, blank, since its start has passed and a repeat chosen starts the windows to
come at it: with script it shows once a repeat is chosen, and without it stands
with its hint to leave it blank unless one is. -#}
{% from '_schedule_preview.html' import schedule_preview %}
{% macro kept_hint(maintenance_default, ending=false, starts=false) -%}
{%- if ending -%}
Unchanged, it keeps this end; emptied, it has none, and ends as what it accepted changes.
{%- elif starts -%}
Unchanged, the window keeps this end; emptied, it runs for the default, {{ maintenance_default }}, from its start.
{%- else -%}
Unchanged, the pin keeps this expiry; emptied, it runs for the default, {{ maintenance_default }}, from now.
{%- endif -%}
{%- endmacro %}
{% macro maintenance_fields(note, duration, prefix, maintenance_default,
maintenance_timezone, compact=false, expiry_was='',
ending=false, starts=none, starts_was='') -%}
Markdown is supported; raw HTML is shown as text.
{%- if starts is not none %}
{%- if starts_was %}
{%- endif %}
{%- if starts_was and starts == starts_was %}Unchanged, the window keeps this start; emptied, it starts now.{% else %}Blank: now.{% endif %} A duration below then counts from the start, and the end is at most a year from now.
{%- endif %}
{%- if expiry_was %}
{%- if duration == expiry_was %}
{{ kept_hint(maintenance_default, ending, starts is not none) }}
{%- endmacro %}
{#- **A maintenance entry's editor** (ADR-0150, landing 4; #35's note, decisions 4 and
6): one column, in the order it is read — *Note*, *Starts*, *Repeats* and the end
field, then the rest, then the buttons the form draws after it, so that the
sentence is the last thing read before *Set maintenance*.
The first look keeps what a window set now needs, the end field taking a duration
from the start or an end with *Once*; *Repeats* — once, or every N days, weeks or
months — turns it into *Length*, `8h` exact and `1d` calendar days. A later start or
a repeat opens the rest in place: the repeat's days — weekdays, *weekend* and
*working week* one click each; or a day of the month counted from its start or its
end, or the first to the fourth or the last of a weekday — *Until*, *Not on* with
the holiday list's name, *Times in …*, *Add an interval*, and beneath them what it
would set (`_schedule_preview.html`): the month, each day's hours, a click on a day
adding or leaving out its window (landing 5), then the windows added and left out,
each with ×, the next windows and the sentence. Without script the rest is the
browser's own disclosure, shown open where the editor is drawn with any of it, and
each of its buttons — *Preview*, *Add an interval*, an ×, *weekend*, *working week*,
a day of the month and its paging — sends the editor back with what it did, nothing
written; the stylesheet shows each part only where *Repeats* asks for it. With
script the rest opens as a repeat or a start is chosen, and what it would set
follows the fields (`maintenance-edit.js`).
`view` is the editor's every field (`app._ScheduleView`): filled from a standing
entry, given back from a form, or empty. *Starts*, the end field and *Until* carry
what they were filled with and the instant that says it, kept exactly while
unchanged. The form's first button is a hidden one that sets, so that Enter in a
field sets rather than pressing the first of the rest's buttons. -#}
{% macro schedule_fields(view, prefix, maintenance_default, maintenance_timezone,
compact=false) -%}
{%- set sm = ' form-control-sm' if compact else '' -%}
{%- set selects = ' form-select-sm' if compact else '' -%}
{%- set choices = not_on_choices() -%}
{%- set day_names = ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday') -%}
{%- set day_keys = ('MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU') -%}
Markdown is supported; raw HTML is shown as text.
{%- if view.starts_was %}
{%- endif %}
{%- if view.open_once %}
{%- endif %}
{%- if view.open_once %}This window is open, and its start has passed: leave it blank. With a repeat, it is when the windows to come start — blank, now.
{%- elif view.starts_was and view.starts == view.starts_was %}Unchanged, the window keeps this start; emptied, it starts now. A duration below then counts from the start, and the end is at most a year from now.
{%- else %}Blank: now. A duration below then counts from the start, and the end is at most a year from now. With a repeat, its windows start at this time of day, the first on the first day on or after it that the repeat picks.{% endif %}
{%- set one = view.interval.strip() == '1' %}
{{ 'day' if one else 'days' }}{{ 'week' if one else 'weeks' }}{{ 'month' if one else 'months' }}
{%- set once_said = 'e.g. 2h or Friday — default ' ~ maintenance_default %}
{%- set length_said = 'a length, e.g. 8h or 1d' %}
{%- if view.expiry_was %}
{%- if view.duration == view.expiry_was %}
With a repeat, how long each window is: 8h exact, across a clock change too, or 1d for whole days.
{#- a length is in no zone, and *Times in* names the one a repeat reads -#}
{{ zone_text(prefix ~ '-expiry-zone', view.zone or maintenance_timezone, 'ls-when-once') }}
{{ expiry_help(prefix ~ '-expiry-help') }}
Its days, until when, holidays, time zone — and what it sets
{%- if view.until_was %}
{%- endif %}
{%- if view.kept %}Required: its last date, at most a year from the start of the window open now, {{ view.kept }}, which keeps its end. A date alone takes in that day.
{%- else %}Required: its last date, at most a year from now. A date alone takes in that day.{% endif %}
{%- set readable = choices.lists %}
{%- set named_unreadable = view.not_on and view.not_on not in (readable | map('first') | list) %}
{%- if readable | length == 1 and not named_unreadable %}
{%- elif readable and not named_unreadable %}
{%- elif choices.unreadable or choices.broken or named_unreadable %}
{%- set why = choices.broken or (choices.unreadable[0][1] if choices.unreadable else 'no holiday list ' ~ view.not_on ~ ' can be read') %}
It cannot be read: {{ why }}.{% if view.not_on %} Saved here, it leaves out no list's days.{% endif %}
{%- endif %}
{{ zone_list() }}
An IANA name, such as {{ maintenance_timezone }}: Starts and every time typed here are read in it, and its windows follow its clock.
{{ schedule_preview(view, prefix) }}
{%- endmacro %}
{#- The sentence under an end's field that says which timezone a time without one is
read in, and the click-opened table of what the field takes — one grammar for a
window's expiry, a *seen*'s end and a silence's deadline. -#}
{% macro zone_text(id, maintenance_timezone, shown='') -%}
Timezone: {{ maintenance_timezone }} — used when the input has no
Z or numeric offset.
{%- endmacro %}
{% macro expiry_help(id) -%}
Which formats can I use?
Input
Meaning
2h, 3d, 1w, 17s
Duration from now
2026-07-10 18:00
Exact local date and time
2026-07-10T18:00+02:00
Exact time with its own offset
07-10
Next 10 July, at midnight
17
Next 17th, at midnight
18:00
Next 18:00
Friday
Next Friday at 12:00
Fri 18:00
Next Friday at 18:00
{%- endmacro %}
{#- **A done's field** (ADR-0146): its note, which says what was found. The event it
closes is its line's, which the form carries as `occurrence`, so that a line that
reads another since closes nothing; it has no end. Its id differs from the other
kinds' under one `prefix`, so that one editor carries every kind's fields. -#}
{% macro done_fields(note, prefix, compact=false, occurrence='') -%}
Markdown is supported; raw HTML is shown as text.
{%- if occurrence %}
{%- endif %}
{%- endmacro %}
{#- **A silence's fields** (ADR-0144): its note, which says what is being done; the
level it holds its part at above — counting as ok, or at most as a warning — its
radio sending `level`; and its deadline, which it always has: blank takes the
deployment's default, `silence_default`, and none lies more than thirty days
away. An edit passes the stored deadline twice, as `deadline` and `deadline_was`,
as an expiry's is, and the route keeps the stored instant while the two agree.
A silence that stands asks what changed (`changing`): a save that moves its
deadline later is refused without the sentence, and any save that has one keeps
it as a note of its own. Its ids differ from `maintenance_fields`' under one
`prefix`, so that the ringed check's editor carries both kinds' fields. -#}
{% macro silence_fields(note, deadline, level, prefix, silence_default,
maintenance_timezone, compact=false, deadline_was='',
changing=false, changed='') -%}
Markdown is supported; raw HTML is shown as text.
{%- if deadline_was %}
{%- if deadline == deadline_was %}
Unchanged, it keeps this deadline; emptied, it runs for the default, {{ silence_default }}, from now.