{% extends "base.html" %}
{% load i18n %}
{% load promgen %}

{% block title %}
Promgen / Project / {{ project.name }}
{% endblock %}

{% block content %}

<div class="page-header">
  <h1>
    Project: {{ project.name }}
    {% if project.owner %}
    <small class="pull-right">{% trans 'Contact' %}: {{project.owner.username}}</small>
    {% endif %}
  </h1>
</div>

{% breadcrumb project %}

{% if project.notifiers.count == 0 and project.service.notifiers.count == 0 %}
<div class="alert alert-warning" role="alert">
  <span class="glyphicon glyphicon-alert" aria-hidden="true"></span>
  <span class="sr-only">Warning:</span>
  {% trans 'No notifications configured for this project. Please configure some' %}
</div>
{% endif %}

{% include "promgen/project_detail_configuration.html" %}

<div class="panel panel-danger" v-cloak v-if="activeProjectAlerts.has('{{project.name}}')">
  <div class="panel-heading">
    <a @click="toggleCollapse('alerts-project-{{project.name|slugify}}')" class="btn btn-danger btn-sm" role="button">Alerts</a>
  </div>
  <table id="alerts-project-{{project.name|slugify}}" class="table table-bordered table-condensed">
    <tr v-for="alert in activeProjectAlerts.get('{{project.name}}')">
      {% include 'promgen/alert_row.html' %}
    </tr>
  </table>
</div>

<div id="silence-project-{{ project.name|slugify }}" class="panel panel-warning" v-cloak v-if="activeProjectSilences.has('{{project.name}}')">
  <div class="panel-heading">
    <a @click="toggleCollapse('silences-project-{{project.name|slugify}}')" class="btn btn-warning btn-sm" role="button">Silences</a>
  </div>
  <table id="silences-project-{{project.name|slugify}}" class="table table-bordered table-condensed">
    <tr v-for="silence in activeProjectSilences.get('{{project.name}}')">
      {% include 'promgen/silence_row.html' %}
    </tr>
  </table>
</div>

<div class="row">
  <div class="col-md-6">
    {% include "promgen/project_detail_exporters.html" %}
    {% include "promgen/project_detail_hosts.html" %}
  </div>

  <div class="col-md-6">
    {% include "promgen/project_detail_urls.html" %}
    {% include "promgen/project_detail_notifiers.html" %}
  </div>
</div>

{% include "promgen/project_detail_rules.html" %}

{% endblock %}
