{% load i18n %}
{% load icon_helpers %}

<div class="row node-details">
  <div class="col-lg-6 col-xs-12">
    <h4> {{ node.power_state|iconized_ironic_node_state|safe }} </h4>

    <h3>{% trans "Inventory" %}</h3>
    <dl class="dl-horizontal dl-horizontal-left">
      <dt>{% trans "Node UUID" %}</dt>
      <dd>{{ node.uuid|default:"&mdash;" }}</dd>
      <dt>{% trans "Driver" %}</dt>
      <dd>
        <a data-toggle="collapse" href="#collapseDriver">
          {{ node.driver|default:"&mdash;" }}
          <span class="caret"></span>
        </a>
        <div id="collapseDriver" class="panel-collapse collapse">
          <dl>
            {% if node.driver == 'pxe_ssh' %}
              <dt>IP Address</dt> <dd>{{ node.driver_info.ssh_address|default:"&mdash;" }}</dd>
              <dt>IPMI User</dt> <dd>{{ node.driver_info.ssh_username|default:"&mdash;" }}</dd>
              <dt>SSH Key</dt> <dd>{{ node.driver_info.ssh_key_contents|default:"&mdash;" }}</dd>
            {% else %}
              <dt>IP Address</dt> <dd>{{ node.driver_info.ipmi_address|default:"&mdash;" }}</dd>
              <dt>IPMI User</dt> <dd>{{ node.driver_info.ipmi_username|default:"&mdash;" }}</dd>
              <dt>IPMI Password</dt>
              <dd><form><fieldset><div class="form-group"><div>
                <input
                  class="form-control"
                  type="password"
                  value="{{ node.driver_info.ipmi_password }}"
                  disabled="true"
                  readonly="true"/>
              </div></div></fieldset></form></dd>
            {% endif %}
          </dl>
        </div>
      </dd>
      <dt>{% trans "Network Cards" %}</dt>
      <dd>
        <a data-toggle="collapse" href="#collapseNetworkCards">
          {% blocktrans count addresses_length=node.addresses|length %}
            {{ addresses_length }} interface
            {% plural %}
            {{ addresses_length }} interfaces
          {% endblocktrans %}
          <span class="caret"></span>
        </a>
        <div id="collapseNetworkCards" class="panel-collapse collapse">
          <ul>
            {% for address in node.addresses %}
              <li>{{ address }}</li>
            {% endfor %}
          </ul>
        </div>
      </dd>
      <dt>{% trans "Registered HW" %}</dt>
      <dd>
        {{ node.cpu_arch|default:"&mdash;" }}<br />
        {{ node.cpus|default:"&mdash;" }} {% trans "CPU" %}<br />
        {{ node.memory_mb|default:"&mdash;" }} {% trans "RAM (MB)" %}<br />
        {{ node.local_gb|default:"&mdash;" }} {% trans "HDD (GB)" %}
      </dd>
    </dl>

    <h3>{% trans "Deployment" %}</h3>
    <dl class="dl-horizontal dl-horizontal-left">
      <dt>{% trans "Deployment Role" %}</dt>
      {% if stack and role %}
        <dd><a href="{% url 'horizon:infrastructure:roles:detail' role.id %}">{{ role.name }}</a></dd>
      {% else %}
        <dd>&mdash;</dd>
      {% endif %}
      <dt>{% trans "Provisioning" %}</dt>
      <dd>
        {{ node.provisioning_status|default:"&mdash;" }}
        {% if node.instance_uuid %}
          <br />{{ node.instance.created }}
        {% endif %}
      </dd>
      <dt>{% trans "Image" %}</dt>
      <dd>{{ node.image_name|default:"&mdash;" }}</dd>
      <dt>{% trans "Instance UUID" %}</dt>
      <dd>{{ node.instance_uuid|default:"&mdash;" }}</dd>
    </dl>

    <h3>{% trans "Deployment Images" %}</h3>
    <dl class="dl-horizontal dl-horizontal-left">
        <dt>{% trans "Kernel" %}</dt>
        <dd>{{ kernel_image.name|default:"&mdash;" }}</dd>
        <dt>{% trans "Ramdisk" %}</dt>
        <dd>{{ ramdisk_image.name|default:"&mdash;" }}</dd>
    </dl>

  </div>
  <div class="col-lg-6 col-xs-12">
    <h3>{% trans "Performance & Metrics" %}</h3>
    {% url 'horizon:infrastructure:nodes:performance' node.uuid as node_perf_url %}
    {% include "infrastructure/_performance_chart_box.html" with meter_conf=meter_conf node_perf_url=node_perf_url col_size=6 %}
  </div>
</div>

{% block additional_data %}
{% endblock %}