luci-app-statistics: fix process graph tab captions
Plugins that provide both detail and non-detail instances led to a mismatch between the instance list to render and the plugin instance list, causing tab captions to be wrongly assigned. Fixes: #5387 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
02a86624ec
commit
e9039ae8f5
1 changed files with 18 additions and 9 deletions
|
@ -31,15 +31,24 @@ return view.extend({
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
for (var i = 0; i < plugin_instances.length; i++)
|
for (var i = 0; i < plugin_instances.length; i++) {
|
||||||
if (rrdtool.hasInstanceDetails(host.value, plugin, plugin_instances[i]))
|
if (rrdtool.hasInstanceDetails(host.value, plugin, plugin_instances[i])) {
|
||||||
render_instances.push(plugin_instances[i]);
|
render_instances.push([
|
||||||
|
plugin_instances[i],
|
||||||
|
plugin_instances[i] ? '%s: %s'.format(rrdtool.pluginTitle(plugin), plugin_instances[i]) : rrdtool.pluginTitle(plugin)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (render_instances.length == 0 || render_instances.length > 1)
|
if (render_instances.length == 0 || render_instances.length > 1) {
|
||||||
render_instances.unshift('-');
|
render_instances.unshift([
|
||||||
|
'-',
|
||||||
|
'%s: %s'.format(rrdtool.pluginTitle(plugin), _('Overview'))
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
Promise.all(render_instances.map(function(instance) {
|
Promise.all(render_instances.map(function(instance) {
|
||||||
if (instance == '-') {
|
if (instance[0] == '-') {
|
||||||
var tasks = [];
|
var tasks = [];
|
||||||
|
|
||||||
for (var i = 0; i < plugin_instances.length; i++)
|
for (var i = 0; i < plugin_instances.length; i++)
|
||||||
|
@ -50,14 +59,14 @@ return view.extend({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return rrdtool.render(plugin, instance, false, host.value, span.value, width, null, cache);
|
return rrdtool.render(plugin, instance[0], false, host.value, span.value, width, null, cache);
|
||||||
}
|
}
|
||||||
})).then(function(blobs) {
|
})).then(function(blobs) {
|
||||||
var multiple = blobs.length > 1;
|
var multiple = blobs.length > 1;
|
||||||
|
|
||||||
dom.content(container, E('div', {}, blobs.map(function(blobs, i) {
|
dom.content(container, E('div', {}, blobs.map(function(blobs, i) {
|
||||||
var plugin_instance = i ? plugin_instances[i-1] : plugin_instances.join('|'),
|
var plugin_instance = i ? render_instances[i][0] : plugin_instances.join('|'),
|
||||||
title = '%s: %s'.format(rrdtool.pluginTitle(plugin), i ? plugin_instance : _('Overview'));
|
title = render_instances[i][1];
|
||||||
|
|
||||||
return E('div', {
|
return E('div', {
|
||||||
'class': 'center',
|
'class': 'center',
|
||||||
|
|
Loading…
Reference in a new issue