2019-09-20 06:42:19 +00:00
|
|
|
{% extends "base.html" %}
|
2023-04-02 16:58:55 +00:00
|
|
|
{% block title %}{{lang.words.edit|title()}} {{lang.words.section2}}{% endblock %}
|
|
|
|
{% block h2 %}{{lang.words.edit|title()}} {{lang.words.section2}} {% endblock %}
|
2019-09-20 06:42:19 +00:00
|
|
|
{% block content %}
|
2024-02-04 07:28:17 +00:00
|
|
|
{% if is_serv_protected and g.user_params['role'] > 2 %}
|
2023-09-17 09:42:39 +00:00
|
|
|
<meta http-equiv="refresh" content="0; url=/app/service/{{service}}">
|
2022-05-22 09:09:04 +00:00
|
|
|
{% else %}
|
2022-08-15 08:50:29 +00:00
|
|
|
<link rel="stylesheet" href="/inc/codemirror/lib/codemirror.css">
|
|
|
|
<link rel="stylesheet" href="/inc/codemirror/addon/dialog/dialog.css">
|
|
|
|
<link rel="stylesheet" href="/inc/codemirror/addon/fold/foldgutter.css">
|
|
|
|
<script src="/inc/codemirror/lib/codemirror.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/search/search.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/search/searchcursor.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/search/jump-to-line.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/search/matchesonscrollbar.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/search/match-highlighter.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/dialog/dialog.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/edit/matchbrackets.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/edit/closebrackets.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/comment/comment.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/wrap/hardwrap.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/fold/foldcode.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/fold/foldgutter.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/fold/brace-fold.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/fold/comment-fold.js"></script>
|
|
|
|
<script src="/inc/codemirror/addon/scroll/annotatescrollbar.js"></script>
|
|
|
|
<script src="/inc/codemirror/mode/haproxy.js"></script>
|
|
|
|
<script src="/inc/codemirror/keymap/sublime.js"></script>
|
2023-09-17 09:42:39 +00:00
|
|
|
<script src="/inc/configshow.js"></script>
|
|
|
|
<div class="left-space" style="margin-top: var(--indent);">
|
|
|
|
<select autofocus required name="section" id="section">
|
2023-04-02 16:58:55 +00:00
|
|
|
<option disabled>------</option>
|
|
|
|
{% for s in sections %}
|
|
|
|
{% if s == section %}
|
|
|
|
<option value="{{ s }}" selected>{{ s }}</option>
|
|
|
|
{% else %}
|
|
|
|
<option value="{{ s }}">{{ s }}</option>
|
2019-09-20 06:42:19 +00:00
|
|
|
{% endif %}
|
2023-04-02 16:58:55 +00:00
|
|
|
{% endfor %}
|
|
|
|
</select>
|
2023-09-17 09:42:39 +00:00
|
|
|
<input type="hidden" value="{{ serv }}" name="serv" id="serv">
|
2024-02-04 07:28:17 +00:00
|
|
|
{% if g.user_params['role'] <= 3 %}
|
2023-09-17 09:42:39 +00:00
|
|
|
<a class="ui-button ui-widget ui-corner-all" title="{{lang.words.edit|title()}} {{lang.words.running}} {{lang.words.config}}" onclick="openSection()">{{lang.words.edit|title()}}</a>
|
2023-04-02 16:58:55 +00:00
|
|
|
{% endif %}
|
2023-09-17 09:42:39 +00:00
|
|
|
</div>
|
2019-09-20 06:42:19 +00:00
|
|
|
{% if config %}
|
2024-02-04 07:28:17 +00:00
|
|
|
{% if g.user_params['role'] <= 3 %}
|
2023-04-02 16:58:55 +00:00
|
|
|
<div id="config" class="left-space">
|
2023-02-13 14:45:45 +00:00
|
|
|
<h4>{{lang.phrases.you_are_editing}} "{{section}}" {{lang.phrases.section_from_server}} {{ serv }}</h4>
|
2023-09-17 09:42:39 +00:00
|
|
|
<form action="/app/config/section/haproxy/{{serv}}/save" name="saveconfig" id="saveconfig" method="post">
|
2022-08-15 08:50:29 +00:00
|
|
|
<input type="hidden" value="{{ serv }}" name="serv">
|
|
|
|
<input type="hidden" value="{{ start_line }}" name="start_line">
|
2024-02-04 07:28:17 +00:00
|
|
|
<input type="hidden" value="{{ end_line }}" name="end_line">
|
2020-06-30 14:54:40 +00:00
|
|
|
<input type="hidden" value="{{ cfg }}.old" name="oldconfig">
|
2023-09-17 09:42:39 +00:00
|
|
|
<input type="hidden" value="haproxy" name="service">
|
2023-04-02 16:58:55 +00:00
|
|
|
<div style="width: 95%;">
|
2022-08-18 03:30:55 +00:00
|
|
|
<textarea name="config" class="config" id="config_text_area" rows="35" cols="100" style="height: 40%">{{ config }}</textarea>
|
2020-06-30 14:54:40 +00:00
|
|
|
</div>
|
2024-02-04 07:28:17 +00:00
|
|
|
{% if not is_serv_protected or g.user_params['role'] <= 2 %}
|
2019-09-20 06:42:19 +00:00
|
|
|
<p>
|
2023-02-13 14:45:45 +00:00
|
|
|
<button type="submit" value="test" name="save" class="btn btn-default" title="{{lang.words.check|title()}} {{lang.words.config}} {{lang.words.without}} {{lang.words.saving}}">{{lang.phrases.check_config}}</button>
|
|
|
|
<button type="submit" value="save" name="save" class="btn btn-default" title="{{lang.phrases.save_title}}">{{lang.words.save|title()}}</button>
|
2022-08-18 03:30:55 +00:00
|
|
|
{% if is_restart|int == 0 %}
|
2023-02-13 14:45:45 +00:00
|
|
|
<button type="submit" value="" name="" class="btn btn-default">{{lang.phrases.save_and_restart}}</button>
|
2022-08-18 03:30:55 +00:00
|
|
|
{% endif %}
|
2023-02-13 14:45:45 +00:00
|
|
|
<button type="submit" value="reload" name="save" class="btn btn-default">{{lang.phrases.save_and_reload}}</button>
|
2021-04-16 14:09:51 +00:00
|
|
|
{% if section != 'globals' and section != 'defaults' %}
|
2023-02-13 14:45:45 +00:00
|
|
|
<button type="submit" value="delete" name="save" class="btn btn-default">{{lang.words.delete|title()}} {{lang.words.this}} {{lang.words.section2}}</button>
|
2021-04-16 14:09:51 +00:00
|
|
|
{% endif %}
|
2019-09-20 06:42:19 +00:00
|
|
|
</p>
|
2021-05-16 05:27:47 +00:00
|
|
|
{% endif %}
|
2019-09-20 06:42:19 +00:00
|
|
|
</form>
|
2020-06-30 14:54:40 +00:00
|
|
|
<script>
|
2022-08-18 03:30:55 +00:00
|
|
|
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("config_text_area"),
|
|
|
|
{
|
|
|
|
mode: "haproxy",
|
|
|
|
lineNumbers: true,
|
|
|
|
lineWrapping: true,
|
|
|
|
autocapitalize: true,
|
|
|
|
autocorrect: true,
|
|
|
|
spellcheck: true,
|
|
|
|
autoCloseBrackets: true,
|
|
|
|
keyMap: "sublime",
|
|
|
|
matchBrackets: true,
|
|
|
|
foldGutter: true,
|
|
|
|
showCursorWhenSelecting: true,
|
|
|
|
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter", "breakpoints"],
|
|
|
|
highlightSelectionMatches: {showToken: /\w/, annotateScrollbar: true}
|
|
|
|
});
|
2020-06-30 14:54:40 +00:00
|
|
|
</script>
|
|
|
|
<style>
|
|
|
|
.CodeMirror {
|
|
|
|
line-height: 1.2em;
|
|
|
|
height: 50%;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
myCodeMirror.refresh();
|
|
|
|
</script>
|
2019-09-20 06:42:19 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2021-05-16 05:27:47 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-05-22 09:09:04 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|