|
216 | 216 | fields: { |
217 | 217 | name: { label: 'label.name' } |
218 | 218 | }, |
| 219 | + |
| 220 | + //??? |
| 221 | + actions: { |
| 222 | + add: { |
| 223 | + label: 'Add GSLB', |
| 224 | + |
| 225 | + messages: { |
| 226 | + confirm: function(args) { |
| 227 | + return 'Add GSLB'; |
| 228 | + }, |
| 229 | + notification: function(args) { |
| 230 | + return 'Add GSLB'; |
| 231 | + } |
| 232 | + }, |
| 233 | + |
| 234 | + createForm: { |
| 235 | + title: 'Add GSLB', |
| 236 | + fields: { |
| 237 | + name: { |
| 238 | + label: 'label.name', |
| 239 | + validation: { required: true } |
| 240 | + }, |
| 241 | + description: { |
| 242 | + label: 'label.description' |
| 243 | + }, |
| 244 | + domainid: { |
| 245 | + label: 'Domain', |
| 246 | + select: function(args) { |
| 247 | + if(isAdmin() || isDomainAdmin()) { |
| 248 | + $.ajax({ |
| 249 | + url: createURL('listDomains'), |
| 250 | + data: { |
| 251 | + listAll: true, |
| 252 | + details: 'min' |
| 253 | + }, |
| 254 | + success: function(json) { |
| 255 | + var array1 = [{id: '', description: ''}]; |
| 256 | + var domains = json.listdomainsresponse.domain; |
| 257 | + if(domains != null && domains.length > 0) { |
| 258 | + for(var i = 0; i < domains.length; i++) { |
| 259 | + array1.push({id: domains[i].id, description: domains[i].path}); |
| 260 | + } |
| 261 | + } |
| 262 | + args.response.success({ |
| 263 | + data: array1 |
| 264 | + }); |
| 265 | + } |
| 266 | + }); |
| 267 | + } |
| 268 | + else { |
| 269 | + args.response.success({ |
| 270 | + data: null |
| 271 | + }); |
| 272 | + } |
| 273 | + }, |
| 274 | + isHidden: function(args) { |
| 275 | + if(isAdmin() || isDomainAdmin()) |
| 276 | + return false; |
| 277 | + else |
| 278 | + return true; |
| 279 | + } |
| 280 | + }, |
| 281 | + account: { |
| 282 | + label: 'Account', |
| 283 | + isHidden: function(args) { |
| 284 | + if(isAdmin() || isDomainAdmin()) |
| 285 | + return false; |
| 286 | + else |
| 287 | + return true; |
| 288 | + } |
| 289 | + }, |
| 290 | + gslblbmethod: { |
| 291 | + label: 'Algorithm', |
| 292 | + select: function(args) { |
| 293 | + var array1 = [{id: 'roundrobin', description: 'roundrobin'}, {id: 'leastconn', description: 'leastconn'}, {id: 'proximity', description: 'proximity'}]; |
| 294 | + args.response.success({ |
| 295 | + data: array1 |
| 296 | + }); |
| 297 | + } |
| 298 | + }, |
| 299 | + gslbdomainname: { |
| 300 | + label: 'Domain Name', |
| 301 | + validation: { required: true } |
| 302 | + }, |
| 303 | + gslbservicetype: { |
| 304 | + label: 'Service Type', |
| 305 | + select: function(args) { |
| 306 | + var array1 = [{id: 'tcp', description: 'tcp'}, {id: 'udp', description: 'udp'}]; |
| 307 | + args.response.success({ |
| 308 | + data: array1 |
| 309 | + }); |
| 310 | + }, |
| 311 | + validation: { required: true } |
| 312 | + } |
| 313 | + } |
| 314 | + }, |
| 315 | + action: function(args) { |
| 316 | + var data = { |
| 317 | + name: args.data.name, |
| 318 | + regionid: args.context.regions[0].id, |
| 319 | + gslblbmethod: args.data.gslblbmethod, |
| 320 | + gslbdomainname: args.data.gslbdomainname, |
| 321 | + gslbservicetype: args.data.gslbservicetype |
| 322 | + }; |
| 323 | + if(args.data.description != null && args.data.description.length > 0) |
| 324 | + $.extend(data, { description: args.data.description }); |
| 325 | + if(args.data.domainid != null && args.data.domainid.length > 0) |
| 326 | + $.extend(data, { domainid: args.data.domainid }); |
| 327 | + if(args.data.account != null && args.data.account.length > 0) |
| 328 | + $.extend(data, { account: args.data.account }); |
| 329 | + |
| 330 | + $.ajax({ |
| 331 | + url: createURL('createGlobalLoadBalancerRule'), |
| 332 | + data: data, |
| 333 | + success: function(json) { |
| 334 | + var item = json.creategloballoadbalancerruleresponse.globalloadbalancerrule; |
| 335 | + args.response.success({data: item}); |
| 336 | + }, |
| 337 | + error: function(data) { |
| 338 | + args.response.error(parseXMLHttpResponse(data)); |
| 339 | + } |
| 340 | + }); |
| 341 | + }, |
| 342 | + |
| 343 | + notification: { |
| 344 | + poll: function(args) { |
| 345 | + args.complete(); |
| 346 | + } |
| 347 | + } |
| 348 | + } |
| 349 | + }, |
| 350 | + //??? |
| 351 | + |
219 | 352 | dataProvider: function(args) { |
220 | 353 | if('regions' in args.context) { |
221 | 354 | var data = { |
|
224 | 357 | $.ajax({ |
225 | 358 | url: createURL('listGlobalLoadBalancerRules'), |
226 | 359 | data: data, |
227 | | - success: function(json) { |
228 | | - debugger; |
| 360 | + success: function(json) { |
229 | 361 | var items = json.listgloballoadbalancerrulesresponse.globalloadbalancerrule; |
230 | 362 | args.response.success({ |
231 | 363 | data: items |
|
0 commit comments