@cryptotaxi247 / netdata-1 / commits / 00c8b6038

additional checks for detecting demo and when downloading charts #261

Costa Tsaousis (ktsaou) committed Apr 18, 2016 at 12:49 UTC 00c8b603821dbe7056a612b072c687e1d9e87390
2 files changed +15 -4
web/dashboard.js
+5 -3
@@ -538,9 +538,11 @@
538 cache: false
539 })
540 .done(function(data) {
541 - var h = NETDATA.chartRegistry.fixid(host);
542 - //console.log('downloaded all charts from ' + host + ' (' + h + ')');
543 - self.charts[h] = data.charts;
541 + if(data !== null) {
542 + var h = NETDATA.chartRegistry.fixid(host);
543 + //console.log('downloaded all charts from ' + host + ' (' + h + ')');
544 + self.charts[h] = data.charts;
545 + }
546 if(typeof callback === 'function')
547 callback(data);
548 })
web/index.html
+10 -1
@@ -780,7 +780,16 @@
780 var this_is_demo = null;
781 function isdemo() {
782 if(this_is_demo !== null) return this_is_demo;
783 - this_is_demo = document.location.hostname.endsWith('.firehol.org');
783 + this_is_demo = false;
784 +
785 + try {
786 + if(typeof document.location.hostname === 'string')
787 + this_is_demo = document.location.hostname.endsWith('.firehol.org');
788 + }
789 + catch(error) {
790 + ;
791 + }
792 +
793 return this_is_demo;
794 }
795