You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haproxy-wi/app/templates/sections.html

79 lines
3.0 KiB

{% extends "base.html" %}
{% block content %}
<link rel="stylesheet" href="/inc/codemirror/codemirror.css">
<script src="/inc/codemirror/codemirror.js"></script>
<script src="/inc/codemirror/nginx.js"></script>
<script src="/inc/codemirror/haproxy.js"></script>
<center>
<p>
5 years ago
<form action="{{ action }}" method="post">
<select autofocus required name="section" id="{{ select_id }}">
<option disabled>Choose a section</option>
{% for s in sections %}
{% if s == section %}
<option value="{{ s }}" selected>{{ s }}</option>
{% else %}
<option value="{{ s }}">{{ s }}</option>
{% endif %}
{% endfor %}
</select>
<input type="hidden" value="{{ serv }}" name="serv">
{% if role <= 3 %}
<button type="submit" value="open" name="open" class="btn btn-default" title="Edit running config">Edit</button>
{% endif %}
</form>
</p>
{% if config %}
{% if role <= 3 %}
<div id="config">
<h4>You are editing "{{section}}" section from server {{ serv }}</h4>
</center>
5 years ago
<form action="{{ action }}" name="saveconfig" method="post">
<input type="hidden" value="{{ serv }}" name="serv">
<input type="hidden" value="{{ start_line }}" name="start_line">
<input type="hidden" value="{{ end_line }}" name="end_line">
<input type="hidden" value="{{ cfg }}.old" name="oldconfig">
<div style="margin-left: 23%;width: 60%;">
<textarea name="config" class="config" id="config_text_area" rows="35" cols="80" style="height: 40%">{{ config }}</textarea>
</div>
<center>
<p>
<button type="submit" value="test" name="save" class="btn btn-default">Just test</button>
<button type="submit" value="save" name="save" class="btn btn-default">Just save</button>
<button type="submit" value="" name="" class="btn btn-default">Save and restart</button>
<button type="submit" value="reload" name="save" class="btn btn-default">Save and reload</button>
</p>
</form>
<div class="alert alert-info">
<p><b>Note:</b></p>
<p>When reconfiguring the master server, the slave will be reconfigured automatically</p>
<p>Unable to delete entire section</p>
</div>
<script>
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("config_text_area"), {mode: "haproxy", lineNumbers: true});
</script>
<style>
.CodeMirror {
line-height: 1.2em;
height: 50%;
}
</style>
<script>
myCodeMirror.refresh();
</script>
</center>
{% endif %}
{% endif %}
{% if aftersave %}
<div class="alert alert-info">New config was saved as: {{ cfg }} </div>
{% if stderr or error %}
{% include 'include/errors.html' %}
{% else %}
<div class="alert alert-success">Config is ok</div>
<a href="config.py?serv={{ serv }}" title="Working with HAProxy config">Config</a> |
<a href="viewsttats.py?serv={{ serv }}" target="_blank" title="View stats">Go to stats</a>
{% endif %}
<script>window.history.pushState("Config", "Config", cur_url[0])</script>
{% endif %}
</center>
{% endblock %}