UI Plugin API: Implement 'apiCall' helper

Adds a helper method to standardize how plugin writers handle server calls,
without having to directly invoke jQuery.ajax. It will correctly sanitize data
and ensure all required parameters (e.g., session key data) are passed.
This commit is contained in:
Brian Federle 2013-02-12 15:21:29 -08:00
parent 22636d520e
commit 5b8e4b9fd9
1 changed files with 9 additions and 0 deletions

View File

@ -12,6 +12,15 @@
};
var pluginAPI = {
apiCall: function(command, args) {
$.ajax({
url: createURL(command),
success: args.success,
error: function(json) {
args.error(parseXMLHttpResponse(json));
}
})
},
addSection: function(section) {
cloudStack.sections[section.id] = $.extend(section, {
customIcon: 'plugins/' + section.id + '/icon.png'