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/config.html

122 lines
5.1 KiB

{% extends "base.html" %}
{% block content %}
<link rel="stylesheet" href="/inc/codemirror/codemirror.css">
<link rel="stylesheet" href="/inc/codemirror/dialog.css">
<script src="/inc/codemirror/codemirror.js"></script>
<script src="/inc/codemirror/nginx.js"></script>
<script src="/inc/codemirror/haproxy.js"></script>
<script src="/inc/codemirror/dialog.js"></script>
<script src="/inc/codemirror/search.js"></script>
<script src="/inc/codemirror/searchcursor.js"></script>
<script src="/inc/codemirror/jump-to-line.js"></script>
<script src="/inc/configshow.js"></script>
{% if is_serv_protected and role > 2 %}
<meta http-equiv="refresh" content="0; url=/app/hapservers.py?service={{service}}">
{% else %}
<center>
{% if selects|length == 0 %}
{% include 'include/getstarted.html' %}
{% else %}
<p>
5 years ago
<form action="{{ action }}" method="post">
<input type="hidden" id="service" value="{{service|default('haproxy', true)}}" />
{% include 'include/select.html' %}
{% if service == 'nginx' or service == 'apache' %}
<a class="ui-button ui-widget ui-corner-all" title="Show running config" onclick="showConfigFiles()">Open</a>
{% else %}
<a class="ui-button ui-widget ui-corner-all" title="Show running config" onclick="showConfig()">Open</a>
{% endif %}
{% if service != 'keepalived' and service != 'apache' %}
<a class="ui-button ui-widget ui-corner-all" title="View stat" onclick="openStats()">Stat</a>
{% endif %}
{% if service != 'keepalived' and service != 'nginx' and service != 'apache' %}
6 years ago
<a class="ui-button ui-widget ui-corner-all" title="Show map" onclick="showMap()">Map</a>
{% endif %}
<a class="ui-button ui-widget ui-corner-all" title="Compare configs" onclick="showCompareConfigs()">Compare</a>
{% if role <= 3 %}
<a class="ui-button ui-widget ui-corner-all" title="Show versions" onclick="openVersions()">Versions</a>
{% endif %}
</form>
</p>
<div id="ajax-config_file_name"></div>
{% endif %}
{% if stderr or error %}
{% include 'include/errors.html' %}
{% endif %}
{% if config %}
{% if role <= 3 %}
<h4>Config {% if config_file_name != 'undefined' %}{{config_file_name.replace('92', '/')}}{%endif%} from {{ serv }}</h4>
</center>
<form action="config.py" name="saveconfig" id="saveconfig" method="post">
<input type="hidden" value="{{ serv }}" name="serv">
<input type="hidden" value="{{ cfg }}.old" name="oldconfig">
<input type="hidden" value="{{ token }}" name="token">
<input type="hidden" value="{{ service }}" name="service">
<input type="hidden" value="{{ config_file_name }}" name="config_file_name">
<div style="margin-left: 23%;width: 60%;">
<textarea name="config" id="config_text_area" class="config" rows="35" cols="100">{{ config }}</textarea>
</div>
<p>
<center>
<a href="config.py?service={{service}}&serv={{serv}}&showConfig" class="ui-button ui-widget ui-corner-all" title="Return to configuration view">Back</a>
{% if service != 'keepalived' %}
<button type="submit" value="test" name="save" class="btn btn-default" title="Check config without saving the config">Check config</button>
{% endif %}
<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 service != 'keepalived' %}
<div class="alert alert-info alert-two-rows"><b>Note:</b> When reconfiguring the master server, the slave will be reconfigured automatically</div>
{% endif %}
</center>
</p>
</form>
{% endif %}
{% endif %}
</center>
<script>
if (cur_url[1].split('&')[1] == 'showMap') {
showMap();
}
if (cur_url[1].split('&')[1] == 'showCompare' || cur_url[1].split('&')[2] == 'showCompare') {
showCompareConfigs();
}
if (cur_url[1].split('&')[2] == 'showConfig') {
showConfig();
}
if (cur_url[1].split('&')[2] == 'showConfigFiles') {
showConfigFiles();
}
if (cur_url[1].split('&')[3].split('=')[0] == 'findInConfig') {
var words = findGetParameter('findInConfig');
waitForElm('#finding_words_from').then((elm) => {
$('#find_p').show();
$('#words').val(words);
findInConfig(words);
});
}
if (cur_url[1].split('&')[3].split('=')[0] == 'config_file_name') {
showConfigFilesForEditing();
}
if (cur_url[1].split('&')[0] == 'service=haproxy' || cur_url[1].split('&')[0] == 'service=None') {
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("config_text_area"),
{mode: "haproxy", lineNumbers: true, autocapitalize: true, autocorrect: true, spellcheck: true, autoCloseBrackets: true});
} else {
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("config_text_area"),
{mode: "nginx", lineNumbers: true, autocapitalize: true, autocorrect: true, spellcheck: true, autoCloseBrackets: true});
}
</script>
<style>
.CodeMirror {
line-height: 1.2em;
height: 70%;
}
</style>
<script>
myCodeMirror.refresh();
</script>
{% endif %}
5 years ago
{% endblock %}