Skip to content

Commit 06d8974

Browse files
committed
CLOUDSTACK-3700: The dedication process should be listed as a step through zone wizard
1 parent cc99a83 commit 06d8974

3 files changed

Lines changed: 138 additions & 43 deletions

File tree

client/WEB-INF/classes/resources/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,7 @@ message.creating.primary.storage=Creating primary storage
13431343
message.creating.secondary.storage=Creating secondary storage
13441344
message.creating.zone=Creating zone
13451345
message.decline.invitation=Are you sure you want to decline this project invitation?
1346+
message.dedicate.zone=Dedicating zone
13461347
message.delete.account=Please confirm that you want to delete this account.
13471348
message.delete.affinity.group=Please confirm that you would like to remove this affinity group.
13481349
message.delete.gateway=Please confirm you want to delete the gateway

ui/dictionary.jsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,7 @@ dictionary = {
13101310
'message.creating.secondary.storage': '<fmt:message key="message.creating.secondary.storage" />',
13111311
'message.creating.zone': '<fmt:message key="message.creating.zone" />',
13121312
'message.decline.invitation': '<fmt:message key="message.decline.invitation" />',
1313+
'message.dedicate.zone': '<fmt:message key="message.dedicate.zone" />',
13131314
'message.delete.account': '<fmt:message key="message.delete.account" />',
13141315
'message.delete.affinity.group': '<fmt:message key="message.delete.affinity.group" />',
13151316
'message.delete.gateway': '<fmt:message key="message.delete.gateway" />',

ui/scripts/zoneWizard.js

Lines changed: 136 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,33 +2099,33 @@
20992099
})
21002100
});
21012101

2102-
dedicatedZoneId = json.createzoneresponse.zone.id;
2103-
//EXPLICIT ZONE DEDICATION
2104-
if (args.data.pluginFrom == null && args.data.zone.ispublic != null) {
2105-
var array2 = [];
2106-
if (args.data.zone.domain != null)
2107-
array2.push("&domainid=" + args.data.zone.domain);
2108-
if (args.data.zone.accountId != "")
2109-
array2.push("&account=" + todb(args.data.zone.accountId));
2110-
2111-
if (dedicatedZoneId != null) {
2112-
$.ajax({
2113-
url: createURL("dedicateZone&ZoneId=" + dedicatedZoneId + array2.join("")),
2114-
dataType: "json",
2115-
success: function(json) {
2116-
var dedicatedObj = json.dedicatezoneresponse.jobid;
2117-
//args.response.success({ data: $.extend(item, dedicatedObj)});
2118-
2119-
},
2120-
2121-
error: function(json) {
2122-
2123-
args.response.error(parseXMLHttpResponse(XMLHttpResponse));
2124-
}
2125-
});
2126-
2127-
}
2128-
}
2102+
// dedicatedZoneId = json.createzoneresponse.zone.id;
2103+
// //EXPLICIT ZONE DEDICATION
2104+
// if (args.data.pluginFrom == null && args.data.zone.ispublic != null) {
2105+
// var array2 = [];
2106+
// if (args.data.zone.domain != null)
2107+
// array2.push("&domainid=" + args.data.zone.domain);
2108+
// if (args.data.zone.accountId != "")
2109+
// array2.push("&account=" + todb(args.data.zone.accountId));
2110+
2111+
// if (dedicatedZoneId != null) {
2112+
// $.ajax({
2113+
// url: createURL("dedicateZone&ZoneId=" + dedicatedZoneId + array2.join("")),
2114+
// dataType: "json",
2115+
// success: function(json) {
2116+
// var dedicatedObj = json.dedicatezoneresponse.jobid;
2117+
// //args.response.success({ data: $.extend(item, dedicatedObj)});
2118+
2119+
// },
2120+
2121+
// error: function(json) {
2122+
2123+
// args.response.error(parseXMLHttpResponse(XMLHttpResponse));
2124+
// }
2125+
// });
2126+
2127+
// }
2128+
// }
21292129

21302130
},
21312131
error: function(XMLHttpResponse) {
@@ -4027,11 +4027,22 @@
40274027
},
40284028

40294029
addSecondaryStorage: function(args) {
4030+
4031+
var dedicatedZone = (args.data.pluginFrom == null && args.data.zone.ispublic != null);
4032+
40304033
if (args.data.secondaryStorage.provider == '') {
4031-
complete({
4032-
data: args.data
4033-
});
4034-
return; //skip addSecondaryStorage if provider dropdown is blank
4034+
4035+
if (dedicatedZone) {
4036+
stepFns.dedicateZone({
4037+
data: args.data
4038+
});
4039+
} else {
4040+
complete({
4041+
data: args.data
4042+
})
4043+
}
4044+
4045+
return; //skip addSecondaryStorage if provider dropdown is blank
40354046
}
40364047

40374048

@@ -4059,11 +4070,21 @@
40594070
url: createURL('addImageStore'),
40604071
data: data,
40614072
success: function(json) {
4062-
complete({
4063-
data: $.extend(args.data, {
4064-
returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
4073+
4074+
if (dedicatedZone) {
4075+
stepFns.dedicateZone({
4076+
data: $.extend(args.data, {
4077+
returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
4078+
})
40654079
})
4066-
});
4080+
} else {
4081+
complete({
4082+
data: $.extend(args.data, {
4083+
returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
4084+
})
4085+
});
4086+
}
4087+
40674088
},
40684089
error: function(XMLHttpResponse) {
40694090
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@@ -4111,11 +4132,20 @@
41114132
url: createURL('addImageStore'),
41124133
data: data,
41134134
success: function(json) {
4114-
complete({
4115-
data: $.extend(args.data, {
4116-
returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
4135+
if (dedicatedZone) {
4136+
stepFns.dedicateZone({
4137+
data: $.extend(args.data, {
4138+
returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
4139+
})
41174140
})
4118-
});
4141+
} else {
4142+
complete({
4143+
data: $.extend(args.data, {
4144+
returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
4145+
})
4146+
});
4147+
}
4148+
41194149
},
41204150
error: function(XMLHttpResponse) {
41214151
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@@ -4179,11 +4209,19 @@
41794209
url: createURL('addImageStore'),
41804210
data: data,
41814211
success: function(json) {
4182-
complete({
4183-
data: $.extend(args.data, {
4184-
returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
4212+
if (dedicatedZone) {
4213+
stepFns.dedicateZone({
4214+
data: $.extend(args.data, {
4215+
returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
4216+
})
41854217
})
4186-
});
4218+
} else {
4219+
complete({
4220+
data: $.extend(args.data, {
4221+
returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage
4222+
})
4223+
});
4224+
}
41874225
},
41884226
error: function(XMLHttpResponse) {
41894227
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@@ -4194,6 +4232,61 @@
41944232
}
41954233
});
41964234
}
4235+
},
4236+
dedicateZone: function(args) {
4237+
4238+
if(args.data.pluginFrom == null && args.data.zone.ispublic != null) {
4239+
var dedicatedZoneId = args.data.returnedZone.id;
4240+
message(dictionary['message.dedicate.zone']);
4241+
4242+
var array2 = [];
4243+
if (args.data.zone.domain != null)
4244+
array2.push("&domainid=" + args.data.zone.domain);
4245+
if (args.data.zone.accountId != "")
4246+
array2.push("&account=" + todb(args.data.zone.accountId));
4247+
4248+
if (dedicatedZoneId != null) {
4249+
$.ajax({
4250+
url: createURL("dedicateZone&ZoneId=" + dedicatedZoneId + array2.join("")),
4251+
dataType: "json",
4252+
success: function(json) {
4253+
var jobId = json.dedicatezoneresponse.jobid;
4254+
var dedicatedZoneIntervalId = setInterval(function() {
4255+
$.ajax({
4256+
url: createURL("queryAsyncJobResult&jobid=" + jobId),
4257+
dataType: "json",
4258+
success: function(json) {
4259+
if (json.queryasyncjobresultresponse.jobstatus == 0) { // not complete
4260+
return;
4261+
} else {
4262+
clearInterval(dedicatedZoneIntervalId);
4263+
if(json.queryasyncjobresultresponse.jobstatus == 1) { // successed
4264+
complete({
4265+
data: $.extend(args.data, {
4266+
returnedDedicateZone: json.queryasyncjobresultresponse.jobresult
4267+
})
4268+
});
4269+
} else if(json.queryasyncjobresultresponse.jobstatus == 2) { // failed
4270+
error('addZone', json.queryasyncjobresultresponse.jobresult.errortext, {
4271+
fn: 'dedicateZone',
4272+
args: args
4273+
})
4274+
}
4275+
}
4276+
4277+
}
4278+
});
4279+
}, g_queryAsyncJobResultInterval);
4280+
}
4281+
});
4282+
4283+
}
4284+
} else {
4285+
complete({
4286+
data: args.data
4287+
});
4288+
}
4289+
41974290
}
41984291
};
41994292

0 commit comments

Comments
 (0)