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

{% block title %}
Promgen / Rule / New
{% endblock %}

{% block content %}

{% breadcrumb rule 'New Rule' %}

{% if form.non_field_errors  %}
<div class="panel panel-danger">
  <div class="panel-heading">Errors</div>
    {% for error in form.non_field_errors %}
      <div class="panel-body">{{ error|linebreaks }}</div>
    {% endfor %}
</div>
{% endif %}

<form action="{{ request.get_full_path }}" method="post">{% csrf_token %}
{% include 'promgen/rule_form_block.html' %}
<div class="panel panel-primary">
  <div class="panel-body">
    <button class="btn btn-primary">Register Rule</button>
  </div>
</div>
</form>

<div class="panel panel-default">
  <div class="panel-heading">Import Rule</div>
  <div class="panel-body">
    <p class="help-block">Copy and Paste a rule from a different Prometheus server</p>
    <form action="{{ request.get_full_path }}" method="post">{% csrf_token %}
        <textarea class="form-control" name="rules"></textarea>
        <br />
        <button class="btn btn-primary">Import Rule</button>
    </form>
  </div>
</div>

{% endblock %}
