pari: trunk r1080 - in /trunk/config: graphs.html graphs/graph_cpu.svgz

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Jun 18 04:00:10 CDT 2007


Author: pari
Date: Mon Jun 18 04:00:09 2007
New Revision: 1080

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1080
Log:
Fix: Graphs page sending too many requests when data_cpu.html is 404

Modified:
    trunk/config/graphs.html
    trunk/config/graphs/graph_cpu.svgz

Modified: trunk/config/graphs.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/graphs.html?view=diff&rev=1080&r1=1079&r2=1080
==============================================================================
--- trunk/config/graphs.html (original)
+++ trunk/config/graphs.html Mon Jun 18 04:00:09 2007
@@ -81,42 +81,10 @@
 	return true;
 }
 
-function getsysinfohtml(){
-	var opt = {
-		method: 'get',
-		asynchronous: true,
-		onComplete: function(originalRequest){
-			_$('sysinfohtml').innerHTML = originalRequest.responseText;
-			_$('osversion').innerHTML = _$('si_uname').innerHTML;
-			_$('uptime').innerHTML = _$('si_uptime').innerHTML;
-			_$('asterisk').innerHTML =_$('si_astver').innerHTML + "<BR>" + "Asterisk GUI-version " + asterisk_guiversion.substr(1) ;
-			_$('today').innerHTML = _$('si_date').innerHTML;
-			_$('hostname').innerHTML =_$('si_hostname').innerHTML;
-			_$('ifconfig').innerHTML =_$('si_ifconfig').innerHTML;
-			_$('diskusage').innerHTML = _$('si_du').innerHTML;
-			_$('memoryusage').innerHTML =_$('si_free').innerHTML;
-
-			var divs_toshow = new Array('osversion_div', 'uptime_div', 'asterisk_div', 'today_div','hostname_div');
-			for(var i=0; i < divs_toshow.length; i++ ){ _$(divs_toshow[i]).style.display = ""; }
-
-			document.getElementById(tabs[0]).className = "tabselected";
-			load_todayslog();
-		},
-		onFailure: function(t) {
-			_$('status_message').style.display='none';
-			gui_alert("Config Error: " + t.status + ": " + t.statusText);
-		}
-	};
-	opt.parameters="";
-	var tmp = new Ajax.Request("./bkps/sysinfo_output.html", opt);
-	return true;
-}
-
-
 function localajaxinit(){
 	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 	setWindowTitle("Resource and Monitoring Graphs");
-	var date = new Date() ; 
+	var date = new Date() ;
 	parent.loadscreen(this);
 	show_window(1);
 }
@@ -137,20 +105,18 @@
 <div class="mainscreenContentBox" id="userscontent">
 <table class="mainscreenTable" align="center">
 	<tr valign="top" height="18">	
-			<td align="left">
-
-				<a href="#" class="tab" onclick="return show_window(1);" id="tab1" tip="en,graph,0">CPU</a>&nbsp;&nbsp;
-				<div id="graphshtml" style="display:none"></div>
-
-				<div id="information" style=" border: solid 0px black; background: transparent; padding: 4px; height:440px; width:95%;">
-						<BR>
-						<div id="cpu_div" style="display:none">
-								<div id="cpu" style="font-family:courier; font-size:10pt;"></div><BR>
-								<embed id="cpu_embed" type="image/svg+xml" src="graphs/graph_cpu.svgz"
-									width="500" height="250" /> 
-						</div>
-				</div>
-			</td>
+	<td align="left">
+		<a href="#" class="tab" onclick="return show_window(1);" id="tab1" tip="en,graph,0">CPU</a>&nbsp;&nbsp;
+		<div id="graphshtml" style="display:none"></div>
+		<div id="information" style=" border: solid 0px black; background: transparent; padding: 4px; height:440px; width:95%;">
+			<BR>
+			<div id="cpu_div" style="display:none">
+					<div id="cpu" style="font-family:courier; font-size:10pt;"></div><BR>
+					<embed id="cpu_embed" type="image/svg+xml" src="graphs/graph_cpu.svgz"
+						width="500" height="250" /> 
+			</div>
+		</div>
+	</td>
 	</tr>
 	<tr><td valign="top" align=center><div  id='status'></div></td></tr>
 	<tr><td></td></tr>

Modified: trunk/config/graphs/graph_cpu.svgz
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/graphs/graph_cpu.svgz?view=diff&rev=1080&r1=1079&r2=1080
==============================================================================
--- trunk/config/graphs/graph_cpu.svgz (original)
+++ trunk/config/graphs/graph_cpu.svgz Mon Jun 18 04:00:09 2007
@@ -86,12 +86,22 @@
       throw 'Both getURL and XMLHttpRequest are undefined';
 
     http_request.onreadystatechange = function() {
+	
       if (http_request.readyState == 4) {
-        callback( { success : true,
-                    content : http_request.responseText,
-                    contentType : http_request.getResponseHeader("Content-Type") } );
+		if( String(http_request.status) == '404' ){
+			SVGDoc.getElementById('collect_initial').setAttributeNS(null, 'visibility', 'visible');
+			return;
+		}
+		callback({ 
+			success : true, 
+			content : http_request.responseText,
+			contentType : http_request.getResponseHeader("Content-Type") 
+			});
+
+
       }
     }
+
     http_request.open('GET', url, true);
     http_request.send(null);
   }




More information about the asterisk-gui-commits mailing list