diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-10-23 00:29:52 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-10-23 00:33:54 +0200 |
commit | e9039ae8f552eb92166da279aa9a4d5b1daa99b5 (patch) | |
tree | 57d5cd966ac86144cfeced66bd270f53b4f44abe /applications/luci-app-statistics/htdocs/luci-static | |
parent | 02a86624ec02ec797f7156cc7f8b9057975ab34b (diff) |
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>
Diffstat (limited to 'applications/luci-app-statistics/htdocs/luci-static')
-rw-r--r-- | applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js index 838af8c661..a3189143eb 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js @@ -31,15 +31,24 @@ return view.extend({ ]) ]); - for (var i = 0; i < plugin_instances.length; i++) - if (rrdtool.hasInstanceDetails(host.value, plugin, plugin_instances[i])) - render_instances.push(plugin_instances[i]); + for (var i = 0; i < plugin_instances.length; i++) { + if (rrdtool.hasInstanceDetails(host.value, plugin, 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) - render_instances.unshift('-'); + if (render_instances.length == 0 || render_instances.length > 1) { + render_instances.unshift([ + '-', + '%s: %s'.format(rrdtool.pluginTitle(plugin), _('Overview')) + ]); + } Promise.all(render_instances.map(function(instance) { - if (instance == '-') { + if (instance[0] == '-') { var tasks = []; for (var i = 0; i < plugin_instances.length; i++) @@ -50,14 +59,14 @@ return view.extend({ }); } 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) { var multiple = blobs.length > 1; dom.content(container, E('div', {}, blobs.map(function(blobs, i) { - var plugin_instance = i ? plugin_instances[i-1] : plugin_instances.join('|'), - title = '%s: %s'.format(rrdtool.pluginTitle(plugin), i ? plugin_instance : _('Overview')); + var plugin_instance = i ? render_instances[i][0] : plugin_instances.join('|'), + title = render_instances[i][1]; return E('div', { 'class': 'center', |