{% extends "base.html" %} {% import "_base.html" as _base %} {% import "_wtform.html" as wtform %} {% import "_section.html" as _section %} {% block breadcrumbs %} {{ _base.breadcrumbs(section, [ (gettext('%(rulename)s', rulename=rule['name']), url_for('rule', path=section['path'], rulename=rule['name'], revision=section['revision'])) ]) }} {% endblock %} {% set current_revision = current_section['revision'] -%} {% set is_editable = section['revision'] == current_revision -%} {% set config_is_editable = (is_editor or is_owner) and section['revision'] == current_revision %} {% if is_editable %} {% block extrahead %} {{ _section.rule_form_script() }} {{ _section.yaml_editor_boilerplate() }} {% endblock %} {% endif %} {% block content %} {% if is_editable and is_owner %} {{ wtform.modal_form(id='editruleform', title=gettext('Edit rule'), submit_text=gettext('Save'), form=edit_rule_form, attrs=_section.ruleform_attrs(section)) }} {% endif %}
{% if section['revision'] != current_revision -%}

{% trans -%} You are viewing a rule from an outdated revision of the section! {%- endtrans %}

{% with securl=url_for('section', path=section['path'], revision=current_revision), secname=section['name'], rulename=rule['name'], ruleurl=url_for('rule', path=section['path'], rulename=rule['name'], revision=current_revision) %}

{%- if not rule_exists_in_current_revision -%} {% trans -%} Rule "{{ rulename }}" was deleted and doesn't exist in the current revision of section "{{ secname }}" r{{ current_revision }}. {%- endtrans %} {%- else -%} {% trans -%} See rule "{{ rulename }}" in section's current revision r{{ current_revision }}. {%- endtrans %} {%- endif %}

{% endwith -%}
{%- endif %}
{{ _section.check_current_revision_script( url_for('rule', path=section['path'], rulename=rule['name'], revision=section['revision']) ) }}

{%- trans rulename=rule['name'], secname=section['name'], secrev=_section.revision(section), securl=url_for('section', path=section['path'], revision=section['revision']) -%} Rule "{{ rulename }}" of section {{ secname }} {{ secrev }} {%- endtrans %} {% if is_editable and is_owner -%} {%- endif %}

{% if parent_rule %} {% trans url=url_for('rule', path=section['path'], rulename=parent_rule['name'], revision=section['revision']), rulename=rule['name'], parent_rule_name=parent_rule['name'] -%} Rule "{{ rulename }}" is a subrule of rule {{ parent_rule_name }}. {%- endtrans %} {% endif %} {% trans url=url_for('history', path=section['path'], rule=rule['name']) -%} See rule changes history {%- endtrans %}

{{ _section.editors(rule['editors']) }}

{{ _section.description(rule['desc']) }}
{% if rule['selector'] is not none %}

{{ rule['selector'] }}

{% else %}

{% trans %}rule applies to all hosts{% endtrans %}

{% endif %}
{% if section['stype'] == 'yaml' %} {{ _section.yaml_editor('#configfield') }} {% else %}

{{ _section.sandbox_rule_config_source(rule['config_source'], section['path'], section['revision']) }} {{ _base.volatile_labels(resource_volatile) }}

{% endif %}
{% if config_is_editable -%} {% endif %}
{% if config_is_editable -%}
{{ wtform.wtform(config_form) }} {% if section['stype'] == 'sandbox_resource' %}

{%- trans %}Manage resource aliases{% endtrans -%}

{% endif %}
{% if section['stype'] == 'yaml' %} {{ _section.yaml_editor('#configform textarea.yaml') }} {% endif %}
{%- endif %} {% if config_is_editable %} {{ wtform.modal_form(id='createrule', title=gettext('Create subrule'), submit_text=gettext('Create'), form=new_subrule_form, attrs=_section.ruleform_attrs(section), submit_btn_class='disable-if-uneditable') }} {{ _section.yaml_editor('#createrule textarea.yaml', line_numbers=False, rows=4) }} {% endif %}
{%- if rule.get('subrules') %}
{{ _section.rules_table(gettext("Subrules"), section, rule['subrules'], is_editable=config_is_editable, parent_rule=rule, rule_order_form=rule_order_form, selector_statuses=selector_statuses) }} {% elif config_is_editable and parent_rule is none and rule['selector'] is not none %}
{% endif -%}
{% endblock %}