]> arthur.barton.de Git - netdata.git/commitdiff
in dashboard menu, replace _ with space
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 3 Sep 2016 14:35:04 +0000 (17:35 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 3 Sep 2016 14:35:04 +0000 (17:35 +0300)
web/index.html

index d7863dc7be3da63b99b8b25e3f0c5428f5abf866..940388712438120d12651a18e148681305bafaf8 100644 (file)
@@ -2062,24 +2062,13 @@ function anyAttribute(obj, attr, key, def) {
     return def;
 }
 
-function anyAttributeTitle(obj, attr, key, def) {
-    if(typeof obj[key] !== 'undefined') {
-        if(typeof obj[key][attr] !== 'undefined')
-            return obj[key][attr];
-    }
-
-    var r = def.replace(/_/g, ' ');
-
-    return r;
-}
-
 function menuTitle(chart) {
     if(typeof chart.menu_pattern !== 'undefined') {
-        return anyAttributeTitle(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_pattern, chart.menu_pattern).toString()
+                + ' ' + chart.type.slice(-(chart.type.length - chart.menu_pattern.length - 1)).toString()).replace(/_/g, ' ');
     }
 
-    return anyAttributeTitle(menuData, 'title', chart.menu, chart.menu);
+    return (anyAttribute(menuData, 'title', chart.menu, chart.menu)).toString().replace(/_/g, ' ');
 }
 
 function menuIcon(chart) {
@@ -2099,11 +2088,11 @@ function menuHeight(menu, relative) {
 
 function submenuTitle(menu, submenu) {
     var key = menu + '.' + submenu;
-    var title = anyAttributeTitle(submenuData, 'title', key, submenu);
-    if(title.length > 30) {
-        var a = title.substring(0, 13);
-        var b = title.substring(title.length - 13, title.length);
-        return a + '...' + b;
+    var title = anyAttribute(submenuData, 'title', key, submenu).toString().replace(/_/g, ' ');;
+    if(title.length > 28) {
+        var a = title.substring(0, 28);
+        // var b = title.substring(title.length - 13, title.length);
+        return a + '...'; // + b;
     }
     return title;
 }