From 3de7f9a3e1f75886ceba66b24fe0ef1323599583 Mon Sep 17 00:00:00 2001 From: Paulo Ewerton Date: Fri, 21 Aug 2015 17:59:04 +0000 Subject: [PATCH] Moving translation to HTML for launch-instance key pair step This patch cleans out the old gettext and move them into the HTML files. This patch addresses the move to launch-instance key pair step. Change-Id: I1c17432f0c7a928388137de18e2b2f969b014bae Closes-Bug: 1487582 --- .../keypair/create-keypair.controller.js | 13 ---- .../keypair/create-keypair.html | 17 ++--- .../keypair/import-keypair-help.controller.js | 56 ----------------- .../keypair/import-keypair.controller.js | 20 ++---- .../keypair/import-keypair.html | 28 ++++----- .../keypair/keypair-details.html | 2 +- .../keypair/keypair-help.controller.js | 59 ------------------ .../keypair/keypair.controller.js | 20 ------ .../launch-instance/keypair/keypair.help.html | 23 +++++-- .../launch-instance/keypair/keypair.html | 24 +++---- .../launch-instance/keypair/keypair.spec.js | 62 ------------------- .../keypair/new-keypair.controller.js | 12 ---- .../launch-instance/keypair/new-keypair.html | 18 +++--- 13 files changed, 70 insertions(+), 284 deletions(-) delete mode 100644 openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair-help.controller.js delete mode 100644 openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair-help.controller.js diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/create-keypair.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/create-keypair.controller.js index 4254333547..22567032dd 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/create-keypair.controller.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/create-keypair.controller.js @@ -38,19 +38,6 @@ ctrl.submit = submit; ctrl.cancel = cancel; - - ctrl.labels = { - wizardTitle: gettext('Launch Instance'), - title: gettext('Create Key Pair'), - /*eslint-disable max-len */ - help: gettext('Key Pairs are how you login to your instance after it is launched. Choose a key pair name you will recognize.'), - /*eslint-enable max-len */ - keyPairName: gettext('Key Pair Name'), - cancel: gettext('Cancel'), - ok: gettext('Create Key Pair'), - required: gettext('Required') - }; - ctrl.model = { name: '' }; ////////// diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/create-keypair.html b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/create-keypair.html index bacdd6012f..3f3699f2ac 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/create-keypair.html +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/create-keypair.html @@ -1,16 +1,19 @@
-
+
Launch Instance
-

{$ ::ctrl.labels.title $}

+

Create Key Pair

-
{$ ::ctrl.labels.help $}
+
+ Key Pairs are how you login to your instance after it is launched. + Choose a key pair name you will recognize. +
- + + ng-required="true" placeholder="{$ 'Required' | translate $}">
@@ -20,14 +23,14 @@
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair-help.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair-help.controller.js deleted file mode 100644 index 23f8b92717..0000000000 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair-help.controller.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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'; - - angular - .module('horizon.dashboard.project.workflow.launch-instance') - .controller('LaunchInstanceImportKeyPairHelpController', - LaunchInstanceImportKeyPairHelpController); - - /** - * @ngdoc controller - * @name LaunchInstanceImportKeyPairHelpController - * @description - * The `LaunchInstanceImportKeyPairHelpController` controller provides help text - * for the import key pair function within the Launch Instance Wizard. - * - */ - function LaunchInstanceImportKeyPairHelpController() { - var ctrl = this; - - ctrl.title = gettext('Import Key Pair Help'); - - var genKeyPairsMap = { genKeyPairCmd: 'ssh-keygen' }; - var keyPathsMap = { privateKeyPath: 'cloud.key', publicKeyPath: 'cloud.key.pub' }; - var windowsCmdMap = { authorizeKeysFile: '.ssh/authorized_keys' }; - - /*eslint-disable max-len */ - 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 keyPathText = gettext('This command generates a pair of keys: a private key (%(privateKeyPath)s) and a public key (%(publicKeyPath)s).'); - 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.'); - /*eslint-enable max-len */ - - ctrl.paragraphs = [ - interpolate(genKeyPairsText, genKeyPairsMap, true), - 'ssh-keygen -t rsa -f cloud.key', - interpolate(keyPathText, keyPathsMap, true), - interpolate(windowsCmd, windowsCmdMap, true) - ]; - } - -})(); diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair.controller.js index 784f1ec227..8d2288232d 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair.controller.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair.controller.js @@ -24,7 +24,8 @@ LaunchInstanceImportKeyPairController.$inject = [ '$modalInstance', 'horizon.app.core.openstack-service-api.nova', - 'horizon.framework.widgets.toast.service' + 'horizon.framework.widgets.toast.service', + 'horizon.dashboard.project.workflow.launch-instance.basePath' ]; /** @@ -33,26 +34,13 @@ * @description * Provide a dialog for import of an existing ssh public key. */ - function LaunchInstanceImportKeyPairController($modalInstance, novaAPI, toastService) { + function LaunchInstanceImportKeyPairController($modalInstance, novaAPI, toastService, basePath) { var ctrl = this; ctrl.submit = submit; ctrl.cancel = cancel; - - ctrl.labels = { - wizardTitle: gettext('Launch Instance'), - title: gettext('Import Key Pair'), - /*eslint-disable max-len */ - help: gettext('Key Pairs are how you login to your instance after it is launched. Choose a key pair name you will recognize and paste your SSH public key into the space provided.'), - /*eslint-enable max-len */ - keyPairName: gettext('Key Pair Name'), - publicKey: gettext('Public Key'), - cancel: gettext('Cancel'), - ok: gettext('Import Key Pair'), - required: gettext('Required') - }; - ctrl.model = { name: '', public_key: '' }; + ctrl.path = basePath + 'keypair/'; ////////// diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair.html b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair.html index 535cd6388f..2c9a7b9228 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair.html +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/import-keypair.html @@ -1,23 +1,27 @@
-
+
Launch Instance
-

{$ ::ctrl.labels.title $}

+

Import Key Pair

-
{$ ::ctrl.labels.help $}
+
+ Key Pairs are how you login to your instance after it is launched. + Choose a key pair name you will recognize and paste your SSH public key into the + space provided. +
- + + ng-required="true" placeholder="{$ 'Required' | translate $}"/>
- +
@@ -28,23 +32,19 @@
-
-

{$ ::importHelpCtrl.title $}

-

-
+
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair-details.html b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair-details.html index 6248963349..9740a8e144 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair-details.html +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair-details.html @@ -1,5 +1,5 @@
-
{$ ctrl.tableLabels.public_key $}
+
Public Key
{$ row.public_key $}
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair-help.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair-help.controller.js deleted file mode 100644 index abe51e137e..0000000000 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair-help.controller.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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'; - - angular - .module('horizon.dashboard.project.workflow.launch-instance') - .controller('LaunchInstanceKeypairHelpController', LaunchInstanceKeypairHelpController); - - /** - * @ngdoc controller - * @name horizon.dashboard.project.workflow.launch-instance.LaunchInstanceKeypairHelpController - * @description - * Provide help for selection of a key pair. - */ - function LaunchInstanceKeypairHelpController() { - var ctrl = this; - - ctrl.title = gettext('Key Pair Help'); - - var genKeyPairsMap = {genKeyPairCmd: 'ssh-keygen'}; - var keyPathsMap = { - privateKeyPath: 'cloud.key', - publicKeyPath: 'cloud.key.pub' - }; - var windowsCmdMap = {authorizeKeysFile: '.ssh/authorized_keys'}; - - /*eslint-disable max-len */ - 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 keyPathText = gettext('This command generates a pair of keys: a private key (%(privateKeyPath)s) and a public key (%(publicKeyPath)s).'); - - 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.'); - /*eslint-enable max-len */ - - 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/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.controller.js index 19c1f85f4a..5a5e112c32 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.controller.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.controller.js @@ -40,22 +40,6 @@ ctrl.createKeyPair = createKeyPair; ctrl.importKeyPair = importKeyPair; - ctrl.label = { - title: gettext('Key Pair'), - /*eslint-disable max-len */ - subtitle: gettext('A key pair allows you to SSH into your newly created instance. You may select an existing key pair, import a key pair, or generate a new key pair.'), - /*eslint-enable max-len */ - name: gettext('Name'), - description: gettext('Description'), - createKeyPair: gettext('Create Key Pair'), - importKeyPair: gettext('Import Key Pair') - }; - - ctrl.tableLabels = { - fingerprint: gettext('Fingerprint'), - public_key: gettext('Public Key') - }; - ctrl.tableData = { available: launchInstanceModel.keypairs, allocated: launchInstanceModel.newInstanceSpec.key_pair, @@ -65,10 +49,6 @@ ctrl.tableDetails = basePath + 'keypair/keypair-details.html'; - ctrl.tableHelp = { - noneAllocText: gettext('Select a key pair from the available key pairs below.') - }; - ctrl.tableLimits = { maxAllocation: 1 }; diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.help.html b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.help.html index 21dfe6c079..21d1296207 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.help.html +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.help.html @@ -1,5 +1,18 @@ -
-

{$ ::helpCtrl.title $}

-

-
+

Key Pair Help

+

+ There are two ways to generate a key pair. From a Linux system, + generate the key pair with the ssh-keygen command: +

+

+ ssh-keygen -t rsa -f cloud.key +

+

+ This command generates a pair of keys: a private key (cloud.key) + and a public key (cloud.key.pub). +

+

+ 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 .ssh/authorized_keys + file. +

diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.html b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.html index 8015091078..78c4c024ab 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.html +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.html @@ -1,26 +1,28 @@
-

{$ ::ctrl.label.title $}

+

Key Pair

-
{$ ::ctrl.label.subtitle $}
+
+ A key pair allows you to SSH into your newly created instance. + You may select an existing key pair, import a key pair, or generate a new key pair. +
@@ -31,16 +33,16 @@ - {$ ::ctrl.label.name $} - {$ ::ctrl.tableLabels.fingerprint $} + Name + Fingerprint -
- {$ ::trCtrl.helpText.noneAllocText $} +
+ Select a key pair from the available key pairs below.
@@ -85,8 +87,8 @@ - {$ ::ctrl.label.name $} - {$ ::ctrl.tableLabels.fingerprint $} + Name + Fingerprint diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.spec.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.spec.js index 48954f394a..0d41f413c5 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.spec.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/keypair.spec.js @@ -39,11 +39,6 @@ { launchInstanceModel: model }); })); - it('contains its general labels', function() { - expect(ctrl.label).toBeDefined(); - expect(Object.keys(ctrl.label).length).toBeGreaterThan(0); - }); - it('contains its table labels', function() { expect(ctrl.tableData).toBeDefined(); expect(Object.keys(ctrl.tableData).length).toBeGreaterThan(0); @@ -62,12 +57,6 @@ expect(ctrl.tableDetails).toBeDefined(); }); - it('defines table help', function() { - expect(ctrl.tableHelp).toBeDefined(); - expect(Object.keys(ctrl.tableHelp).length).toBe(1); - expect(ctrl.tableHelp.noneAllocText).toBeDefined(); - }); - it('allows allocation of only one', function() { expect(ctrl.tableLimits).toBeDefined(); expect(Object.keys(ctrl.tableLimits).length).toBe(1); @@ -76,25 +65,6 @@ }); - describe('LaunchInstanceKeypairHelpController', function() { - var ctrl; - - beforeEach(module('horizon.dashboard.project.workflow.launch-instance')); - - beforeEach(inject(function($controller) { - ctrl = $controller('LaunchInstanceKeypairHelpController'); - })); - - it('defines the title', function() { - expect(ctrl.title).toBeDefined(); - }); - - it('has paragraphs', function() { - expect(ctrl.paragraphs).toBeDefined(); - expect(ctrl.paragraphs.length).toBeGreaterThan(0); - }); - }); - describe('LaunchInstanceCreateKeyPairController', function() { var ctrl; @@ -110,10 +80,6 @@ ctrl = $controller('LaunchInstanceCreateKeyPairController'); })); - it('contains its general labels', function() { - expect(ctrl.labels).toBeDefined(); - }); - it('defines a model with a empty name', function() { expect(ctrl.model).toBeDefined(); expect(ctrl.model.name).toBe(''); @@ -141,10 +107,6 @@ ctrl = $controller('LaunchInstanceNewKeyPairController', { keypair: {} }); })); - it('contains its general labels', function() { - expect(ctrl.labels).toBeDefined(); - }); - it('defines an empty keypair', function() { expect(ctrl.keypair).toBeDefined(); }); @@ -169,10 +131,6 @@ ctrl = $controller('LaunchInstanceImportKeyPairController'); })); - it('contains its general labels', function() { - expect(ctrl.labels).toBeDefined(); - }); - it('defines a model with a empty name and public key', function() { expect(ctrl.model).toBeDefined(); expect(ctrl.model.name).toBe(''); @@ -187,26 +145,6 @@ expect(ctrl.cancel).toBeDefined(); }); }); - - describe('LaunchInstanceImportKeyPairHelpController', function() { - var ctrl; - - beforeEach(module('horizon.dashboard.project.workflow.launch-instance')); - - beforeEach(inject(function($controller) { - ctrl = $controller('LaunchInstanceImportKeyPairHelpController'); - })); - - it('defines the title', function() { - expect(ctrl.title).toBeDefined(); - }); - - it('has paragraphs', function() { - expect(ctrl.paragraphs).toBeDefined(); - expect(ctrl.paragraphs.length).toBeGreaterThan(0); - }); - }); - }); })(); diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/new-keypair.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/new-keypair.controller.js index c3f04bab12..4c4832872e 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/new-keypair.controller.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/new-keypair.controller.js @@ -34,18 +34,6 @@ var ctrl = this; ctrl.ok = ok; - - ctrl.labels = { - wizardTitle: gettext('Launch Instance'), - title: gettext('Private Key'), - help: gettext('This is your new key pair. Copy this information and keep it secure.'), - keyPairName: gettext('Key Pair Name'), - fingerprint: gettext('Fingerprint'), - privateKey: gettext('Private Key'), - publicKey: gettext('Public Key'), - ok: gettext('OK') - }; - ctrl.keypair = keypair; ////////// diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/new-keypair.html b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/new-keypair.html index cd845f7e15..a5519578ac 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/new-keypair.html +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/keypair/new-keypair.html @@ -1,19 +1,21 @@
-
+
Launch Instance
-

{$ ::ctrl.labels.title $}

+

Private Key

-
{$ ::ctrl.labels.help $}
+
+ This is your new key pair. Copy this information and keep it secure. +
-
{$ ::ctrl.labels.keyPairName $}
+
Key Pair Name
{$ ctrl.keypair.name $}
-
{$ ::ctrl.labels.fingerprint $}
+
Fingerprint
{$ ctrl.keypair.fingerprint $}
-
{$ ::ctrl.labels.publicKey $}
+
Public Key
{$ ctrl.keypair.public_key $}
-
{$ ::ctrl.labels.privateKey $}
+
Private Key
{$ ctrl.keypair.private_key $}
@@ -24,7 +26,7 @@