v1.10.2.2

More AJAX!!!! Fixed bugs
pull/19/head
Aidaho12 2018-04-10 12:24:33 +06:00
parent 1e53c561ea
commit 541bfb2b2f
5 changed files with 35 additions and 38 deletions

View File

@ -5,6 +5,7 @@ import os
import funct
import paramiko
import configparser
from datetime import datetime
from pytz import timezone
form = cgi.FieldStorage()

View File

@ -129,6 +129,7 @@ def head(title):
'<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>'
'<script src="/inc/js-cookie.js"></script>'
'<script src="/inc/script.js"></script>'
'<script src="/inc/configshow.js"></script>'
'<script src="/inc/nprogress.js"></script>'
'<script src="/inc/vertical_scrol/custom_scrollbar.min.js"></script>'
'</head>'

View File

@ -153,7 +153,6 @@ if serv is not None and form.getvalue('right') is not None:
if serv is not None and form.getvalue('act') == "configShow":
import os
from paramiko import SSHClient
from datetime import datetime
from pytz import timezone
@ -165,11 +164,7 @@ if serv is not None and form.getvalue('act') == "configShow":
funct.get_config(serv, cfg)
print('<script>$( ".configShow" ).accordion({'
'collapsible: true,'
'heightStyle: "content",'
'icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }'
'});</script>')
print('<script src="/inc/configshow.js"></script>')
print("<center><h3>Config from %s</h3>" % serv)
print('<p class="accordion-expand-holder">'
'<a class="accordion-expand-all ui-button ui-widget ui-corner-all" href="#">Expand all</a>'

32
inc/configshow.js Normal file
View File

@ -0,0 +1,32 @@
$( function() {
$( ".configShow" ).accordion({
collapsible: true,
heightStyle: "content",
icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }
});
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);
});
})

View File

@ -248,38 +248,6 @@ $( function() {
$( "input[type=checkbox]" ).checkboxradio();
$( "#number" ).spinner();
$( ".controlgroup" ).controlgroup();
$( ".configShow" ).accordion({
collapsible: true,
heightStyle: "content",
icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }
});
var headers = $('.configShow .accordion-header');
var contentAreas = $('.configShow .ui-accordion-content ').hide()
.first().show().end();
var expandLink = $('.accordion-expand-all');
// add the accordion functionality
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);
});
function ajaxActionServers(action, id) {
var bad_ans = 'Bad config, check please';