Moving translation to HTML for launch-instance security-group step

We should clean out old gettext and move them into HTML files.
This bug addresses the move to launch-instance security-group step.

Change-Id: Iea7512684f7fb029b88ea907431b342090bbc928
Partial-Bug: #1487582
This commit is contained in:
jingliuqing 2015-08-25 15:57:42 +08:00
parent b2a323b14f
commit 7d33374cf1
6 changed files with 18 additions and 97 deletions

View File

@ -1,12 +1,12 @@
<table st-table="row.security_group_rules" class="table-rsp modern security-group-details">
<thead>
<tr>
<th st-sort="direction" st-sort-default>{$ ctrl.tableLabels.direction $}</th>
<th st-sort="ethertype">{$ ctrl.tableLabels.ethertype $}</th>
<th st-sort="protocol">{$ ctrl.tableLabels.protocol $}</th>
<th st-sort="port_range_min">{$ ctrl.tableLabels.port_range_min $}</th>
<th st-sort="port_range_max">{$ ctrl.tableLabels.port_range_max $}</th>
<th st-sort="remote_ip_prefix">{$ ctrl.tableLabels.remote_ip_prefix $}</th>
<th st-sort="direction" st-sort-default translate>Direction</th>
<th st-sort="ethertype" translate>Ether Type</th>
<th st-sort="protocol" translate>Protocol</th>
<th st-sort="port_range_min" translate>Min Port</th>
<th st-sort="port_range_max" translate>Max Port</th>
<th st-sort="remote_ip_prefix" translate>Remote</th>
</tr>
</thead>
<tr ng-repeat="d in row.security_group_rules">
@ -17,4 +17,4 @@
<td>{$ d.port_range_max || '-' $}</td>
<td>{$ d.remote_ip_prefix || '-' $}</td>
</tr>
</table>
</table>

View File

@ -1,41 +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('LaunchInstanceSecurityGroupsHelpController',
LaunchInstanceSecurityGroupsHelpController);
/**
* @ngdoc controller
* @name horizon.dashboard.project.workflow.launch-instance.LaunchInstanceSecurityGroupsHelpController
* @description
* Provide help for selection of security groups and key pairs.
*/
function LaunchInstanceSecurityGroupsHelpController() {
var ctrl = this;
ctrl.title = gettext('Security Groups Help');
ctrl.paragraphs = [
/*eslint-disable max-len */
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 <b>Compute | Access & Security</b> view, then find the security group and click <b>Manage Rules</b>.'),
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.')
/*eslint-enable max-len */
];
}
})();

View File

@ -32,22 +32,6 @@
function LaunchInstanceSecurityGroupsController(launchInstanceModel, basePath) {
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,

View File

@ -1,5 +1,6 @@
<div ng-controller="LaunchInstanceSecurityGroupsHelpController as helpCtrl">
<h1>{$ ::helpCtrl.title $}</h1>
<p ng-repeat="paragraph in ::helpCtrl.paragraphs"
ng-bind-html="::paragraph"></p>
<div>
<h1 translate>Security Groups Help</h1>
<p translate>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 <b>Compute | Access & Security</b> view, then find the security group and click <b>Manage Rules</b>.</p>
<p translate>Security groups are project-specific and cannot be shared across projects.</p>
<p translate>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.</p>
</div>

View File

@ -1,8 +1,8 @@
<div ng-controller="LaunchInstanceSecurityGroupsController as ctrl">
<h1>{$ ::ctrl.label.title $}</h1>
<h1 translate>Security Groups</h1>
<div class="content">
<div class="subtitle">{$ ::ctrl.label.subtitle $}</div>
<div class="subtitle" translate>Select the security groups.</div>
<transfer-table tr-model="ctrl.tableData"
help-text="ctrl.tableHelp"
@ -16,8 +16,8 @@
<thead>
<tr>
<th class="expander"></th>
<th st-sort="name" st-sort-default class="rsp-p1">{$ ::ctrl.label.name $}</th>
<th st-sort="description" class="rsp-p2">{$ ::ctrl.label.description $}</th>
<th st-sort="name" st-sort-default class="rsp-p1" translate>Name</th>
<th st-sort="description" class="rsp-p2" translate>Description</th>
<th></th>
</tr>
</thead>
@ -69,8 +69,8 @@
</tr>
<tr>
<th class="expander"></th>
<th st-sort="name" st-sort-default class="rsp-p1">{$ ::ctrl.label.name $}</th>
<th st-sort="description" class="rsp-p1">{$ ::ctrl.label.description $}</th>
<th st-sort="name" st-sort-default class="rsp-p1" translate>Name</th>
<th st-sort="description" class="rsp-p1" translate>Description</th>
<th></th>
</tr>
</thead>

View File

@ -38,11 +38,6 @@
});
}));
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);
@ -75,23 +70,5 @@
});
});
describe('LaunchInstanceSecurityGroupsHelpController', function() {
var ctrl;
beforeEach(module('horizon.dashboard.project'));
beforeEach(inject(function($controller) {
ctrl = $controller('LaunchInstanceSecurityGroupsHelpController');
}));
it('defines the title', function() {
expect(ctrl.title).toBeDefined();
});
it('has paragraphs', function() {
expect(ctrl.paragraphs).toBeDefined();
expect(ctrl.paragraphs.length).toBeGreaterThan(0);
});
});
});
})();