cloudstack/ui/scripts/plugins.js
Brian Federle 1a3ea28243 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.
2012-12-20 13:27:37 -08:00

32 lines
748 B
JavaScript

(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
};
// Load plugins
$(cloudStack.plugins).map(function(index, pluginID) {
var basePath = 'plugins/' + pluginID + '/';
var pluginJS = basePath + pluginID + '.js';
var configJS = basePath + 'config.js';
require([pluginJS], function() {
require([configJS]);
// Execute plugin
cloudStack.plugins[pluginID]({
ui: pluginAPI
});
});
});
}(jQuery, cloudStack, require));