fixed IE8 bug (page title change not allowed).
authorJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 19 Sep 2011 18:30:08 +0000 (18:30 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 19 Sep 2011 18:30:08 +0000 (18:30 +0000)
dynamic refresh of the graph.

NEWS
www/details.html
www/psensor.js
www/style.css

diff --git a/NEWS b/NEWS
index dd7dcd3..e6622a2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@
 ** psensor-server/web interface: automatic update of the monitoring page.
 ** psensor-server/web interface: improved styling and navigation.
 ** psensor-server/web interface: added graph for cpu usage.
+** psensor-server/web interface: fixed IE8 bug (page title change not
+   allowed).
+** psensor-server/web interface: dynamic refresh of the graph.
 
 * v0.6.2.10
 ** psensor-server: added network, cpu load and memory information in
index 52725b5..83a750a 100644 (file)
@@ -1,7 +1,7 @@
 <html>
   <head>
     <meta charset="utf-8">
-    <title>Sensor </title>
+    <title id="title">Sensor </title>
 
     <link type="text/css"
          rel="stylesheet"
@@ -20,15 +20,20 @@ href="http://fonts.googleapis.com/css?family=Ubuntu:regular,bold&subset=Latin">
 
     <script>
       $(document).ready(function() {
-          var url_id;
+               var url_id;
 
-         url_id = get_url_params()["id"];
+               url_id = get_url_params()["id"];
 
-      update_menu();
-      
-          $.getJSON(url_id, function(data) {
-               update_chart("chart", type_to_str(data["type"]), data);
-         });
+               update_menu();
+               $.getJSON(url_id, function(data) {
+                               update_chart("chart", type_to_str(data["type"]), data);
+               });
+
+               setInterval(function() {
+                       $.getJSON(url_id, function(data) {
+                               update_chart("chart", type_to_str(data["type"]), data);
+                       });
+               }, 5000);
       });
     </script>
   </head>
index 01ab6b3..b002c41 100644 (file)
@@ -100,11 +100,19 @@ function update_chart(chart_id, title, data) {
     var measures, data_chart, date, entry;
     var style;
 
+    $("#"+chart_id).html("");
+
     measures = data["measures"];
     data_chart = [];
     
+    $("h1").html("");
     $("h1").append(data["name"]);
-    $("title").append(data["name"]);
+
+    try {
+       $("title").html(data["name"]);
+    } catch(ignore) {
+       // IE8 doesn't allow to modify the page title
+    }
     
     $.each(measures, function(i, item) {
         value = item["value"];
@@ -146,6 +154,7 @@ function update_chart(chart_id, title, data) {
        } ]
     };
 
+
     $.jqplot (chart_id, [data_chart], style);
 }
 
index b1bc42b..3fbf003 100644 (file)
@@ -79,10 +79,12 @@ td {
     padding: 0.25em 0.25em 0em 0.25em;
 }
 
-.chart {
+#chart {
     color: #000;
     font-style: normal;
     font-weight: normal;
+    width: 100%;
+    height: 300px;
 }
 
 ul {