{% load i18n %} {# While the job runs, the panel replaces itself every few seconds with a fresh copy from the same view. #}

{% trans "Leases" %} {% if can_load and not in_branch %}
{% csrf_token %}
{% endif %}

{% if can_load and in_branch %}

{% trans "Leases are loaded for subnets as they are in main: switch to main to load them." %}

{% endif %} {% if not windows_server %} {% trans "This subnet does not belong to a Windows server you can view." %} {% elif running %} {% blocktrans with server=windows_server %}Reading leases from {{ server }}...{% endblocktrans %} {% elif lost %} {% elif result.error %} {% elif job and result.leases is not None %}

{% blocktrans count total=result.total with server=result.server scope=result.scope when=job.completed|date:"SHORT_DATETIME_FORMAT" %}{{ total }} lease in scope {{ scope }} on {{ server }} (read {{ when }}){% plural %}{{ total }} leases in scope {{ scope }} on {{ server }} (read {{ when }}){% endblocktrans %} {% if result.truncated %} {% blocktrans with shown=result.leases|length %}Only the first {{ shown }} are shown.{% endblocktrans %} {% endif %}

{% else %} {% trans "Not read yet. Leases are read live from the Windows server in a background job; only the latest read is kept, with that job." %} {% endif %}
{% if not running and result.leases %}
{% if result.family == 6 %}{% endif %} {% for lease in result.leases %} {% if result.family == 6 %}{% endif %} {% if result.family == 6 %} {# Windows keeps no state for a DHCPv6 lease, so there is none to show. #} {% else %} {% endif %} {% endfor %}
{% trans "IP address" %} {% if result.family == 6 %}{% trans "DUID" %}{% else %}{% trans "Client ID" %}{% endif %}{% trans "IAID" %}{% trans "Host name" %} {% trans "State" %} {% trans "Expires (UTC)" %} {% trans "Description" %}
{{ lease.ip_address }} {{ lease.client }}{{ lease.iaid }}{{ lease.host_name|default:"" }}{% trans "n/a" %}{{ lease.address_state }}{{ lease.lease_expiry_time|default:"" }} {{ lease.description|default:"" }}
{% endif %}