]> arthur.barton.de Git - netdata.git/blobdiff - web/index.html
Merge pull request #337 from ktsaou/master
[netdata.git] / web / index.html
index 6f6013da1d6a93f0ac701d58b17349c7caa7f9bf..17b4fca0c2f1e41111ca2018bc5a081443652a18 100644 (file)
        </script>
 
        <!-- load the dashboard manager - it will do the rest -->
-       <script type="text/javascript" src="dashboard.js?v32"></script>
+       <script type="text/javascript" src="dashboard.js?v34"></script>
 </head>
 
 <body data-spy="scroll" data-target="#sidebar">
                                </button>
                                <a href="/" class="navbar-brand" id="hostname">netdata</a>
                        </div>
+                       <nav id="demosites_nav" class="collapse navbar-collapse navbar-left" role="navigation">
+                               <ul class="nav navbar-nav">
+                                       <li class="dropdown">
+                                               <a href="#" class="dropdown-toggle" data-toggle="dropdown" id="current_view">demo sites <strong class="caret"></strong></a>
+                                               <ul class="dropdown-menu scrollable-menu inpagemenu" role="menu">
+                                                       <li id="demo_eu"><a href="//netdata1.firehol.org?nowelcome">EU - London (DigitalOcean.com)</a></li>
+                                                       <li id="demo_us"><a href="//netdata2.firehol.org?nowelcome">US - Atlanta (CDN77.com)</a></li>
+                                                       <li id="demo_gr"><a href="//netdata3.firehol.org?nowelcome">EU - Greece</a></li>
+                                                       <li role="separator" class="divider"></li>
+                                                       <li id="demo_tv"><a href="tv.html">TV Dashboard for 2 servers</a></li>
+                                                       <li id="demosites"><a href="demosites.html">Dashboard for monitoring netdata demo sites</a></li>
+                                               </ul>
+                                       </li>
+                               </ul>
+                       </nav>
                        <nav class="collapse navbar-collapse navbar-right" role="navigation">
                                <ul class="nav navbar-nav">
                                        <li><a href="#" class="btn" data-toggle="modal" data-target="#optionsModal"><i class="fa fa-cog"></i> settings</a></li>
@@ -783,8 +798,23 @@ function isdemo() {
        this_is_demo = false;
 
        try {
-               if(typeof document.location.hostname === 'string')
-                       this_is_demo = document.location.hostname.endsWith('.firehol.org');
+               if(typeof document.location.hostname === 'string') {
+                       if(document.location.hostname === 'netdata.firehol.org' || document.location.hostname === 'netdata1.firehol.org') {
+                               document.getElementById("demo_eu").className = "active";
+                               this_is_demo = true;
+                       }
+                       else if(document.location.hostname === 'netdata2.firehol.org') {
+                               document.getElementById("demo_us").className = "active";
+                               this_is_demo = true;
+                       }
+                       else if(document.location.hostname === 'netdata3.firehol.org') {
+                               document.getElementById("demo_gr").className = "active";
+                               this_is_demo = true;
+                       }
+               }
+
+               if(!this_is_demo)
+                       document.getElementById("demosites_nav").style.visibility = "hidden";
        }
        catch(error) {
                ;
@@ -987,6 +1017,21 @@ var menuData = {
                title: 'Example Charts',
                info: undefined
        },
+
+       'cgroup': {
+               title: 'Container',
+               info: undefined
+       },
+
+       'mysql': {
+               title: 'MySQL',
+               info: undefined
+       },
+
+       'named': {
+               title: 'named',
+               info: undefined
+       },
 };
 
 var submenuData = {
@@ -1297,8 +1342,13 @@ function anyAttribute(obj, attr, key, def) {
        return def;
 }
 
-function menuTitle(menu) {
-       return anyAttribute(menuData, 'title', menu, menu);
+function menuTitle(chart) {
+       if(typeof chart.menu_pattern !== 'undefined') {
+               return anyAttribute(menuData, 'title', chart.menu_pattern, chart.menu_pattern).toString()
+                               + ': ' + chart.type.slice(-(chart.type.length - chart.menu_pattern.length - 1)).toString();
+       }
+
+       return anyAttribute(menuData, 'title', chart.menu, chart.menu);
 }
 
 function menuInfo(menu) {
@@ -1354,6 +1404,13 @@ function enrichChartData(chart) {
                        chart.menu = tmp;
                        break;
 
+               case 'mysql':
+               case 'named':
+               case 'cgroup':
+                       chart.menu = chart.type;
+                       chart.menu_pattern = tmp;
+                       break;
+
                case 'tc':
                        chart.menu = tmp;
 
@@ -1390,11 +1447,11 @@ function enrichChartData(chart) {
 
 function name2id(s) {
        return s
-               .replace(' ', '_')
-               .replace('(', '_')
-               .replace(')', '_')
-               .replace('.', '_')
-               .replace('/', '_');
+               .replace(/ /g, '_')
+               .replace(/\(/g, '_')
+               .replace(/\)/g, '_')
+               .replace(/\./g, '_')
+               .replace(/\//g, '_');
 }
 
 function headMain(charts, duration) {
@@ -1549,7 +1606,7 @@ function renderPage(menus, data) {
 
                // generate an entry at the main menu
 
-               sidebar += '<li class=""><a href="#' + menu + '">' + menus[menu].title + '</a><ul class="nav">';
+               sidebar += '<li class=""><a href="#' + name2id(menu) + '">' + menus[menu].title + '</a><ul class="nav">';
                html += '<div role="section"><div role="sectionhead"><h1 id="' + menu + '" role="heading">' + menus[menu].title + '</h1></div><div id="' + menu + '" role="document">';
 
                if(menus[menu].info !== null)
@@ -1629,7 +1686,7 @@ function renderChartsAndMenu(data) {
                        menus[charts[c].menu] = {
                                priority: charts[c].priority,
                                submenus: {},
-                               title: menuTitle(charts[c].menu),
+                               title: menuTitle(charts[c]),
                                info: menuInfo(charts[c].menu),
                                height: menuHeight(charts[c].menu, options.chartsHeight)
                        };
@@ -1656,6 +1713,8 @@ function renderChartsAndMenu(data) {
                menus[charts[c].menu].submenus[charts[c].submenu].charts.push(charts[c]);
        }
 
+       // propagate the descriptive subname given to QoS
+       // to all the other submenus with the same name
        for(var m in menus) {
                for(var s in menus[m].submenus) {
                        // set the family using a name
@@ -1841,12 +1900,15 @@ function finalizePage() {
        // the Dom elements are initially zero-sized
        NETDATA.parseDom();
 
-       var before = 0, after = 0;
+       var before = 0, after = 0, nowelcome = 0;
        after = getUrlParameter('force_after_ms');
        before = getUrlParameter('force_before_ms');
+       nowelcome = (getUrlParameter('nowelcome') === true)?true:false;
 
-       if(before > 0 && after > 0)
+       if(before > 0 && after > 0) {
+               nowelcome = true;
                NETDATA.globalPanAndZoom.setMaster(NETDATA.options.targets[0], after, before);
+       }
 
        // let it run (update the charts)
        NETDATA.unpause();
@@ -1939,11 +2001,11 @@ function finalizePage() {
        // this has to be the last
        // it reloads the page
        $('#netdata_theme_control').change(function() {
-               if(setTheme($(this).prop('checked')?'slate':'default'))
+               if(setTheme($(this).prop('checked')?'slate':'white'))
                        location.reload();
        });
 
-       if(isdemo()) {
+       if(!nowelcome && isdemo()) {
                setTimeout(function() {
                        $('#welcomeModal').modal();
                }, 1000);