From e2a889ed5fee4ddc8065670a99fb5c9e5d2826af Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Wed, 23 Nov 2011 15:34:15 -0800 Subject: [PATCH] Add example logout action --- ui/scripts-test/cloudStack.js | 19 ++++++++++++++++--- ui/scripts/cloudStack.js | 6 ++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ui/scripts-test/cloudStack.js b/ui/scripts-test/cloudStack.js index 402e86aeac4..5837f68e1b5 100644 --- a/ui/scripts-test/cloudStack.js +++ b/ui/scripts-test/cloudStack.js @@ -29,8 +29,7 @@ $(function() { var $container = $('#cloudStack3-container'); - // Login - cloudStack.uiCustom.login({ + var loginArgs = { $container: $container, // Use this for checking the session, to bypass login screen @@ -66,6 +65,10 @@ return args.response.error(); }, + logoutAction: function(args) { + document.location.reload(); + }, + complete: function(args) { var context = { users: [args.user] @@ -94,7 +97,17 @@ } } }); + + // Logout action + $('#user-options a').live('click', function() { + loginArgs.logoutAction({ + context: cloudStack.context + }); + }); } - }); + }; + + // Login + cloudStack.uiCustom.login(loginArgs); }); })(cloudStack, jQuery, testData); diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index 47ca3f47290..b6650851a66 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -36,7 +36,7 @@ $(function() { var $container = $('#cloudStack3-container'); - cloudStack.uiCustom.login({ + var loginArgs = { $container: $container, // Use this for checking the session, to bypass login screen @@ -180,6 +180,8 @@ } }); } - }); + }; + + cloudStack.uiCustom.login(loginArgs); }); })(cloudStack, jQuery, testData);