|
2099 | 2099 | }) |
2100 | 2100 | }); |
2101 | 2101 |
|
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 | + // } |
2129 | 2129 |
|
2130 | 2130 | }, |
2131 | 2131 | error: function(XMLHttpResponse) { |
|
4027 | 4027 | }, |
4028 | 4028 |
|
4029 | 4029 | addSecondaryStorage: function(args) { |
| 4030 | + |
| 4031 | + var dedicatedZone = (args.data.pluginFrom == null && args.data.zone.ispublic != null); |
| 4032 | + |
4030 | 4033 | 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 |
4035 | 4046 | } |
4036 | 4047 |
|
4037 | 4048 |
|
|
4059 | 4070 | url: createURL('addImageStore'), |
4060 | 4071 | data: data, |
4061 | 4072 | 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 | + }) |
4065 | 4079 | }) |
4066 | | - }); |
| 4080 | + } else { |
| 4081 | + complete({ |
| 4082 | + data: $.extend(args.data, { |
| 4083 | + returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage |
| 4084 | + }) |
| 4085 | + }); |
| 4086 | + } |
| 4087 | + |
4067 | 4088 | }, |
4068 | 4089 | error: function(XMLHttpResponse) { |
4069 | 4090 | var errorMsg = parseXMLHttpResponse(XMLHttpResponse); |
|
4111 | 4132 | url: createURL('addImageStore'), |
4112 | 4133 | data: data, |
4113 | 4134 | 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 | + }) |
4117 | 4140 | }) |
4118 | | - }); |
| 4141 | + } else { |
| 4142 | + complete({ |
| 4143 | + data: $.extend(args.data, { |
| 4144 | + returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage |
| 4145 | + }) |
| 4146 | + }); |
| 4147 | + } |
| 4148 | + |
4119 | 4149 | }, |
4120 | 4150 | error: function(XMLHttpResponse) { |
4121 | 4151 | var errorMsg = parseXMLHttpResponse(XMLHttpResponse); |
|
4179 | 4209 | url: createURL('addImageStore'), |
4180 | 4210 | data: data, |
4181 | 4211 | 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 | + }) |
4185 | 4217 | }) |
4186 | | - }); |
| 4218 | + } else { |
| 4219 | + complete({ |
| 4220 | + data: $.extend(args.data, { |
| 4221 | + returnedSecondaryStorage: json.addimagestoreresponse.secondarystorage |
| 4222 | + }) |
| 4223 | + }); |
| 4224 | + } |
4187 | 4225 | }, |
4188 | 4226 | error: function(XMLHttpResponse) { |
4189 | 4227 | var errorMsg = parseXMLHttpResponse(XMLHttpResponse); |
|
4194 | 4232 | } |
4195 | 4233 | }); |
4196 | 4234 | } |
| 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 | + |
4197 | 4290 | } |
4198 | 4291 | }; |
4199 | 4292 |
|
|
0 commit comments