mirror of https://github.com/Aidaho12/haproxy-wi
parent
9259562776
commit
f9c324da13
|
@ -543,10 +543,12 @@ def show_config(server_ip: str) -> None:
|
||||||
|
|
||||||
is_serv_protected = sql.is_serv_protected(server_ip)
|
is_serv_protected = sql.is_serv_protected(server_ip)
|
||||||
server_id = sql.select_server_id_by_ip(server_ip)
|
server_id = sql.select_server_id_by_ip(server_ip)
|
||||||
|
hostname = sql.get_hostname_by_server_ip(server_ip)
|
||||||
is_restart = sql.select_service_setting(server_id, service, 'restart')
|
is_restart = sql.select_service_setting(server_id, service, 'restart')
|
||||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True, trim_blocks=True, lstrip_blocks=True,
|
lang = roxywi_common.get_user_lang()
|
||||||
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True, trim_blocks=True, lstrip_blocks=True,
|
||||||
extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
|
extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
|
||||||
template = env.get_template('config_show.html')
|
template = env.get_template('ajax/config_show.html')
|
||||||
|
|
||||||
template = template.render(conf=conf,
|
template = template.render(conf=conf,
|
||||||
serv=server_ip,
|
serv=server_ip,
|
||||||
|
@ -555,7 +557,9 @@ def show_config(server_ip: str) -> None:
|
||||||
service=service,
|
service=service,
|
||||||
config_file_name=config_file_name,
|
config_file_name=config_file_name,
|
||||||
is_serv_protected=is_serv_protected,
|
is_serv_protected=is_serv_protected,
|
||||||
is_restart=is_restart)
|
is_restart=is_restart,
|
||||||
|
lang=lang,
|
||||||
|
hostname=hostname)
|
||||||
print(template)
|
print(template)
|
||||||
conf.close()
|
conf.close()
|
||||||
|
|
||||||
|
@ -580,8 +584,9 @@ def show_config_files(server_ip: str) -> None:
|
||||||
config_file_name = ''
|
config_file_name = ''
|
||||||
|
|
||||||
return_files += ' ' + sql.get_setting(f'{service}_config_path')
|
return_files += ' ' + sql.get_setting(f'{service}_config_path')
|
||||||
|
lang = roxywi_common.get_user_lang()
|
||||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('ajax/show_configs_files.html')
|
template = env.get_template('ajax/show_configs_files.html')
|
||||||
template = template.render(serv=server_ip, service=service, return_files=return_files,
|
template = template.render(serv=server_ip, service=service, return_files=return_files, lang=lang,
|
||||||
config_file_name=config_file_name, path_dir=service_config_dir)
|
config_file_name=config_file_name, path_dir=service_config_dir)
|
||||||
print(template)
|
print(template)
|
||||||
|
|
|
@ -371,12 +371,12 @@
|
||||||
<input type="hidden" value="{{serv}}" name="serv">
|
<input type="hidden" value="{{serv}}" name="serv">
|
||||||
<input type="hidden" value="{{configver}}" name="configver">
|
<input type="hidden" value="{{configver}}" name="configver">
|
||||||
<input type="hidden" value="1" name="config">
|
<input type="hidden" value="1" name="config">
|
||||||
<button type='submit' value='save' name='save' class='btn btn-default' title="{{lang.words.save|title()}} {{lang.words.config}} {{lang.words.without}} {{lang.words.reloading}} {{lang.words.the}} {{lang.words.service2}}">{{lang.words.save|title()}}</button>
|
<button type='submit' value='save' name='save' class='btn btn-default' title="{{lang.phrases.save_title}}">{{lang.words.save|title()}}</button>
|
||||||
{% if is_restart|int == 0 %}
|
{% if is_restart|int == 0 %}
|
||||||
<button type='submit' value='' name='' class='btn btn-default'>{{lang.phrases.upload_and_restart|title()}}</button>
|
<button type='submit' value='' name='' class='btn btn-default'>{{lang.phrases.upload_and_restart}}</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if service != 'keepalived' %}
|
{% if service != 'keepalived' %}
|
||||||
<button type='submit' value='reload' name='save' class='btn btn-default'>{{lang.phrases.upload_and_reload|title()}}</button>
|
<button type='submit' value='reload' name='save' class='btn btn-default'>{{lang.phrases.upload_and_reload}}</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
{% import 'languages/'+lang|default('en')+'.html' as lang %}
|
||||||
{% from 'include/input_macros.html' import input %}
|
{% from 'include/input_macros.html' import input %}
|
||||||
<div style="text-align: center;margin-top: 20px;">
|
<div style="text-align: center;margin-top: 20px;">
|
||||||
{% if 'cannot access' not in return_files %}
|
{% if 'cannot access' not in return_files %}
|
||||||
|
@ -7,7 +8,7 @@
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<p>
|
<p>
|
||||||
<select autofocus required name="config_file_name" id="config_file_name" style="width: 365px;">
|
<select autofocus required name="config_file_name" id="config_file_name" style="width: 365px;">
|
||||||
<option disabled selected>Select a config file</option>
|
<option disabled selected>{{lang.words.select|title()}} {{lang.words.w_a}} {{lang.words.config}} {{lang.words.file}}</option>
|
||||||
{% for file in return_files.split() %}
|
{% for file in return_files.split() %}
|
||||||
{% if file == config_file_name %}
|
{% if file == config_file_name %}
|
||||||
<option value="{{ file }}" selected>{{ file.split('/', maxsplit=3)[3] }}</option>
|
<option value="{{ file }}" selected>{{ file.split('/', maxsplit=3)[3] }}</option>
|
||||||
|
@ -19,15 +20,15 @@
|
||||||
|
|
||||||
{{ input('serv', type='hidden', value=serv) }}
|
{{ input('serv', type='hidden', value=serv) }}
|
||||||
{{ input('open', type='hidden', value='open') }}
|
{{ input('open', type='hidden', value='open') }}
|
||||||
<a class="ui-button ui-widget ui-corner-all" id="show" title="Open config" onclick="showConfig()">Open</a>
|
<a class="ui-button ui-widget ui-corner-all" id="show" title="{{lang.words.open|title()}} {{lang.words.config}}" onclick="showConfig()">{{lang.words.open|title()}}</a>
|
||||||
<a class="ui-button ui-widget ui-corner-all" title="Create a new config file" onclick="addNewConfig('{{serv}}', '{{service}}')">Add</a>
|
<a class="ui-button ui-widget ui-corner-all" title="{{lang.words.create|title()}} {{lang.words.w_a}} {{lang.words.new}} {{lang.words.config}} {{lang.words.file}}" onclick="addNewConfig('{{serv}}', '{{service}}')">{{lang.words.add|title()}}</a>
|
||||||
<a class="ui-button ui-widget ui-corner-all" title="Lookup in config files" id="open_find_form">Find</a>
|
<a class="ui-button ui-widget ui-corner-all" title="{{lang.words.find|title()}} {{lang.words.in}} {{lang.words.config}} {{lang.words.files}}" id="open_find_form">{{lang.words.find|title()}}</a>
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
<form action="" method="post" id="finding_words_from">
|
<form action="" method="post" id="finding_words_from">
|
||||||
<p id="find_p" style="display: none;">
|
<p id="find_p" style="display: none;">
|
||||||
{{ input('words', type='text', style='height: 32.5px;') }}
|
{{ input('words', type='text', style='height: 32.5px;') }}
|
||||||
<button type="submit" name="find" id="find_in_configs" value="Find" title="Find in configs">Find</button>
|
<button type="submit" name="find" id="find_in_configs" value="Find" title="Find in configs">{{lang.words.find|title()}}</button>
|
||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="alert alert-warning">{{return_files}}</div>
|
<div class="alert alert-warning">{{return_files}}</div>
|
||||||
|
@ -39,7 +40,7 @@
|
||||||
<table class="overview">
|
<table class="overview">
|
||||||
{% include 'include/tr_validate_tips.html' %}
|
{% include 'include/tr_validate_tips.html' %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="padding20">Config file name:</td>
|
<td class="padding20">{{lang.phrases.config_file_name}}:</td>
|
||||||
<td>{{ input('new_config_name', type='text', placeholder='conf.d/config_name', title='Format: sub-directory/config_name') }}</td>
|
<td>{{ input('new_config_name', type='text', placeholder='conf.d/config_name', title='Format: sub-directory/config_name') }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{ input('path_config_name', type='hidden', value=path_dir) }}
|
{{ input('path_config_name', type='hidden', value=path_dir) }}
|
||||||
|
@ -75,7 +76,7 @@
|
||||||
height: "auto",
|
height: "auto",
|
||||||
width: 600,
|
width: 600,
|
||||||
modal: true,
|
modal: true,
|
||||||
title: "Create a new config file",
|
title: "{{lang.words.create|title()}} {{lang.words.w_a}} {{lang.words.new}} {{lang.words.config}} {{lang.words.file}}",
|
||||||
show: {
|
show: {
|
||||||
effect: "fade",
|
effect: "fade",
|
||||||
duration: 200
|
duration: 200
|
||||||
|
@ -84,8 +85,9 @@
|
||||||
effect: "fade",
|
effect: "fade",
|
||||||
duration: 200
|
duration: 200
|
||||||
},
|
},
|
||||||
buttons: {
|
buttons: [{
|
||||||
"Create": function() {
|
text: "{{lang.words.create|title()}}",
|
||||||
|
click: function () {
|
||||||
let config_file_name = $('#new_config_name').val();
|
let config_file_name = $('#new_config_name').val();
|
||||||
let path_dir = $('#path_config_name').val();
|
let path_dir = $('#path_config_name').val();
|
||||||
config_file_name = config_file_name.replaceAll('\/', '92');
|
config_file_name = config_file_name.replaceAll('\/', '92');
|
||||||
|
@ -96,11 +98,13 @@
|
||||||
config_file_name = escapeHtml(config_file_name);
|
config_file_name = escapeHtml(config_file_name);
|
||||||
window.location.replace('config.py?service=' + service + '&serv=' + serv + '&open=open&config_file_name=' + path_dir + '92' + config_file_name + '.conf&new_config=1');
|
window.location.replace('config.py?service=' + service + '&serv=' + serv + '&open=open&config_file_name=' + path_dir + '92' + config_file_name + '.conf&new_config=1');
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
},
|
}
|
||||||
Cancel: function() {
|
}, {
|
||||||
|
text: "{{lang.words.cancel|title()}}",
|
||||||
|
click: function() {
|
||||||
$( this ).dialog( "close" );
|
$( this ).dialog( "close" );
|
||||||
}
|
}
|
||||||
}
|
}]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$( "select" ).selectmenu();
|
$( "select" ).selectmenu();
|
||||||
|
|
Loading…
Reference in New Issue