From 61d2fcd7e6040952642b93d85e8dd755fc3aba77 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 24 Mar 2015 13:31:35 +1100 Subject: [PATCH] [Launch Instance Fix] Split Security & Access in 2 This splits the single Security and Access step so that the two panes in that step (Security Groups / Keypairs) have their own steps in the wizard, thus making everything much more consistent. This also now uses the Controller As syntax which is considered to be a best practice. Change-Id: Ib1d79ce8019e5361faccf77360989c38ce1cab2c Co-Authored-By: Travis Tripp Closes-Bug: 1435636 --- openstack_dashboard/enabled/_10_project.py | 6 +- .../access-and-security.help.html | 4 - .../access-and-security.html | 261 ------------------ .../access-and-security.js | 113 -------- .../access-and-security.scss | 28 -- .../security-group-details.html | 20 -- .../keypair/keypair-details.html | 6 + .../launch-instance/keypair/keypair.help.html | 4 + .../launch-instance/keypair/keypair.html | 116 ++++++++ .../launch-instance/keypair/keypair.js | 79 ++++++ .../launch-instance/keypair/keypair.scss | 18 ++ .../keypair.spec.js} | 2 +- .../launch-instance/launch-instance.js | 12 +- .../launch-instance/launch-instance.scss | 3 +- .../keypair-details.html | 0 .../security-group-details.html | 20 ++ .../security-groups/security-groups.help.html | 4 + .../security-groups/security-groups.html | 114 ++++++++ .../security-groups/security-groups.js | 73 +++++ .../security-groups/security-groups.scss | 11 + .../security-groups/security-groups.spec.js | 24 ++ .../test/jasmine/jasmine_tests.py | 6 +- 22 files changed, 489 insertions(+), 435 deletions(-) delete mode 100644 openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.help.html delete mode 100644 openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.html delete mode 100644 openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.js delete mode 100644 openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.scss delete mode 100644 openstack_dashboard/static/dashboard/launch-instance/access-and-security/security-group-details.html create mode 100644 openstack_dashboard/static/dashboard/launch-instance/keypair/keypair-details.html create mode 100644 openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.help.html create mode 100644 openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.html create mode 100644 openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.js create mode 100644 openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.scss rename openstack_dashboard/static/dashboard/launch-instance/{access-and-security/access-and-security.spec.js => keypair/keypair.spec.js} (91%) rename openstack_dashboard/static/dashboard/launch-instance/{access-and-security => security-groups}/keypair-details.html (100%) create mode 100644 openstack_dashboard/static/dashboard/launch-instance/security-groups/security-group-details.html create mode 100644 openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.help.html create mode 100644 openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.html create mode 100644 openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.js create mode 100644 openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.scss create mode 100644 openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.spec.js diff --git a/openstack_dashboard/enabled/_10_project.py b/openstack_dashboard/enabled/_10_project.py index 609b22f625..03e4b47107 100644 --- a/openstack_dashboard/enabled/_10_project.py +++ b/openstack_dashboard/enabled/_10_project.py @@ -32,7 +32,8 @@ ADD_JS_FILES = [ LAUNCH_INST + 'source/source.js', LAUNCH_INST + 'flavor/flavor.js', LAUNCH_INST + 'network/network.js', - LAUNCH_INST + 'access-and-security/access-and-security.js', + LAUNCH_INST + 'security-groups/security-groups.js', + LAUNCH_INST + 'keypair/keypair.js', LAUNCH_INST + 'configuration/configuration.js', ] @@ -43,6 +44,7 @@ ADD_JS_SPEC_FILES = [ LAUNCH_INST + 'source/source.spec.js', LAUNCH_INST + 'flavor/flavor.spec.js', LAUNCH_INST + 'network/network.spec.js', - LAUNCH_INST + 'access-and-security/access-and-security.spec.js', + LAUNCH_INST + 'security-groups/security-groups.spec.js', + LAUNCH_INST + 'keypair/keypair.spec.js', LAUNCH_INST + 'configuration/configuration.spec.js', ] diff --git a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.help.html b/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.help.html deleted file mode 100644 index c8f57c29dc..0000000000 --- a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.help.html +++ /dev/null @@ -1,4 +0,0 @@ -
-

{$ ::accessSecHelpCtrl.title $}

-

-
diff --git a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.html b/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.html deleted file mode 100644 index e4b12c42de..0000000000 --- a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.html +++ /dev/null @@ -1,261 +0,0 @@ -
-

{$ ::label.title $}

- -
-
{$ ::label.subtitle $}
- -
- - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{$ ::label.name $}{$ ::label.description $}
-
- {$ ::trCtrl.helpText.noneAllocText $} -
-
- - {$ row.name $}{$ row.description $} - - - - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
{$ ::label.name $}{$ ::label.description $}
-
- {$ ::trCtrl.helpText.noneAvailText $} -
-
- - {$ row.name$}{$ row.description $} - - - - - - - - -
-
-
- -
- -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{$ ::label.name $}{$ ::keyPairTableLabels.fingerprint $}
-
- {$ ::trCtrl.helpText.noneAllocText $} -
-
- - {$ row.name $}{$ row.fingerprint $} - - - - - -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
{$ ::label.name $}{$ ::keyPairTableLabels.fingerprint $}
-
- {$ ::trCtrl.helpText.noneAvailText $} -
-
- - {$ row.name$}{$ row.fingerprint $} - - - - - - - - -
-
-
- -
- -
-
-
-
-
diff --git a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.js b/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.js deleted file mode 100644 index 166f88131b..0000000000 --- a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.js +++ /dev/null @@ -1,113 +0,0 @@ -(function () { - 'use strict'; - - var module = angular.module('hz.dashboard.launch-instance'); - - /** - * @ngdoc controller - * @name hz.dashboard.launch-instance.LaunchInstanceAccessAndSecurityCtrl - * @description - * Allows selection of security groups and key pairs. - */ - module.controller('LaunchInstanceAccessAndSecurityCtrl', [ - '$scope', - function ($scope) { - $scope.label = { - title: gettext('Access and Security'), - subtitle: gettext('Select the security groups and a key pair.'), - security_groups: gettext('Security Groups'), - key_pairs: gettext('Key Pairs'), - name: gettext('Name'), - description: gettext('Description') - }; - - $scope.secGroupTableLabels = { - direction: gettext('Direction'), - ethertype: gettext('Ether Type'), - protocol: gettext('Protocol'), - port_range_min: gettext('Min Port'), - port_range_max: gettext('Max Port'), - remote_ip_prefix: gettext('Remote') - }; - - $scope.secGroupTableData = { - available: $scope.model.securityGroups, - allocated: $scope.model.newInstanceSpec.security_groups, - displayedAvailable: [], - displayedAllocated: [] - }; - - $scope.secGroupTableDetails = - '/static/dashboard/launch-instance/access-and-security/security-group-details.html'; - - $scope.secGroupTableHelp = { - noneAllocText: gettext('Select one or more security groups from the available groups below.'), - availHelpText: gettext('Select one or more') - }; - - $scope.secGroupTableLimits = { - maxAllocation: -1 - }; - - $scope.keyPairTableLabels = { - fingerprint: gettext('Fingerprint'), - public_key: gettext('Public Key') - }; - - $scope.keyPairTableData = { - available: $scope.model.keypairs, - allocated: $scope.model.newInstanceSpec.key_pair, - displayedAvailable: [], - displayedAllocated: [] - }; - - $scope.keyPairTableDetails = - '/static/dashboard/launch-instance/access-and-security/keypair-details.html'; - - $scope.keyPairTableHelp = { - noneAllocText: gettext('Select a key pair from the available key pairs below.') - }; - - $scope.keyPairTableLimits = { - maxAllocation: 1 - }; - - } - ]); - - - /** - * @ngdoc controller - * @name hz.dashboard.launch-instance.LaunchInstanceAccessAndSecurityHelpCtrl - * @description - * Provide help for selection of security groups and key pairs. - */ - module.controller('LaunchInstanceAccessAndSecurityHelpCtrl', [ - '$scope', - function ($scope) { - var ctrl = this; - - ctrl.title = gettext('Access and Security Help'); - - var genKeyPairsMap = { genKeyPairCmd: 'ssh-keygen' }; - var genKeyPairsText = gettext('There are two ways to generate a key pair. From a Linux system, generate the key pair with the %(genKeyPairCmd)s command:'); - - var keyPathsMap = { privateKeyPath: 'cloud.key', publicKeyPath: 'cloud.key.pub' }; - var keyPathText = gettext('This command generates a pair of keys: a private key (%(privateKeyPath)s) and a public key (%(publicKeyPath)s).'); - - var windowsCmdMap = { authorizeKeysFile: '.ssh/authorized_keys' }; - var windowsCmd = gettext('From a Windows system, you can use PuTTYGen to create private/public keys. Use the PuTTY Key Generator to create and save the keys, then copy the public key in the red highlighted box to your %(authorizeKeysFile)s file.'); - - ctrl.paragraphs = [ - gettext('Security groups define a set of IP filter rules that determine how network traffic flows to and from an instance. Users can add additional rules to an existing security group to further define the access options for an instance. To create additional rules, go to the Compute | Access & Security view, then find the security group and click Manage Rules.'), - gettext('Security groups are project-specific and cannot be shared across projects.'), - gettext('If a security group is not associated with an instance before it is launched, then you will have very limited access to the instance after it is deployed. You will only be able to access the instance from a VNC console.'), - gettext('The key pair allows you to SSH into the instance.'), - interpolate(genKeyPairsText, genKeyPairsMap, true), - 'ssh-keygen -t rsa -f cloud.key', - interpolate(keyPathText, keyPathsMap, true), - interpolate(windowsCmd, windowsCmdMap, true) - ]; - } - ]); -})(); diff --git a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.scss b/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.scss deleted file mode 100644 index 8be0a75219..0000000000 --- a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.scss +++ /dev/null @@ -1,28 +0,0 @@ -[ng-controller="LaunchInstanceAccessAndSecurityCtrl"] { - - dl.key-pair-details { - - dt { - width: 15%; - } - dd { - width: 85%; - margin-left: 15%; - padding-right: 25px; - - pre { - background: none; - } - } - } - - .table-rsp.security-group-details { - background: none; - - td { - background: none !important; - padding: 15px !important; - } - - } -} diff --git a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/security-group-details.html b/openstack_dashboard/static/dashboard/launch-instance/access-and-security/security-group-details.html deleted file mode 100644 index 0cf4de38e9..0000000000 --- a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/security-group-details.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
{$ secGroupTableLabels.direction $}{$ secGroupTableLabels.ethertype $}{$ secGroupTableLabels.protocol $}{$ secGroupTableLabels.port_range_min $}{$ secGroupTableLabels.port_range_max $}{$ secGroupTableLabels.remote_ip_prefix $}
{$ x.direction || '-' $}{$ x.ethertype || '-' $}{$ x.protocol || '-' $}{$ x.port_range_min || '-' $}{$ x.port_range_max || '-' $}{$ x.remote_ip_prefix || '-' $}
\ No newline at end of file diff --git a/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair-details.html b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair-details.html new file mode 100644 index 0000000000..9b66b037ee --- /dev/null +++ b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair-details.html @@ -0,0 +1,6 @@ +
+
{$ ctrl.tableLabels.public_key $}
+
+
{$ row.public_key $}
+
+
diff --git a/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.help.html b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.help.html new file mode 100644 index 0000000000..21f5618170 --- /dev/null +++ b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.help.html @@ -0,0 +1,4 @@ +
+

{$ ::helpCtrl.title $}

+

+
diff --git a/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.html b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.html new file mode 100644 index 0000000000..e100c3cefe --- /dev/null +++ b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.html @@ -0,0 +1,116 @@ +
+

{$ ::ctrl.label.title $}

+ +
+
{$ ::ctrl.label.subtitle $}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$ ::ctrl.label.name $}{$ ::ctrl.tableLabels.fingerprint $}
+
+ {$ ::trCtrl.helpText.noneAllocText $} +
+
+ + {$ row.name $}{$ row.fingerprint $} + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
{$ ::ctrl.label.name $}{$ ::ctrl.tableLabels.fingerprint $}
+
+ {$ ::trCtrl.helpText.noneAvailText $} +
+
+ + {$ row.name$}{$ row.fingerprint $} + + + + + +
+
+
+ +
+ +
+
diff --git a/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.js b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.js new file mode 100644 index 0000000000..68533a65a6 --- /dev/null +++ b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.js @@ -0,0 +1,79 @@ +(function () { + 'use strict'; + + var module = angular.module('hz.dashboard.launch-instance'); + + /** + * @ngdoc controller + * @name hz.dashboard.launch-instance.LaunchInstanceKeypairCtrl + * @description + * Allows selection of key pairs. + */ + module.controller('LaunchInstanceKeypairCtrl', [ + 'launchInstanceModel', + function (launchInstanceModel) { + var ctrl = this; + + ctrl.label = { + title: gettext('Key Pair'), + subtitle: gettext('Select a key pair.'), + name: gettext('Name'), + description: gettext('Description') + }; + + ctrl.tableLabels = { + fingerprint: gettext('Fingerprint'), + public_key: gettext('Public Key') + }; + + ctrl.tableData = { + available: launchInstanceModel.keypairs, + allocated: launchInstanceModel.newInstanceSpec.key_pair, + displayedAvailable: [], + displayedAllocated: [] + }; + + ctrl.tableDetails = + '/static/dashboard/launch-instance/keypair/keypair-details.html'; + + ctrl.tableHelp = { + noneAllocText: gettext('Select a key pair from the available key pairs below.') + }; + + ctrl.tableLimits = { + maxAllocation: 1 + }; + + } + ]); + + + /** + * @ngdoc controller + * @name hz.dashboard.launch-instance.LaunchInstanceKeypairHelpCtrl + * @description + * Provide help for selection of security groups and key pairs. + */ + module.controller('LaunchInstanceKeypairHelpCtrl', [function () { + var ctrl = this; + + ctrl.title = gettext('Key Pair Help'); + + var genKeyPairsMap = { genKeyPairCmd: 'ssh-keygen' }; + var genKeyPairsText = gettext('There are two ways to generate a key pair. From a Linux system, generate the key pair with the %(genKeyPairCmd)s command:'); + + var keyPathsMap = { privateKeyPath: 'cloud.key', publicKeyPath: 'cloud.key.pub' }; + var keyPathText = gettext('This command generates a pair of keys: a private key (%(privateKeyPath)s) and a public key (%(publicKeyPath)s).'); + + var windowsCmdMap = { authorizeKeysFile: '.ssh/authorized_keys' }; + var windowsCmd = gettext('From a Windows system, you can use PuTTYGen to create private/public keys. Use the PuTTY Key Generator to create and save the keys, then copy the public key in the red highlighted box to your %(authorizeKeysFile)s file.'); + + ctrl.paragraphs = [ + gettext('The key pair allows you to SSH into the instance.'), + interpolate(genKeyPairsText, genKeyPairsMap, true), + 'ssh-keygen -t rsa -f cloud.key', + interpolate(keyPathText, keyPathsMap, true), + interpolate(windowsCmd, windowsCmdMap, true) + ]; } + ]); +})(); diff --git a/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.scss b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.scss new file mode 100644 index 0000000000..947fa2e15e --- /dev/null +++ b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.scss @@ -0,0 +1,18 @@ +[ng-controller="LaunchInstanceKeypairCtrl as ctrl"] { + + dl.key-pair-details { + + dt { + width: 15%; + } + dd { + width: 85%; + margin-left: 15%; + padding-right: 25px; + + pre { + background: none; + } + } + } +} diff --git a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.spec.js b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.spec.js similarity index 91% rename from openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.spec.js rename to openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.spec.js index 7472fd6eca..4ba4e734e5 100644 --- a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/access-and-security.spec.js +++ b/openstack_dashboard/static/dashboard/launch-instance/keypair/keypair.spec.js @@ -17,7 +17,7 @@ (function() { 'use strict'; - describe('Launch Instance Access and Security Step', function() { + describe('Launch Instance Keypair Step', function() { }); })(); diff --git a/openstack_dashboard/static/dashboard/launch-instance/launch-instance.js b/openstack_dashboard/static/dashboard/launch-instance/launch-instance.js index 6f39a0ae80..10b90b8edf 100644 --- a/openstack_dashboard/static/dashboard/launch-instance/launch-instance.js +++ b/openstack_dashboard/static/dashboard/launch-instance/launch-instance.js @@ -28,11 +28,17 @@ formName: 'launchInstanceNetworkForm' }, { - title: gettext('Access and Security'), - templateUrl: path + 'launch-instance/access-and-security/access-and-security.html', - helpUrl: path + 'launch-instance/access-and-security/access-and-security.help.html', + title: gettext('Security Groups'), + templateUrl: path + 'launch-instance/security-groups/security-groups.html', + helpUrl: path + 'launch-instance/security-groups/security-groups.help.html', formName: 'launchInstanceAccessAndSecurityForm' }, + { + title: gettext('Key Pair'), + templateUrl: path + 'launch-instance/keypair/keypair.html', + helpUrl: path + 'launch-instance/keypair/keypair.help.html', + formName: 'launchInstanceKeypairForm' + }, { title: gettext('Configuration'), templateUrl: path + 'launch-instance/configuration/configuration.html', diff --git a/openstack_dashboard/static/dashboard/launch-instance/launch-instance.scss b/openstack_dashboard/static/dashboard/launch-instance/launch-instance.scss index eb2d01e92f..c1179ad5aa 100644 --- a/openstack_dashboard/static/dashboard/launch-instance/launch-instance.scss +++ b/openstack_dashboard/static/dashboard/launch-instance/launch-instance.scss @@ -1,5 +1,6 @@ @import "source/source"; @import "flavor/flavor"; @import "network/network"; -@import "access-and-security/access-and-security"; +@import "keypair/keypair"; +@import "security-groups/security-groups"; @import "configuration/configuration"; diff --git a/openstack_dashboard/static/dashboard/launch-instance/access-and-security/keypair-details.html b/openstack_dashboard/static/dashboard/launch-instance/security-groups/keypair-details.html similarity index 100% rename from openstack_dashboard/static/dashboard/launch-instance/access-and-security/keypair-details.html rename to openstack_dashboard/static/dashboard/launch-instance/security-groups/keypair-details.html diff --git a/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-group-details.html b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-group-details.html new file mode 100644 index 0000000000..720ca6f49b --- /dev/null +++ b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-group-details.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + +
{$ ctrl.tableLabels.direction $}{$ ctrl.tableLabels.ethertype $}{$ ctrl.tableLabels.protocol $}{$ ctrl.tableLabels.port_range_min $}{$ ctrl.tableLabels.port_range_max $}{$ ctrl.tableLabels.remote_ip_prefix $}
{$ d.direction || '-' $}{$ d.ethertype || '-' $}{$ d.protocol || '-' $}{$ d.port_range_min || '-' $}{$ d.port_range_max || '-' $}{$ d.remote_ip_prefix || '-' $}
\ No newline at end of file diff --git a/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.help.html b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.help.html new file mode 100644 index 0000000000..0820f083e5 --- /dev/null +++ b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.help.html @@ -0,0 +1,4 @@ +
+

{$ ::helpCtrl.title $}

+

+
diff --git a/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.html b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.html new file mode 100644 index 0000000000..a3f36f5926 --- /dev/null +++ b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.html @@ -0,0 +1,114 @@ +
+

{$ ::ctrl.label.title $}

+ +
+
{$ ::ctrl.label.subtitle $}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$ ::ctrl.label.name $}{$ ::ctrl.label.description $}
+
+ {$ ::trCtrl.helpText.noneAllocText $} +
+
+ + {$ row.name $}{$ row.description $} + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
{$ ::ctrl.label.name $}{$ ::ctrl.label.description $}
+
+ {$ ::trCtrl.helpText.noneAvailText $} +
+
+ + {$ row.name$}{$ row.description $} + + + + + +
+
+
+ +
+ +
+
diff --git a/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.js b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.js new file mode 100644 index 0000000000..b74152918d --- /dev/null +++ b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.js @@ -0,0 +1,73 @@ +(function () { + 'use strict'; + + var module = angular.module('hz.dashboard.launch-instance'); + + /** + * @ngdoc controller + * @name hz.dashboard.launch-instance.LaunchInstanceSecurityGroupsCtrl + * @description + * Allows selection of security groups. + */ + module.controller('LaunchInstanceSecurityGroupsCtrl', [ + 'launchInstanceModel', + function (launchInstanceModel) { + var ctrl = this; + + ctrl.label = { + title: gettext('Security Groups'), + subtitle: gettext('Select the security groups.'), + name: gettext('Name'), + description: gettext('Description') + }; + + ctrl.tableLabels = { + direction: gettext('Direction'), + ethertype: gettext('Ether Type'), + protocol: gettext('Protocol'), + port_range_min: gettext('Min Port'), + port_range_max: gettext('Max Port'), + remote_ip_prefix: gettext('Remote') + }; + + ctrl.tableData = { + available: launchInstanceModel.securityGroups, + allocated: launchInstanceModel.newInstanceSpec.security_groups, + displayedAvailable: [], + displayedAllocated: [] + }; + + ctrl.tableDetails = + '/static/dashboard/launch-instance/security-groups/security-group-details.html'; + + ctrl.tableHelp = { + noneAllocText: gettext('Select one or more security groups from the available groups below.'), + availHelpText: gettext('Select one or more') + }; + + ctrl.tableLimits = { + maxAllocation: -1 + }; + } + ]); + + + /** + * @ngdoc controller + * @name hz.dashboard.launch-instance.LaunchInstanceSecurityGroupsHelpCtrl + * @description + * Provide help for selection of security groups and key pairs. + */ + module.controller('LaunchInstanceSecurityGroupsHelpCtrl', [function () { + var ctrl = this; + + ctrl.title = gettext('Security Groups Help'); + + ctrl.paragraphs = [ + gettext('Security groups define a set of IP filter rules that determine how network traffic flows to and from an instance. Users can add additional rules to an existing security group to further define the access options for an instance. To create additional rules, go to the Compute | Access & Security view, then find the security group and click Manage Rules.'), + gettext('Security groups are project-specific and cannot be shared across projects.'), + gettext('If a security group is not associated with an instance before it is launched, then you will have very limited access to the instance after it is deployed. You will only be able to access the instance from a VNC console.'), + ]; + } + ]); +})(); diff --git a/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.scss b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.scss new file mode 100644 index 0000000000..7de7648292 --- /dev/null +++ b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.scss @@ -0,0 +1,11 @@ +[ng-controller="LaunchInstanceSecurityGroupsCtrl as ctrl"] { + .table-rsp.security-group-details { + background: none; + + td { + background: none !important; + padding: 15px !important; + } + + } +} diff --git a/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.spec.js b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.spec.js new file mode 100644 index 0000000000..525dac23de --- /dev/null +++ b/openstack_dashboard/static/dashboard/launch-instance/security-groups/security-groups.spec.js @@ -0,0 +1,24 @@ +/* jshint globalstrict: true */ +/* + * (c) Copyright 2015 Hewlett-Packard Development Company, L.P. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + 'use strict'; + + describe('Launch Instance Security Groups Step', function() { + }); + +})(); + diff --git a/openstack_dashboard/test/jasmine/jasmine_tests.py b/openstack_dashboard/test/jasmine/jasmine_tests.py index a71a2ebfcd..4c360f44fd 100644 --- a/openstack_dashboard/test/jasmine/jasmine_tests.py +++ b/openstack_dashboard/test/jasmine/jasmine_tests.py @@ -24,7 +24,8 @@ class ServicesTests(test.JasmineTests): sources = [ LAUNCH_INST + "/launch-instance.js", LAUNCH_INST + "/launch-instance.model.js", - LAUNCH_INST + "/access-and-security/access-and-security.js", + LAUNCH_INST + 'security-groups/security-groups.js', + LAUNCH_INST + 'keypair/keypair.js', LAUNCH_INST + "/configuration/configuration.js", LAUNCH_INST + "/flavor/flavor.js", LAUNCH_INST + "/network/network.js", @@ -34,7 +35,8 @@ class ServicesTests(test.JasmineTests): specs = [ LAUNCH_INST + "/launch-instance.spec.js", LAUNCH_INST + "/launch-instance.model.spec.js", - LAUNCH_INST + "/access-and-security/access-and-security.spec.js", + LAUNCH_INST + 'security-groups/security-groups.spec.js', + LAUNCH_INST + 'keypair/keypair.spec.js', LAUNCH_INST + "/configuration/configuration.spec.js", LAUNCH_INST + "/flavor/flavor.spec.js", LAUNCH_INST + "/network/network.spec.js",