Browse Source

Merge "Set some useful default values with the new launch wizard."

Jenkins 2 years ago
parent
commit
4d917d200a

+ 15
- 0
openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js View File

@@ -344,6 +344,9 @@
344 344
           e.keypair.id = e.keypair.name;
345 345
           return e.keypair;
346 346
         }));
347
+      if (data.data.items.length === 1) {
348
+        model.newInstanceSpec.key_pair.push(data.data.items[0].keypair);
349
+      }
347 350
     }
348 351
 
349 352
     function setFinalSpecKeyPairs(finalSpec) {
@@ -361,6 +364,15 @@
361 364
 
362 365
     function onGetSecurityGroups(data) {
363 366
       model.securityGroups.length = 0;
367
+      angular.forEach(data.data.items, function addDefault(item) {
368
+        // 'default' is a special security group in neutron. It can not be
369
+        // deleted and is guaranteed to exist. It by default contains all
370
+        // of the rules needed for an instance to reach out to the network
371
+        // so the instance can provision itself.
372
+        if (item.name === 'default') {
373
+          model.newInstanceSpec.security_groups.push(item);
374
+        }
375
+      });
364 376
       push.apply(model.securityGroups, data.data.items);
365 377
     }
366 378
 
@@ -386,6 +398,9 @@
386 398
     function onGetNetworks(data) {
387 399
       model.neutronEnabled = true;
388 400
       model.networks.length = 0;
401
+      if (data.data.items.length === 1) {
402
+        model.newInstanceSpec.networks.push(data.data.items[0]);
403
+      }
389 404
       push.apply(model.networks, data.data.items);
390 405
       return data;
391 406
     }

Loading…
Cancel
Save