Skip to content

Commit 5b8e4b9

Browse files
committed
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.
1 parent 22636d5 commit 5b8e4b9

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

ui/scripts/plugins.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
};
1313

1414
var pluginAPI = {
15+
apiCall: function(command, args) {
16+
$.ajax({
17+
url: createURL(command),
18+
success: args.success,
19+
error: function(json) {
20+
args.error(parseXMLHttpResponse(json));
21+
}
22+
})
23+
},
1524
addSection: function(section) {
1625
cloudStack.sections[section.id] = $.extend(section, {
1726
customIcon: 'plugins/' + section.id + '/icon.png'

0 commit comments

Comments
 (0)