From df8553b807d40e2496b2be7486ad954acb6c99dd Mon Sep 17 00:00:00 2001 From: bfederle Date: Wed, 1 Feb 2012 10:38:48 -0800 Subject: [PATCH] bug 12806 After configuring swift, disable (hide) swift button after leaving zone page. Note that the button will still be visble until them, in case the user needs to re-configure (i.e., because of a typo) status 12806: resolved fixed --- ui/scripts/cloudStack.js | 17 ++++++++++++++++- ui/scripts/system.js | 12 ++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index 751a655ae74..53ad9feab85 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -119,6 +119,21 @@ } }); + if (userValid && isAdmin()) { + $.ajax({ + url: createURL("listSwifts"), + dataType: "json", + async: false, + success: function(json) { + var items = json.listswiftsresponse.swift; + if(items != null && items.length > 0) + havingSwift = true; + } + }); + } else { + havingSwift = false; + } + return userValid ? { user: { userid: g_userid, @@ -233,7 +248,7 @@ dataType: "json", async: false, success: function(json) { - var items = json.ListSwiftresponse.swift; + var items = json.listswiftsresponse.swift; if(items != null && items.length > 0) havingSwift = true; } diff --git a/ui/scripts/system.js b/ui/scripts/system.js index c1bdb4483b0..19d88d55059 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -2905,9 +2905,9 @@ enableSwift: { label: 'Configure Swift', isHeader: true, + addRow: false, preFilter: function(args) { var swiftEnabled = false; - $.ajax({ url: createURL('listConfigurations'), data: { @@ -2915,8 +2915,16 @@ }, async: false, success: function(json) { - swiftEnabled = json.listconfigurationsresponse.configuration[0].value == 'true' ? + swiftEnabled = json.listconfigurationsresponse.configuration[0].value == 'true' && !havingSwift ? true : false; + + cloudStack.dialog.notice({ + message: 'Swift configured. Note: When you leave this page, you will not be able to re-configure Swift again.' + }); + }, + + error: function(json) { + cloudStack.dialog.notice({ message: parseXMLHttpResponse(json) }); } });