mirror of https://github.com/apache/cloudstack.git
UI plugins API: addSection method
Adds 'addSection' method to UI plugins, which will add a new top-level section. It follows the same syntax used by the existing sections in the UI.
This commit is contained in:
parent
977123be36
commit
1a3ea28243
|
|
@ -1,7 +1,14 @@
|
|||
(function (cloudStack) {
|
||||
cloudStack.plugins.testPlugin = function(plugin) {
|
||||
//
|
||||
// Plugin code goes here
|
||||
//
|
||||
plugin.ui.addSection({
|
||||
id: 'testPlugin',
|
||||
title: 'TestPlugin',
|
||||
preFilter: function(args) {
|
||||
return isAdmin();
|
||||
},
|
||||
show: function() {
|
||||
return $('<div>').html('Test plugin section');
|
||||
}
|
||||
});
|
||||
};
|
||||
}(cloudStack));
|
||||
|
|
@ -1,4 +1,13 @@
|
|||
(function($, cloudStack, require) {
|
||||
var pluginAPI = {
|
||||
addSection: function(section) {
|
||||
cloudStack.sections[section.id] = section;
|
||||
},
|
||||
extend: function(obj) {
|
||||
$.extend(true, cloudStack, obj);
|
||||
}
|
||||
};
|
||||
|
||||
cloudStack.sections.plugins = {
|
||||
title: 'Plugins',
|
||||
show: cloudStack.uiCustom.plugins
|
||||
|
|
@ -15,11 +24,7 @@
|
|||
|
||||
// Execute plugin
|
||||
cloudStack.plugins[pluginID]({
|
||||
ui: {
|
||||
extend: function(obj) {
|
||||
$.extend(true, cloudStack, obj);
|
||||
}
|
||||
}
|
||||
ui: pluginAPI
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue