{% macro availability(row) %} {%- set hold = row.hold -%} {%- if row.machine.status == 'retired' -%} Retired {%- elif row.machine.status == 'maintenance' -%} Maintenance {%- elif not hold -%} Free {%- elif hold.state == 'armed' -%} Reserved by {{ hold.holder }} {%- elif hold.state == 'grace' -%} In use by {{ hold.holder }}, reconnecting {%- else -%} In use by {{ hold.holder }} {%- if hold.started_at %}since {{ hold.started_at|localtime('%H:%M') }}{% endif -%} {%- endif -%} {% endmacro %} {% macro health(machine) %} {%- if machine.online is none -%} Unknown {%- elif machine.online -%} Online {%- elif machine.ping_ok -%} No RDP {%- else -%} Offline {%- endif -%} {% endmacro %} {% macro firewall(machine) %} {%- set c = machine.compliance -%} {%- if c == 'compliant' -%}Locked {%- elif c == 'drift' -%}Drift {%- elif c == 'error' -%}Check failed {%- elif c == 'pending' -%}Pushing {%- elif c == 'not_enforced' -%}Not enforced {%- else -%}Unchecked {%- endif -%} {% endmacro %} {% macro connect_button(row, user, csrf) %} {%- set hold = row.hold -%} {%- if hold and hold.username == user.username -%} Open {%- elif row.can_connect -%}
{%- elif hold -%} {%- elif not row.allowed -%} {%- else -%} {%- endif -%} {% endmacro %} {% macro kebab(row, size=16) %} {%- set m = row.machine -%} {% endmacro %} {% macro picker(machine) %} {% endmacro %} {% macro field(name, label, values, errors, type='text', help='', required=False, cls='', placeholder='', autofocus=False) %} {% endmacro %} {% macro drawer_link(url, label, cls='') %} {{ label }} {% endmacro %}