@cryptotaxi247 / netdata-1 / commits / 67f3d0a1f

allow netdata to work without fontawesome; fixes #3644

Costa Tsaousis (ktsaou) committed Apr 27, 2018 at 00:41 UTC 67f3d0a1f0ca8572e61ee93b9b0eee1a43edd314
1 file changed +35 -12
web/dashboard.js
+35 -12
@@ -23,6 +23,10 @@
23 * (default: false) */
24 /*global netdataNoBootstrap *//* boolean, disable bootstrap - disables help too
25 * (default: false) */
26 +/*global netdataNoFontAwesome *//* boolean, disable fontawesome (do not load it)
27 + * (default: false) */
28 +/*global netdataIcons *//* object, overwrite netdata fontawesome icons
29 + * (default: null) */
30 /*global netdataDontStart *//* boolean, do not start the thread to process the charts
31 * (default: false) */
32 /*global netdataErrorCallback *//* function, callback to be called when the dashboard encounters an error
@@ -338,6 +342,23 @@ var NETDATA = window.NETDATA || {};
342 // (blue) (red) (orange) (green) (pink) (brown) (purple) (yellow) (gray)
343 //NETDATA.colors = [ '#5DA5DA', '#F15854', '#FAA43A', '#60BD68', '#F17CB0', '#B2912F', '#B276B2', '#DECF3F', '#4D4D4D' ];
344
345 + NETDATA.icons = {
346 + left: '<i class="fas fa-backward"></i>',
347 + reset: '<i class="fas fa-play"></i>',
348 + right: '<i class="fas fa-forward"></i>',
349 + zoomIn: '<i class="fas fa-plus"></i>',
350 + zoomOut: '<i class="fas fa-minus"></i>',
351 + resize: '<i class="fas fa-sort"></i>',
352 + lineChart: '<i class="fas fa-chart-line"></i>',
353 + areaChart: '<i class="fas fa-chart-area"></i>',
354 + noChart: '<i class="fas fa-chart-area"></i>',
355 + loading: '<i class="fas fa-sync-alt"></i>',
356 + noData: '<i class="fas fa-exclamation-triangle"></i>'
357 + };
358 +
359 + if(typeof netdataIcons === 'object')
360 + NETDATA.icons = netdataIcons;
361 +
362 if(typeof netdataSnapshotData === 'undefined')
363 netdataSnapshotData = null;
364
@@ -3119,19 +3140,19 @@ var NETDATA = window.NETDATA || {};
3140 var icon;
3141 if(that.chart !== null) {
3142 if(that.chart.chart_type === 'line')
3122 - icon = '<i class="fas fa-chart-line"></i>';
3143 + icon = NETDATA.icons.lineChart;
3144 else
3124 - icon = '<i class="fas fa-chart-area"></i>';
3145 + icon = NETDATA.icons.areaChart;
3146 }
3147 else
3127 - icon = '<i class="fas fa-chart-area"></i>';
3148 + icon = NETDATA.icons.noChart;
3149
3150 showMessageIcon(icon + ' netdata' + invisibleSearchableText());
3151 };
3152
3153 var showLoading = function() {
3154 if(that.chart_created === false) {
3134 - showMessageIcon('<i class="fas fa-sync-alt"></i> netdata');
3155 + showMessageIcon(NETDATA.icons.loading + ' netdata');
3156 return true;
3157 }
3158 return false;
@@ -3532,7 +3553,7 @@ var NETDATA = window.NETDATA || {};
3553
3554
3555 var noDataToShow = function() {
3535 - showMessageIcon('<i class="fas fa-exclamation-triangle"></i> empty');
3556 + showMessageIcon(NETDATA.icons.noData + ' empty');
3557 that.legendUpdateDOM();
3558 that.tm.last_autorefreshed = Date.now();
3559 // that.data_update_every = 30 * 1000;
@@ -4315,7 +4336,7 @@ var NETDATA = window.NETDATA || {};
4336 this.element.appendChild(this.element_legend_childs.toolbox);
4337
4338 this.element_legend_childs.toolbox_left.className += ' netdata-legend-toolbox-button';
4318 - this.element_legend_childs.toolbox_left.innerHTML = '<i class="fas fa-backward"></i>';
4339 + this.element_legend_childs.toolbox_left.innerHTML = NETDATA.icons.left;
4340 this.element_legend_childs.toolbox.appendChild(this.element_legend_childs.toolbox_left);
4341 this.element_legend_childs.toolbox_left.onclick = function(e) {
4342 e.preventDefault();
@@ -4340,7 +4361,7 @@ var NETDATA = window.NETDATA || {};
4361
4362
4363 this.element_legend_childs.toolbox_reset.className += ' netdata-legend-toolbox-button';
4343 - this.element_legend_childs.toolbox_reset.innerHTML = '<i class="fas fa-play"></i>';
4364 + this.element_legend_childs.toolbox_reset.innerHTML = NETDATA.icons.reset;
4365 this.element_legend_childs.toolbox.appendChild(this.element_legend_childs.toolbox_reset);
4366 this.element_legend_childs.toolbox_reset.onclick = function(e) {
4367 e.preventDefault();
@@ -4359,7 +4380,7 @@ var NETDATA = window.NETDATA || {};
4380 });
4381
4382 this.element_legend_childs.toolbox_right.className += ' netdata-legend-toolbox-button';
4362 - this.element_legend_childs.toolbox_right.innerHTML = '<i class="fas fa-forward"></i>';
4383 + this.element_legend_childs.toolbox_right.innerHTML = NETDATA.icons.right;
4384 this.element_legend_childs.toolbox.appendChild(this.element_legend_childs.toolbox_right);
4385 this.element_legend_childs.toolbox_right.onclick = function(e) {
4386 e.preventDefault();
@@ -4383,7 +4404,7 @@ var NETDATA = window.NETDATA || {};
4404
4405
4406 this.element_legend_childs.toolbox_zoomin.className += ' netdata-legend-toolbox-button';
4386 - this.element_legend_childs.toolbox_zoomin.innerHTML = '<i class="fas fa-plus"></i>';
4407 + this.element_legend_childs.toolbox_zoomin.innerHTML = NETDATA.icons.zoomIn;
4408 this.element_legend_childs.toolbox.appendChild(this.element_legend_childs.toolbox_zoomin);
4409 this.element_legend_childs.toolbox_zoomin.onclick = function(e) {
4410 e.preventDefault();
@@ -4405,7 +4426,7 @@ var NETDATA = window.NETDATA || {};
4426 });
4427
4428 this.element_legend_childs.toolbox_zoomout.className += ' netdata-legend-toolbox-button';
4408 - this.element_legend_childs.toolbox_zoomout.innerHTML = '<i class="fas fa-minus"></i>';
4429 + this.element_legend_childs.toolbox_zoomout.innerHTML = NETDATA.icons.zoomOut;
4430 this.element_legend_childs.toolbox.appendChild(this.element_legend_childs.toolbox_zoomout);
4431 this.element_legend_childs.toolbox_zoomout.onclick = function(e) {
4432 e.preventDefault();
@@ -4441,7 +4462,7 @@ var NETDATA = window.NETDATA || {};
4462 this.element_legend_childs.resize_handler = document.createElement('div');
4463
4464 this.element_legend_childs.resize_handler.className += " netdata-legend-resize-handler";
4444 - this.element_legend_childs.resize_handler.innerHTML = '<i class="fas fa-sort"></i>';
4465 + this.element_legend_childs.resize_handler.innerHTML = NETDATA.icons.resize;
4466 this.element.appendChild(this.element_legend_childs.resize_handler);
4467 if (NETDATA.options.current.show_help === true)
4468 $(this.element_legend_childs.resize_handler).popover({
@@ -8695,7 +8716,9 @@ var NETDATA = window.NETDATA || {};
8716 {
8717 url: NETDATA.serverStatic + 'lib/fontawesome-all-5.0.1.min.js',
8718 async: true,
8698 - isAlreadyLoaded: function() { return false; }
8719 + isAlreadyLoaded: function() {
8720 + return (typeof netdataNoFontAwesome !== 'undefined' && netdataNoFontAwesome === true);
8721 + }
8722 },
8723 {
8724 url: NETDATA.serverStatic + 'lib/perfect-scrollbar-0.6.15.min.js',