Skip to content

Commit 013f974

Browse files
author
Jessica Wang
committed
CLOUDSTACK-3950: UI > remove global variable havingS3, havingSwift who are no longer in use.
1 parent 7c45ca2 commit 013f974

3 files changed

Lines changed: 50 additions & 102 deletions

File tree

‎ui/scripts/cloudStack.js‎

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -207,40 +207,7 @@
207207
return true;
208208
}
209209
});
210-
211-
if (userValid && isAdmin()) {
212-
$.ajax({
213-
url: createURL("listImageStores"),
214-
data: {
215-
provider: 'Swift'
216-
},
217-
async: false,
218-
success: function(json) {
219-
var items = json.listimagestoreresponse.imagestore;
220-
if (items != null && items.length > 0)
221-
havingSwift = true;
222-
}
223-
});
224-
if (havingSwift == false) {
225-
$.ajax({
226-
url: createURL("listImageStores"),
227-
data: {
228-
provider: 'S3'
229-
},
230-
async: false,
231-
success: function(json) {
232-
var items = json.listimagestoreresponse.imagestore;
233-
if (items != null && items.length > 0) {
234-
havingS3 = true;
235-
}
236-
}
237-
});
238-
}
239-
} else {
240-
havingSwift = false;
241-
havingS3 = false;
242-
}
243-
210+
244211
return userValid ? {
245212
user: {
246213
userid: g_userid,
@@ -387,40 +354,7 @@
387354
args.response.error();
388355
}
389356
});
390-
391-
if (isAdmin()) {
392-
$.ajax({
393-
url: createURL("listImageStores"),
394-
data: {
395-
provider: 'Swift'
396-
},
397-
async: false,
398-
success: function(json) {
399-
var items = json.listimagestoreresponse.imagestore;
400-
if (items != null && items.length > 0)
401-
havingSwift = true;
402-
}
403-
});
404-
if (havingSwift = false) {
405-
$.ajax({
406-
url: createURL("listImageStores"),
407-
data: {
408-
provider: 'S3'
409-
},
410-
async: false,
411-
success: function(json) {
412-
var items = json.listimagestoreresponse.imagestore;
413-
if (items != null && items.length > 0) {
414-
havingS3 = true;
415-
}
416-
}
417-
});
418-
}
419-
} else {
420-
havingSwift = false;
421-
havingS3 = false;
422-
}
423-
357+
424358
// Get project configuration
425359
// TEMPORARY -- replace w/ output of capability response, etc., once implemented
426360
window.g_projectsInviteRequired = false;

‎ui/scripts/sharedFunctions.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ var md5HashedLogin = false;
4848
var pageSize = 20;
4949

5050
var rootAccountId = 1;
51-
var havingSwift = false;
52-
var havingS3 = false;
5351

5452
//async action
5553
var pollAsyncJobResult = function(args) {

‎ui/scripts/system.js‎

Lines changed: 48 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5619,27 +5619,37 @@
56195619
label: 'label.enable.swift',
56205620
isHeader: true,
56215621
addRow: false,
5622-
preFilter: function(args) {
5623-
var swiftEnabled = false;
5624-
$.ajax({
5622+
preFilter: function(args) {
5623+
var swiftEnableConfiguration = false;
5624+
$.ajax({
56255625
url: createURL('listConfigurations'),
56265626
data: {
56275627
name: 'swift.enable'
56285628
},
56295629
async: false,
56305630
success: function(json) {
5631-
swiftEnabled = json.listconfigurationsresponse.configuration[0].value == 'true' && !havingSwift ?
5632-
true : false;
5631+
swiftEnableConfiguration = json.listconfigurationsresponse.configuration[0].value == 'true' ? true : false;
5632+
}
5633+
});
5634+
5635+
var havingSwift = false;
5636+
$.ajax({
5637+
url: createURL("listImageStores"),
5638+
data: {
5639+
provider: 'Swift'
56335640
},
5634-
5635-
error: function(json) {
5636-
cloudStack.dialog.notice({
5637-
message: parseXMLHttpResponse(json)
5638-
});
5641+
async: false,
5642+
success: function(json) {
5643+
var items = json.listimagestoreresponse.imagestore;
5644+
if (items != null && items.length > 0)
5645+
havingSwift = true;
56395646
}
56405647
});
5641-
5642-
return swiftEnabled;
5648+
5649+
if(swiftEnableConfiguration == true && havingSwift == false)
5650+
return true;
5651+
else
5652+
return false;
56435653
},
56445654
messages: {
56455655
notification: function(args) {
@@ -5675,8 +5685,7 @@
56755685
username: args.data.username,
56765686
key: args.data.key
56775687
},
5678-
success: function(json) {
5679-
havingSwift = true;
5688+
success: function(json) {
56805689
args.response.success();
56815690

56825691
cloudStack.dialog.notice({
@@ -5695,26 +5704,38 @@
56955704
isHeader: true,
56965705
addRow: false,
56975706

5698-
preFilter: function(args) {
5699-
var s3Enabled = false;
5707+
preFilter: function(args) {
5708+
var s3EnableConfiguration = false;
57005709
$.ajax({
57015710
url: createURL('listConfigurations'),
57025711
data: {
57035712
name: 's3.enable'
57045713
},
57055714
async: false,
57065715
success: function(json) {
5707-
s3Enabled = json.listconfigurationsresponse.configuration[0].value == 'true' && !havingS3 ?
5708-
true : false;
5716+
s3EnableConfiguration = json.listconfigurationsresponse.configuration[0].value == 'true' ? true : false;
5717+
}
5718+
});
5719+
5720+
var havingS3 = false;
5721+
$.ajax({
5722+
url: createURL("listImageStores"),
5723+
data: {
5724+
provider: 'S3'
57095725
},
5710-
error: function(json) {
5711-
cloudStack.dialog.notice({
5712-
message: parseXMLHttpResponse(json)
5713-
});
5726+
async: false,
5727+
success: function(json) {
5728+
var items = json.listimagestoreresponse.imagestore;
5729+
if (items != null && items.length > 0) {
5730+
havingS3 = true;
5731+
}
57145732
}
57155733
});
5716-
5717-
return s3Enabled;
5734+
5735+
if(s3EnableConfiguration == true && havingS3 == false)
5736+
return true;
5737+
else
5738+
return false;
57185739
},
57195740

57205741
messages: {
@@ -5778,8 +5799,7 @@
57785799
maxerrorretry: args.data.maxerrorretry,
57795800
sockettimeout: args.data.sockettimeout
57805801
},
5781-
success: function(json) {
5782-
havingS3 = true;
5802+
success: function(json) {
57835803
args.response.success();
57845804

57855805
cloudStack.dialog.notice({
@@ -14543,9 +14563,7 @@
1454314563
$.ajax({
1454414564
url: createURL('addImageStore'),
1454514565
data: data,
14546-
success: function(json) {
14547-
havingS3 = true;
14548-
14566+
success: function(json) {
1454914567
g_regionsecondaryenabled = true;
1455014568

1455114569
var item = json.addimagestoreresponse.imagestore;
@@ -14606,9 +14624,7 @@
1460614624
$.ajax({
1460714625
url: createURL('addImageStore'),
1460814626
data: data,
14609-
success: function(json) {
14610-
havingSwift = true;
14611-
14627+
success: function(json) {
1461214628
g_regionsecondaryenabled = true;
1461314629

1461414630
var item = json.addimagestoreresponse.imagestore;

0 commit comments

Comments
 (0)