@cryptotaxi247 / netdata-1 / commits / 50777b1c9

Don't use IE11 incompatible for-const #4710 (#4906)

* Don't user IE11 incompatible for-const #4710 * Run make * Use var in for-loops #4710

George Moschovitis committed Dec 4, 2018 at 11:24 UTC 50777b1c99c7e37ec3f0022256494ccfee6b3ea1
7 files changed +20 -20
web/gui/dashboard.js
+8 -8
@@ -159,7 +159,7 @@ NETDATA.seconds4human = function (seconds, options) {
159 if (typeof options !== 'object') {
160 options = defaultOptions;
161 } else {
162 - for (const x in defaultOptions) {
162 + for (var x in defaultOptions) {
163 if (typeof options[x] !== 'string') {
164 options[x] = defaultOptions[x];
165 }
@@ -691,7 +691,7 @@ NETDATA.xss = {
691 } else {
692 // console.log('checking object "' + name + '"');
693
694 - for (const i in obj) {
694 + for (var i in obj) {
695 if (obj.hasOwnProperty(i) === false) {
696 continue;
697 }
@@ -1036,7 +1036,7 @@ NETDATA.unitsConversion = {
1036 // }
1037 // }
1038 const sunit = this.scalableUnits[units];
1039 - for (const x of Object.keys(sunit)) {
1039 + for (var x of Object.keys(sunit)) {
1040 let m = sunit[x];
1041 if (m <= max && m > tdivider) {
1042 tunits = x;
@@ -1072,7 +1072,7 @@ NETDATA.unitsConversion = {
1072
1073 // find the max divider of all charts
1074 let common_units = t[uuid];
1075 - for (const x in t) {
1075 + for (var x in t) {
1076 if (t.hasOwnProperty(x) && t[x].divider > common_units.divider) {
1077 common_units = t[x];
1078 }
@@ -1139,7 +1139,7 @@ NETDATA.unitsConversion = {
1139 } else if (typeof this.convertibleUnits[units] !== 'undefined') {
1140 // units that can be converted
1141 if (desired_units === 'auto') {
1142 - for (const x in this.convertibleUnits[units]) {
1142 + for (var x in this.convertibleUnits[units]) {
1143 if (this.convertibleUnits[units].hasOwnProperty(x)) {
1144 if (this.convertibleUnits[units][x].check(max)) {
1145 //console.log('DEBUG: ' + uuid.toString() + ' converting ' + units.toString() + ' to: ' + x.toString());
@@ -1195,7 +1195,7 @@ if (typeof netdataIcons === 'object') {
1195 // if (NETDATA.icons.hasOwnProperty(icon) && typeof(netdataIcons[icon]) === 'string')
1196 // NETDATA.icons[icon] = netdataIcons[icon];
1197 // }
1198 - for (const icon of Object.keys(NETDATA.icons)) {
1198 + for (var icon of Object.keys(NETDATA.icons)) {
1199 if (typeof(netdataIcons[icon]) === 'string') {
1200 NETDATA.icons[icon] = netdataIcons[icon]
1201 }
@@ -4755,7 +4755,7 @@ NETDATA.commonMin = {
4755 // for (let i in t) {
4756 // if (t.hasOwnProperty(i) && t[i] < m) m = t[i];
4757 // }
4758 - for (const ti of Object.values(t)) {
4758 + for (var ti of Object.values(t)) {
4759 if (ti < m) {
4760 m = ti;
4761 }
@@ -4819,7 +4819,7 @@ NETDATA.commonMax = {
4819 // for (let i in t) {
4820 // if (t.hasOwnProperty(i) && t[i] > m) m = t[i];
4821 // }
4822 - for (const ti of Object.values(t)) {
4822 + for (var ti of Object.values(t)) {
4823 if (ti > m) {
4824 m = ti;
4825 }
web/gui/main.js
+4 -4
@@ -512,7 +512,7 @@ function renderStreamedHosts(options) {
512 return naturalSortCompare(a.hostname, b.hostname);
513 });
514
515 - for (const s of sorted) {
515 + for (var s of sorted) {
516 let url, icon;
517 const hostname = s.hostname;
518
@@ -560,7 +560,7 @@ function renderMachines(machinesArray) {
560 return naturalSortCompare(a.name, b.name);
561 });
562
563 - for (const machine of machines) {
563 + for (var machine of machines) {
564 found = true;
565
566 const alternateUrlItems = (
@@ -625,7 +625,7 @@ function renderMachines(machinesArray) {
625
626 ]
627
628 - for (const server of demoServers) {
628 + for (var server of demoServers) {
629 html += (
630 `<div class="agent-item">
631 <i class="fas fa-chart-bar" color: #fff"></i>
@@ -1698,7 +1698,7 @@ function renderChartsAndMenu(data) {
1698
1699 // propagate the descriptive subname given to QoS
1700 // to all the other submenus with the same name
1701 - for (m in menus) {
1701 + for (var m in menus) {
1702 if (!menus.hasOwnProperty(m)) {
1703 continue;
1704 }
web/gui/src/dashboard.js/common.js
+2 -2
@@ -56,7 +56,7 @@ NETDATA.commonMin = {
56 // for (let i in t) {
57 // if (t.hasOwnProperty(i) && t[i] < m) m = t[i];
58 // }
59 - for (const ti of Object.values(t)) {
59 + for (var ti of Object.values(t)) {
60 if (ti < m) {
61 m = ti;
62 }
@@ -120,7 +120,7 @@ NETDATA.commonMax = {
120 // for (let i in t) {
121 // if (t.hasOwnProperty(i) && t[i] > m) m = t[i];
122 // }
123 - for (const ti of Object.values(t)) {
123 + for (var ti of Object.values(t)) {
124 if (ti > m) {
125 m = ti;
126 }
web/gui/src/dashboard.js/options.js
+1 -1
@@ -18,7 +18,7 @@ if (typeof netdataIcons === 'object') {
18 // if (NETDATA.icons.hasOwnProperty(icon) && typeof(netdataIcons[icon]) === 'string')
19 // NETDATA.icons[icon] = netdataIcons[icon];
20 // }
21 - for (const icon of Object.keys(NETDATA.icons)) {
21 + for (var icon of Object.keys(NETDATA.icons)) {
22 if (typeof(netdataIcons[icon]) === 'string') {
23 NETDATA.icons[icon] = netdataIcons[icon]
24 }
web/gui/src/dashboard.js/units-conversion.js
+3 -3
@@ -269,7 +269,7 @@ NETDATA.unitsConversion = {
269 // }
270 // }
271 const sunit = this.scalableUnits[units];
272 - for (const x of Object.keys(sunit)) {
272 + for (var x of Object.keys(sunit)) {
273 let m = sunit[x];
274 if (m <= max && m > tdivider) {
275 tunits = x;
@@ -305,7 +305,7 @@ NETDATA.unitsConversion = {
305
306 // find the max divider of all charts
307 let common_units = t[uuid];
308 - for (const x in t) {
308 + for (var x in t) {
309 if (t.hasOwnProperty(x) && t[x].divider > common_units.divider) {
310 common_units = t[x];
311 }
@@ -372,7 +372,7 @@ NETDATA.unitsConversion = {
372 } else if (typeof this.convertibleUnits[units] !== 'undefined') {
373 // units that can be converted
374 if (desired_units === 'auto') {
375 - for (const x in this.convertibleUnits[units]) {
375 + for (var x in this.convertibleUnits[units]) {
376 if (this.convertibleUnits[units].hasOwnProperty(x)) {
377 if (this.convertibleUnits[units][x].check(max)) {
378 //console.log('DEBUG: ' + uuid.toString() + ' converting ' + units.toString() + ' to: ' + x.toString());
web/gui/src/dashboard.js/utils.js
+1 -1
@@ -75,7 +75,7 @@ NETDATA.seconds4human = function (seconds, options) {
75 if (typeof options !== 'object') {
76 options = defaultOptions;
77 } else {
78 - for (const x in defaultOptions) {
78 + for (var x in defaultOptions) {
79 if (typeof options[x] !== 'string') {
80 options[x] = defaultOptions[x];
81 }
web/gui/src/dashboard.js/xss.js
+1 -1
@@ -42,7 +42,7 @@ NETDATA.xss = {
42 } else {
43 // console.log('checking object "' + name + '"');
44
45 - for (const i in obj) {
45 + for (var i in obj) {
46 if (obj.hasOwnProperty(i) === false) {
47 continue;
48 }