{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans 'Monitoring' %}{% endblock %}

{% block breadcrumb_nav %}
  <ol class="breadcrumb">
    <li class="breadcrumb-item-truncate">{% trans "Monitoring" %}</li>
    <li class="breadcrumb-item-truncate active">{% trans "Overview" %}</li>
  </ol>
{% endblock %}

{% block page_header %}
  {% include 'horizon/common/_page_header.html' with title=_("Monitoring") %}
{% endblock page_header %}
{% block main %}
    <div style="padding: 3px;">
      {% if grafana_url %}
      {% if show_grafana_home %}
      <a target="Grafana Home" href="{{grafana_url}}" class="btn btn-primary">
          <span class="fa fa-bar-chart"></span>
          Grafana Home
      </a>
      {% endif %}
      {% for dashboard in dashboards %}
      {% if dashboard.raw %}
      <a target={{ dashboard.title }} href="{{ dashboard.path }}" class="btn btn-default">
      {% else %}
      <a target={{ dashboard.title }} href="{{grafana_url}}/dashboard/db/{{ dashboard.path }}" class="btn btn-default">
      {% endif %}
              <span class="fa fa-bar-chart"></span>
              {% trans dashboard.title %}
          </a>
      {% endfor %}
      {% else %}
      {% for dashboard in dashboards %}
      {% if dashboard.raw %}
      <a target={{ dashboard.title }} href="{{ dashboard.fileName }}" class="btn btn-default">
      {% else %}
      <a target={{ dashboard.title }} href="/grafana/index.html#/dashboard/file/{{ dashboard.fileName }}?api={{api}}" class="btn btn-default">
      {% endif %}
          <span class="fa fa-bar-chart"></span>
              {% trans dashboard.title %}
      </a>
      {% endfor %}
      {% endif %}
      {% if can_access_kibana %}
          {% if enable_log_management_button or enable_event_management_button %}
          <a target="dashboard" href="{% url 'horizon:monitoring:overview:kibana_proxy' url='/app/kibana' %}" class="btn btn-default">
              <span class="fa fa-bar-chart"></span>
                    {% if enable_log_management_button %}
                        {% if enable_event_management_button %}
                            Log and Event Management
                        {% else %}
                            Log Management
                        {% endif %}
                    {% elif enable_event_management_button %}
                        Event Management
                    {% endif %}
          </a>
          {% endif %}
      {% endif %}
    </div>
    {%  include 'monitoring/overview/monitor.html' %}
{% endblock %}
