{# The pieces every Curb page is built from (Curb PRD §11.3). Imported `with context`, so a macro reads the page's own state: whether names are shown, whether this machine can ask for an approval, and where the page is. #} {% import "_icon.html" as ico %} {% macro risk(level, tone, long=false) -%} {{ level }}{{ " risk" if long }} {%- endmacro %} {# A state in words, with a mark, so it does not rest on colour. #} {% macro st(kind, text) -%} {%- if kind == "open" %}{{ ico.icon('unlock', 12) }} {{ text }} {%- elif kind == "closed" %}{{ ico.icon('lock', 12) }} {{ text }} {%- elif kind == "proved" %}{{ ico.icon('shield', 12) }} {{ text }} {%- elif kind == "on" %}{{ ico.icon('check', 12) }} {{ text }} {%- else %}{{ text }}{% endif %} {%- endmacro %} {# A name or a location. The server sends it only to a browser with a live reveal. #} {% macro slot(value) -%} {%- if value %}{{ value }} {%- else %}{{ ico.icon('lock', 12) }} hidden{% endif %} {%- endmacro %} {# The link that opens one review. Without scripts it loads this page with the review open. #} {% macro rev(name, extra="") -%} {{ here }}{{ "&" if "?" in here else "?" }}review={{ name }}{{ extra }} {%- endmacro %} {# A button that changes something: a review first, then the operating system asks. #} {% macro act(label, name, kind="", extra="", shield=true) -%} {%- if shield and (read_only or paused_until) -%} {%- else -%} {% if shield %}{{ ico.icon('shield', 14) }} {% endif %}{{ label }} {%- endif -%} {%- endmacro %} {# A check that only reads: it runs at once, and the button says it is working. #} {% macro again(label="Check again") -%} {{ ico.icon('refresh', 14) }} {{ label }} {%- endmacro %} {% macro ask_names(text="Show names and locations") -%} {{ text }} {%- endmacro %} {# When a slow check was last done, or that one is running now. #} {% macro checked(held) -%} {%- if held.busy %} Checking again… {%- elif held.at %}Checked {{ ago(held.at) }}.{% endif %} {%- endmacro %} {# How every part opens: what it is for, where its facts come from, its actions. #} {% macro head(what, src, held=none) -%}

{{ what }}

{{ src }}{% if held %} {{ checked(held) }}{% endif %}

{{ caller() }}
{%- endmacro %} {% macro explain(title, gist, open=false) -%}

{{ title }}

{{ gist }}
{{ caller() }}
{%- endmacro %} {% macro cmd(command) -%}
{{ command }}
{%- endmacro %} {# Something the page names and leaves to the terminal, and why. #} {% macro terminal(title, why, command) -%}
{{ title }}{{ why }}
{{ command }}
{%- endmacro %} {# One toolbar on top of every table: its search, then its filters. #} {% macro tools(label, keep={}) -%} {%- endmacro %} {% macro option(value, label, chosen) -%} {%- endmacro %} {# A table's count: what is listed, and of how many when a filter is on. #} {% macro tally() -%} {{ "{:,}".format(table.total) }} {%- if table.total != table.of %} of {{ "{:,}".format(table.of) }}{% endif %} {%- endmacro %} {# Under every table: nothing matched, or the pages. #} {% macro foot(nothing="Nothing matches that search.") -%} {% if not table.rows %}
{{ nothing }} {% if table.total != table.of or table.q %}Clear the search{% endif %}
{% endif %} {% with pager=table.pager, pager_query=table.pager_query, pager_qs=table.pager_qs, per_choices=table.per_choices %} {% include "_pager.html" %} {% endwith %} {%- endmacro %} {# The project picker: it lists the Projects page, and starts on every project. #} {% macro picker(chosen, all=true) -%}
from your Projects page {{ ico.icon('plus', 12) }} Add a project
{%- endmacro %} {# The picture: what it can read, the agent, and where it can send. #} {% macro gate(state, verb) -%} {{ ico.icon('unlock' if state == 'open' else 'shield' if state == 'proved' else 'lock', 12) }} {{ verb if state == "open" else "blocked" }} {%- endmacro %} {% macro picture(card) -%} {%- endmacro %} {# Each way in and out for one agent, in words. #} {% macro ways(card) -%}
{% for title, list in (("It reads through", card.reads), ("It sends out through", card.sends)) %}

{{ title }}

{% for way in list %}
{{ way.name }}{{ st(way.kind, way.state) }} {{ way.why }} {% if way.link %}{{ way.link[0] }}{% endif %} {% if way.close %}To close it: {{ way.close }}{% endif %}
{% endfor %}
{% endfor %}
{% if card.assumed or card.not_checked %}
{% if card.assumed %}
Curb assumed
{{ card.assumed | join(" ") }}
{% endif %} {% if card.not_checked %}
Curb did not check
{{ card.not_checked | join(" ") }}
{% endif %}
{% endif %} {%- endmacro %} {# The first check has not come back: say so, and show the shape of what is coming. #} {% macro checking(what="Checking what your agents can reach…") -%}

{{ what }}

Curb is reading each agent's settings, and looking for credentials on this machine. It takes a few seconds, and this page updates when it is done.

{% for n in range(2) %}
{% endfor %}
{%- endmacro %} {% macro failed(error) -%} {%- endmacro %} {# The review before a change: what will change, what to expect, how to undo it. #} {% macro review_box(name, title, action, fields={}, go="", shield=true, wide=true) -%} {% if review == name %}

{{ title }}

{{ caller() }}
{% for key, value in fields.items() %}{% endfor %} Cancel
{% endif %} {%- endmacro %}