|
1 | | -(function(cloudStack, testData) { |
| 1 | +(function(cloudStack, testData, $) { |
2 | 2 | cloudStack.sections.configuration = { |
3 | 3 | title: 'Configuration', |
4 | 4 | id: 'configuration', |
|
72 | 72 | setTimeout(function() { |
73 | 73 | args.response.success({ |
74 | 74 | data: testData.data.serviceOfferings |
75 | | - }); |
| 75 | + }); |
76 | 76 | }); |
77 | 77 | } |
78 | 78 | } |
|
144 | 144 | setTimeout(function() { |
145 | 145 | args.response.success({ |
146 | 146 | data: testData.data.systemServiceOfferings |
147 | | - }); |
| 147 | + }); |
148 | 148 | }); |
149 | 149 | } |
150 | 150 | } |
|
250 | 250 | networkrate: { label: 'Network Rate' }, |
251 | 251 | traffictype: { label: 'Traffic Type'} |
252 | 252 | }, |
| 253 | + |
| 254 | + actions: { |
| 255 | + add: { |
| 256 | + label: 'Add network offering', |
| 257 | + |
| 258 | + action: function(args) { |
| 259 | + setTimeout(function() { |
| 260 | + args.response.success(); |
| 261 | + }, 200); |
| 262 | + }, |
| 263 | + |
| 264 | + createForm: { |
| 265 | + title: 'Add network offering', |
| 266 | + desc: 'Please specify the network offering', |
| 267 | + fields: { |
| 268 | + name: { label: 'Name', validation: { required: true } }, |
| 269 | + |
| 270 | + displayText: { label: 'Display Text', validation: { required: true } }, |
| 271 | + |
| 272 | + maxConnections: { label: 'Max Connections' }, |
| 273 | + |
| 274 | + networkRate: { label: 'Network Rate' }, |
| 275 | + |
| 276 | + trafficType: { |
| 277 | + label: 'Traffic Type', validation: { required: true }, |
| 278 | + select: function(args) { |
| 279 | + args.response.success({ |
| 280 | + data: [ |
| 281 | + { id: 'GUEST', description: 'Guest' } |
| 282 | + ] |
| 283 | + }); |
| 284 | + } |
| 285 | + }, |
| 286 | + |
| 287 | + guestType: { |
| 288 | + label: 'Guest Type', |
| 289 | + select: function(args) { |
| 290 | + args.response.success({ |
| 291 | + data: [ |
| 292 | + { id: 'Isolated', description: 'Isolated' }, |
| 293 | + { id: 'Shared', description: 'Shared' } |
| 294 | + ] |
| 295 | + }); |
| 296 | + } |
| 297 | + }, |
| 298 | + |
| 299 | + availability: { |
| 300 | + label: 'Availability', |
| 301 | + select: function(args) { |
| 302 | + args.response.success({ |
| 303 | + data: [ |
| 304 | + { id: 'Required', description: 'Required' }, |
| 305 | + { id: 'Optional', description: 'Optional' }, |
| 306 | + { id: 'Unavailable', description: 'Unavailable' } |
| 307 | + ] |
| 308 | + }); |
| 309 | + } |
| 310 | + }, |
| 311 | + |
| 312 | + serviceOfferingId: { |
| 313 | + label: 'Service Offering', |
| 314 | + select: function(args) { |
| 315 | + args.response.success({ |
| 316 | + data: $.map(testData.data.serviceOfferings, function(elem) { |
| 317 | + return { |
| 318 | + id: elem.id, |
| 319 | + description: elem.name |
| 320 | + }; |
| 321 | + }) |
| 322 | + }); |
| 323 | + } |
| 324 | + }, |
| 325 | + |
| 326 | + specifyVlan: { label: 'Specify VLAN', isBoolean: true }, |
| 327 | + |
| 328 | + vlanId: { label: 'VLAN ID', isHidden: true, dependsOn: 'specifyVlan'}, |
| 329 | + |
| 330 | + supportedServices: { |
| 331 | + label: 'Supported Services', |
| 332 | + |
| 333 | + dynamic: function(args) { |
| 334 | + setTimeout(function() { |
| 335 | + var fields = {}; |
| 336 | + var services = ['Vpn', 'Dhcp', 'Gateway', 'Firewall', 'Lb', 'UserData', 'SourceNat', 'StaticNat', 'PortForwarding', 'SecurityGroup']; |
| 337 | + |
| 338 | + $(services).each(function() { |
| 339 | + var id = { |
| 340 | + isEnabled: this + '.' + 'isEnabled', |
| 341 | + capabilities: this + '.' + 'capabilities', |
| 342 | + provider: this + '.' + 'provider' |
| 343 | + }; |
| 344 | + |
| 345 | + fields[id.isEnabled] = { label: this, isBoolean: true }; |
| 346 | + fields[id.provider] = { |
| 347 | + label: this + ' Provider', |
| 348 | + isHidden: true, |
| 349 | + dependsOn: id.isEnabled, |
| 350 | + select: function(args) { |
| 351 | + args.response.success({ |
| 352 | + data: [ |
| 353 | + { id: 'NetScaler', description: 'NetScaler'}, |
| 354 | + { id: 'SRX', description: 'SRX' } |
| 355 | + ] |
| 356 | + }); |
| 357 | + } |
| 358 | + }; |
| 359 | + }); |
| 360 | + |
| 361 | + args.response.success({ |
| 362 | + fields: fields |
| 363 | + }); |
| 364 | + }, 50); |
| 365 | + } |
| 366 | + }, |
| 367 | + |
| 368 | + tags: { label: 'Tags' } |
| 369 | + } |
| 370 | + }, |
| 371 | + |
| 372 | + notification: { |
| 373 | + poll: testData.notifications.testPoll |
| 374 | + }, |
| 375 | + messages: { |
| 376 | + notification: function(args) { |
| 377 | + return 'Added network offering'; |
| 378 | + } |
| 379 | + } |
| 380 | + } |
| 381 | + }, |
253 | 382 | dataProvider: function(args) { |
254 | 383 | setTimeout(function() { |
255 | 384 | args.response.success({ |
|
261 | 390 | } |
262 | 391 | } |
263 | 392 | }; |
264 | | -})(cloudStack, testData); |
| 393 | +})(cloudStack, testData, jQuery); |
0 commit comments