You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/02/13 23:59:37 UTC

[31/35] git commit: refs/heads/master - UI Plugin API: Implement 'apiCall' helper

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/master
Commit: 5b8e4b9fd9b00276b2fb29e3e4f41da217c40f87
Parents: 22636d5
Author: Brian Federle <br...@citrix.com>
Authored: Tue Feb 12 15:21:29 2013 -0800
Committer: Brian Federle <br...@citrix.com>
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'