Merge "JSCS Cleanup - style cleanup for Launch Instance Network Step"

This commit is contained in:
Jenkins 2015-06-26 22:58:50 +00:00 committed by Gerrit Code Review
commit 7a56acec89
6 changed files with 94 additions and 86 deletions

View File

@ -35,7 +35,8 @@ ADD_JS_FILES = [
LAUNCH_INST + 'flavor/flavor.controller.js',
LAUNCH_INST + 'flavor/select-flavor-table.directive.js',
LAUNCH_INST + 'flavor/flavor-help.controller.js',
LAUNCH_INST + 'network/network.js',
LAUNCH_INST + 'network/network.controller.js',
LAUNCH_INST + 'network/network-help.controller.js',
LAUNCH_INST + 'security-groups/security-groups.js',
LAUNCH_INST + 'keypair/keypair.js',
LAUNCH_INST + 'configuration/configuration.controller.js',

View File

@ -16,86 +16,17 @@
(function () {
'use strict';
/**
* @ngdoc module
* @name hz.dashboard.launch-instance
* @description
* Module containing functionality for Launch Instance - Network Step.
*/
var module = angular.module('hz.dashboard.launch-instance');
/**
* @ngdoc controller
* @name LaunchInstanceNetworkCtrl
* @description
* Controller for the Launch Instance - Network Step.
*/
module.controller('LaunchInstanceNetworkCtrl', [
'$scope',
LaunchInstanceNetworkCtrl
]);
/**
* @ngdoc controller
* @name LaunchInstanceNetworkHelpCtrl
* @name LaunchInstanceNetworkHelpController
* @description
* Controller for the Launch Instance - Network Step Help.
*/
module.controller('LaunchInstanceNetworkHelpCtrl', [
LaunchInstanceNetworkHelpCtrl
]);
angular
.module('hz.dashboard.launch-instance')
.controller('LaunchInstanceNetworkHelpController', LaunchInstanceNetworkHelpController);
function LaunchInstanceNetworkCtrl($scope) {
var ctrl = this;
ctrl.label = {
title: gettext('Networks'),
subtitle: gettext('Networks provide the communication channels for instances in the cloud.'),
network: gettext('Network'),
subnet_associated: gettext('Subnets Associated'),
shared: gettext('Shared'),
admin_state: gettext('Admin State'),
status: gettext('Status'),
profile: gettext('Profile'),
none_option: gettext('(None)'),
id: gettext('ID'),
project_id: gettext('Project'),
external_network: gettext('External Network'),
provider_network: gettext('Provider Network'),
provider_network_type: gettext('Type'),
provider_segmentation_id: gettext('Segmentation ID'),
provider_physical_network: gettext('Physical Network')
};
ctrl.networkStatuses = {
'ACTIVE': gettext('Active'),
'DOWN': gettext('Down')
};
ctrl.networkAdminStates = {
'UP': gettext('Up'),
'DOWN': gettext('Down')
};
ctrl.tableDataMulti = {
available: $scope.model.networks,
allocated: $scope.model.newInstanceSpec.networks,
displayedAvailable: [],
displayedAllocated: []
};
ctrl.tableLimits = {
maxAllocation: -1
};
ctrl.tableHelpText = {
allocHelpText: gettext('Select networks from those listed below.'),
availHelpText: gettext('Select at least one network')
};
}
function LaunchInstanceNetworkHelpCtrl() {
function LaunchInstanceNetworkHelpController() {
var ctrl = this;
ctrl.title = gettext('Network Help');
@ -120,5 +51,4 @@
gettext('The status indicates whether the network has an active connection.')
];
}
})();

View File

@ -0,0 +1,79 @@
/*
* (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';
/**
* @ngdoc controller
* @name LaunchInstanceNetworkController
* @description
* Controller for the Launch Instance - Network Step.
*/
angular
.module('hz.dashboard.launch-instance')
.controller('LaunchInstanceNetworkController', LaunchInstanceNetworkController);
LaunchInstanceNetworkController.$inject = ['$scope'];
function LaunchInstanceNetworkController($scope) {
var ctrl = this;
ctrl.label = {
title: gettext('Networks'),
subtitle: gettext('Networks provide the communication channels for instances in the cloud.'),
network: gettext('Network'),
subnet_associated: gettext('Subnets Associated'),
shared: gettext('Shared'),
admin_state: gettext('Admin State'),
status: gettext('Status'),
profile: gettext('Profile'),
none_option: gettext('(None)'),
id: gettext('ID'),
project_id: gettext('Project'),
external_network: gettext('External Network'),
provider_network: gettext('Provider Network'),
provider_network_type: gettext('Type'),
provider_segmentation_id: gettext('Segmentation ID'),
provider_physical_network: gettext('Physical Network')
};
ctrl.networkStatuses = {
'ACTIVE': gettext('Active'),
'DOWN': gettext('Down')
};
ctrl.networkAdminStates = {
'UP': gettext('Up'),
'DOWN': gettext('Down')
};
ctrl.tableDataMulti = {
available: $scope.model.networks,
allocated: $scope.model.newInstanceSpec.networks,
displayedAvailable: [],
displayedAllocated: []
};
ctrl.tableLimits = {
maxAllocation: -1
};
ctrl.tableHelpText = {
allocHelpText: gettext('Select networks from those listed below.'),
availHelpText: gettext('Select at least one network')
};
}
})();

View File

@ -1,4 +1,4 @@
<div ng-controller="LaunchInstanceNetworkHelpCtrl as networkHelpCtrl">
<div ng-controller="LaunchInstanceNetworkHelpController as networkHelpCtrl">
<h1>{$ ::networkHelpCtrl.title $}</h1>
<p ng-repeat="paragraph in ::networkHelpCtrl.paragraphs"
ng-bind-html="::paragraph"></p>

View File

@ -1,4 +1,4 @@
<div ng-controller="LaunchInstanceNetworkCtrl as ctrl">
<div ng-controller="LaunchInstanceNetworkController as ctrl">
<h1>{$ ::ctrl.label.title $}</h1>
<div class="content">
<div class="subtitle">{$ ::ctrl.label.subtitle $}</div>

View File

@ -18,16 +18,16 @@
describe('Launch Instance Network Step', function() {
describe('LaunchInstanceNetworkCtrl', function() {
var scope, ctrl;
beforeEach(module('hz.dashboard.launch-instance'));
beforeEach(module('hz.dashboard.launch-instance'));
describe('LaunchInstanceNetworkController', function() {
var scope, ctrl;
beforeEach(inject(function($controller) {
scope = {model: {
newInstanceSpec: {networks: ['net-a']},
networks: ['net-a', 'net-b']}};
ctrl = $controller('LaunchInstanceNetworkCtrl', {$scope:scope});
ctrl = $controller('LaunchInstanceNetworkController', {$scope:scope});
}));
it('has correct network statuses', function() {
@ -69,13 +69,11 @@
});
});
describe('LaunchInstanceNetworkHelpCtrl', function() {
describe('LaunchInstanceNetworkHelpController', function() {
var ctrl;
beforeEach(module('hz.dashboard.launch-instance'));
beforeEach(inject(function($controller) {
ctrl = $controller('LaunchInstanceNetworkHelpCtrl', {});
ctrl = $controller('LaunchInstanceNetworkHelpController', {});
}));
it('defines the title', function() {