{% extends "infrastructure/overview/deployment_base.html" %}

{% load i18n %}
{% load url from future%}
{% load horizon %}

{% block deployment-icon %}fa-spinner fa-spin{% endblock %}

{% block deployment-title %}
            {% if stack.is_deleting %}
                {% trans "Undeploying..." %}
            {% elif stack.is_deploying %}
                {% trans "Deploying..." %}
            {% elif stack.is_updating %}
                {% trans "Updating..." %}
            {% endif %}
{% endblock %}

{% block deployment-info %}
{% if progress %}
  <div class="progress">
    <div
      class="progress-bar progress-bar-striped active"
      role="progressbar"
      aria-valuenow="{{ progress }}"
      aria-valuemin="0"
      aria-valuemax="100"
      style="width: {{ progress }}%"
      ><span class="sr-only">{{ progress }}% {% trans "Complete" %}</span></div>
  </div>
{% endif %}
<div class="deploy-last-events">
  {% include "infrastructure/overview/_last_events.html" %}
</div>
{% endblock %}

{% block deployment-buttons %}
    {% if stack.is_deploying or stack.is_updating %}
      <a
    href="{% url 'horizon:infrastructure:overview:undeploy_confirmation' %}"
    class="btn btn-danger ajax-modal">
        <i class="fa fa-lg fa-times"></i>
        {% trans "Stop" %}
      </a>
    {% endif %}
{% endblock %}

{% block templates %}
<script type="text/html" id="events-template">{% spaceless %}{% jstemplate %}
[[#show_last_events]]
<strong>[[ last_events_title ]]</strong>
<div>
  <dl>
    [[#last_events]]
    <dd>
      <time datetime="[[ event_time ]]">[[ event_time ]]</time>
      <br />
      [[ resource_name ]] |
      [[ resource_status ]] |
      [[ resource_status_reason ]]
    </dd>
    <br />
    [[/last_events]]
  </dl>
</div>
[[/show_last_events]]
<p><a href="{% url 'horizon:infrastructure:history:index' %}">See full log</a></p>
{% endjstemplate %}{% endspaceless %}</script>
{% endblock %}
