Skip to content

Commit fdee284

Browse files
author
Jessica Wang
committed
CLOUDSTACK-2351: object store - Infrastructure menu - secondary storages - add secondary storage dialog - implement Swift provider.
1 parent a00e30c commit fdee284

1 file changed

Lines changed: 23 additions & 31 deletions

File tree

ui/scripts/system.js

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@
282282

283283
secondaryStorageCount: function(data) {
284284
$.ajax({
285-
url: createURL('listHosts'),
285+
url: createURL('listImageStores'),
286286
data: {
287-
type: 'SecondaryStorage',
287+
type: 'image',
288288
page: 1,
289289
pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property.
290290
},
@@ -10322,16 +10322,9 @@
1032210322
id: 'secondarystorages',
1032310323
section: 'seconary-storage',
1032410324
fields: {
10325-
name: { label: 'label.name' },
10326-
created: { label: 'label.created', converter: cloudStack.converters.toLocalDate },
10327-
resourcestate: {
10328-
label: 'label.state',
10329-
indicator: {
10330-
'Enabled': 'on',
10331-
'Disabled': 'off',
10332-
'Destroyed': 'off'
10333-
}
10334-
}
10325+
providername: { label: 'Provider' },
10326+
scope: { label: 'Scope' },
10327+
url: { label: 'URL' }
1033510328
},
1033610329

1033710330
dataProvider: function(args) {
@@ -10345,10 +10338,9 @@
1034510338
break;
1034610339
}
1034710340
}
10348-
}
10349-
array1.push("&zoneid=" + args.context.zones[0].id);
10341+
}
1035010342
$.ajax({
10351-
url: createURL("listHosts&type=SecondaryStorage&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
10343+
url: createURL("listImageStores&type=image&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
1035210344
dataType: "json",
1035310345
async: true,
1035410346
success: function(json) {
@@ -10369,7 +10361,7 @@
1036910361
title: 'label.add.secondary.storage',
1037010362
fields: {
1037110363
provider: {
10372-
label: "Storage Provider",
10364+
label: 'Provider',
1037310365
select: function(args){
1037410366
$.ajax({
1037510367
url: createURL('listStorageProviders'),
@@ -10473,13 +10465,12 @@
1047310465
label: 'Zone',
1047410466
docID: 'helpSecondaryStorageZone',
1047510467
validation: { required: true },
10476-
select: function(args) {
10477-
var data = args.context.zones ?
10478-
{ id: args.context.zones[0].id } : { listAll: true };
10479-
10468+
select: function(args) {
1048010469
$.ajax({
1048110470
url: createURL('listZones'),
10482-
data: data,
10471+
data: {
10472+
listAll: true
10473+
},
1048310474
success: function(json) {
1048410475
var zones = json.listzonesresponse.zone;
1048510476

@@ -10570,7 +10561,7 @@
1057010561
}
1057110562
else if(args.data.provider == 'S3') {
1057210563
$.ajax({
10573-
url: createURL('addS3'),
10564+
url: createURL('addImageStore'),
1057410565
data: {
1057510566
provider: args.data.provider,
1057610567
accesskey: args.data.accesskey,
@@ -10584,7 +10575,7 @@
1058410575
},
1058510576
success: function(json) {
1058610577
havingS3 = true;
10587-
var item = json.adds3response.secondarystorage;
10578+
var item = json.addimagestoreresponse.secondarystorage;
1058810579
args.response.success({
1058910580
data:item
1059010581
});
@@ -10596,17 +10587,20 @@
1059610587
}
1059710588
else if(args.data.provider == 'Swift') {
1059810589
$.ajax({
10599-
url: createURL('addSwift'),
10590+
url: createURL('addImageStore'),
1060010591
data: {
1060110592
provider: args.data.provider,
1060210593
url: args.data.url,
10603-
account: args.data.account,
10604-
username: args.data.username,
10605-
key: args.data.key
10594+
'details[0].key': 'account',
10595+
'details[0].value': args.data.account,
10596+
'details[1].key': 'username',
10597+
'details[1].value': args.data.username,
10598+
'details[2].key': 'key',
10599+
'details[2].value': args.data.key
1060610600
},
1060710601
success: function(json) {
1060810602
havingSwift = true;
10609-
var item = json.addswiftresponse.secondarystorage;
10603+
var item = json.addimagestoreresponse.secondarystorage;
1061010604
args.response.success({
1061110605
data:item
1061210606
});
@@ -10615,9 +10609,7 @@
1061510609
args.response.error(parseXMLHttpResponse(json));
1061610610
}
1061710611
});
10618-
}
10619-
10620-
10612+
}
1062110613
},
1062210614

1062310615
notification: {

0 commit comments

Comments
 (0)