Merge "Moving translation to HTML for launch-instance configuration step"

This commit is contained in:
Jenkins 2015-09-11 22:19:47 +00:00 committed by Gerrit Code Review
commit 4daf99cb4c
6 changed files with 20 additions and 103 deletions

View File

@ -1,47 +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';
angular
.module('horizon.dashboard.project.workflow.launch-instance')
.controller('LaunchInstanceConfigHelpController', LaunchInstanceConfigHelpController);
/**
* @ngdoc controller
* @name LaunchInstanceConfigHelpController
* @description
* The `LaunchInstanceConfigHelpController` controller provides functions for
* configuring the help text used within the configuration step of the
* Launch Instance Wizard.
*
*/
function LaunchInstanceConfigHelpController() {
var ctrl = this;
ctrl.title = gettext('Configuration Help');
/*eslint-disable max-len */
var customScriptMap = { cloutInit: 'cloud-init' };
var customScriptText = gettext('Custom scripts are attached to instances to perform specific actions when the instance is launched. For example, if you are unable to install <samp>%(cloutInit)s</samp> inside a guest operating system, you can use a custom script to get a public key and add it to the user account.');
ctrl.paragraphs = [
interpolate(customScriptText, customScriptMap, true),
gettext('Type your script directly into the Customization Script field. If your browser supports the HTML5 File API, you may choose to load your script from a file. The size of your script should not exceed 16 Kb.'),
gettext('An advanced option available when launching an instance is disk partitioning. There are two disk partition options. Selecting <b>Automatic</b> resizes the disk and sets it to a single partition. Selecting <b>Manual</b> allows you to create multiple partitions on the disk.'),
gettext('Check the <b>Configuration Drive</b> box if you want to write metadata to a special configuration drive. When the instance boots, it attaches to the <b>Configuration Drive</b> and accesses the metadata.')
];
/*eslint-enable max-len */
}
})();

View File

@ -50,21 +50,6 @@
ctrl.MAX_SCRIPT_SIZE = MAX_SCRIPT_SIZE;
ctrl.label = {
title: gettext('Configuration'),
subtitle: '',
customizationScript: gettext('Customization Script'),
customizationScriptMax: gettext('(Max: 16Kb)'),
loadScriptFromFile: gettext('Load script from a file'),
configurationDrive: gettext('Configuration Drive'),
diskPartition: gettext('Disk Partition'),
scriptSize: gettext('Script size'),
scriptModified: gettext('Modified'),
scriptSizeWarningMsg: gettext('Script size > 16Kb'),
bytes: gettext('bytes'),
scriptSizeHoverWarningMsg: gettext('The maximum script size is 16Kb.')
};
ctrl.diskConfigOptions = [
{ value: 'AUTO', text: gettext('Automatic') },
{ value: 'MANUAL', text: gettext('Manual') }

View File

@ -35,11 +35,6 @@
});
}));
it('contains its own labels', function() {
expect(ctrl.label).toBeDefined();
expect(Object.keys(ctrl.label).length).toBeGreaterThan(0);
});
it('has correct disk configuration options', function() {
expect(ctrl.diskConfigOptions).toBeDefined();
expect(ctrl.diskConfigOptions.length).toBe(2);
@ -62,25 +57,6 @@
});
describe('LaunchInstanceConfigHelpController', function() {
var ctrl;
beforeEach(module('horizon.dashboard.project.workflow.launch-instance'));
beforeEach(inject(function($controller) {
ctrl = $controller('LaunchInstanceConfigHelpController');
}));
it('defines the title', function() {
expect(ctrl.title).toBeDefined();
});
it('has help paragraphs', function() {
expect(ctrl.paragraphs).toBeDefined();
expect(ctrl.paragraphs.length).toBeGreaterThan(0);
});
});
});
})();

View File

@ -1,5 +1,7 @@
<div ng-controller="LaunchInstanceConfigHelpController as configHelpCtrl">
<h1>{$ ::configHelpCtrl.title $}</h1>
<p ng-repeat="paragraph in ::configHelpCtrl.paragraphs"
ng-bind-html="::paragraph"></p>
</div>
<div>
<h1 translate>Configuration Help</h1>
<p translate>Custom scripts are attached to instances to perform specific actions when the instance is launched. For example, if you are unable to install <samp>cloud-init</samp> inside a guest operating system, you can use a custom script to get a public key and add it to the user account.</p>
<p translate>Type your script directly into the Customization Script field. If your browser supports the HTML5 File API, you may choose to load your script from a file. The size of your script should not exceed 16 Kb.</p>
<p translate>An advanced option available when launching an instance is disk partitioning. There are two disk partition options. Selecting <b>Automatic</b> resizes the disk and sets it to a single partition. Selecting <b>Manual</b> allows you to create multiple partitions on the disk.</p>
<p translate>Check the <b>Configuration Drive</b> box if you want to write metadata to a special configuration drive. When the instance boots, it attaches to the <b>Configuration Drive</b> and accesses the metadata.</p>
</div>

View File

@ -1,8 +1,8 @@
<div ng-controller="LaunchInstanceConfigurationController as config">
<h1>{$ ::config.label.title $}</h1>
<h1 translate>Configuration</h1>
<div class="content">
<div class="subtitle">{$ ::config.label.subtitle $}</div>
<div class="subtitle"></div>
<load-edit config="config"
user-input="model.newInstanceSpec"
@ -11,8 +11,8 @@
<div hz-if-nova-extensions='["DiskConfig"]'>
<div class="form-group disk-partition">
<label for="launch-instance-disk-partition">
{$ ::config.label.diskPartition $}
<label for="launch-instance-disk-partition" translate>
Disk Partition
</label>
<select class="form-control"
id="launch-instance-disk-partition"
@ -27,7 +27,7 @@
<label>
<input type="checkbox"
ng-model="model.newInstanceSpec.config_drive">
{$ ::config.label.configurationDrive $}
<span translate>Configuration Drive</span>
</label>
</div>
</div>

View File

@ -1,9 +1,10 @@
<div class="form-group customization-script">
<label>
{$ ::config.label.customizationScript $}
<span translate>Customization Script</span>
<span class="script-modified"
ng-show="scriptModified">
({$ ::config.label.scriptModified $})</span>
ng-show="scriptModified"
translate>
(Modified)</span>
</label>
<span class="size-indicator pull-right clearfix"
ng-class="{warning: scriptLength >= config.MAX_SCRIPT_SIZE}">
@ -13,10 +14,10 @@
popover-append-to-body="true"
popover-trigger="hover">
</span>
{$ ::config.label.scriptSize $}:
<span translate>Script size</span>
{$ (scriptLength || 0) | number $}
{$ ::config.label.bytes $}
<span>{$ ::config.label.customizationScriptMax $}</span>
<span translate>bytes</span>
<span translate>(Max: 16Kb)</span>
</span>
<textarea class="form-control"
name="customization-script"
@ -28,7 +29,7 @@
<div class="form-group script-file" ng-show="config.fileApiSupported">
<span class="file-input btn btn-primary btn-file">
<span class="fa fa-upload"></span>
{$ ::config.label.loadScriptFromFile $}
<span translate>Load script from a file</span>
<input type="file">
</span>
</div>