gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14988 - in gauger: . css


From: gnunet
Subject: [GNUnet-SVN] r14988 - in gauger: . css
Date: Fri, 15 Apr 2011 13:34:29 +0200

Author: bartpolot
Date: 2011-04-15 13:34:29 +0200 (Fri, 15 Apr 2011)
New Revision: 14988

Modified:
   gauger/css/style.css
   gauger/template.php
   gauger/template_host.php
Log:
Added graph combination in host view


Modified: gauger/css/style.css
===================================================================
--- gauger/css/style.css        2011-04-15 11:29:01 UTC (rev 14987)
+++ gauger/css/style.css        2011-04-15 11:34:29 UTC (rev 14988)
@@ -346,6 +346,11 @@
     background:         white;
 }
 
+.select-metric {
+    width:              95px;
+    font-size:          90%;
+}
+
 .footer-shadow {
     height:             50px;
     background-image:   url("images/f.png");

Modified: gauger/template.php
===================================================================
--- gauger/template.php 2011-04-15 11:29:01 UTC (rev 14987)
+++ gauger/template.php 2011-04-15 11:34:29 UTC (rev 14988)
@@ -384,8 +384,34 @@
                         this.src = this.src.replace(/&h=[^&]+/g, 
'')+"&h="+hosts;
                     });
                 });
+                $(".add-metric").click(function(){
+                    x = 
$(this).parents(".control-column").find(".select-metric").val();
+                    
$(this).parents(".control-column").find(".added-metrics").append(
+                        '<li>\
+                            <input type="checkbox" checked="checked" 
class="added-metric" onclick="rescan_added_hosts(this)">\
+                            <a href="index.php?graph=' + x + '" title="[' + 
get_category(x) + '] ' + get_name(x) + '">' + get_name(x) + '</a>\
+                        </li>'
+                    );
+                    $(this).parents("tr").find(".plot").each(function() {
+                        this.src = this.src.replace(/(g=[^&]+)/g, '$1,'+x);
+                    });
+                });
         });
 
+        function rescan_added_hosts(that) {
+            var graphs = "";
+            var sep = "";
+            var links = 
$(that).parents("ul").find(".added-metric:checked").parents("li").find("a").get().reverse();
+            for(i in links) {
+                graph = "" + links[i];
+                graphs += sep + graph.replace(/.*graph=([^&]+).*/g, "$1");
+                sep = ",";
+            }
+            $(that).parents("tr").find(".plot").each(function() {
+                this.src = this.src.replace(/&g=[^&]+/g, '')+"&g="+graphs;
+            });
+        }
+
         function get_command(element) {
             var url = $(element).parents("tr").find("img").attr("src");
             document.location = url + "&raw_cmd=true";
@@ -428,6 +454,19 @@
             document.location = '?logout=1';
         }
 
+        function get_category(s) {
+            return s.replace(/:::.*/g, '');
+        }
+
+        function get_name(s) {
+            s = s.replace(/.*:::/g, '');
+            return s.replace(/___.*/g, '');
+        }
+
+        function get_unit(s) {
+            return s.replace(/.*___/g, '');
+        }
+
         </script>
 
     </head>

Modified: gauger/template_host.php
===================================================================
--- gauger/template_host.php    2011-04-15 11:29:01 UTC (rev 14987)
+++ gauger/template_host.php    2011-04-15 11:34:29 UTC (rev 14988)
@@ -69,10 +69,22 @@
                         <input class="auto_max" type="checkbox" <?php 
if(get_session('x_max_a')) echo 'checked="checked"'?>/>
                     </div>
                 </div>
-                <br/>
-                <a href="?graph=<?php echo $counter ?>">Compare</a>
-                <br/><br/>
+                <hr/>
                 <a href="#" onclick="get_command(this); return false;" >Get 
Source</a>
+                <hr/>
+                <ul class="added-metrics">
+                    <li>
+                        <input type="checkbox" checked="checked" 
class="added-metric" readonly="true">
+                        <a href="?graph=<?php echo $counter ?>"><?php echo 
get_counter_name($counter) ?></a>
+                    </li>
+                </ul>
+                Compare with:
+                <select class="select-metric">
+                <?php foreach ($hosts[$current] as $graph): ?>
+                    <option value="<?php echo $graph?>"><?php echo 
get_counter_name($graph) ?></option>
+                <?php endforeach; ?>
+                </select>
+                <input type="button" value="Add" class="add-metric"></input>
             </th>
             <td height="<?php echo get_session('png_y_size')+2 ?>" 
width="<?php echo get_session('png_x_size')+2 ?>"><img class="plot" 
src="plot.php?h=<?php echo "$current&g=$counter" ?>" alt="loading..."/></td>
         </tr>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]