Improved Versions pages
pull/19/head
Aidaho12 2018-06-11 21:05:57 +06:00
parent bd78cc7bd6
commit 8dc6dda1b1
6 changed files with 32 additions and 9 deletions

View File

@ -14,6 +14,7 @@ funct.page_for_admin(level = 2)
form = cgi.FieldStorage()
serv = form.getvalue('serv')
view = form.getvalue('view')
configver = form.getvalue('configver')
hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
config_read = ""
@ -77,5 +78,6 @@ output_from_parsed_template = template.render(h2 = 1, title = "Old Versions HAPr
onclick = "showUploadConfig()",
error = error,
note = 1,
token = token)
token = token,
view = view)
print(output_from_parsed_template)

View File

@ -279,8 +279,9 @@ if serv is not None and act == "configShow":
print('<input type="hidden" value="%s" name="serv">' % serv)
print('<input type="hidden" value="%s" name="configver">' % form.getvalue('configver'))
print('<input type="hidden" value="1" name="config">')
funct.get_button("Just save", value="save")
funct.get_button("Upload and restart")
if form.getvalue('view') is None:
funct.get_button("Just save", value="save")
funct.get_button("Upload and restart")
print('</form></center>')
if form.getvalue('master'):

View File

@ -100,7 +100,7 @@
</ul>
</nav>
<div class="copyright-menu">
HAproxy-WI v2.5.6.1
HAproxy-WI v2.5.6.2
<br>
<a href="https://www.patreon.com/haproxy_wi" title="Donate" target="_blank" style="color: #fff; margin-left: 40px;">Patreon</a>
</div>

View File

@ -39,11 +39,16 @@
<select autofocus required name="configver" id="configver">
<option disabled selected>Choose version</option>
{% for file in return_files %}
<option {{file}}>{{file}}</option>
{% if file == configver %}
<option {{file}} selected>{{file}}</option>
{% else %}
<option {{file}}>{{file}}</option>
{% endif %}
{% endfor %}
</select>
<input type="hidden" value="{{serv}}" name="serv">
<input type="hidden" value="open" name="open">
<input type="hidden" value="{{ view }}" id="view">
<a class="ui-button ui-widget ui-corner-all" id="show" title="Enter" onclick="{{ onclick }}">Select</a>
</p>
</form>
@ -66,5 +71,10 @@
<script>window.history.pushState("Map", "Map", cur_url[0])</script>
{% endif %}
{% endif %}
</center>
</center>
{% if view %}
<script>
showUploadConfig()
</script>
{% endif %}
{% endblock %}

View File

@ -27,7 +27,8 @@
<label for="select_all" id="label_select_all"><b>Select all</b></label>
<input type="checkbox" id="select_all"><br />
{% for file in return_files %}
<label for="{{file}}"> {{file}} </label><input type="checkbox" value="{{file}}" name="{{file}}" id="{{file}}"><br />
<label for="{{file}}"> {{file}} </label><input type="checkbox" value="{{file}}" name="{{file}}" id="{{file}}">
<a href="/app/configver.py?serv={{serv}}&open=open&configver={{file}}&view=1" class="ui-button ui-widget ui-corner-all" target="_blanck" title="View config" style="margin-top: -6px;">View</a><br />
{% endfor %}
<input type="hidden" value="{{serv}}" name="serv">
<input type="hidden" value="open" name="open">

View File

@ -251,18 +251,27 @@ function showConfig() {
} );
}
function showUploadConfig() {
var view = $('#view').val();
if(view != "1") {
view = ""
}
$.ajax( {
url: "options.py",
data: {
serv: $("#serv").val(),
act: "configShow",
configver: $('#configver').val(),
token: $('#token').val()
token: $('#token').val(),
view: view
},
type: "GET",
success: function( data ) {
$("#ajax").html(data);
window.history.pushState("Show config", "Show config", cur_url[0]+"?serv="+$("#serv").val()+"&open=open&configver="+$('#configver').val());
if(view == "1") {
window.history.pushState("Show config", "Show config", cur_url[0]+"?serv="+$("#serv").val()+"&open=open&configver="+$('#configver').val()+"&view="+$('#view').val());
} else {
window.history.pushState("Show config", "Show config", cur_url[0]+"?serv="+$("#serv").val()+"&open=open&configver="+$('#configver').val());
}
var urlConfigShowJs = '/inc/configshow.js';
$.getScript(urlConfigShowJs);
}