Updated Branches: refs/heads/ui-plugins 22636d520 -> 5b8e4b9fd
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. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/5b8e4b9f Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/5b8e4b9f Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/5b8e4b9f Branch: refs/heads/ui-plugins Commit: 5b8e4b9fd9b00276b2fb29e3e4f41da217c40f87 Parents: 22636d5 Author: Brian Federle <[email protected]> Authored: Tue Feb 12 15:21:29 2013 -0800 Committer: Brian Federle <[email protected]> Committed: Tue Feb 12 15:21:29 2013 -0800 ---------------------------------------------------------------------- ui/scripts/plugins.js | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5b8e4b9f/ui/scripts/plugins.js ---------------------------------------------------------------------- diff --git a/ui/scripts/plugins.js b/ui/scripts/plugins.js index f40d0fa..b83dffe 100644 --- a/ui/scripts/plugins.js +++ b/ui/scripts/plugins.js @@ -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'
