mirror of https://github.com/Aidaho12/haproxy-wi
v8.0: Optimize AJAX call and unify button styling in templates
Updated the AJAX call to send JSON data with proper content type and handle the response more robustly. Also standardized the button styling across delver.html and configver.html templates for a consistent user experience.pull/399/head
parent
cde708065b
commit
0727c2979f
|
@ -409,19 +409,21 @@ function showUploadConfig() {
|
|||
let service = $('#service').val();
|
||||
let configver = $('#configver').val();
|
||||
let serv = $("#serv").val()
|
||||
let jsonData = {
|
||||
"serv": serv,
|
||||
"configver": configver
|
||||
}
|
||||
$.ajax( {
|
||||
url: "/config/" + service + "/show",
|
||||
data: {
|
||||
serv: serv,
|
||||
configver: configver
|
||||
},
|
||||
data: JSON.stringify(jsonData),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
type: "POST",
|
||||
success: function( data ) {
|
||||
if (data.indexOf('error:') != '-1') {
|
||||
toastr.error(data);
|
||||
if (data.status === 'failed') {
|
||||
toastr.error(data.error);
|
||||
} else {
|
||||
toastr.clear();
|
||||
$("#ajax").html(data);
|
||||
$("#ajax").html(data.data);
|
||||
window.history.pushState("Show config", "Show config", "/config/versions/" + service + "/" + serv + "/" + configver);
|
||||
$.getScript(configShow);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<form action="/config/versions/{{service}}/{{serv}}" method="post" class="left-space">
|
||||
<input type="hidden" id="service" value="{{service}}">
|
||||
{{ select('serv', values=g.user_params['servers'], is_servers='true', selected=serv) }}
|
||||
<button type="submit" value="open" name="open" class="btn btn-default">{{lang.words.open|title()}}</button>
|
||||
<a href="/config/versions/{{service}}/{{ serv }}" class="ui-button ui-widget ui-corner-all" title="Open versions">{{lang.words.open|title()}}</a>
|
||||
</form>
|
||||
</p>
|
||||
<div id="config_version_div"></div>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<form action="{{ action }}" method="post" class="left-space">
|
||||
<input type="hidden" value="{{service}}" name="service" id="service">
|
||||
{{ select('serv', values=g.user_params['servers'], is_servers='true', selected=serv) }}
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Open versions" onclick="showListOfVersion(1)">{{lang.words.open|title()}}</a>
|
||||
<a href="/config/{{service}}" class="ui-button ui-widget ui-corner-all" title="Configs page">{{lang.words.configs|title()}}</a>
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Open versions" onclick="showListOfVersion(1)">{{lang.words.open|title()}}</a>
|
||||
<a href="/config/{{service}}" class="ui-button ui-widget ui-corner-all" title="Configs page">{{lang.words.configs|title()}}</a>
|
||||
{% if service != 'keepalived' %}
|
||||
<a class="ui-button ui-widget ui-corner-all" title="View stat" onclick="openStats()">{{lang.words.stats|title()}}</a>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue