{% extends 'generic/_base.html' %} {% load helpers %} {% load i18n %} {% comment %} Context: - object: The device - plan: diff.SyncPlan - form: forms.DeviceSyncForm - errors: Error messages from a failed apply - device_rows: (DeviceFieldDiff, bound checkbox) pairs - kinds: {'diff': KindDiff, 'summaries': [(PropertySummary, bound checkbox)]} for changed component types - return_url: The device page {% endcomment %} {% block title %}{% trans "Sync with device type" %}{% endblock %} {% block page-header %}
{{ block.super }} {% endblock page-header %} {% block subtitle %}
{% endblock subtitle %} {% block content %} {% if errors %} {% endif %} {% if plan.is_empty %}

{% trans "The device is in sync with its device type" %}

{% blocktrans trimmed with device_type=plan.device_type %} Every component of {{ device_type }} exists on the device, and their properties match. {% endblocktrans %}

{% trans "Back to device" %}
{% else %}
{% csrf_token %}

{% blocktrans trimmed %} A checked property is copied from the device type to every component of that type with the same name. An unchecked property keeps the value of the device. Components that are missing on the device are always created. Cables, IP addresses, VLANs, descriptions and other settings of the components are not changed. {% endblocktrans %}

{# Device fields #} {% if device_rows %}

{% trans "Device" %}

{% for diff, field in device_rows %} {% endfor %}
{% trans "Property" %} {% trans "Device" %} {% trans "Device type" %}
{{ field }} {{ diff.current }} {{ diff.desired }}
{% endif %} {# Component types #} {% for kind in kinds %} {% with diff=kind.diff %}

{{ diff.kind.verbose_name_plural }}
{% if diff.create %} {% blocktrans trimmed count counter=diff.create|length %} {{ counter }} to create {% plural %} {{ counter }} to create {% endblocktrans %} {% endif %} {% if diff.update %} {% blocktrans trimmed count counter=diff.update|length %} {{ counter }} with differences {% plural %} {{ counter }} with differences {% endblocktrans %} {% endif %}

{% if diff.create or diff.conflicts %}
{% if diff.create %}
{% blocktrans trimmed count counter=diff.create|length with kind=diff.kind.verbose_name|lower kinds=diff.kind.verbose_name_plural|lower %} {{ counter }} {{ kind }} will be created {% plural %} {{ counter }} {{ kinds }} will be created {% endblocktrans %}
{% for item in diff.create %} {{ item.name }} {% endfor %}
{% endif %} {% if diff.conflicts %} {% endif %}
{% endif %} {% if kind.summaries %} {% for summary, field in kind.summaries %} {% endfor %}
{% trans "Property" %} {% trans "Differs on" %}
{{ field }}
{% blocktrans trimmed count counter=summary.count with kind=diff.kind.verbose_name|lower kinds=diff.kind.verbose_name_plural|lower %} {{ counter }} {{ kind }} {% plural %} {{ counter }} {{ kinds }} {% endblocktrans %} {% for name, change in summary.components %} {% endfor %}
{% trans "Name" %} {% trans "Device" %} {% trans "Device type" %}
{{ name }} {{ change.current }} {{ change.desired }}
{% endif %}
{% endwith %} {% endfor %}
{% endif %} {% endblock content %}