diff options
author | Scott Dale <sdale@pfsense.org> | 2007-12-30 21:07:15 +0000 |
---|---|---|
committer | Scott Dale <sdale@pfsense.org> | 2007-12-30 21:07:15 +0000 |
commit | 9c0fa9d56f092e92ea10f4c904fdfad26f7e3848 (patch) | |
tree | 3117f7390e0a5e8526fd5575613f9da53bfe3192 /usr | |
parent | fa4295ce7f0959dfff2f280396ec5536bbc4aeee (diff) | |
download | pfsense-9c0fa9d56f092e92ea10f4c904fdfad26f7e3848.zip pfsense-9c0fa9d56f092e92ea10f4c904fdfad26f7e3848.tar.gz |
new ajax functions for dashboard
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/javascript/index/sajax.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/usr/local/www/javascript/index/sajax.js b/usr/local/www/javascript/index/sajax.js index b15aa2c..fd9b00a 100644 --- a/usr/local/www/javascript/index/sajax.js +++ b/usr/local/www/javascript/index/sajax.js @@ -24,6 +24,10 @@ function stats(x) { updateUptime(values[2]); updateState(values[3]); updateTemp(values[4]); + updateDateTime(values[5]); + updateInterfaceStats(values[6]); + updateInterfaces(values[7]); + } function updateMemory(x) @@ -51,6 +55,14 @@ function updateTemp(x) } } +function updateDateTime(x) { + if(!$('datetime')) + return; + if(document.getElementById("datetime") == null) + return; + document.getElementById("datetime").firstChild.data = x; +} + function updateUptime(x) { document.getElementById("uptime").value = x; @@ -61,6 +73,42 @@ function updateState(x) document.getElementById("pfstate").value = x; } +function updateInterfaceStats(x){ + var widget = document.getElementById("interface_statistics-container"); + if (widget.style.display != "none"){ + statistics_split = x.split(","); + var counter = 1; + for (var y=0; y<statistics_split.length-1; y++){ + document.getElementById('stat' + counter).innerHTML = statistics_split[y]; + counter++; + } + } +} + +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"; + } + + } +} /* start ajax helper "thread" if not started */ if(!ajaxStarted) { |