mirror of https://github.com/Aidaho12/haproxy-wi
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.
85 lines
3.4 KiB
85 lines
3.4 KiB
{% extends "base.html" %}
|
|
{% block content %}
|
|
{% if is_serv_protected and role > 2 %}
|
|
<meta http-equiv="refresh" content="0; url=/app/hapservers.py?service={{service}}">
|
|
{% else %}
|
|
<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>
|
|
<form action="{{ action }}" method="post">
|
|
<select autofocus required name="section" id="{{ select_id }}">
|
|
<option disabled>------</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>
|
|
<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%; text-align: left">
|
|
<textarea name="config" class="config" id="config_text_area" rows="35" cols="80" style="height: 40%">{{ config }}</textarea>
|
|
</div>
|
|
{% if not is_serv_protected or role <= 2 %}
|
|
<p>
|
|
<button type="submit" value="test" name="save" class="btn btn-default" title="Check config without saving the config">Check config</button>
|
|
<button type="submit" value="save" name="save" class="btn btn-default" title="Save config without reloading the service">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>
|
|
{% if section != 'globals' and section != 'defaults' %}
|
|
<button type="submit" value="delete" name="save" class="btn btn-default">Delete this section</button>
|
|
{% endif %}
|
|
</p>
|
|
{% endif %}
|
|
</form>
|
|
<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>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if aftersave %}
|
|
<div class="alert alert-info">A new config has been saved as: {{ cfg }} </div>
|
|
{% if stderr or error %}
|
|
{% include 'include/errors.html' %}
|
|
{% else %}
|
|
<div class="alert alert-success">Config is ok</div>
|
|
{% if warning %}
|
|
<div class="alert alert-warning">{{warning}}</div>
|
|
{% endif %}
|
|
<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 %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|