258
259
$('.highlight-tooltip').tooltip({
260
html: true,
261
- delay: {show: 500, hide: 0},
261
+ delay: { show: 500, hide: 0 },
262
container: 'body'
263
});
264
} else {
588
const alternateUrlItems = (
589
`<div class="agent-alternate-urls agent-${machine.guid} collapsed">
590
${machine.alternate_urls.reduce((str, url) => {
591
- if (url === maskedURL) {
592
- return str
593
- }
591
+ if (url === maskedURL) {
592
+ return str
593
+ }
594
595
- return str + (
596
- `<div class="agent-item agent-item--alternate">
595
+ return str + (
596
+ `<div class="agent-item agent-item--alternate">
597
<div></div>
598
<a href="${url}" title="${url}">${truncateString(url, 64)}</a>
599
<a href="#" onclick="deleteRegistryModalHandler('${machine.guid}', '${machine.name}', '${url}'); return false;">
600
<i class="fas fa-trash" style="color: #777;"></i>
601
</a>
602
</div>`
603
- )
604
- },
603
+ )
604
+ },
605
''
606
)}
607
</div>`
650
html += `<div class="info-item">Demo netdata nodes</div>`;
651
652
const demoServers = [
653
- {url: "//london.netdata.rocks/default.html", title: "UK - London (DigitalOcean.com)"},
654
- {url: "//newyork.netdata.rocks/default.html", title: "US - New York (DigitalOcean.com)"},
655
- {url: "//sanfrancisco.netdata.rocks/default.html", title: "US - San Francisco (DigitalOcean.com)"},
656
- {url: "//atlanta.netdata.rocks/default.html", title: "US - Atlanta (CDN77.com)"},
657
- {url: "//frankfurt.netdata.rocks/default.html", title: "Germany - Frankfurt (DigitalOcean.com)"},
658
- {url: "//toronto.netdata.rocks/default.html", title: "Canada - Toronto (DigitalOcean.com)"},
659
- {url: "//singapore.netdata.rocks/default.html", title: "Japan - Singapore (DigitalOcean.com)"},
660
- {url: "//bangalore.netdata.rocks/default.html", title: "India - Bangalore (DigitalOcean.com)"},
653
+ { url: "//london.netdata.rocks/default.html", title: "UK - London (DigitalOcean.com)" },
654
+ { url: "//newyork.netdata.rocks/default.html", title: "US - New York (DigitalOcean.com)" },
655
+ { url: "//sanfrancisco.netdata.rocks/default.html", title: "US - San Francisco (DigitalOcean.com)" },
656
+ { url: "//atlanta.netdata.rocks/default.html", title: "US - Atlanta (CDN77.com)" },
657
+ { url: "//frankfurt.netdata.rocks/default.html", title: "Germany - Frankfurt (DigitalOcean.com)" },
658
+ { url: "//toronto.netdata.rocks/default.html", title: "Canada - Toronto (DigitalOcean.com)" },
659
+ { url: "//singapore.netdata.rocks/default.html", title: "Japan - Singapore (DigitalOcean.com)" },
660
+ { url: "//bangalore.netdata.rocks/default.html", title: "India - Bangalore (DigitalOcean.com)" },
661
662
]
663
704
</div>`);
705
}
706
707
+function openAuthenticatedUrl(url) {
708
+ if (isSignedIn()) {
709
+ window.open(url);
710
+ } else {
711
+ window.open(`${NETDATA.registry.cloudBaseURL}/account/sign-in-agent?id=${NETDATA.registry.machine_guid}&name=${encodeURIComponent(NETDATA.registry.hostname)}&origin=${encodeURIComponent(window.location.origin + "/")}`);
712
+ }
713
+}
714
+
715
function renderMyNetdataMenu(machinesArray) {
716
const el = document.getElementById('my-netdata-dropdown-content');
717
el.classList.add(`theme-${netdataTheme}`);
774
if (!isSignedIn()) {
775
html += (
776
`<div class="agent-item">
777
+ <i class="fas fa-tv"></i>
778
+ <a onClick="openAuthenticatedUrl('console/index.html');" target="_blank">Nodes<sup class="beta"> beta</sup></a>
779
+ <div></div>
780
+ </div>
781
+ <div class="agent-item">
782
<i class="fas fa-cog""></i>
783
<a href="#" onclick="switchRegistryModalHandler(); return false;">Switch Identity</a>
784
<div></div>
792
} else {
793
html += (
794
`<div class="agent-item">
795
+ <i class="fas fa-tv"></i>
796
+ <a onclick="openAuthenticatedUrl('console/index.html');" target="_blank">Nodes<sup class="beta"> beta</sup></a>
797
+ <div></div>
798
+ </div>
799
+ <div class="agent-item">
800
<i class="fas fa-sync"></i>
801
<a href="#" onclick="showSyncModal(); return false">Synchronize with netdata.cloud</a>
802
<div></div>
1009
}
1010
}
1011
994
-var deleteRegistryGuid = null;
1012
+var deleteRegistryGuid = null;
1013
var deleteRegistryUrl = null;
1014
1015
function deleteRegistryModalHandler(guid, name, url) {
1022
document.getElementById('deleteRegistryServerName2').innerHTML = name;
1023
document.getElementById('deleteRegistryServerURL').innerHTML = url;
1024
document.getElementById('deleteRegistryResponse').innerHTML = '';
1007
-
1025
+
1026
$('#deleteRegistryModal').modal('show');
1027
}
1028
1045
deleteRegistryUrl = null;
1046
$('#deleteRegistryModal').modal('hide');
1047
NETDATA.registry.init();
1030
- });
1048
+ });
1049
});
1050
} else {
1051
NETDATA.registry.delete(deleteRegistryUrl, function (result) {
1056
} else {
1057
responseEl.innerHTML = "<b>Sorry, this command was rejected by the registry server!</b>";
1058
}
1041
- });
1059
+ });
1060
}
1061
}
1062
}
1137
var offset = $('#' + hash).offset();
1138
if (typeof offset !== 'undefined') {
1139
//console.log('scrolling to ' + hash + ' at ' + offset.top.toString());
1122
- $('html, body').animate({scrollTop: offset.top - 30}, 0);
1140
+ $('html, body').animate({ scrollTop: offset.top - 30 }, 0);
1141
}
1142
}
1143
1189
}
1190
1191
if (typeof this.sparklines_registry[key] === 'undefined') {
1174
- this.sparklines_registry[key] = {count: 1};
1192
+ this.sparklines_registry[key] = { count: 1 };
1193
} else {
1194
this.sparklines_registry[key].count++;
1195
}
1790
1791
sidebar += '<li class="" style="padding-top:15px;"><a href="https://github.com/netdata/netdata/blob/master/docs/Add-more-charts-to-netdata.md#add-more-charts-to-netdata" target="_blank"><i class="fas fa-plus"></i> add more charts</a></li>';
1792
sidebar += '<li class=""><a href="https://github.com/netdata/netdata/tree/master/health#Health-monitoring" target="_blank"><i class="fas fa-plus"></i> add more alarms</a></li>';
1775
- sidebar += '<li class="" style="margin:20px;color:#666;"><small>netdata on <b>' + data.hostname.toString() + '</b>, collects every ' + ((data.update_every === 1) ? 'second' : data.update_every.toString() + ' seconds') + ' <b>' + data.dimensions_count.toLocaleString() + '</b> metrics, presented as <b>' + data.charts_count.toLocaleString() + '</b> charts and monitored by <b>' + data.alarms_count.toLocaleString() + '</b> alarms, using ' + Math.round(data.rrd_memory_bytes / 1024 / 1024).toLocaleString() + ' MB of memory for ' + NETDATA.seconds4human(data.update_every * data.history, {space: ' '}) + ' of real-time history.<br/> <br/><b>netdata</b><br/>' + data.version.toString() + '</small></li>';
1793
+ sidebar += '<li class="" style="margin:20px;color:#666;"><small>netdata on <b>' + data.hostname.toString() + '</b>, collects every ' + ((data.update_every === 1) ? 'second' : data.update_every.toString() + ' seconds') + ' <b>' + data.dimensions_count.toLocaleString() + '</b> metrics, presented as <b>' + data.charts_count.toLocaleString() + '</b> charts and monitored by <b>' + data.alarms_count.toLocaleString() + '</b> alarms, using ' + Math.round(data.rrd_memory_bytes / 1024 / 1024).toLocaleString() + ' MB of memory for ' + NETDATA.seconds4human(data.update_every * data.history, { space: ' ' }) + ' of real-time history.<br/> <br/><b>netdata</b><br/>' + data.version.toString() + '</small></li>';
1794
sidebar += '</ul>';
1795
div.innerHTML = html;
1796
document.getElementById('sidebar').innerHTML = sidebar;
1904
url: url,
1905
cache: true,
1906
dataType: "script",
1889
- xhrFields: {withCredentials: true} // required for the cookie
1907
+ xhrFields: { withCredentials: true } // required for the cookie
1908
})
1909
.fail(function () {
1910
alert('Cannot load required JS library: ' + url);
2006
if (data === null) {
2007
document.getElementById('alarms_active').innerHTML =
2008
document.getElementById('alarms_all').innerHTML =
1991
- document.getElementById('alarms_log').innerHTML =
1992
- 'failed to load alarm data!';
2009
+ document.getElementById('alarms_log').innerHTML =
2010
+ 'failed to load alarm data!';
2011
return;
2012
}
2013
2057
2058
return '<code>' + alarm.lookup_method + '</code> '
2059
+ dimensions + ', of chart <code>' + alarm.chart + '</code>'
2042
- + ', starting <code>' + NETDATA.seconds4human(alarm.lookup_after + alarm.lookup_before, {space: ' '}) + '</code> and up to <code>' + NETDATA.seconds4human(alarm.lookup_before, {space: ' '}) + '</code>'
2060
+ + ', starting <code>' + NETDATA.seconds4human(alarm.lookup_after + alarm.lookup_before, { space: ' ' }) + '</code> and up to <code>' + NETDATA.seconds4human(alarm.lookup_before, { space: ' ' }) + '</code>'
2061
+ ((alarm.lookup_options) ? (', with options <code>' + alarm.lookup_options.replace(/ /g, ', ') + '</code>') : '')
2062
+ '.';
2063
}
2133
}
2134
2135
html += '<tr><td width="10%" style="text-align:right">check every</td><td>' + NETDATA.seconds4human(alarm.update_every, {
2118
- space: ' ',
2119
- negative_suffix: ''
2120
- }) + '</td></tr>'
2136
+ space: ' ',
2137
+ negative_suffix: ''
2138
+ }) + '</td></tr>'
2139
+ ((has_alarm === true) ? ('<tr><td width="10%" style="text-align:right">execute</td><td><span style="font-family: monospace;">' + alarm.exec + '</span>' + delay + '</td></tr>') : '')
2140
+ '<tr><td width="10%" style="text-align:right">source</td><td><span style="font-family: monospace;">' + alarm.source + '</span></td></tr>'
2141
+ '</table></td></tr>';
2180
// not found - this should never happen!
2181
if (typeof chart === 'undefined') {
2182
console.log('WARNING: alarm ' + x + ' is linked to chart ' + alarm.chart + ', which is not found in the list of chart got from the server.');
2165
- chart = {priority: 9999999};
2183
+ chart = { priority: 9999999 };
2184
}
2185
else if (typeof chart.menu !== 'undefined' && typeof chart.submenu !== 'undefined')
2186
// the family based on the chart
2317
2318
switch (row.status) {
2319
case 'CRITICAL':
2302
- return {classes: 'danger'};
2320
+ return { classes: 'danger' };
2321
break;
2322
case 'WARNING':
2305
- return {classes: 'warning'};
2323
+ return { classes: 'warning' };
2324
break;
2325
case 'UNDEFINED':
2308
- return {classes: 'info'};
2326
+ return { classes: 'info' };
2327
break;
2328
case 'CLEAR':
2311
- return {classes: 'success'};
2329
+ return { classes: 'success' };
2330
break;
2331
}
2332
return {};
2514
formatter: function (value, row, index) {
2515
void (row);
2516
void (index);
2499
- return NETDATA.seconds4human(value, {negative_suffix: '', space: ' ', now: 'no time'});
2517
+ return NETDATA.seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' });
2518
},
2519
align: 'center',
2520
valign: 'middle',
2528
formatter: function (value, row, index) {
2529
void (row);
2530
void (index);
2513
- return NETDATA.seconds4human(value, {negative_suffix: '', space: ' ', now: 'no time'});
2531
+ return NETDATA.seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' });
2532
},
2533
align: 'center',
2534
valign: 'middle',
2660
void (row);
2661
void (index);
2662
2645
- return NETDATA.seconds4human(value, {negative_suffix: '', space: ' ', now: 'no time'});
2663
+ return NETDATA.seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' });
2664
},
2665
align: 'center',
2666
valign: 'middle',
2864
if (v1 == v2) {
2865
return true;
2866
} else {
2849
- let s1=v1.split('.');
2850
- let s2=v2.split('.');
2867
+ let s1 = v1.split('.');
2868
+ let s2 = v2.split('.');
2869
// Check major version
2852
- let n1 = parseInt(s1[0].substring(1,2),10);
2853
- let n2 = parseInt(s2[0].substring(1,2), 10);
2854
- if ( n1 < n2 ) return false;
2855
- else if ( n1 > n2 ) return true;
2870
+ let n1 = parseInt(s1[0].substring(1, 2), 10);
2871
+ let n2 = parseInt(s2[0].substring(1, 2), 10);
2872
+ if (n1 < n2) return false;
2873
+ else if (n1 > n2) return true;
2874
2875
// Check minor version
2858
- n1 = parseInt(s1[1],10);
2859
- n2 = parseInt(s2[1],10);
2860
- if ( n1 < n2 ) return false;
2861
- else if ( n1 > n2 ) return true;
2876
+ n1 = parseInt(s1[1], 10);
2877
+ n2 = parseInt(s2[1], 10);
2878
+ if (n1 < n2) return false;
2879
+ else if (n1 > n2) return true;
2880
2881
// Split patch: format could be e.g. 0-22-nightly
2864
- s1=s1[2].split('-');
2865
- s2=s2[2].split('-');
2882
+ s1 = s1[2].split('-');
2883
+ s2 = s2[2].split('-');
2884
2867
- n1 = parseInt(s1[0],10);
2868
- n2 = parseInt(s2[0],10);
2869
- if ( n1 < n2 ) return false;
2870
- else if ( n1 > n2 ) return true;
2885
+ n1 = parseInt(s1[0], 10);
2886
+ n2 = parseInt(s2[0], 10);
2887
+ if (n1 < n2) return false;
2888
+ else if (n1 > n2) return true;
2889
2872
- n1 = (s1.length > 1) ? parseInt(s1[1],10) : 0;
2873
- n2 = (s2.length > 1) ? parseInt(s2[1],10) : 0;
2874
- if ( n1 < n2 ) return false;
2890
+ n1 = (s1.length > 1) ? parseInt(s1[1], 10) : 0;
2891
+ n2 = (s2.length > 1) ? parseInt(s2[1], 10) : 0;
2892
+ if (n1 < n2) return false;
2893
else return true;
2894
}
2895
}
3137
bytes_per_point_disk: 1.9,
3138
3139
compress: function (s) {
3122
- return btoa(pako.deflate(s, {to: 'string'}));
3140
+ return btoa(pako.deflate(s, { to: 'string' }));
3141
},
3142
3143
compressed_length: function (s) {
3145
},
3146
3147
uncompress: function (s) {
3130
- return pako.inflate(atob(s), {to: 'string'});
3148
+ return pako.inflate(atob(s), { to: 'string' });
3149
}
3150
},
3151
3154
bytes_per_point_disk: 3.2,
3155
3156
compress: function (s) {
3139
- return pako.deflate(s, {to: 'string'});
3157
+ return pako.deflate(s, { to: 'string' });
3158
},
3159
3160
compressed_length: function (s) {
3162
},
3163
3164
uncompress: function (s) {
3147
- return pako.inflate(s, {to: 'string'});
3165
+ return pako.inflate(s, { to: 'string' });
3166
}
3167
},
3168
3955
animated: 'fade',
3956
trigger: 'hover',
3957
html: true,
3940
- delay: {show: 500, hide: 0},
3958
+ delay: { show: 500, hide: 0 },
3959
container: 'body'
3960
});
3961
$('[data-toggle="popover"]').popover();
4033
4034
// scroll to the position we had open before the modal
4035
$('html, body')
4018
- .animate({scrollTop: scrollPos}, 0);
4036
+ .animate({ scrollTop: scrollPos }, 0);
4037
4038
// unpause netdata, if we paused it
4039
if (netdata_paused_on_modal === true) {
4199
.on('hidden.bs.modal', function () {
4200
document.getElementById('alarms_active').innerHTML =
4201
document.getElementById('alarms_all').innerHTML =
4184
- document.getElementById('alarms_log').innerHTML =
4185
- 'loading...';
4202
+ document.getElementById('alarms_log').innerHTML =
4203
+ 'loading...';
4204
});
4205
4206
// ------------------------------------------------------------------------
4250
if ($this.hasClass('less')) {
4251
$this.removeClass('less');
4252
$this.html(config.moreText);
4235
- $this.parent().prev().animate({'height': '0' + '%'}, 0, function () {
4253
+ $this.parent().prev().animate({ 'height': '0' + '%' }, 0, function () {
4254
$this.parent().prev().prev().show();
4255
}).hide(0, function () {
4256
config.onLess();
4258
} else {
4259
$this.addClass('less');
4260
$this.html(config.lessText);
4243
- $this.parent().prev().animate({'height': '100' + '%'}, 0, function () {
4261
+ $this.parent().prev().animate({ 'height': '100' + '%' }, 0, function () {
4262
$this.parent().prev().prev().hide();
4263
}).show(0, function () {
4264
config.onMore();
4581
if (!isSignedIn()) {
4582
return [];
4583
}
4566
-
4584
+
4585
return fetch(
4586
`${NETDATA.registry.cloudBaseURL}/api/v1/accounts/${cloudAccountID}/agents`,
4587
{
4591
"Authorization": `Bearer ${cloudToken}`
4592
}
4593
}
4576
- ).then((response) => {
4594
+ ).then((response) => {
4595
if (!response.ok) {
4596
throw Error("Cannot fetch known accounts");
4597
}
4617
});
4618
}
4619
4620
+/** Updates the lastAccessTime and accessCount properties of the agent for the account. */
4621
+function touchAgent() {
4622
+ if (!isSignedIn()) {
4623
+ return [];
4624
+ }
4625
+
4626
+ const touchUrl = `${NETDATA.registry.cloudBaseURL}/api/v1/agents/${NETDATA.registry.machine_guid}/touch?account_id=${cloudAccountID}`;
4627
+ return fetch(
4628
+ touchUrl,
4629
+ {
4630
+ method: "post",
4631
+ body: "",
4632
+ mode: "cors",
4633
+ headers: {
4634
+ "Authorization": `Bearer ${cloudToken}`
4635
+ }
4636
+ }
4637
+ ).then((response) => {
4638
+ if (!response.ok) {
4639
+ throw Error("Cannot touch agent" + JSON.stringify(response));
4640
+ }
4641
+ return response.json();
4642
+ }).then((payload) => {
4643
+
4644
+ }).catch(function (error) {
4645
+ console.log(error);
4646
+ return null;
4647
+ });
4648
+}
4649
+
4650
// https://github.com/netdata/hub/issues/128
4651
function postCloudAccountAgents(agentsToSync) {
4652
if (!isSignedIn()) {
4670
"agents": agents,
4671
"merge": false,
4672
};
4625
-
4673
+
4674
return fetch(
4675
`${NETDATA.registry.cloudBaseURL}/api/v1/accounts/${cloudAccountID}/agents`,
4676
{
4698
"url": a.urls[0],
4699
"alternate_urls": a.urls
4700
}
4653
- })
4701
+ })
4702
});
4703
}
4704
4775
4776
if (options.hosts.length > 1) {
4777
const streamedEl = document.getElementById("my-netdata-menu-streamed")
4730
- streamedEl.innerHTML = renderStreamedHosts(options);
4778
+ streamedEl.innerHTML = renderStreamedHosts(options);
4779
}
4780
}
4781
4790
const inputEl = e.target;
4791
setTimeout(() => {
4792
myNetdataMenuFilterValue = inputEl.value;
4745
- updateMyNetdataAfterFilterChange();
4793
+ updateMyNetdataAfterFilterChange();
4794
}, 1);
4795
}
4796
4801
const inputEl = document.getElementById("my-netdata-menu-filter-input");
4802
inputEl.value = "";
4803
myNetdataMenuFilterValue = "";
4756
-
4757
- updateMyNetdataAfterFilterChange();
4758
-
4804
+
4805
+ updateMyNetdataAfterFilterChange();
4806
+
4807
inputEl.focus();
4808
}
4809
4840
container.removeAttribute("title");
4841
container.removeAttribute("data-original-title");
4842
container.removeAttribute("data-placement");
4843
+ // <a href="/console/index.html#/charts/${NETDATA.registry.machine_guid}" target="_blank" class="btn">
4844
container.innerHTML = (
4845
`<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span id="amc-account-name"></span> <strong class="caret"></strong></a>
4797
- <ul id="cloud-menu" class="dropdown-menu scrollable-menu inpagemenu" role="menu">
4798
- <li>
4799
- <a href="#" class="btn" onclick="signOutDidClick(event); return false">
4800
- <i class="fas fa-sign-out-alt"></i> <span class="hidden-sm hidden-md">Sign Out</span>
4846
+ <ul id="cloud-menu" class="dropdown-menu scrollable-menu inpagemenu" role="menu">
4847
+ <li>
4848
+ <a onclick="openAuthenticatedUrl('console/index.html');" target="_blank" class="btn">
4849
+ <i class="fas fa-tv"></i> <span class="hidden-sm hidden-md">Nodes<sup class="beta"> beta</sup></span>
4850
+ </a>
4851
+ </li>
4852
+ <li>
4853
+ <a href="#" class="btn" onclick="signOutDidClick(event); return false">
4854
+ <i class="fas fa-sign-out-alt"></i> <span class="hidden-sm hidden-md">Sign Out</span>
4855
</a>
4856
</li>
4857
</ul>`
4895
}
4896
4897
function handleSignOutMessage(e) {
4844
- clearCloudVariables();
4898
+ clearCloudVariables();
4899
renderAccountUI();
4900
renderMyNetdataMenu(registryAgents);
4901
}
4969
$("#syncRegistryModal").modal("hide");
4970
4971
const json = localStorage.getItem("cloud.sync");
4918
- const sync = json ? JSON.parse(json): {};
4972
+ const sync = json ? JSON.parse(json) : {};
4973
delete sync[cloudAccountID];
4974
localStorage.setItem("cloud.sync", JSON.stringify(sync));
4921
-
4975
+
4976
NETDATA.registry.init();
4977
}
4978
4979
function syncAgents(callback) {
4980
const json = localStorage.getItem("cloud.sync");
4927
- const sync = json ? JSON.parse(json): {};
4928
-
4981
+ const sync = json ? JSON.parse(json) : {};
4982
+
4983
const currentAgent = {
4984
guid: NETDATA.registry.machine_guid,
4985
name: NETDATA.registry.hostname,
4987
alternate_urls: [NETDATA.serverDefault],
4988
}
4989
4936
- const localAgents = sync[cloudAccountID]
4937
- ? [currentAgent]
4990
+ const localAgents = sync[cloudAccountID]
4991
+ ? [currentAgent]
4992
: registryAgents.concat([currentAgent]);
4939
-
4993
+
4994
console.log("Checking if sync is needed.", localAgents);
4995
4996
const agentsToSync = mergeAgents(cloudAgents, localAgents);
4997
4944
- if ((!sync[cloudAccountID]) || agentsToSync) {
4998
+ if ((!sync[cloudAccountID]) || agentsToSync) {
4999
sync[cloudAccountID] = new Date().getTime();
5000
localStorage.setItem("cloud.sync", JSON.stringify(sync));
5001
}
5002
5003
if (agentsToSync) {
5004
console.log("Synchronizing with netdata.cloud.");
4951
-
5005
+
5006
postCloudAccountAgents(agentsToSync).then((agents) => {
5007
// TODO: clear syncTime on error!
5008
cloudAgents = agents;
5009
callback(cloudAgents);
5010
});
5011
4958
- return
4959
- }
5012
+ return
5013
+ }
5014
5015
callback(cloudAgents);
5016
}
5049
cloudSSOInit();
5050
}
5051
5052
+ touchAgent();
5053
renderAccountUI();
5054
}
5055
5059
5060
initCloud();
5061
5007
- registryAgents = machinesArray;
5062
+ registryAgents = machinesArray;
5063
5064
if (isSignedIn()) {
5065
// We call getCloudAccountAgents() here because it requires that
5070
errorMyNetdataMenu();
5071
return;
5072
}
5018
- cloudAgents = agents;
5073
+ cloudAgents = agents;
5074
syncAgents((agents) => {
5075
const agentsMap = {}
5076
for (const agent of agents) {
5077
agentsMap[agent.guid] = agent;
5078
}
5024
-
5079
+
5080
NETDATA.registry.machines = agentsMap;
5081
NETDATA.registry.machines_array = agents;
5027
-
5028
- renderMyNetdataMenu(agents);
5082
+
5083
+ renderMyNetdataMenu(agents);
5084
});
5085
});
5086
} else {
5099
NETDATA.registry.cloudBaseURL = baseURL;
5100
NETDATA.registry.machine_guid = agentID;
5101
NETDATA.registry.isCloudEnabled = true;
5047
-
5102
+
5103
initCloud();
5104
}
5105
}
5106
5107
function initializeApp() {
5053
- window.addEventListener("message", handleMessage, false);
5108
+ window.addEventListener("message", handleMessage, false);
5109
5055
-// tryFastInitCloud();
5110
+ // tryFastInitCloud();
5111
}
5112
5113
if (document.readyState === "complete") {