render plugin and module on the dashboard
Costa Tsaousis (ktsaou) committed
Oct 15, 2017 at 18:18 UTC
bd399ec9a49e963067f9ff81fa740ae4464ab28e
1 file changed
+27
-3
web/dashboard.js
+27
-3
@@ -3166,10 +3166,10 @@ var NETDATA = window.NETDATA || {};
3166
3167
this.legendShowUndefined = function() {
3168
if(this.element_legend_childs.title_date !== null)
3169
- this.__legendSetDateString(' ');
3169
+ this.__legendSetDateString(this.legendPluginModuleString(false));
3170
3171
if(this.element_legend_childs.title_time !== null)
3172
- this.__legendSetTimeString(this.chart.name);
3172
+ this.__legendSetTimeString(this.chart.context.toString());
3173
3174
if(this.element_legend_childs.title_units !== null)
3175
this.legendSetUnitsString(' ');
@@ -3336,6 +3336,30 @@ var NETDATA = window.NETDATA || {};
3336
return this.colors;
3337
};
3338
3339
+ this.legendPluginModuleString = function(withContext) {
3340
+ var str = ' ';
3341
+ var context = '';
3342
+
3343
+ if(typeof this.chart !== 'undefined') {
3344
+ if(withContext && typeof this.chart.context === 'string')
3345
+ context = this.chart.context;
3346
+
3347
+ if (typeof this.chart.plugin === 'string' && this.chart.plugin !== '') {
3348
+ str = this.chart.plugin;
3349
+ if (typeof this.chart.module === 'string' && this.chart.module !== '') {
3350
+ str += '/' + this.chart.module;
3351
+ }
3352
+
3353
+ if (withContext && context !== '')
3354
+ str += ', ' + context;
3355
+ }
3356
+ else if (withContext && context !== '')
3357
+ str = context;
3358
+ }
3359
+
3360
+ return str;
3361
+ };
3362
+
3363
this.legendResolutionTooltip = function () {
3364
if(!this.chart) return '';
3365
@@ -3669,7 +3693,7 @@ var NETDATA = window.NETDATA || {};
3693
}, false);
3694
3695
if(this.chart) {
3672
- this.element_legend_childs.title_date.title = this.chart.context.toString();
3696
+ this.element_legend_childs.title_date.title = this.legendPluginModuleString(true);
3697
this.element_legend_childs.title_time.title = this.legendResolutionTooltip();
3698
}
3699