summaryrefslogtreecommitdiffstats
path: root/usr/local/www/javascript/index
diff options
context:
space:
mode:
authorScott Dale <sdale@pfsense.org>2008-03-17 01:55:45 +0000
committerScott Dale <sdale@pfsense.org>2008-03-17 01:55:45 +0000
commit34eac803ea56372ba994fb961db5d9f64c90a8fe (patch)
tree7dd68991a20c91c28872435070fe0052d222675c /usr/local/www/javascript/index
parent62d57e6dca82bf4db55805af91f9b8c34b60707f (diff)
downloadpfsense-34eac803ea56372ba994fb961db5d9f64c90a8fe.zip
pfsense-34eac803ea56372ba994fb961db5d9f64c90a8fe.tar.gz
Show loading icon while loading new widget through AJAX. Note: loading icon needs improvement.
Diffstat (limited to 'usr/local/www/javascript/index')
-rw-r--r--usr/local/www/javascript/index/sajax.js53
1 files changed, 31 insertions, 22 deletions
diff --git a/usr/local/www/javascript/index/sajax.js b/usr/local/www/javascript/index/sajax.js
index fd9b00a..b7dd82a 100644
--- a/usr/local/www/javascript/index/sajax.js
+++ b/usr/local/www/javascript/index/sajax.js
@@ -74,8 +74,7 @@ function updateState(x)
}
function updateInterfaceStats(x){
- var widget = document.getElementById("interface_statistics-container");
- if (widget.style.display != "none"){
+ if (widgetActive("interface_statistics")){
statistics_split = x.split(",");
var counter = 1;
for (var y=0; y<statistics_split.length-1; y++){
@@ -86,30 +85,40 @@ function updateInterfaceStats(x){
}
function updateInterfaces(x){
- interfaces = x.split("~");
- for (var z=0; z<interfaces.length-1; z++){
- details = interfaces[z].split(",");
- if (details[1] == "up"){
- document.getElementById(details[0] + '-up').style.display = "inline";
- document.getElementById(details[0] + '-down').style.display = "none";
- document.getElementById(details[0] + '-block').style.display = "none";
- document.getElementById(details[0] + '-ip').innerHTML = details[2];
- document.getElementById(details[0] + '-media').innerHTML = details[3];
- } else if (details[1] == "down"){
- document.getElementById(details[0] + '-down').style.display = "inline";
- document.getElementById(details[0] + '-up').style.display = "none";
- document.getElementById(details[0] + '-block').style.display = "none";
- document.getElementById(details[0] + '-ip').innerHTML = details[2];
- document.getElementById(details[0] + '-media').innerHTML = details[3];
- } else if (details[1] == "block"){
- document.getElementById(details[0] + '-block').style.display = "inline";
- document.getElementById(details[0] + '-down').style.display = "none";
- document.getElementById(details[0] + '-up').style.display = "none";
+ if (widgetActive("interfaces")){
+ interfaces = x.split("~");
+ for (var z=0; z<interfaces.length-1; z++){
+ details = interfaces[z].split(",");
+ if (details[1] == "up"){
+ document.getElementById(details[0] + '-up').style.display = "inline";
+ document.getElementById(details[0] + '-down').style.display = "none";
+ document.getElementById(details[0] + '-block').style.display = "none";
+ document.getElementById(details[0] + '-ip').innerHTML = details[2];
+ document.getElementById(details[0] + '-media').innerHTML = details[3];
+ } else if (details[1] == "down"){
+ document.getElementById(details[0] + '-down').style.display = "inline";
+ document.getElementById(details[0] + '-up').style.display = "none";
+ document.getElementById(details[0] + '-block').style.display = "none";
+ document.getElementById(details[0] + '-ip').innerHTML = details[2];
+ document.getElementById(details[0] + '-media').innerHTML = details[3];
+ } else if (details[1] == "block"){
+ document.getElementById(details[0] + '-block').style.display = "inline";
+ document.getElementById(details[0] + '-down').style.display = "none";
+ document.getElementById(details[0] + '-up').style.display = "none";
+ }
+
}
-
}
}
+function widgetActive(x){
+ var widget = document.getElementById(x + '-container');
+ if (widget.style.display != "none")
+ return TRUE;
+ else
+ return FALSE;
+}
+
/* start ajax helper "thread" if not started */
if(!ajaxStarted) {
window.setTimeout('updateMeters()', update_interval);
OpenPOWER on IntegriCloud