]> arthur.barton.de Git - netdata.git/commitdiff
further optimizations; in the progress of adding a menu to the new dashboard;
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 13 Dec 2015 21:19:34 +0000 (23:19 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 13 Dec 2015 21:19:34 +0000 (23:19 +0200)
web/dashboard.css
web/dashboard.js
web/dashboard_full.html

index d7a4ccd1736a6d4f330a97ded4acd0250fe57a7b..0210fb1968856d6327e61fd3cdef830ecf8ef823 100755 (executable)
@@ -83,7 +83,7 @@ html {
        margin-top: 0px;\r
 }\r
 .netdata-legend-series {\r
-       position: relative;\r
+       position: absolute;\r
        width: 110px;\r
        height: calc(100% - 50px);\r
        overflow: hidden;\r
index 58becde437a3017fd6a4ed1afd94217e7c891de0..18e2316e9ccac5805c3a5a98273595972fc5fdd9 100755 (executable)
        }
 
        chartState.prototype.legendFormatValue = function(value) {
-               // FIXME
-               // return '';
-               // return value;
                if(value === null) return '';
                if(typeof value !== 'number') return value;
 
        chartState.prototype.legendSetLabelValue = function(label, value) {
                var series = this.element_legend_childs.series[label];
 
-               if(typeof series === 'undefined' || series.last === value)
-                       return;
+               if(typeof series === 'undefined') return;
 
-               series.last = value;
                value = this.legendFormatValue(value);
 
+               // if the value has not changed, skip DOM update
+               if(series.last === value) return;
+               series.last = value;
+
                if(series.value !== null) series.value.innerHTML = value;
                if(series.user !== null) series.user.innerHTML = value;
        }
 
        NETDATA.requiredCSS = [
                NETDATA.serverDefault + 'css/bootstrap.min.css',
-               NETDATA.serverDefault + 'css/bootstrap-theme.min.css',
+               //NETDATA.serverDefault + 'css/bootstrap-theme.min.css',
                NETDATA.dashboard_css
        ];
 
index 203f75a681e19f7e6e5ff9876455d64715f3e976..13d4d9a2d6871fb69808bf6dbf2861373c69e5a0 100755 (executable)
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
        <meta name="author" content="costa@tsaousis.gr">
+<style>
+body {
+ padding-top:50px;
+}
+
+#masthead h1 {
+ /*font-size: 30px;*/
+ line-height: 1;
+ padding-top:20px;
+}
+
+#masthead .well {
+ margin-top:4%;
+}
+
+#sidebar li.active {
+  border:0 #eee solid;
+  border-right-width:5px;
+}
+
+@media (min-width: 979px) {
+  #sidebar.affix-top {
+    position: static;
+       margin-top:30px;
+       width:228px;
+  }
+  
+  #sidebar.affix {
+    position: fixed;
+    top:70px;
+    width:228px;
+  }
+}
+</style>
 </head>
 <body>
-
-<div class="container-fluid">
-       <div id="charts_div" class="container-fluid"></div>
-</div>
+       <nav class="navbar navbar-default navbar-fixed-top" role="banner">
+               <div class="container">
+                       <div class="navbar-header">
+                               <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-collapse">
+                                       <span class="sr-only">Toggle navigation</span>
+                                       <span class="icon-bar"></span>
+                                       <span class="icon-bar"></span>
+                                       <span class="icon-bar"></span>
+                               </button>
+                               <a href="/" class="navbar-brand">Netdata</a>
+                       </div>
+                       <nav class="collapse navbar-collapse" role="navigation">
+                               <ul class="nav navbar-nav">
+                                       <li><a href="#sec">Get Started</a></li>
+                                       <li><a href="#sec">Edit</a></li>
+                                       <li><a href="#sec">Visualize</a></li>
+                                       <li><a href="#sec">Prototype</a></li>
+                               </ul>
+                       </nav>
+               </div>
+       </nav>
+
+       <div id="masthead"> 
+               <div class="container">
+                       <div class="row">
+                               <div class="col-md-6">
+                                       <h1>Netdata Dashboard
+                                               <p class="lead">Real time data collection and graphs...</p>
+                                       </h1>
+                               </div>
+                               <div class="col-md-6">
+                                       <div class="well well-lg">
+                                               <div class="row">
+                                                       <div class="col-sm-6">
+                                                               <div data-netdata="system.cpu" data-chart-library="dygraph" data-dygraph-theme="sparkline" data-before="0" data-after="-60" data-width="100%" data-height="60px"></div>
+                                                       </div>
+                                                       <div class="col-sm-6">
+                                                               Drag charts to pan.<br/>
+                                                               Shift + wheel on them, to zoom.</br>
+                                                               Double-click on them, to reset.
+                                                       </div>
+                                               </div>
+                                       </div>
+                               </div>
+                       </div>
+               </div>
+       </div>
+
+       <div class="container">
+               <div class="row">
+                       <div class="col-md-10" role="main">
+                               <div id="charts_div"></div>
+                       </div>
+                       <div class="col-md-2" role="complementary">
+                               <div class="hidden-print hidden-xs hidden-sm affix-top">
+                                       <ul class="nav nav-stacked" id="sidebar">
+                                               <li><a href="#sec0">Section 0</a>
+                                                       <ul class="nav">
+                                                               <li><a href="#sec0">Section 0a</a></li>
+                                                               <li><a href="#sec0">Section 0b</a></li>
+                                                       </ul>
+                                               </li>
+                                               <li><a href="#sec0">Section 1</a></li>
+                                       </ul>
+                               </div>
+                       </div>
+               </div>
+       </div>
 
 </body>
 </html>
@@ -35,8 +133,8 @@ var options = {
        families: new Array(),
        families_idx: {},
        chartsPerRow: 0,
-       chartsMinWidth: 450,
-       chartsHeight: 200,
+       chartsMinWidth: 1450,
+       chartsHeight: 150,
        sparklinesHeight: 60
 }
 
@@ -121,7 +219,7 @@ function prepareScreen(data) {
                        switch(c.category) {
                                case 'system':
                                        c.category_priority = 10;
-                                       c.category_title = 'System';
+                                       c.category_title = 'System Summary';
                                        c.glyphicon = "glyphicon-dashboard";
                                        break;
 
@@ -151,13 +249,13 @@ function prepareScreen(data) {
 
                                case 'netfilter':
                                        c.category_priority = 60;
-                                       c.category_title = 'Netfilter';
+                                       c.category_title = 'Netfilter / IPTables';
                                        c.glyphicon = "glyphicon-cloud";
                                        break;
 
                                case 'ipv4':
                                        c.category_priority = 70;
-                                       c.category_title = 'IPv4';
+                                       c.category_title = 'IPv4 Summary';
                                        c.glyphicon = "glyphicon-globe";
                                        break;
 
@@ -197,6 +295,18 @@ function prepareScreen(data) {
                                        c.glyphicon = "glyphicon-thumbs-up";
                                        break;
 
+                               case 'sensors':
+                                       c.category_priority = 160;
+                                       c.category_title = 'Hardware Sensors';
+                                       c.glyphicon = "glyphicon-thumbs-up";
+                                       break;
+
+                               case 'postfix':
+                                       c.category_priority = 170;
+                                       c.category_title = 'Mail Server';
+                                       c.glyphicon = "glyphicon-thumbs-up";
+                                       break;
+
                                case 'example':
                                        c.category_priority = 100000;
                                        c.category_title = 'Example Plugins';
@@ -258,11 +368,15 @@ function prepareScreen(data) {
        // find the proper duration for per-second updates
        var duration = Math.round(($(div).width() * pcent_width / 100 * data.update_every / 3) / 60) * 60;
        console.log(duration);
-       html = '';
+       var html = '';
+       var sidebar = '';
+
+       // render the charts
        $.each(options.categories, function(i, t) {
                t.charts.sort(prioritySort);
 
-               html += '<div class="container-fluid row clearfix"><h2>' + t.title + '</h2>';
+               sidebar += '<li><a href="#section' + i + '">' + t.title + '</a></li>';
+               html += '<h2 id="section' + i + '">' + t.title + '</h2>';
 
                if(t.name === 'net') {
                        var interfaces = uniq_with_list(t.charts, function(c) { return c.family; });
@@ -329,7 +443,7 @@ function prepareScreen(data) {
                        });
                }
 
-               html += '</div>';
+               html += '';
        });
 
        html += '<br/>'
@@ -338,7 +452,33 @@ function prepareScreen(data) {
        });
 
        div.innerHTML = html;
+       document.getElementById('sidebar').innerHTML = sidebar;
        NETDATA.unpause();
+
+       /* activate sidebar */
+       $('#sidebar').affix({
+               offset: {
+                       top: 200
+               }
+       });
+
+       // fix for jumping to proper anchor after ajax
+       $(window).load(function(){
+               // Remove the # from the hash, as different browsers may or may not include it
+               var hash = location.hash.replace('#','');
+
+               if(hash != '') {
+                       // Clear the hash in the URL
+                       // location.hash = '';   // delete front "//" if you want to change the address bar
+                       $('html, body').animate({ scrollTop: $(location.hash).offset().top - 55}, 0);
+               }
+       });
+
+       /* activate scrollspy menu */
+       $(document.body).scrollspy({
+               target: '#leftCol',
+               offset: -55
+       });
 }
 
 NETDATA.ready(function() {