mirror of https://github.com/Aidaho12/haproxy-wi
				
				
				
			v1.9
							parent
							
								
									724625523c
								
							
						
					
					
						commit
						ccfaa1b46a
					
				| 
						 | 
				
			
			@ -39,7 +39,9 @@ if form.getvalue('serv') is not None and form.getvalue('open') is not None :
 | 
			
		|||
	
 | 
			
		||||
	print('<a name="conf"></a>')
 | 
			
		||||
	print("<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>'
 | 
			
		||||
		'</p>')
 | 
			
		||||
	funct.show_config(cfg)
 | 
			
		||||
 | 
			
		||||
	os.system("/bin/rm -f " + cfg)	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -147,7 +147,6 @@ def links():
 | 
			
		|||
					'<ul>'
 | 
			
		||||
						'<li><a href=/cgi-bin/overview.py title="Server and service status">Overview</a> </li>'
 | 
			
		||||
						'<li><a href=/cgi-bin/viewsttats.py title="View Stats">Stats</a> </li>'
 | 
			
		||||
						'<li><a href="http://172.28.5.106:3000/d/000000002/haproxy?refresh=1m&orgId=1" title="Mon" target="_blanck">Monitoring</a> </li>'
 | 
			
		||||
						'<li><a href=/cgi-bin/logs.py title="View logs">Logs</a></li>'
 | 
			
		||||
						'<li><a href=/cgi-bin/map.py title="View map">Map</a></li>'
 | 
			
		||||
					'</ul>'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,7 +49,7 @@ if funct.is_admin():
 | 
			
		|||
		users = json.loads(f)
 | 
			
		||||
		if i is 4:
 | 
			
		||||
			style = 'style="display: none;" class="show-users"'
 | 
			
		||||
		print('<tr ' + style + '><td class="padding10">' + users['login'] +'</td><td>')
 | 
			
		||||
		print('<tr ' + style + '><td class="padding10 first-collumn">' + users['login'] +'</td><td class="second-collumn">')
 | 
			
		||||
		print(users['group']+'</td><td>')
 | 
			
		||||
		print(users['role'])
 | 
			
		||||
		print('</td><td></td></tr>')
 | 
			
		||||
| 
						 | 
				
			
			@ -79,7 +79,7 @@ commands = [ "ps -Af |grep [h]aproxy |wc -l" ]
 | 
			
		|||
commands1 = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ]
 | 
			
		||||
 | 
			
		||||
for i in sorted(listhap):
 | 
			
		||||
	print('<tr><td class="padding10"><a href="#%s" title="Go to %s status" style="color: #000">%s</a></td><td>' % (i, i, i))
 | 
			
		||||
	print('<tr><td class="padding10 first-collumn"><a href="#%s" title="Go to %s status" style="color: #000">%s</a></td><td  class="second-collumn">' % (i, i, i))
 | 
			
		||||
	funct.ssh_command(listhap.get(i), commands, server_status="1")
 | 
			
		||||
	print('</td><td>')
 | 
			
		||||
	print('<a href="/cgi-bin/configshow.py?serv=%s&open=open#conf"  title="Show config"><img src=/image/pic/show.png alt="show" class="icon"></a>' % listhap.get(i))
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +89,7 @@ for i in sorted(listhap):
 | 
			
		|||
	print('</td><td>')
 | 
			
		||||
	funct.ssh_command(listhap.get(i), commands1)
 | 
			
		||||
	print('</td><td></td></tr>')
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
print('</table><table class="overview"><tr class="overviewHead">'
 | 
			
		||||
		'<td class="padding10">Server</td>'
 | 
			
		||||
		'<td class="padding10">'
 | 
			
		||||
| 
						 | 
				
			
			@ -111,8 +111,8 @@ commands = [ "cat " + haproxy_config_path + " |grep -E '^listen|^backend|^fronte
 | 
			
		|||
			status_command + "|grep Active | sed 's/^[ \t]*//'" ]
 | 
			
		||||
commands1 =  [ "top -u haproxy -b -n 1" ]
 | 
			
		||||
for i in sorted(listhap):
 | 
			
		||||
	print('<tr><td class="overviewTr"><a name="'+i+'"></a><h3 title="IP ' + listhap.get(i) + '">' + i + ':</h3></td>')
 | 
			
		||||
	print('<td class="overviewTd"><span style="margin-left: -10px;">Total listen/frontend/backend:</span><pre>')
 | 
			
		||||
	print('<tr><td class="overviewTr first-collumn"><a name="'+i+'"></a><h3 title="IP ' + listhap.get(i) + '">' + i + ':</h3></td>')
 | 
			
		||||
	print('<td class="overviewTd"><span>Total listen/frontend/backend:</span><pre>')
 | 
			
		||||
	funct.ssh_command(listhap.get(i), commands)
 | 
			
		||||
	print('</pre></td><td class="overviewTd"><pre>')
 | 
			
		||||
	funct.ssh_command(listhap.get(i), commands1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,6 +21,34 @@ $( function() {
 | 
			
		|||
	  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);    
 | 
			
		||||
	});
 | 
			
		||||
	
 | 
			
		||||
	$('#select_all').click(function(){
 | 
			
		||||
        var checkboxes = $(this).closest('form').find(':checkbox');
 | 
			
		||||
        if($(this).prop('checked')) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,10 @@ form {
 | 
			
		|||
iframe {
 | 
			
		||||
	width: 33%;
 | 
			
		||||
}
 | 
			
		||||
pre {
 | 
			
		||||
	padding-left: 25px;
 | 
			
		||||
	padding-top: 20px;
 | 
			
		||||
}
 | 
			
		||||
.icon {
 | 
			
		||||
	max-width: 20px;
 | 
			
		||||
	margin-left: 2px;
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +59,7 @@ iframe {
 | 
			
		|||
	font-style: italic;
 | 
			
		||||
	font-weight: bold;
 | 
			
		||||
	height: 52px;
 | 
			
		||||
	background-color: #f2ae72;
 | 
			
		||||
	background-color: #f4ab76;
 | 
			
		||||
}
 | 
			
		||||
.top-menu img {
 | 
			
		||||
	max-width: 125px;
 | 
			
		||||
| 
						 | 
				
			
			@ -204,17 +208,18 @@ iframe {
 | 
			
		|||
	border-radius: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.overviewTd {
 | 
			
		||||
	padding-left: 35px;
 | 
			
		||||
/*.overviewTd {	
 | 
			
		||||
	padding-top: 20px;
 | 
			
		||||
	border-color: #ddd;
 | 
			
		||||
}
 | 
			
		||||
}*/
 | 
			
		||||
.overviewTr {
 | 
			
		||||
	margin: 0;
 | 
			
		||||
	background-color: #f6f6f6;
 | 
			
		||||
	padding-left: 15px;
 | 
			
		||||
	font-size: 15px;
 | 
			
		||||
}
 | 
			
		||||
.first-collumn {
 | 
			
		||||
	width: 200px;
 | 
			
		||||
}
 | 
			
		||||
.serverUp, .serverDown {
 | 
			
		||||
	padding: 3px; 
 | 
			
		||||
	border-radius: 3px;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue