{% import "_base.html" as _base %}
{% import "_wtform.html" as wtform %}
{% macro revision(section) -%}
{%- trans rev=section['revision'] %}r{{ rev }}{% endtrans -%}
{%- if section['rules'] and section['status'] and 'mcount' in section['status'] -%}
+{{ section['status']['mcount'] }}
{%- endif -%}
{%- endmacro %}
{% macro nsubsections(section) -%}
{%- if section['subsections'] -%}
{%- trans count=section['subsections']|count -%}
{{ count }} subsection
{%- pluralize -%}
{{ count }} subsections
{%- endtrans -%}
{%- endif -%}
{%- endmacro %}
{% macro nrules(section) -%}
{%- if section['rules'] -%}
{%- trans count=section['rules']|count -%}
{{ count }} rule
{%- pluralize -%}
{{ count }} rules
{%- endtrans -%}
{%- endif -%}
{%- endmacro %}
{% macro section_content(section) -%}
{% if section['subsections'] %}
{{ nsubsections(section) }}
{% elif section['rules'] %}
{{ nrules(section) }}
{% endif %}
{% endmacro %}
{% macro userlist(users) -%}
{% for user in users -%}
{{ _base.username(user) }}{% if not loop.last %}, {% endif %}
{%- endfor %}
{%- endmacro %}
{% macro owners(users, inherited_owners=None) -%}
{% if users or inherited_owners -%}
{%- if users and inherited_owners -%}
{% trans owners_list=userlist(users), inherited=userlist(inherited_owners) -%}
owners: {{ owners_list }}, inherited owners: {{ inherited }}
{%- endtrans %}
{%- elif users -%}
{% trans owners_list=userlist(users) -%}
owners: {{ owners_list }}
{%- endtrans %}
{%- else -%}
{% trans inherited=userlist(inherited_owners) -%}
inherited owners: {{ inherited }}
{%- endtrans %}
{%- endif -%}
{%- endif %}
{%- endmacro %}
{% macro editors(users) -%}
{% if users -%}
{%- trans editors_list=userlist(users) -%}
editors: {{ editors_list }}
{%- endtrans -%}
{%- endif %}
{%- endmacro %}
{% macro description(desc) -%}
{% if desc -%}
{{ desc|markdown_safe -}}
{% endif -%}
{% endmacro %}
{% macro rule_form_script() -%}
{% endmacro %}
{% macro check_current_revision_script(url) %}
{% endmacro %}
{% macro ruleform_attrs(section, extra_class="") -%}
{% if section['stype'] == 'sandbox_resource' %}
class="ruleform sandbox_resource {{ extra_class }}"
data-forceupdateurl="{{ url_for('force_volatile_update', vtype='sandbox_releases', key=section['stype_options']['resource_type']) }}"
{%- else %}
class="ruleform {{ extra_class }}"
{%- endif %}
{%- endmacro %}
{% macro sandbox_rule_config_source(config_source, section_path, revision) %}
{% if config_source['rtype'] == 'by_alias' %}
{% trans resource=_base.sandbox_resource(config_source['resource']),
description=config_source['description'],
alias_url=url_for('aliases', path=section_path, revision=revision),
alias_id=config_source['alias_id'],
alias_name=config_source['alias_name'] -%}
Resource {{ resource }}: {{ description }};
by alias {{ alias_name }}
{% endtrans %}
{% else %}
{% trans resource=_base.sandbox_resource(config_source['resource']),
description=config_source['description'] -%}
Resource {{ resource }}: {{ description }}
{%- endtrans %}
{% endif %}
{% endmacro %}
{% macro section_icon(section, height) -%}
{% if section['stype'] == 'sandbox_resource' %}
{% endif %}
{%- endmacro %}
{% macro yaml_editor_boilerplate() -%}
{%- endmacro %}
{% macro yaml_editor(selector, line_numbers=True, rows=None) -%}
{%- endmacro %}
{% macro rule_link(section, rule, status=None, extra_class="") -%}
{{- rule['name'] -}}
h
{%- if status %}
{{ _base.volatile_labels(status) }}
{%- endif -%}
{%- endmacro %}
{% macro rules_table(panel_title, section, rules, is_editable,
parent_rule, rule_order_form, selector_statuses) -%}
{% with reorderable=is_editable and rules and rules|length > 1 %}
{{ rule_link(section, rule) }} {% with status = selector_statuses.get(rule['selector']) %}{% if status %} {{ _base.volatile_labels(status) }} {% endif %}{% endwith %} {{ editors(rule['editors']) }}{{ description(rule['desc']) }}
|
{% if rule['selector'] is not none %}
{{ rule['selector'] }} {% trans %}applies to all hosts{% endtrans %} {% endif %} {% if section['stype'] == 'sandbox_resource' %}{{ sandbox_rule_config_source(rule['config_source'], section['path'], section['revision']) }} {% endif %} {%- if rule.get('subrules') %}{{- ngettext('%(num)d subrule', '%(num)d subrules', rule['subrules']|length) -}}
|
{{ rule_link(section, rule) }} {% if rule['subrules'] %}
{{ rule_link(section, subrule) }}