Files
haproxy-wi/app/static/js/configshow.js
Aidaho 1954b60e13 v7.2.4.0: Update requirements and refactor date formatting function
The requirements for el9, deb, and main have been updated to specifically use version 2.27.1 of the "requests" package. In addition, the date formatting function get_time_zoned_date in common.py has been refactored. The default format for the date has been moved to the function arguments, and the function now also checks if the provided date is an instance of datetime before processing it.
2024-04-18 09:58:32 +03:00

76 lines
2.3 KiB
JavaScript

$( function() {
$( "input[type=submit], button" ).button();
$( ".configShow" ).accordion({
collapsible: true,
heightStyle: "content",
icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }
});
$('#raw').click(function() {
$(".configShow").accordion("destroy");
$('#raw').css('display', 'none');
$('.numRow').css('display', 'none');
$('#according').css('display', 'inline-block');
$('.accordion-expand-all').css('display', 'none');
});
$('#according').click(function() {
$( ".configShow" ).accordion({
collapsible: true,
heightStyle: "content",
icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }
});
$('#raw').css('display', 'inline-block');
$('.numRow').css('display', 'inline-block');
$('#according').css('display', 'none');
$('.accordion-expand-all').css('display', 'inline-block');
});
var headers = $('.configShow .accordion-header');
var contentAreas = $('.configShow .ui-accordion-content ').hide()
.first().show().end();
var expandLink = $('.accordion-expand-all');
headers.click(function() {
// close all panels
contentAreas.slideUp();
// open the appropriate panel
$(this).next().slideDown();
// reset Expand all button
expandLink.text('Expand all')
.data('isAllOpen', false);
// stop page scroll
return false;
});
// hook up the expand/collapse all
expandLink.click(function(){
var isAllOpen = !$(this).data('isAllOpen');
console.log({isAllOpen: isAllOpen, contentAreas: contentAreas})
contentAreas[isAllOpen? 'slideDown': 'slideUp']();
expandLink.text(isAllOpen? 'Collapse All': 'Expand all')
.data('isAllOpen', isAllOpen);
});
$(".accordion-link a").on("click", function(event) {
window.location.href = $(this).attr("href");
event.preventDefault();
});
$( "#saveconfig" ).on("click", ":submit", function(e){
var frm = $('#saveconfig');
var service = $('#service').val();
myCodeMirror.save();
$.ajax({
url: frm.attr('action'),
data: frm.serialize() + "&save=" + $(this).val(),
type: frm.attr('method'),
success: function( data ) {
data = data.replace(/\n/g, "<br>");
toastr.clear();
returnNiceCheckingConfig(data);
$(window).unbind('beforeunload');
if (data.indexOf('warning: ') != '-1') {
toastr.warning(data)
}
}
});
event.preventDefault();
});
})