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 #563

(cherry picked from commit 7c206c30a5)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2015-07-07 15:01:12 +05:30
parent 7eac6310bc
commit 4de4a0f3dd
3 changed files with 9 additions and 5 deletions

View File

@ -19,6 +19,7 @@
plugin.ui.addSection({
id: 'testPlugin',
title: 'TestPlugin',
showOnNavigation: true,
preFilter: function(args) {
return isAdmin();
},

View File

@ -31,9 +31,12 @@
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "regions", "affinityGroups"];
}
if (cloudStack.plugins.length) {
sections.push('plugins');
}
$.each(cloudStack.plugins, function(idx, plugin) {
if (cloudStack.sections.hasOwnProperty(plugin) && !cloudStack.sections[plugin].showOnNavigation) {
sections.push('plugins');
return false;
}
});
return sections;
},

View File

@ -61,7 +61,7 @@
);
}
if (args.isPlugin) {
if (args.isPlugin && !args.showOnNavigation) {
$li.hide();
}
@ -88,7 +88,7 @@
return $(this).hasClass(sectionID);
});
var data = args.sections[sectionID];
var isPlugin = data.isPlugin;
var isPlugin = data.isPlugin && !data.showOnNavigation;
data.$browser = $browser;