@cryptotaxi247 / netdata-1 / commits / adaa8192b

code cleanup; fixed typos;

Costa Tsaousis (ktsaou) committed Apr 17, 2016 at 01:25 UTC adaa8192b980375eeb56f2d2be9b04622793ccd8
2 files changed +153 -151
web/dashboard.js
+139 -137
@@ -155,7 +155,7 @@
155 after: -600, // panning
156 pixels_per_point: 1, // the detail of the chart
157 fill_luminance: 0.8 // luminance of colors in solit areas
158 - }
158 + };
159
160 // ----------------------------------------------------------------------------------------------------------------
161 // global options
@@ -281,7 +281,7 @@
281 libraries: false,
282 dygraph: false
283 }
284 - }
284 + };
285
286
287 // ----------------------------------------------------------------------------------------------------------------
@@ -329,7 +329,7 @@
329
330 NETDATA.localStorage.current[key.toString()] = ret;
331 return ret;
332 - }
332 + };
333
334 NETDATA.localStorageSet = function(key, value, callback) {
335 if(typeof value === 'undefined' || value === 'undefined') {
@@ -354,7 +354,7 @@
354
355 NETDATA.localStorage.current[key.toString()] = value;
356 return value;
357 - }
357 + };
358
359 NETDATA.localStorageGetRecursive = function(obj, prefix, callback) {
360 for(var i in obj) {
@@ -366,7 +366,7 @@
366
367 obj[i] = NETDATA.localStorageGet(prefix + '.' + i.toString(), obj[i], callback);
368 }
369 - }
369 + };
370
371 NETDATA.setOption = function(key, value) {
372 if(key.toString() === 'setOptionCallback') {
@@ -391,11 +391,11 @@
391 }
392
393 return true;
394 - }
394 + };
395
396 NETDATA.getOption = function(key) {
397 return NETDATA.options.current[key.toString()];
398 - }
398 + };
399
400 // read settings from local storage
401 NETDATA.localStorageGetRecursive(NETDATA.options.current, 'options', null);
@@ -475,7 +475,7 @@
475
476 if(NETDATA.errorCodes[code].alert)
477 alert("ERROR " + code + ": " + NETDATA.errorCodes[code].message + ": " + msg);
478 - }
478 + };
479
480 NETDATA.errorReset = function() {
481 NETDATA.errorLast.code = 0;
@@ -630,7 +630,7 @@
630
631 return true;
632 }
633 - }
633 + };
634
635 // ----------------------------------------------------------------------------------------------------------------
636 // dimensions selection
@@ -646,19 +646,19 @@
646 this.value_div = null;
647 this.color = NETDATA.themes.current.foreground;
648
649 - if(parent.selected === parent.unselected)
649 + if(parent.selected_count > parent.unselected_count)
650 this.selected = true;
651 else
652 this.selected = false;
653
654 this.setOptions(name_div, value_div, color);
655 - }
655 + };
656
657 dimensionStatus.prototype.invalidate = function() {
658 this.name_div = null;
659 this.value_div = null;
660 this.enabled = false;
661 - }
661 + };
662
663 dimensionStatus.prototype.setOptions = function(name_div, value_div, color) {
664 this.color = color;
@@ -685,7 +685,7 @@
685
686 this.enabled = true;
687 this.setHandler();
688 - }
688 + };
689
690 dimensionStatus.prototype.setHandler = function() {
691 if(this.enabled === false) return;
@@ -730,7 +730,7 @@
730
731 ds.parent.state.redrawChart();
732 }
733 - }
733 + };
734
735 dimensionStatus.prototype.select = function() {
736 if(this.enabled === false) return;
@@ -738,7 +738,7 @@
738 this.name_div.className = 'netdata-legend-name selected';
739 this.value_div.className = 'netdata-legend-value selected';
740 this.selected = true;
741 - }
741 + };
742
743 dimensionStatus.prototype.unselect = function() {
744 if(this.enabled === false) return;
@@ -746,11 +746,11 @@
746 this.name_div.className = 'netdata-legend-name not-selected';
747 this.value_div.className = 'netdata-legend-value hidden';
748 this.selected = false;
749 - }
749 + };
750
751 dimensionStatus.prototype.isSelected = function() {
752 return(this.enabled === true && this.selected === true);
753 - }
753 + };
754
755 // ----------------------------------------------------------------------------------------------------------------
756
@@ -760,7 +760,7 @@
760 this.dimensions = {};
761 this.selected_count = 0;
762 this.unselected_count = 0;
763 - }
763 + };
764
765 dimensionsVisibility.prototype.dimensionAdd = function(label, name_div, value_div, color) {
766 if(typeof this.dimensions[label] === 'undefined') {
@@ -771,21 +771,21 @@
771 this.dimensions[label].setOptions(name_div, value_div, color);
772
773 return this.dimensions[label];
774 - }
774 + };
775
776 dimensionsVisibility.prototype.dimensionGet = function(label) {
777 return this.dimensions[label];
778 - }
778 + };
779
780 dimensionsVisibility.prototype.invalidateAll = function() {
781 for(var d in this.dimensions)
782 this.dimensions[d].invalidate();
783 - }
783 + };
784
785 dimensionsVisibility.prototype.selectAll = function() {
786 for(var d in this.dimensions)
787 this.dimensions[d].select();
788 - }
788 + };
789
790 dimensionsVisibility.prototype.countSelected = function() {
791 var i = 0;
@@ -793,12 +793,12 @@
793 if(this.dimensions[d].isSelected()) i++;
794
795 return i;
796 - }
796 + };
797
798 dimensionsVisibility.prototype.selectNone = function() {
799 for(var d in this.dimensions)
800 this.dimensions[d].unselect();
801 - }
801 + };
802
803 dimensionsVisibility.prototype.selected2BooleanArray = function(array) {
804 var ret = new Array();
@@ -829,7 +829,7 @@
829 }
830
831 return ret;
832 - }
832 + };
833
834
835 // ----------------------------------------------------------------------------------------------------------------
@@ -871,7 +871,7 @@
871 that.element.innerHTML = that.id + ': ' + msg;
872 that.enabled = false;
873 that.current = that.pan;
874 - }
874 + };
875
876 // GUID - a unique identifier for the chart
877 this.uuid = NETDATA.guid();
@@ -1090,10 +1090,10 @@
1090 that.tm.last_dom_created = new Date().getTime();
1091
1092 showLoading();
1093 - }
1093 + };
1094
1095 /* init() private
1096 - * initialize state viariables
1096 + * initialize state variables
1097 * destroy all (possibly) created state elements
1098 * create the basic DOM for a chart
1099 */
@@ -1123,7 +1123,7 @@
1123 last_hidden: 0, // the time the chart was hidden
1124 last_unhidden: 0, // the time the chart was unhidden
1125 last_autorefreshed: 0 // the time the chart was last refreshed
1126 - },
1126 + };
1127
1128 that.data = null; // the last data as downloaded from the netdata server
1129 that.data_url = 'invalid://'; // string - the last url used to update the chart
@@ -1136,7 +1136,7 @@
1136 createDOM();
1137
1138 that.setMode('auto');
1139 - }
1139 + };
1140
1141 var maxMessageFontSize = function() {
1142 // normally we want a font size, as tall as the element
@@ -1167,29 +1167,29 @@
1167 // set it
1168 that.element_message.style.fontSize = h.toString() + 'px';
1169 that.element_message.style.paddingTop = paddingTop.toString() + 'px';
1170 - }
1170 + };
1171
1172 var showMessage = function(msg) {
1173 that.element_message.className = 'netdata-message';
1174 that.element_message.innerHTML = msg;
1175 - this.element_message.style.fontSize = 'x-small';
1175 + that.element_message.style.fontSize = 'x-small';
1176 that.element_message.style.paddingTop = '0px';
1177 that.___messageHidden___ = undefined;
1178 - }
1178 + };
1179
1180 var showMessageIcon = function(icon) {
1181 that.element_message.innerHTML = icon;
1182 that.element_message.className = 'netdata-message icon';
1183 maxMessageFontSize();
1184 that.___messageHidden___ = undefined;
1185 - }
1185 + };
1186
1187 var hideMessage = function() {
1188 if(typeof that.___messageHidden___ === 'undefined') {
1189 that.___messageHidden___ = true;
1190 that.element_message.className = 'netdata-message hidden';
1191 }
1192 - }
1192 + };
1193
1194 var showRendering = function() {
1195 var icon;
@@ -1203,7 +1203,7 @@
1203 icon = '<i class="fa fa-area-chart"></i>';
1204
1205 showMessageIcon(icon + ' netdata');
1206 - }
1206 + };
1207
1208 var showLoading = function() {
1209 if(that.chart_created === false) {
@@ -1211,14 +1211,14 @@
1211 return true;
1212 }
1213 return false;
1214 - }
1214 + };
1215
1216 var isHidden = function() {
1217 if(typeof that.___chartIsHidden___ !== 'undefined')
1218 return true;
1219
1220 return false;
1221 - }
1221 + };
1222
1223 // hide the chart, when it is not visible - called from isVisible()
1224 var hideChart = function() {
@@ -1239,7 +1239,7 @@
1239 }
1240
1241 that.___chartIsHidden___ = true;
1242 - }
1242 + };
1243
1244 // unhide the chart, when it is visible - called from isVisible()
1245 var unhideChart = function() {
@@ -1260,14 +1260,14 @@
1260 resizeChart();
1261 hideMessage();
1262 }
1263 - }
1263 + };
1264
1265 var canBeRendered = function() {
1266 if(isHidden() === true || that.isVisible(true) === false)
1267 return false;
1268
1269 return true;
1270 - }
1270 + };
1271
1272 // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers
1273 var callChartLibraryUpdateSafely = function(data) {
@@ -1293,7 +1293,7 @@
1293 }
1294
1295 return true;
1296 - }
1296 + };
1297
1298 // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers
1299 var callChartLibraryCreateSafely = function(data) {
@@ -1321,7 +1321,7 @@
1321 that.chart_created = true;
1322 that.updates_since_last_creation = 0;
1323 return true;
1324 - }
1324 + };
1325
1326 // ----------------------------------------------------------------------------------------------------------------
1327 // Chart Resize
@@ -1347,7 +1347,7 @@
1347
1348 that.tm.last_resized = new Date().getTime();
1349 }
1350 - }
1350 + };
1351
1352 // this is the actual chart resize algorithm
1353 // it will:
@@ -1464,7 +1464,7 @@
1464 NETDATA.options.auto_refresher_stop_until = 0;
1465 };
1466 }
1467 - }
1467 + };
1468
1469
1470 var noDataToShow = function() {
@@ -1475,14 +1475,14 @@
1475 //that.element_chart.style.display = 'none';
1476 //if(that.element_legend !== null) that.element_legend.style.display = 'none';
1477 //that.___chartIsHidden___ = true;
1478 - }
1478 + };
1479
1480 // ============================================================================================================
1481 // PUBLIC FUNCTIONS
1482
1483 this.error = function(msg) {
1484 error(msg);
1485 - }
1485 + };
1486
1487 this.setMode = function(m) {
1488 if(this.current !== null && this.current.name === m) return;
@@ -1501,7 +1501,7 @@
1501 this.current.force_after_ms = null;
1502
1503 this.tm.last_mode_switch = new Date().getTime();
1504 - }
1504 + };
1505
1506 // ----------------------------------------------------------------------------------------------------------------
1507 // global selection sync
@@ -1515,7 +1515,7 @@
1515 NETDATA.globalSelectionSync.dont_sync_before = new Date().getTime() + ms;
1516 else
1517 NETDATA.globalSelectionSync.dont_sync_before = new Date().getTime() + NETDATA.options.current.sync_selection_delay;
1518 - }
1518 + };
1519
1520 // can we globally apply selection sync?
1521 this.globalSelectionSyncAbility = function() {
@@ -1526,14 +1526,14 @@
1526 return false;
1527
1528 return true;
1529 - }
1529 + };
1530
1531 this.globalSelectionSyncIsMaster = function() {
1532 if(NETDATA.globalSelectionSync.state === this)
1533 return true;
1534 else
1535 return false;
1536 - }
1536 + };
1537
1538 // this chart is the master of the global selection sync
1539 this.globalSelectionSyncBeMaster = function() {
@@ -1578,7 +1578,7 @@
1578 }
1579
1580 // this.globalSelectionSyncDelay(100);
1581 - }
1581 + };
1582
1583 // can the chart participate to the global selection sync as a slave?
1584 this.globalSelectionSyncIsEligible = function() {
@@ -1590,13 +1590,13 @@
1590 return true;
1591
1592 return false;
1593 - }
1593 + };
1594
1595 // this chart becomes a slave of the global selection sync
1596 this.globalSelectionSyncBeSlave = function() {
1597 if(NETDATA.globalSelectionSync.state !== this)
1598 NETDATA.globalSelectionSync.slaves.push(this);
1599 - }
1599 + };
1600
1601 // sync all the visible charts to the given time
1602 // this is to be called from the chart libraries
@@ -1626,7 +1626,7 @@
1626 $.each(NETDATA.globalSelectionSync.slaves, function(i, st) {
1627 st.setSelection(t);
1628 });
1629 - }
1629 + };
1630
1631 // stop syncing all charts to the given time
1632 this.globalSelectionSyncStop = function() {
@@ -1653,7 +1653,7 @@
1653 }
1654
1655 this.clearSelection();
1656 - }
1656 + };
1657
1658 this.setSelection = function(t) {
1659 if(typeof this.library.setSelection === 'function') {
@@ -1668,7 +1668,7 @@
1668 this.log('selection set to ' + t.toString());
1669
1670 return this.selected;
1671 - }
1671 + };
1672
1673 this.clearSelection = function() {
1674 if(this.selected === true) {
@@ -1687,26 +1687,26 @@
1687 }
1688
1689 return this.selected;
1690 - }
1690 + };
1691
1692 // find if a timestamp (ms) is shown in the current chart
1693 this.timeIsVisible = function(t) {
1694 if(t >= this.data_after && t <= this.data_before)
1695 return true;
1696 return false;
1697 - },
1697 + };
1698
1699 this.calculateRowForTime = function(t) {
1700 if(this.timeIsVisible(t) === false) return -1;
1701 return Math.floor((t - this.data_after) / this.data_update_every);
1702 - }
1702 + };
1703
1704 // ----------------------------------------------------------------------------------------------------------------
1705
1706 // console logging
1707 this.log = function(msg) {
1708 console.log(this.id + ' (' + this.library_name + ' ' + this.uuid + '): ' + msg);
1709 - }
1709 + };
1710
1711 this.pauseChart = function() {
1712 if(this.paused === false) {
@@ -1715,7 +1715,7 @@
1715
1716 this.paused = true;
1717 }
1718 - }
1718 + };
1719
1720 this.unpauseChart = function() {
1721 if(this.paused === true) {
@@ -1724,7 +1724,7 @@
1724
1725 this.paused = false;
1726 }
1727 - }
1727 + };
1728
1729 this.resetChart = function(dont_clear_master, dont_update) {
1730 if(this.debug === true)
@@ -1766,7 +1766,7 @@
1766 if(dont_update !== true && this.isVisible() === true) {
1767 this.updateChart();
1768 }
1769 - }
1769 + };
1770
1771 this.updateChartPanOrZoom = function(after, before) {
1772 var logme = 'updateChartPanOrZoom(' + after + ', ' + before + '): ';
@@ -1776,7 +1776,9 @@
1776 this.log(logme);
1777
1778 if(before < after) {
1779 - this.log(logme + 'flipped parameters, rejecting it.');
1779 + if(this.debug === true)
1780 + this.log(logme + 'flipped parameters, rejecting it.');
1781 +
1782 return false;
1783 }
1784
@@ -1840,7 +1842,7 @@
1842 this.current.force_before_ms = before;
1843 NETDATA.globalPanAndZoom.setMaster(this, after, before);
1844 return ret;
1843 - }
1845 + };
1846
1847 this.legendFormatValue = function(value) {
1848 if(value === null || value === 'undefined') return '-';
@@ -1852,7 +1854,7 @@
1854 if(abs >= 1 ) return (Math.round(value * 100) / 100).toLocaleString();
1855 if(abs >= 0.1 ) return (Math.round(value * 1000) / 1000).toLocaleString();
1856 return (Math.round(value * 10000) / 10000).toLocaleString();
1855 - }
1857 + };
1858
1859 this.legendSetLabelValue = function(label, value) {
1860 var series = this.element_legend_childs.series[label];
@@ -1882,7 +1884,7 @@
1884
1885 if(series.value !== null) series.value.innerHTML = s;
1886 if(series.user !== null) series.user.innerHTML = r;
1885 - }
1887 + };
1888
1889 this.legendSetDate = function(ms) {
1890 if(typeof ms !== 'number') {
@@ -1900,7 +1902,7 @@
1902
1903 if(this.element_legend_childs.title_units)
1904 this.element_legend_childs.title_units.innerHTML = this.units;
1903 - }
1905 + };
1906
1907 this.legendShowUndefined = function() {
1908 if(this.element_legend_childs.title_date)
@@ -1923,7 +1925,7 @@
1925 this.legendSetLabelValue(label, null);
1926 }
1927 }
1926 - }
1928 + };
1929
1930 this.legendShowLatestValues = function() {
1931 if(this.chart === null) return;
@@ -1958,11 +1960,11 @@
1960 else
1961 this.legendSetLabelValue(label, this.data.view_latest_values[i]);
1962 }
1961 - }
1963 + };
1964
1965 this.legendReset = function() {
1966 this.legendShowLatestValues();
1965 - }
1967 + };
1968
1969 // this should be called just ONCE per dimension per chart
1970 this._chartDimensionColor = function(label) {
@@ -1986,13 +1988,14 @@
1988
1989 this.colors.push(this.colors_assigned[label]);
1990 return this.colors_assigned[label];
1989 - }
1991 + };
1992
1993 this.chartColors = function() {
1994 if(this.colors !== null) return this.colors;
1995
1996 this.colors = new Array();
1997 this.colors_available = new Array();
1998 + var i, len;
1999
2000 var c = $(this.element).data('colors');
2001 // this.log('read colors: ' + c);
@@ -2005,7 +2008,7 @@
2008 var added = 0;
2009
2010 while(added < 20) {
2008 - for(var i = 0, len = c.length; i < len ; i++) {
2011 + for(i = 0, len = c.length; i < len ; i++) {
2012 added++;
2013 this.colors_available.push(c[i]);
2014 // this.log('adding color: ' + c[i]);
@@ -2015,11 +2018,11 @@
2018 }
2019
2020 // push all the standard colors too
2018 - for(var i = 0, len = NETDATA.themes.current.colors.length; i < len ; i++)
2021 + for(i = 0, len = NETDATA.themes.current.colors.length; i < len ; i++)
2022 this.colors_available.push(NETDATA.themes.current.colors[i]);
2023
2024 return this.colors;
2022 - }
2025 + };
2026
2027 this.legendUpdateDOM = function() {
2028 var needed = false;
@@ -2088,7 +2091,7 @@
2091 if(user_id !== null) {
2092 user_element = document.getElementById(user_id) || null;
2093 if(user_element === null)
2091 - me.log('Cannot find element with id: ' + user_id);
2094 + state.log('Cannot find element with id: ' + user_id);
2095 }
2096
2097 state.element_legend_childs.series[name] = {
@@ -2180,7 +2183,7 @@
2183 var after = that.view_after - dt;
2184 if(after >= that.netdata_first)
2185 that.library.toolboxPanAndZoom(that, after, before);
2183 - }
2186 + };
2187 if(NETDATA.options.current.show_help === true)
2188 $(this.element_legend_childs.toolbox_left).popover({
2189 container: "body",
@@ -2200,7 +2203,7 @@
2203 this.element_legend_childs.toolbox_reset.onclick = function(e) {
2204 e.preventDefault();
2205 NETDATA.resetAllCharts(that);
2203 - }
2206 + };
2207 if(NETDATA.options.current.show_help === true)
2208 $(this.element_legend_childs.toolbox_reset).popover({
2209 container: "body",
@@ -2223,7 +2226,7 @@
2226 var after = that.view_after + dt;
2227 if(before <= that.netdata_last)
2228 that.library.toolboxPanAndZoom(that, after, before);
2226 - }
2229 + };
2230 if(NETDATA.options.current.show_help === true)
2231 $(this.element_legend_childs.toolbox_right).popover({
2232 container: "body",
@@ -2246,7 +2249,7 @@
2249 var before = that.view_before - dt;
2250 var after = that.view_after + dt;
2251 that.library.toolboxPanAndZoom(that, after, before);
2249 - }
2252 + };
2253 if(NETDATA.options.current.show_help === true)
2254 $(this.element_legend_childs.toolbox_zoomin).popover({
2255 container: "body",
@@ -2269,7 +2272,7 @@
2272 var after = that.view_after - dt;
2273
2274 that.library.toolboxPanAndZoom(that, after, before);
2272 - }
2275 + };
2276 if(NETDATA.options.current.show_help === true)
2277 $(this.element_legend_childs.toolbox_zoomout).popover({
2278 container: "body",
@@ -2414,7 +2417,7 @@
2417 $(this.element_legend_childs.nano).nanoScroller(this.element_legend_childs.nano_options);
2418
2419 this.legendShowLatestValues();
2417 - }
2420 + };
2421
2422 this.hasLegend = function() {
2423 if(typeof this.___hasLegendCache___ !== 'undefined')
@@ -2428,23 +2431,23 @@
2431
2432 this.___hasLegendCache___ = leg;
2433 return leg;
2431 - }
2434 + };
2435
2436 this.legendWidth = function() {
2437 return (this.hasLegend())?140:0;
2435 - }
2438 + };
2439
2440 this.legendHeight = function() {
2441 return $(this.element).height();
2439 - }
2442 + };
2443
2444 this.chartWidth = function() {
2445 return $(this.element).width() - this.legendWidth();
2443 - }
2446 + };
2447
2448 this.chartHeight = function() {
2449 return $(this.element).height();
2447 - }
2450 + };
2451
2452 this.chartPixelsPerPoint = function() {
2453 // force an options provided detail
@@ -2457,7 +2460,7 @@
2460 px = NETDATA.options.current.pixels_per_point;
2461
2462 return px;
2460 - }
2463 + };
2464
2465 this.needsRecreation = function() {
2466 return (
@@ -2466,7 +2469,7 @@
2469 && this.library.autoresize() === false
2470 && this.tm.last_resized < NETDATA.options.last_resized
2471 );
2469 - }
2472 + };
2473
2474 this.chartURL = function() {
2475 var after, before, points_multiplier = 1;
@@ -2542,12 +2545,12 @@
2545
2546 if(NETDATA.options.debug.chart_data_url === true || this.debug === true)
2547 this.log('chartURL(): ' + this.data_url + ' WxH:' + this.chartWidth() + 'x' + this.chartHeight() + ' points: ' + this.data_points + ' library: ' + this.library_name);
2545 - }
2548 + };
2549
2550 this.redrawChart = function() {
2551 if(this.data !== null)
2552 this.updateChartWithData(this.data);
2550 - }
2553 + };
2554
2555 this.updateChartWithData = function(data) {
2556 if(this.debug === true)
@@ -2660,7 +2663,7 @@
2663
2664 if(this.refresh_dt_element !== null)
2665 this.refresh_dt_element.innerHTML = this.refresh_dt_ms.toString();
2663 - }
2666 + };
2667
2668 this.updateChart = function(callback) {
2669 if(this.debug === true)
@@ -2730,12 +2733,12 @@
2733 error('data download failed for url: ' + that.data_url);
2734 })
2735 .always(function() {
2733 - this._updating = false;
2736 + that._updating = false;
2737 if(typeof callback === 'function') callback();
2738 });
2739
2740 return true;
2738 - }
2741 + };
2742
2743 this.isVisible = function(nocache) {
2744 if(typeof nocache === 'undefined')
@@ -2784,14 +2787,14 @@
2787 this.___isVisible___ = true;
2788 return this.___isVisible___;
2789 }
2787 - }
2790 + };
2791
2792 this.isAutoRefreshed = function() {
2793 return (this.current.autorefresh);
2791 - }
2794 + };
2795
2796 this.canBeAutoRefreshed = function() {
2794 - now = new Date().getTime();
2797 + var now = new Date().getTime();
2798
2799 if(this.enabled === false) {
2800 if(this.debug === true)
@@ -2880,7 +2883,7 @@
2883 }
2884
2885 return false;
2883 - }
2886 + };
2887
2888 this.autoRefresh = function(callback) {
2889 if(this.canBeAutoRefreshed() === true) {
@@ -2890,7 +2893,7 @@
2893 if(typeof callback !== 'undefined')
2894 callback();
2895 }
2893 - }
2896 + };
2897
2898 this._defaultsFromDownloadedChart = function(chart) {
2899 this.chart = chart;
@@ -2904,7 +2907,7 @@
2907
2908 if(this.units === null)
2909 this.units = chart.units;
2907 - }
2910 + };
2911
2912 // fetch the chart description from the netdata server
2913 this.getChart = function(callback) {
@@ -2938,13 +2941,13 @@
2941 if(typeof callback === 'function') callback();
2942 });
2943 }
2941 - }
2944 + };
2945
2946 // ============================================================================================================
2947 // INITIALIZATION
2948
2949 init();
2947 - }
2950 + };
2951
2952 NETDATA.resetAllCharts = function(state) {
2953 // first clear the global selection sync
@@ -2965,10 +2968,10 @@
2968
2969 // if we were not the master, reset our status too
2970 // this is required because most probably the mouse
2968 - // is over this chart, blocking it from autorefreshing
2971 + // is over this chart, blocking it from auto-refreshing
2972 if(master === false && (state.paused === true || state.selected === true))
2973 state.resetChart();
2971 - }
2974 + };
2975
2976 // get or create a chart state, given a DOM element
2977 NETDATA.chartState = function(element) {
@@ -2978,7 +2981,7 @@
2981 $(element).data('netdata-state-object', state);
2982 }
2983 return state;
2981 - }
2984 + };
2985
2986 // ----------------------------------------------------------------------------------------------------------------
2987 // Library functions
@@ -3005,7 +3008,7 @@
3008 }
3009 else if(typeof callback === "function")
3010 callback();
3008 - }
3011 + };
3012
3013 NETDATA._loadCSS = function(filename) {
3014 // don't use jQuery here
@@ -3019,7 +3022,7 @@
3022
3023 if (typeof fileref !== 'undefined')
3024 document.getElementsByTagName("head")[0].appendChild(fileref);
3022 - }
3025 + };
3026
3027 NETDATA.colorHex2Rgb = function(hex) {
3028 // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
@@ -3034,7 +3037,7 @@
3037 g: parseInt(result[2], 16),
3038 b: parseInt(result[3], 16)
3039 } : null;
3037 - }
3040 + };
3041
3042 NETDATA.colorLuminance = function(hex, lum) {
3043 // validate hex string
@@ -3053,7 +3056,7 @@
3056 }
3057
3058 return rgb;
3056 - }
3059 + };
3060
3061 NETDATA.guid = function() {
3062 function s4() {
@@ -3063,35 +3066,35 @@
3066 }
3067
3068 return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
3066 - }
3069 + };
3070
3071 NETDATA.zeropad = function(x) {
3072 if(x > -10 && x < 10) return '0' + x.toString();
3073 else return x.toString();
3071 - }
3074 + };
3075
3076 // user function to signal us the DOM has been
3077 // updated.
3078 NETDATA.updatedDom = function() {
3079 NETDATA.options.updated_dom = true;
3077 - }
3080 + };
3081
3082 NETDATA.ready = function(callback) {
3083 NETDATA.options.pauseCallback = callback;
3081 - }
3084 + };
3085
3086 NETDATA.pause = function(callback) {
3087 if(NETDATA.options.pause === true)
3088 callback();
3089 else
3090 NETDATA.options.pauseCallback = callback;
3088 - }
3091 + };
3092
3093 NETDATA.unpause = function() {
3094 NETDATA.options.pauseCallback = null;
3095 NETDATA.options.updated_dom = true;
3096 NETDATA.options.pause = false;
3094 - }
3097 + };
3098
3099 // ----------------------------------------------------------------------------------------------------------------
3100
@@ -3139,7 +3142,7 @@
3142 }, NETDATA.options.current.idle_between_charts);
3143 }
3144 }
3142 - }
3145 + };
3146
3147 // this is part of the parallel refresher
3148 // its cause is to refresh sequencially all the charts
@@ -3147,7 +3150,7 @@
3150 // it will call the parallel refresher back
3151 // as soon as it sees a chart that its chart library
3152 // is initialized
3150 - NETDATA.chartRefresher_unitialized = function() {
3153 + NETDATA.chartRefresher_uninitialized = function() {
3154 if(NETDATA.options.updated_dom === true) {
3155 // the dom has been updated
3156 // get the dom parts again
@@ -3162,20 +3165,20 @@
3165 if(state.library.initialized === true)
3166 NETDATA.chartRefresher();
3167 else
3165 - state.autoRefresh(NETDATA.chartRefresher_unitialized);
3168 + state.autoRefresh(NETDATA.chartRefresher_uninitialized);
3169 }
3167 - }
3170 + };
3171
3172 NETDATA.chartRefresherWaitTime = function() {
3173 return NETDATA.options.current.idle_parallel_loops;
3171 - }
3174 + };
3175
3176 // the default refresher
3177 // it will create 2 sets of charts:
3178 // - the ones that can be refreshed in parallel
3179 // - the ones that depend on something else
3180 // the first set will be executed in parallel
3178 - // the second will be given to NETDATA.chartRefresher_unitialized()
3181 + // the second will be given to NETDATA.chartRefresher_uninitialized()
3182 NETDATA.chartRefresher = function() {
3183 if(NETDATA.options.pause === true) {
3184 // console.log('auto-refresher is paused');
@@ -3244,7 +3247,7 @@
3247 setTimeout(NETDATA.chartRefresher,
3248 NETDATA.chartRefresherWaitTime());
3249 }
3247 - }
3250 + };
3251
3252 NETDATA.parseDom = function(callback) {
3253 NETDATA.options.last_page_scroll = new Date().getTime();
@@ -3264,7 +3267,7 @@
3267 }
3268
3269 if(typeof callback === 'function') callback();
3267 - }
3270 + };
3271
3272 // this is the main function - where everything starts
3273 NETDATA.start = function() {
@@ -3304,7 +3307,7 @@
3307 $('.modal').on('shown.bs.modal', NETDATA.onscroll);
3308
3309 NETDATA.parseDom(NETDATA.chartRefresher);
3307 - }
3310 + };
3311
3312 // ----------------------------------------------------------------------------------------------------------------
3313 // peity
@@ -3348,7 +3351,7 @@
3351
3352 $(state.peity_instance).peity('line', state.peity_options);
3353 return true;
3351 - }
3354 + };
3355
3356 NETDATA.peityChartCreate = function(state, data) {
3357 state.peity_instance = document.createElement('div');
@@ -3365,7 +3368,7 @@
3368
3369 NETDATA.peityChartUpdate(state, data);
3370 return true;
3368 - }
3371 + };
3372
3373 // ----------------------------------------------------------------------------------------------------------------
3374 // sparkline
@@ -3402,7 +3405,7 @@
3405
3406 $(state.element_chart).sparkline(data.result, state.sparkline_options);
3407 return true;
3405 - }
3408 + };
3409
3410 NETDATA.sparklineChartCreate = function(state, data) {
3411 var self = $(state.element);
@@ -3430,7 +3433,6 @@
3433 var drawNormalOnTop = self.data('sparkline-drawnormalontop') || undefined;
3434 var xvalues = self.data('sparkline-xvalues') || undefined;
3435 var chartRangeClip = self.data('sparkline-chartrangeclip') || undefined;
3433 - var xvalues = self.data('sparkline-xvalues') || undefined;
3436 var chartRangeMinX = self.data('sparkline-chartrangeminx') || undefined;
3437 var chartRangeMaxX = self.data('sparkline-chartrangemaxx') || undefined;
3438 var disableInteraction = self.data('sparkline-disableinteraction') || false;
@@ -3569,7 +3571,7 @@
3571 if(typeof callback === "function")
3572 callback();
3573 });
3572 - }
3574 + };
3575
3576 NETDATA.dygraphInitialize = function(callback) {
3577 if(typeof netdataNoDygraphs === 'undefined' || !netdataNoDygraphs) {
@@ -4558,7 +4560,7 @@
4560 }
4561
4562 return pcent;
4561 - }
4563 + };
4564
4565 // ----------------------------------------------------------------------------------------------------------------
4566 // easy-pie-chart
@@ -4621,7 +4623,7 @@
4623 state.easyPieChartEvent = {
4624 timer: null,
4625 value: 0,
4624 - pcent: 0,
4626 + pcent: 0
4627 };
4628 }
4629
@@ -4791,7 +4793,7 @@
4793
4794 state.gauge_instance.animationSpeed = speed;
4795 state.___gaugeOld__.speed = speed;
4794 - }
4796 + };
4797
4798 NETDATA.gaugeSet = function(state, value, min, max) {
4799 if(typeof value !== 'number') value = 0;
@@ -4925,7 +4927,7 @@
4927
4928 NETDATA.gaugeChartCreate = function(state, data) {
4929 var self = $(state.element);
4928 - var chart = $(state.element_chart);
4930 + // var chart = $(state.element_chart);
4931
4932 var value = data.result[0];
4933 var max = self.data('gauge-max-value') || null;
@@ -5275,7 +5277,7 @@
5277 NETDATA.chartLibraries[library].url = url;
5278 NETDATA.chartLibraries[library].initialized = true;
5279 NETDATA.chartLibraries[library].enabled = true;
5278 - }
5280 + };
5281
5282 // ----------------------------------------------------------------------------------------------------------------
5283 // Start up
@@ -5357,7 +5359,7 @@
5359 .fail(function() {
5360 alert('Cannot load required JS library: ' + NETDATA.requiredJs[index].url);
5361 })
5360 - }
5362 + };
5363
5364 NETDATA.loadRequiredCSS = function(index) {
5365 if(index >= NETDATA.requiredCSS.length)
@@ -5373,7 +5375,7 @@
5375
5376 NETDATA._loadCSS(NETDATA.requiredCSS[index].url);
5377 NETDATA.loadRequiredCSS(++index);
5376 - }
5378 + };
5379
5380 NETDATA.errorReset();
5381 NETDATA.loadRequiredCSS(0);
web/index.html
+14 -14
@@ -28,7 +28,7 @@
28
29 <style>
30
31 - /* prevent body from hidding under the navbar */
31 + /* prevent body from hiding under the navbar */
32 body {
33 padding-top: 50px;
34 }
@@ -330,7 +330,7 @@
330 </script>
331
332 <!-- load the dashboard manager - it will do the rest -->
333 - <script type="text/javascript" src="dashboard.js?v28"></script>
333 + <script type="text/javascript" src="dashboard.js?v29"></script>
334 </head>
335
336 <body data-spy="scroll" data-target="#sidebar">
@@ -474,7 +474,7 @@
474 </div>
475 <div class="modal-body">
476 <div class="p">
477 - <b><a href="https://github.com/firehol/netdata/wiki" target="_blank">netdata</a></b> is the fastest way to visualize metrics. It is a resource efficient, highly optimized system for collecting and visualizing any type of realtime timeseries data, from CPU usage, disk activity, SQL queries, API calls, web site visitors, etc.
477 + <b><a href="https://github.com/firehol/netdata/wiki" target="_blank">netdata</a></b> is the fastest way to visualize metrics. It is a resource efficient, highly optimized system for collecting and visualizing any type of real-time time series data, from CPU usage, disk activity, SQL queries, API calls, web site visitors, etc.
478 </div>
479 <div class="p">
480 <b><a href="https://github.com/firehol/netdata/wiki" target="_blank">netdata</a></b> tries to visualize the truth of <b>now</b>, in its <b>greatest detail</b>, so that you can get insights of what is happening now and what just happened, on your systems and applications.
@@ -546,7 +546,7 @@
546 While pressing the shift key, click on the contents of a chart and move the mouse to select an area, to zoom in. The other charts will follow too. Zooming is performed in two phases:
547 <ul>
548 <li>The already loaded chart contents are zoomed (low resolution)</li>
549 - <li>New data are transfered from the netdata server, to refresh the chart with possibly more detail.</li>
549 + <li>New data are transferred from the netdata server, to refresh the chart with possibly more detail.</li>
550 </ul>
551 Once a chart is zoomed, auto refreshing stops for all charts. To enable it again, <b>double click</b> a zoomed chart.
552 </div>
@@ -560,9 +560,9 @@
560 <hr/>
561 <div class="p">
562 <h4>Legend Operations</h4>
563 - Click on the label or value of a dimension, will select / unselect this dimension.
563 + Click on the label or value of a dimension, will select / un-select this dimension.
564 <br/>
565 - You can press any of the SHIFT or CONTROL keys and then click on legend labels or values, to select / unselect multiple dimensions.
565 + You can press any of the SHIFT or CONTROL keys and then click on legend labels or values, to select / un-select multiple dimensions.
566 </div>
567 </div>
568 <div role="tabpanel" class="tab-pane" id="help_touch">
@@ -596,7 +596,7 @@
596 <hr/>
597 <div class="p">
598 <h4>Legend Operations</h4>
599 - Tap on the label or value of a dimension, will select / unselect this dimension.
599 + Tap on the label or value of a dimension, will select / un-select this dimension.
600 </div>
601 </div>
602 </div>
@@ -649,7 +649,7 @@
649 <input id="eliminate_zero_dimensions" type="checkbox" checked data-toggle="toggle" data-on="Non Zero" data-off="All" data-width="110px">
650 </td>
651 <td class="option-info"><strong>Which dimensions to show?</strong><br/>
652 - <small>When set to <b>Non Zero</b>, dimensions that have all their values (within the current view) set to zero will not be transfered from the netdata server (except if all dimensions of the chart are zero, in which case this setting does nothing - all dimensions are transfered and shown). When set to <b>All</b>, all dimensions will always be shown. Set it to <b>Non Zero</b> to lower the data transfered between netdata and your browser, lower the CPU requirements of your browser (fewer lines to draw) and increase the focus on the legends (fewer entries at the legends).</small>
652 + <small>When set to <b>Non Zero</b>, dimensions that have all their values (within the current view) set to zero will not be transferred from the netdata server (except if all dimensions of the chart are zero, in which case this setting does nothing - all dimensions are transferred and shown). When set to <b>All</b>, all dimensions will always be shown. Set it to <b>Non Zero</b> to lower the data transferred between netdata and your browser, lower the CPU requirements of your browser (fewer lines to draw) and increase the focus on the legends (fewer entries at the legends).</small>
653 </td>
654 </tr>
655 <tr class="option-row">
@@ -667,9 +667,9 @@
667 <div class="form-group">
668 <table>
669 <tr class="option-row">
670 - <td class="option-control"><input id="parallel_refresher" type="checkbox" checked data-toggle="toggle" data-on="Parallel" data-off="Sequencial" data-width="110px"></td>
670 + <td class="option-control"><input id="parallel_refresher" type="checkbox" checked data-toggle="toggle" data-on="Parallel" data-off="Sequential" data-width="110px"></td>
671 <td class="option-info"><strong>Which chart refresh policy to use?</strong><br/>
672 - <small>When set to <b>parallel</b>, visible charts are refreshed in parallel (all queries are sent to netdata server in parallel) and are rendered asynchronously. When set to <b>sequencial</b> charts are refreshed one after another. Set it to parallel if your browser can cope with it (most modern browsers do), set it to sequencial if you work on an older/slower computer.</small>
672 + <small>When set to <b>parallel</b>, visible charts are refreshed in parallel (all queries are sent to netdata server in parallel) and are rendered asynchronously. When set to <b>sequential</b> charts are refreshed one after another. Set it to parallel if your browser can cope with it (most modern browsers do), set it to sequential if you work on an older/slower computer.</small>
673 </td>
674 </tr>
675 <tr class="option-row" id="concurrent_refreshes_row">
@@ -949,19 +949,19 @@ var menuData = {
949
950 'apps': {
951 title: 'Applications',
952 - info: 'Per application statistics are collected using netdata\'s <code>apps.plugin</code>. This plugin walks through the entire <code>/proc</code> filesystem and aggregates statistics for applications of interest, defined in <code>/etc/netdata/apps_groups.conf</code> (the default is <a href="https://github.com/firehol/netdata/blob/master/conf.d/apps_groups.conf" target="_blank">here</a>). The plugin internaly builds a process tree (much like <code>ps fax</code> does), and groups processes together (evaluating both child and parent processes) so that the result is always a chart with a predefined set of dimensions (of course, only application groups found running are reported).<br/><b>IMPORTANT</b>: The values shown here are not 100% accurate. They only include values for the processes running. If an application is spawning childs continiously, which are terminated in just a few milliseconds (like shell scripts do), the values reported will be inaccurate. Linux does report the values for the exited childs of a process. However, these values are reported to the parent process <b>only when the child exits</b>. If these values, of the exited child processes, were also aggregated in the charts below, the charts would have been full of spikes, presenting unrealisting utilization for each process group. So, we decided to ignore these values and present only the utilization of <b>the currently running processes</b>.',
952 + info: 'Per application statistics are collected using netdata\'s <code>apps.plugin</code>. This plugin walks through the entire <code>/proc</code> filesystem and aggregates statistics for applications of interest, defined in <code>/etc/netdata/apps_groups.conf</code> (the default is <a href="https://github.com/firehol/netdata/blob/master/conf.d/apps_groups.conf" target="_blank">here</a>). The plugin internally builds a process tree (much like <code>ps fax</code> does), and groups processes together (evaluating both child and parent processes) so that the result is always a chart with a predefined set of dimensions (of course, only application groups found running are reported).<br/><b>IMPORTANT</b>: The values shown here are not 100% accurate. They only include values for the processes running. If an application is spawning children continuously, which are terminated in just a few milliseconds (like shell scripts do), the values reported will be inaccurate. Linux does report the values for the exited children of a process. However, these values are reported to the parent process <b>only when the child exits</b>. If these values, of the exited child processes, were also aggregated in the charts below, the charts would have been full of spikes, presenting unrealistic utilization for each process group. So, we decided to ignore these values and present only the utilization of <b>the currently running processes</b>.',
953 height: 1.5
954 },
955
956 'users': {
957 title: 'Users',
958 - info: 'Per user statistics are collected using netdata\'s <code>apps.plugin</code>. This plugin walks through the entire <code>/proc</code> filesystem and aggregates statistics per user.<br/><b>IMPORTANT</b>: The values shown here are not 100% accurate. They only include values for the processes running. If an application is spawning childs continiously, which are terminated in just a few milliseconds (like shell scripts do), the values reported will be inaccurate. Linux does report the values for the exited childs of a process. However, these values are reported to the parent process <b>only when the child exits</b>. If these values, of the exited child processes, were also aggregated in the charts below, the charts would have been full of spikes, presenting unrealisting utilization for each process group. So, we decided to ignore these values and present only the utilization of <b>the currently running processes</b>.',
958 + info: 'Per user statistics are collected using netdata\'s <code>apps.plugin</code>. This plugin walks through the entire <code>/proc</code> filesystem and aggregates statistics per user.<br/><b>IMPORTANT</b>: The values shown here are not 100% accurate. They only include values for the processes running. If an application is spawning children continuously, which are terminated in just a few milliseconds (like shell scripts do), the values reported will be inaccurate. Linux does report the values for the exited children of a process. However, these values are reported to the parent process <b>only when the child exits</b>. If these values, of the exited child processes, were also aggregated in the charts below, the charts would have been full of spikes, presenting unrealistic utilization for each process group. So, we decided to ignore these values and present only the utilization of <b>the currently running processes</b>.',
959 height: 1.5
960 },
961
962 'groups': {
963 title: 'User Groups',
964 - info: 'Per user group statistics are collected using netdata\'s <code>apps.plugin</code>. This plugin walks through the entire <code>/proc</code> filesystem and aggregates statistics per user group.<br/><b>IMPORTANT</b>: The values shown here are not 100% accurate. They only include values for the processes running. If an application is spawning childs continiously, which are terminated in just a few milliseconds (like shell scripts do), the values reported will be inaccurate. Linux does report the values for the exited childs of a process. However, these values are reported to the parent process <b>only when the child exits</b>. If these values, of the exited child processes, were also aggregated in the charts below, the charts would have been full of spikes, presenting unrealisting utilization for each process group. So, we decided to ignore these values and present only the utilization of <b>the currently running processes</b>.',
964 + info: 'Per user group statistics are collected using netdata\'s <code>apps.plugin</code>. This plugin walks through the entire <code>/proc</code> filesystem and aggregates statistics per user group.<br/><b>IMPORTANT</b>: The values shown here are not 100% accurate. They only include values for the processes running. If an application is spawning children continuously, which are terminated in just a few milliseconds (like shell scripts do), the values reported will be inaccurate. Linux does report the values for the exited children of a process. However, these values are reported to the parent process <b>only when the child exits</b>. If these values, of the exited child processes, were also aggregated in the charts below, the charts would have been full of spikes, presenting unrealistic utilization for each process group. So, we decided to ignore these values and present only the utilization of <b>the currently running processes</b>.',
965 height: 1.5
966 },
967
@@ -1057,7 +1057,7 @@ var chartData = {
1057
1058 'system.idlejitter': {
1059 colors: '#5555AA',
1060 - info: 'Idle jitter is calculated by netdata. A thread is spawned that requests to sleep for a few microseconds. When the system wakes it up, it measures how many microseconds have passed. The difference between the requested and the actual duration of the sleep, is the <b>idle jitter</b>. This number is useful in realtime environments, where CPU jitter can affect the quality of the service (like VoIP media gateways).'
1060 + info: 'Idle jitter is calculated by netdata. A thread is spawned that requests to sleep for a few microseconds. When the system wakes it up, it measures how many microseconds have passed. The difference between the requested and the actual duration of the sleep, is the <b>idle jitter</b>. This number is useful in real-time environments, where CPU jitter can affect the quality of the service (like VoIP media gateways).'
1061 },
1062
1063 'system.ipv4': {