add javascript refresh
authorJulien Moutinho <julm+air@autogeree.net>
Fri, 4 Dec 2015 12:29:05 +0000 (13:29 +0100)
committerJulien Moutinho <julm+air@autogeree.net>
Fri, 4 Dec 2015 12:29:05 +0000 (13:29 +0100)
remote-collect.sh
xsl/year/month.html5.xsl

index 39fd7c389418bfe372eae77dfcc155b799b094cc..98b43efce5a9a70cf15904aac97048191412ea52 100755 (executable)
@@ -2,11 +2,12 @@
 
 year=${year:-$(date +%Y)}
 month=${month:-$(date +%m)}
-day=${day-$(date +%d)}
-host=${host:-air-collect}
+day=${day-}
+host=${host:-cubie}
 user=${user:-root}
 
 ssh "$host" ${user:+-l "$user"} \
 rrdtool dump \~user/work/tool/air/rrd/"$year"/"$month".rrd |
 rrdtool restore -f - rrd/"$year"/"$month".rrd
-make NO_INO=set view/"$year"/"$month"/html5
+make NO_INO=set view/"$year"/"$month"/${day:+$day/}png
+make NO_INO=set view/"$year"/"$month"/${day:+$day/}html5
index fcf4d9bd6d524b9a6ab270910c7c06f5d48e201e..8c50210f70eeabcf40e3d809b0d83a653f2017c2 100644 (file)
@@ -3,6 +3,7 @@
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output doctype-system="about:legacy-compat"
         encoding="UTF-8" indent="yes" method="html"/>
+       <xsl:param name="refresh-interval" select="'60'"/>
        <xsl:template match="report">
                <html>
                        <head>
                                                text-decoration:none;
                                         }
                                 </style>
+                               <script type="application/javascript">
+                                       var PageRefresh = {};
+                                       PageRefresh.interval = <xsl:value-of select="$refresh-interval"/>;
+                                       PageRefresh.refresh = function() {
+                                               window.setTimeout(function(){
+                                                       window.location.reload(true);
+                                                       setTimeout(arguments.callee, PageRefresh.interval * 1000);
+                                                }, PageRefresh.interval * 1000);
+                                        }
+                                </script>
                         </head>
-                       <body>
+                       <body onload="PageRefresh.refresh()">
                                <table class="graphs">
                                        <tbody>
                                                <xsl:apply-templates/>