Merge "Move i18n to HTML for launch-instance source step"

This commit is contained in:
Jenkins 2015-08-27 09:23:52 +00:00 committed by Gerrit Code Review
commit d91ae7109a
6 changed files with 33 additions and 134 deletions

View File

@ -4,13 +4,13 @@
<div class="row">
<dl class="col-sm-2">
<dt>{$ ::ctrl.label.min_disk $}</dt>
<dt translate>Min Disk</dt>
<dd>
{$ (row.properties ? row.min_disk : row.volume_image_metadata.min_disk) || '--' $}
</dd>
</dl>
<dl class="col-sm-2">
<dt>{$ ::ctrl.label.min_ram $}</dt>
<dt translate>Min RAM</dt>
<dd>
{$ (row.properties ? row.min_ram : row.volume_image_metadata.min_ram) || '--' $}
</dd>
@ -40,4 +40,4 @@
</td>
<td></td>
<td></td>

View File

@ -1,55 +0,0 @@
/*
* 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';
/**
* @ngdoc controller
* @name LaunchInstanceSourceHelpController
* @description
* The `LaunchInstanceSourceHelpController` controller provides functions for
* configuring the help text used within the source step of the
* Launch Instance Wizard.
*/
angular
.module('horizon.dashboard.project.workflow.launch-instance')
.controller('LaunchInstanceSourceHelpController', LaunchInstanceSourceHelpController);
function LaunchInstanceSourceHelpController() {
var ctrl = this;
ctrl.title = gettext('Select Source Help');
ctrl.instanceDetailsTitle = gettext('Instance Details');
ctrl.instanceDetailsParagraphs = [
/*eslint-disable max-len */
gettext('An instance name is required and used to help you uniquely identify your instance in the dashboard.'),
gettext('If you select an availability zone and plan to use the boot from volume option, make sure that the availability zone you select for the instance is the same availability zone where your bootable volume resides.')
/*eslint-enable max-len */
];
ctrl.instanceSourceTitle = gettext('Instance Source');
ctrl.instanceSourceParagraphs = [
/*eslint-disable max-len */
gettext('If you want to create an instance that uses ephemeral storage, meaning the instance data is lost when the instance is deleted, then choose one of the following boot sources:'),
gettext('<li><b>Image</b>: This option uses an image to boot the instance.</li>'),
gettext('<li><b>Instance Snapshot</b>: This option uses an instance snapshot to boot the instance.</li>'),
gettext('If you want to create an instance that uses persistent storage, meaning the instance data is saved when the instance is deleted, then select one of the following boot options:'),
gettext('<li><b>Image (with Create New Volume checked)</b>: This options uses an image to boot the instance, and creates a new volume to persist instance data. You can specify volume size and whether to delete the volume on termination of the instance.</li>'),
gettext('<li><b>Volume</b>: This option uses a volume that already exists. It does not create a new volume. You can choose to delete the volume on termination of the instance. <em>Note: when selecting Volume, you can only launch one instance.</em></li>'),
gettext('<li><b>Volume Snapshot</b>: This option uses a volume snapshot to boot the instance, and creates a new volume to persist instance data. You can choose to delete the volume on termination of the instance.</li>')
/*eslint-enable max-len */
];
}
})();

View File

@ -55,27 +55,6 @@
basePath) {
var ctrl = this;
ctrl.label = {
title: gettext('Instance Details'),
/*eslint-disable max-len */
subtitle: gettext('Please provide the initial host name for the instance, the availability zone where it will be deployed, and the instance count. Increase the Count to create multiple instances with the same settings.'),
/*eslint-enable max-len */
instanceName: gettext('Instance Name'),
availabilityZone: gettext('Availability Zone'),
instance_count: gettext('Count'),
instanceSourceTitle: gettext('Instance Source'),
/*eslint-disable max-len */
instanceSourceSubTitle: gettext('Instance source is the template used to create an instance. You can use a snapshot of an existing instance, an image, or a volume (if enabled). You can also choose to use persistent storage by creating a new volume.'),
/*eslint-enable max-len */
bootSource: gettext('Select Boot Source'),
volumeSize: gettext('Size (GB)'),
volumeCreate: gettext('Create New Volume'),
volumeDeviceName: gettext('Device Name'),
deleteVolumeOnTerminate: gettext('Delete Volume on Terminate'),
id: gettext('ID'),
min_ram: gettext('Min Ram'),
min_disk: gettext('Min Disk')
};
// Error text for invalid fields
/*eslint-disable max-len */

View File

@ -67,11 +67,6 @@
expect(ctrl).toBeDefined();
});
it('has its own labels', function() {
expect(ctrl.label).toBeDefined();
expect(Object.keys(ctrl.label).length).toBeGreaterThan(0);
});
it('has defined error messages for invalid fields', function() {
expect(ctrl.bootSourceTypeError).toBeDefined();
expect(ctrl.instanceNameError).toBeDefined();
@ -332,36 +327,6 @@
});
});
describe('LaunchInstanceSourceHelpController', function() {
var ctrl;
beforeEach(inject(function($controller) {
ctrl = $controller('LaunchInstanceSourceHelpController', {});
}));
it('defines the title', function() {
expect(ctrl.title).toBeDefined();
});
it('defines the instance details title', function() {
expect(ctrl.title).toBeDefined();
});
it('has instance details paragraphs', function() {
expect(ctrl.instanceDetailsParagraphs).toBeDefined();
expect(ctrl.instanceDetailsParagraphs.length).toBeGreaterThan(0);
});
it('defines the instance source title', function() {
expect(ctrl.instanceSourceTitle).toBeDefined();
});
it('has instance source paragraphs', function() {
expect(ctrl.instanceSourceParagraphs).toBeDefined();
expect(ctrl.instanceSourceParagraphs.length).toBeGreaterThan(0);
});
});
describe('diskFormatFilter', function() {
var diskFormatFilter;

View File

@ -1,11 +1,21 @@
<div ng-controller="LaunchInstanceSourceHelpController as sourceHelpCtrl">
<h1>{$ ::sourceHelpCtrl.title $}</h1>
<h4>{$ ::sourceHelpCtrl.instanceDetailsTitle $}</h4>
<p ng-repeat="instanceDetailsParagraph in ::sourceHelpCtrl.instanceDetailsParagraphs"
ng-bind-html="::instanceDetailsParagraph"></p>
<h4>{$ ::sourceHelpCtrl.instanceSourceTitle $}</h4>
<p ng-repeat="instanceSourceParagraph in ::sourceHelpCtrl.instanceSourceParagraphs"
ng-bind-html="::instanceSourceParagraph"></p>
<h1 translate>Select Source Help</h1>
<h4 translate>Instance Details</h4>
<p translate>An instance name is required and used to help you uniquely identify your instance in the dashboard.</p>
<p translate>If you select an availability zone and plan to use the boot from volume option, make sure that the availability zone you select for the instance is the same availability zone where your bootable volume resides.</p>
<h4 translate>Instance Source</h4>
<p translate>If you want to create an instance that uses ephemeral storage, meaning th instance data is lost when the instance is deleted, then choose one of the following boot sources:</p>
<p translate><li><b>Image</b>: This option uses an image to boot the instance.</li></p>
<p translate><li><b>Instance Snapshot</b>: This option uses an instance snapshot to boot the instance.</li></p>
<p translate>If you want to create an instance that uses persistent storage, meaning the instance data is saved when the instance is deleted, then select one of the following boot options:</p>
<p translate><li><b>Image (with Create New Volume checked)</b>: This options uses an image to boot the instance, and creates a new volume to persist instance data. You can specify volume size and whether to delete the volume on termination of the instance.</li></p>
<p translate><li><b>Volume</b>: This option uses a volume that already exists. It does not create a new volume. You can choose to delete the volume on termination of the instance. <em>Note: when selecting Volume, you can only launch one instance.</em></li></p>
<p translate><li><b>Volume Snapshot</b>: This option uses a volume snapshot to boot the instance, and creates a new volume to persist instance data. You can choose to delete the volume on termination of the instance.</li></p>
</div>

View File

@ -1,9 +1,9 @@
<div ng-controller="LaunchInstanceSourceController as ctrl">
<h1>{$ ::ctrl.label.title $}</h1>
<h1 translate>Instance Details</h1>
<!--content-->
<div class="content">
<div class="subtitle">{$ ::ctrl.label.subtitle $}</div>
<div translate class="subtitle">Please provide the initial host name for the instance, the availability zone where it will be deployed, and the instance count. Increase the Count to create multiple instances with the same settings.</div>
<!--selected-source form-->
<div class="selected-source clearfix">
@ -13,7 +13,7 @@
<div class="col-sm-12 col-md-5">
<div class="form-field required instance-name"
ng-class="{ 'has-warning': launchInstanceSourceForm['instance-name'].$invalid && launchInstanceSourceForm['instance-name'].$dirty }">
<label class="on-top">{$ ::ctrl.label.instanceName $}</label>
<label translate class="on-top">Instance Name</label>
<span class="fa fa-exclamation-triangle invalid"
ng-show="launchInstanceSourceForm['instance-name'].$invalid && launchInstanceSourceForm.$dirty"
popover="{$ ctrl.instanceNameError $}"
@ -26,7 +26,7 @@
<div class="col-sm-12 col-md-5">
<div class="form-field availability-zone">
<label class="on-top">{$ ::ctrl.label.availabilityZone $}</label>
<label translate class="on-top">Availability Zone</label>
<select class="form-control input-sm"
ng-options="zone for zone in model.availabilityZones"
ng-model="model.newInstanceSpec.availability_zone">
@ -37,7 +37,7 @@
<div class="col-sm-6 col-md-2">
<div class="form-field instance_count"
ng-class="{ 'has-warning': launchInstanceSourceForm['instance-count'].$invalid }">
<label class="on-top">{$ ::ctrl.label.instance_count $}</label>
<label translate class="on-top">Count</label>
<span class="fa fa-exclamation-triangle invalid"
ng-show="launchInstanceSourceForm['instance-count'].$invalid"
popover="{$ launchInstanceSourceForm['instance-count'].$error.validateNumberMax ? ctrl.instanceCountMaxError : ctrl.instanceCountError $}"
@ -66,8 +66,8 @@
</div>
<!--end selected-source form-->
<h2 class="section-title">{$ ::ctrl.label.instanceSourceTitle $}</h2>
<div class="subtitle">{$ ::ctrl.label.instanceSourceSubTitle $}</div>
<h2 translate class="section-title">Instance Source</h2>
<div translate class="subtitle">Instance source is the template used to create an instance. You can use a snapshot of an existing instance, an image, or a volume (if enabled). You can also choose to use persistent storage by creating a new volume.</div>
<!--instance-source form-->
<div class="instance-source clearfix">
@ -76,7 +76,7 @@
<div class="col-xs-12 col-sm-3">
<div class="form-field image"
ng-class="{ 'has-warning': launchInstanceSourceForm['boot-source-type'].$invalid }">
<label class="on-top">{$ ::ctrl.label.bootSource $}</label>
<label translate class="on-top">Boot Source</label>
<span class="fa fa-exclamation-triangle invalid"
ng-show="launchInstanceSourceForm['boot-source-type'].$invalid"
popover="{$ ctrl.bootSourceTypeError $}"
@ -97,7 +97,7 @@
<div class="col-xs-12 col-sm-3">
<div class="form-group create-volume">
<label class="on-top">{$ ::ctrl.label.volumeCreate $}</label>
<label translate class="on-top">Create New Volume</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-toggle"
@ -113,7 +113,7 @@
ng-if="model.newInstanceSpec.vol_create === true">
<div class="col-xs-12 col-sm-3">
<div class="form-field">
<label>{$ ::ctrl.label.volumeDeviceName $}</label>
<label translate>Device Name</label>
<input class="form-control input-sm"
ng-model="model.newInstanceSpec.vol_device_name"
type="text">
@ -124,7 +124,7 @@
<div class="col-xs-12 col-sm-2 volume-size-wrapper" ng-if="model.newInstanceSpec.vol_create == true">
<div class="form-field volume-size"
ng-class="{ 'has-warning': launchInstanceSourceForm['volume-size'].$invalid }">
<label class="on-top">{$ ::ctrl.label.volumeSize $}</label>
<label translate class="on-top">Size (GB)</label>
<span class="fa fa-exclamation-triangle invalid"
ng-show="launchInstanceSourceForm['volume-size'].$invalid"
popover="{$ launchInstanceSourceForm['volume-size'].$error.validateNumberMin ? ctrl.minVolumeSizeError :
@ -141,7 +141,7 @@
<div class="col-xs-12 col-sm-4" ng-if="model.newInstanceSpec.vol_create == true">
<div class="form-group delete-volume">
<label class="on-top">{$ ::ctrl.label.deleteVolumeOnTerminate $}</label>
<label translate class="on-top">Delete Volume on Terminate</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-toggle"
@ -160,7 +160,7 @@
<div class="col-xs-12 col-sm-6">
<div class="form-group delete-volume">
<label class="on-top">{$ ::ctrl.label.deleteVolumeOnTerminate $}</label>
<label translate class="on-top">Delete Volume on Terminate</label>
<div class="form-field">
<div class="btn-group">
<label class="btn btn-toggle"