mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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.
32 lines
748 B
JavaScript
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));
|