@cryptotaxi247 / netdata-1 / commits / 1bc192a7c

error handling for charts index download #269

Costa Tsaousis (ktsaou) committed Apr 19, 2016 at 02:19 UTC 1bc192a7ca2a525b1d44b1d009e430be2718abdd
2 files changed +8 -3
web/dashboard.js
+7 -2
@@ -459,7 +459,9 @@
459 101: { message: "Cannot load jQuery", alert: true },
460 402: { message: "Chart library not found", alert: false },
461 403: { message: "Chart library not enabled/is failed", alert: false },
462 - 404: { message: "Chart not found", alert: false }
462 + 404: { message: "Chart not found", alert: false },
463 + 405: { message: "Cannot download charts index from server", alert: true },
464 + 406: { message: "Invalid charts index downloaded from server", alert: true }
465 };
466 NETDATA.errorLast = {
467 code: 0,
@@ -546,13 +548,16 @@
548 .done(function(data) {
549 if(data !== null) {
550 var h = NETDATA.chartRegistry.fixid(host);
549 - //console.log('downloaded all charts from ' + host + ' (' + h + ')');
551 self.charts[h] = data.charts;
552 }
553 + else NETDATA.error(406, host + '/api/v1/charts');
554 +
555 if(typeof callback === 'function')
556 callback(data);
557 })
558 .fail(function() {
559 + NETDATA.error(405, host + '/api/v1/charts');
560 +
561 if(typeof callback === 'function')
562 callback(null);
563 });
web/index.html
+1 -1
@@ -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?v31"></script>
333 + <script type="text/javascript" src="dashboard.js?v32"></script>
334 </head>
335
336 <body data-spy="scroll" data-target="#sidebar">