Pavel Loginov 2020-06-30 16:54:40 +02:00
parent 7c63eae923
commit e0d298bdbb
1 changed files with 23 additions and 5 deletions

View File

@ -1,5 +1,9 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% 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> <center>
<h3>Choose a section</h3> <h3>Choose a section</h3>
<p> <p>
@ -29,12 +33,16 @@
{% if role <= 2 %} {% if role <= 2 %}
<div id="config"> <div id="config">
<h4>You are editting "{{section}}" from server {{ serv }}</h4> <h4>You are editting "{{section}}" from server {{ serv }}</h4>
</center>
<form action="{{ action }}" name="saveconfig" method="post"> <form action="{{ action }}" name="saveconfig" method="post">
<input type="hidden" value="{{ serv }}" name="serv"> <input type="hidden" value="{{ serv }}" name="serv">
<input type="hidden" value="{{ start_line }}" name="start_line"> <input type="hidden" value="{{ start_line }}" name="start_line">
<input type="hidden" value="{{ end_line }}" name="end_line"> <input type="hidden" value="{{ end_line }}" name="end_line">
<input type="hidden" value="{{ cfg }}.old" name="oldconfig"> <input type="hidden" value="{{ cfg }}.old" name="oldconfig">
<textarea name="config" class="config" rows="35" cols="80" style="height: 40%">{{ config }}</textarea> <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> <p>
<button type="submit" value="test" name="save" class="btn btn-default">Just test</button> <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="save" name="save" class="btn btn-default">Just save</button>
@ -45,9 +53,19 @@
{% if note %} {% if note %}
<div class="alert alert-info"><b>Note:</b> If you reconfigure Master server, Slave will reconfigured automatically</div> <div class="alert alert-info"><b>Note:</b> If you reconfigure Master server, Slave will reconfigured automatically</div>
{% endif %} {% endif %}
</div> <script>
<script src="/inc/jquery-linenumbers.js"></script> var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("config_text_area"), {mode: "haproxy", lineNumbers: true});
<script>$('textarea').linenumbers({col_width: '25px'});</script> </script>
<style>
.CodeMirror {
line-height: 1.2em;
height: 50%;
}
</style>
<script>
myCodeMirror.refresh();
</script>
</center>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if aftersave %} {% if aftersave %}