@cryptotaxi247 / netdata-1 / commits / 083193c21

more jslint fixes and typo fixes

Costa Tsaousis committed Feb 4, 2017 at 21:43 UTC 083193c21b1246b739ccf408d210483075c513d2
2 files changed +49 -39
web/dashboard.js
+48 -38
@@ -233,7 +233,7 @@ var NETDATA = window.NETDATA || {};
233 before: 0, // panning
234 after: -600, // panning
235 pixels_per_point: 1, // the detail of the chart
236 - fill_luminance: 0.8 // luminance of colors in solit areas
236 + fill_luminance: 0.8 // luminance of colors in solid areas
237 };
238
239 // ----------------------------------------------------------------------------------------------------------------
@@ -252,12 +252,12 @@ var NETDATA = window.NETDATA || {};
252 // new elements we have to check.
253
254 auto_refresher_fast_weight: 0, // this is the current time in ms, spent
255 - // rendering charts continiously.
255 + // rendering charts continuously.
256 // used with .current.fast_render_timeframe
257
258 page_is_visible: true, // when true, this page is visible
259
260 - auto_refresher_stop_until: 0, // timestamp in ms - used internaly, to stop the
260 + auto_refresher_stop_until: 0, // timestamp in ms - used internally, to stop the
261 // auto-refresher for some time (when a chart is
262 // performing pan or zoom, we need to stop refreshing
263 // all other charts, to have the maximum speed for
@@ -281,7 +281,7 @@ var NETDATA = window.NETDATA || {};
281
282 idle_between_charts: 100, // ms - how much time to wait between chart updates
283
284 - fast_render_timeframe: 200, // ms - render continously until this time of continious
284 + fast_render_timeframe: 200, // ms - render continuously until this time of continuous
285 // rendering has been reached
286 // this setting is used to make it render e.g. 10
287 // charts at once, sleep idle_between_charts time
@@ -295,8 +295,8 @@ var NETDATA = window.NETDATA || {};
295 idle_lost_focus: 500, // ms - when the window does not have focus, check
296 // if focus has been regained, every this time
297
298 - global_pan_sync_time: 1000, // ms - when you pan or zoon a chart, the background
299 - // autorefreshing of charts is paused for this amount
298 + global_pan_sync_time: 1000, // ms - when you pan or zoom a chart, the background
299 + // auto-refreshing of charts is paused for this amount
300 // of time
301
302 sync_selection_delay: 1500, // ms - when you pan or zoom a chart, wait this amount
@@ -914,8 +914,8 @@ var NETDATA = window.NETDATA || {};
914 // every time a chart is panned or zoomed
915 // we set the timestamp here
916 // then we use it as a sequence number
917 - // to find if other charts are syncronized
918 - // to this timerange
917 + // to find if other charts are synchronized
918 + // to this time-range
919
920 master: null, // the master chart (state), to which all others
921 // are synchronized
@@ -1324,7 +1324,6 @@ var NETDATA = window.NETDATA || {};
1324 this.override_options = self.data('override-options') || null; // override options to pass to netdata
1325
1326 this.running = false; // boolean - true when the chart is being refreshed now
1327 - this.validated = false; // boolean - has the chart been validated?
1327 this.enabled = true; // boolean - is the chart enabled for refresh?
1328 this.paused = false; // boolean - is the chart paused for any reason?
1329 this.selected = false; // boolean - is the chart shown a selection?
@@ -1395,8 +1394,9 @@ var NETDATA = window.NETDATA || {};
1394 // find the element that needs to be updated
1395 var refresh_dt_element_name = self.data('dt-element-name') || null; // string - the element to print refresh_dt_ms
1396
1398 - if(refresh_dt_element_name !== null)
1397 + if(refresh_dt_element_name !== null) {
1398 this.refresh_dt_element = document.getElementById(refresh_dt_element_name) || null;
1399 + }
1400 else
1401 this.refresh_dt_element = null;
1402
@@ -2779,7 +2779,7 @@ var NETDATA = window.NETDATA || {};
2779 placement: 'bottom',
2780 title: 'Chart Legend',
2781 delay: { show: NETDATA.options.current.show_help_delay_show_ms, hide: NETDATA.options.current.show_help_delay_hide_ms },
2782 - content: 'You can click or tap on the values or the labels to select dimentions. By pressing SHIFT or CONTROL, you can enable or disable multiple dimensions.<br/><small>Help, can be disabled from the settings.</small>'
2782 + content: 'You can click or tap on the values or the labels to select dimensions. By pressing SHIFT or CONTROL, you can enable or disable multiple dimensions.<br/><small>Help, can be disabled from the settings.</small>'
2783 });
2784 }
2785 else {
@@ -3016,12 +3016,12 @@ var NETDATA = window.NETDATA || {};
3016
3017 if(NETDATA.options.current.pan_and_zoom_data_padding === true && this.requested_padding !== null) {
3018 if(this.view_after < this.data_after) {
3019 - // console.log('adusting view_after from ' + this.view_after + ' to ' + this.data_after);
3019 + // console.log('adjusting view_after from ' + this.view_after + ' to ' + this.data_after);
3020 this.view_after = this.data_after;
3021 }
3022
3023 if(this.view_before > this.data_before) {
3024 - // console.log('adusting view_before from ' + this.view_before + ' to ' + this.data_before);
3024 + // console.log('adjusting view_before from ' + this.view_before + ' to ' + this.data_before);
3025 this.view_before = this.data_before;
3026 }
3027 }
@@ -4371,7 +4371,7 @@ var NETDATA = window.NETDATA || {};
4371 // the time it thinks is selected is wrong
4372 // here we calculate the time t based on the row number selected
4373 // which is ok
4374 - var t = state.data_after + row * state.data_update_every;
4374 + // var t = state.data_after + row * state.data_update_every;
4375 // console.log('row = ' + row + ', x = ' + x + ', t = ' + t + ' ' + ((t === x)?'SAME':(Math.abs(x-t)<=state.data_update_every)?'SIMILAR':'DIFFERENT') + ', rows in db: ' + state.data_points + ' visible(x) = ' + state.timeIsVisible(x) + ' visible(t) = ' + state.timeIsVisible(t) + ' r(x) = ' + state.calculateRowForTime(x) + ' r(t) = ' + state.calculateRowForTime(t) + ' range: ' + state.data_after + ' - ' + state.data_before + ' real: ' + state.data.after + ' - ' + state.data.before + ' every: ' + state.data_update_every);
4376
4377 state.globalSelectionSync(x);
@@ -4497,7 +4497,7 @@ var NETDATA = window.NETDATA || {};
4497 var xOffset = g.toDomCoords(g.xAxisRange()[0], null)[0];
4498 var yar0 = g.yAxisRange(0);
4499
4500 - // This is calculating the pixel of the higest value. (Top pixel)
4500 + // This is calculating the pixel of the highest value. (Top pixel)
4501 var yOffset = g.toDomCoords(null, yar0[1])[1];
4502
4503 // x y w and h are relative to the corner of the drawing area,
@@ -4608,7 +4608,7 @@ var NETDATA = window.NETDATA || {};
4608 Dygraph.defaultInteractionModel.touchstart(event, dygraph, context);
4609
4610 // we overwrite the touch directions at the end, to overwrite
4611 - // the internal default of dygraphs
4611 + // the internal default of dygraph
4612 context.touchDirections = { x: true, y: false };
4613
4614 state.dygraph_last_touch_start = Date.now();
@@ -4637,7 +4637,7 @@ var NETDATA = window.NETDATA || {};
4637
4638 // if it didn't move, it is a selection
4639 if(state.dygraph_last_touch_move === 0 && state.dygraph_last_touch_page_x !== 0) {
4640 - // internal api of dygraphs
4640 + // internal api of dygraph
4641 var pct = (state.dygraph_last_touch_page_x - (dygraph.plotter_.area.x + state.element.getBoundingClientRect().left)) / dygraph.plotter_.area.w;
4642 var t = Math.round(state.data_after + (state.data_before - state.data_after) * pct);
4643 if(NETDATA.dygraphSetSelection(state, t) === true)
@@ -4693,7 +4693,7 @@ var NETDATA = window.NETDATA || {};
4693 state.__commonMax = self.data('common-max') || null;
4694 }
4695 else {
4696 - state.log('incompatible version of dygraphs detected');
4696 + state.log('incompatible version of Dygraph detected');
4697 state.__commonMin = null;
4698 state.__commonMax = null;
4699 }
@@ -4979,10 +4979,16 @@ var NETDATA = window.NETDATA || {};
4979 };
4980
4981 NETDATA.d3ChartUpdate = function(state, data) {
4982 + void(state);
4983 + void(data);
4984 +
4985 return false;
4986 };
4987
4988 NETDATA.d3ChartCreate = function(state, data) {
4989 + void(state);
4990 + void(data);
4991 +
4992 return false;
4993 };
4994
@@ -5177,10 +5183,11 @@ var NETDATA = window.NETDATA || {};
5183
5184 NETDATA.easypiechartClearSelection = function(state) {
5185 if(typeof state.easyPieChartEvent !== 'undefined') {
5180 - if(state.easyPieChartEvent.timer !== null)
5186 + if(state.easyPieChartEvent.timer !== undefined) {
5187 clearTimeout(state.easyPieChartEvent.timer);
5188 + }
5189
5183 - state.easyPieChartEvent.timer = null;
5190 + state.easyPieChartEvent.timer = undefined;
5191 }
5192
5193 if(state.isAutoRefreshable() === true && state.data !== null) {
@@ -5205,7 +5212,7 @@ var NETDATA = window.NETDATA || {};
5212
5213 if(typeof state.easyPieChartEvent === 'undefined') {
5214 state.easyPieChartEvent = {
5208 - timer: null,
5215 + timer: undefined,
5216 value: 0,
5217 pcent: 0
5218 };
@@ -5220,11 +5227,11 @@ var NETDATA = window.NETDATA || {};
5227 state.easyPieChartEvent.pcent = pcent;
5228 state.easyPieChartLabel.innerText = state.legendFormatValue(value);
5229
5223 - if(state.easyPieChartEvent.timer === null) {
5230 + if(state.easyPieChartEvent.timer === undefined) {
5231 state.easyPieChart_instance.disableAnimation();
5232
5233 state.easyPieChartEvent.timer = setTimeout(function() {
5227 - state.easyPieChartEvent.timer = null;
5234 + state.easyPieChartEvent.timer = undefined;
5235 state.easyPieChart_instance.update(state.easyPieChartEvent.pcent);
5236 }, NETDATA.options.current.charts_selection_animation_delay);
5237 }
@@ -5453,10 +5460,11 @@ var NETDATA = window.NETDATA || {};
5460
5461 NETDATA.gaugeClearSelection = function(state) {
5462 if(typeof state.gaugeEvent !== 'undefined') {
5456 - if(state.gaugeEvent.timer !== null)
5463 + if(state.gaugeEvent.timer !== undefined) {
5464 clearTimeout(state.gaugeEvent.timer);
5465 + }
5466
5459 - state.gaugeEvent.timer = null;
5467 + state.gaugeEvent.timer = undefined;
5468 }
5469
5470 if(state.isAutoRefreshable() === true && state.data !== null) {
@@ -5482,7 +5490,7 @@ var NETDATA = window.NETDATA || {};
5490
5491 if(typeof state.gaugeEvent === 'undefined') {
5492 state.gaugeEvent = {
5485 - timer: null,
5493 + timer: undefined,
5494 value: 0,
5495 min: 0,
5496 max: 0
@@ -5502,11 +5510,11 @@ var NETDATA = window.NETDATA || {};
5510 state.gaugeEvent.max = max;
5511 NETDATA.gaugeSetLabels(state, value, min, max);
5512
5505 - if(state.gaugeEvent.timer === null) {
5513 + if(state.gaugeEvent.timer === undefined) {
5514 NETDATA.gaugeAnimation(state, false);
5515
5516 state.gaugeEvent.timer = setTimeout(function() {
5509 - state.gaugeEvent.timer = null;
5517 + state.gaugeEvent.timer = undefined;
5518 NETDATA.gaugeSet(state, state.gaugeEvent.value, state.gaugeEvent.min, state.gaugeEvent.max);
5519 }, NETDATA.options.current.charts_selection_animation_delay);
5520 }
@@ -5624,6 +5632,7 @@ var NETDATA = window.NETDATA || {};
5632 delete options.percentColors;
5633 }
5634 else if(generateGradient === false && NETDATA.themes.current.gauge_gradient === true) {
5635 + //noinspection PointlessArithmeticExpressionJS
5636 options.percentColors = [
5637 [0.0, NETDATA.colorLuminance(startColor, (lum_d * 10) - (lum_d * 0))],
5638 [0.1, NETDATA.colorLuminance(startColor, (lum_d * 10) - (lum_d * 1))],
@@ -6096,7 +6105,7 @@ var NETDATA = window.NETDATA || {};
6105 return;
6106 }
6107 title = name + ' back to normal (' + value_string.toString() + ')';
6099 - icon = 'images/check-mark-2-128-green.png'
6108 + icon = 'images/check-mark-2-128-green.png';
6109 interaction = false;
6110 break;
6111
@@ -6112,7 +6121,7 @@ var NETDATA = window.NETDATA || {};
6121 if(entry.old_status === 'WARNING')
6122 status = 'escalated to ' + entry.status.toLowerCase();
6123
6115 - icon = 'images/alert-128-red.png'
6124 + icon = 'images/alert-128-red.png';
6125 interaction = true;
6126 break;
6127
@@ -6354,12 +6363,12 @@ var NETDATA = window.NETDATA || {};
6363 // Registry of netdata hosts
6364
6365 NETDATA.registry = {
6357 - server: null, // the netdata registry server
6358 - person_guid: null, // the unique ID of this browser / user
6359 - machine_guid: null, // the unique ID the netdata server that served dashboard.js
6360 - hostname: null, // the hostname of the netdata server that served dashboard.js
6361 - machines: null, // the user's other URLs
6362 - machines_array: null, // the user's other URLs in an array
6366 + server: null, // the netdata registry server
6367 + person_guid: null, // the unique ID of this browser / user
6368 + machine_guid: null, // the unique ID the netdata server that served dashboard.js
6369 + hostname: 'unknown', // the hostname of the netdata server that served dashboard.js
6370 + machines: null, // the user's other URLs
6371 + machines_array: null, // the user's other URLs in an array
6372 person_urls: null,
6373
6374 parsePersonUrls: function(person_urls) {
@@ -6370,7 +6379,6 @@ var NETDATA = window.NETDATA || {};
6379 NETDATA.registry.machines = {};
6380 NETDATA.registry.machines_array = [];
6381
6373 - var now = Date.now();
6382 var apu = person_urls;
6383 var i = apu.length;
6384 while(i--) {
@@ -6416,7 +6424,9 @@ var NETDATA = window.NETDATA || {};
6424 if(data) {
6425 NETDATA.registry.server = data.registry;
6426 NETDATA.registry.machine_guid = data.machine_guid;
6419 - NETDATA.registry.hostname = data.hostname;
6427 +
6428 + if(typeof data.hostname === 'string')
6429 + NETDATA.registry.hostname = data.hostname;
6430
6431 NETDATA.registry.access(2, function (person_urls) {
6432 NETDATA.registry.parsePersonUrls(person_urls);
web/index.html
+1 -1
@@ -3312,4 +3312,4 @@
3312 </div>
3313 </body>
3314 </html>
3315 -<script type="text/javascript" src="dashboard.js?v20170204-2"></script>
3315 +<script type="text/javascript" src="dashboard.js?v20170204-3"></script>