Skip to content

Commit 4de4a0f

Browse files
committed
CLOUDSTACK-8621: Allow UI plugins to be shown on navigation bar
Introduces a boolean option in UI plugins setting it to 'true' would display the UI plugin on the left navigation bar. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> This closes apache#563 (cherry picked from commit 7c206c3) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 7eac631 commit 4de4a0f

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

ui/plugins/testPlugin/testPlugin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
plugin.ui.addSection({
2020
id: 'testPlugin',
2121
title: 'TestPlugin',
22+
showOnNavigation: true,
2223
preFilter: function(args) {
2324
return isAdmin();
2425
},

ui/scripts/cloudStack.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@
3131
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "regions", "affinityGroups"];
3232
}
3333

34-
if (cloudStack.plugins.length) {
35-
sections.push('plugins');
36-
}
34+
$.each(cloudStack.plugins, function(idx, plugin) {
35+
if (cloudStack.sections.hasOwnProperty(plugin) && !cloudStack.sections[plugin].showOnNavigation) {
36+
sections.push('plugins');
37+
return false;
38+
}
39+
});
3740

3841
return sections;
3942
},

ui/scripts/ui/core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
);
6262
}
6363

64-
if (args.isPlugin) {
64+
if (args.isPlugin && !args.showOnNavigation) {
6565
$li.hide();
6666
}
6767

@@ -88,7 +88,7 @@
8888
return $(this).hasClass(sectionID);
8989
});
9090
var data = args.sections[sectionID];
91-
var isPlugin = data.isPlugin;
91+
var isPlugin = data.isPlugin && !data.showOnNavigation;
9292

9393
data.$browser = $browser;
9494

0 commit comments

Comments
 (0)