Fix eslint errors
This patch fixes lint errors for JavaScript except "FIXME" warnings. Change-Id: Iefa0868365eb08c3a5383885dc1a747808751318 Needed-By: Idb8b9064c1e465db8284e287bcf56949ab1de5e6
This commit is contained in:
parent
b56de185aa
commit
c2042f873a
@ -26,11 +26,11 @@
|
||||
'horizon.dashboard.container.containers',
|
||||
'ngRoute'
|
||||
])
|
||||
.config(config)
|
||||
.config(config);
|
||||
|
||||
config.$inject = ['$provide', '$windowProvider', '$routeProvider'];
|
||||
config.$inject = ['$provide', '$windowProvider'];
|
||||
|
||||
function config($provide, $windowProvider, $routeProvider) {
|
||||
function config($provide, $windowProvider) {
|
||||
var path = $windowProvider.$get().STATIC_URL + 'dashboard/container/';
|
||||
$provide.constant('horizon.dashboard.container.basePath', path);
|
||||
}
|
||||
|
@ -22,8 +22,12 @@
|
||||
* @description
|
||||
* Provides all of the actions for containers.
|
||||
*/
|
||||
angular.module('horizon.dashboard.container.containers.actions', ['horizon.framework', 'horizon.dashboard.container'])
|
||||
.run(registerContainerActions);
|
||||
angular.module('horizon.dashboard.container.containers.actions',
|
||||
[
|
||||
'horizon.framework',
|
||||
'horizon.dashboard.container'
|
||||
])
|
||||
.run(registerContainerActions);
|
||||
|
||||
registerContainerActions.$inject = [
|
||||
'horizon.framework.conf.resource-type-registry.service',
|
||||
@ -38,7 +42,7 @@
|
||||
'horizon.dashboard.container.containers.unpause.service',
|
||||
'horizon.dashboard.container.containers.execute.service',
|
||||
'horizon.dashboard.container.containers.kill.service',
|
||||
'horizon.dashboard.container.containers.resourceType',
|
||||
'horizon.dashboard.container.containers.resourceType'
|
||||
];
|
||||
|
||||
function registerContainerActions(
|
||||
@ -54,8 +58,8 @@
|
||||
unpauseContainerService,
|
||||
executeContainerService,
|
||||
killContainerService,
|
||||
resourceType)
|
||||
{
|
||||
resourceType
|
||||
) {
|
||||
var containersResourceType = registry.getResourceType(resourceType);
|
||||
|
||||
containersResourceType.globalActions
|
||||
|
@ -38,6 +38,7 @@
|
||||
* @ngdoc constant
|
||||
* @name horizon.dashboard.container.containers.events
|
||||
* @description A list of events used by Container
|
||||
* @returns {Object} Event constants
|
||||
*/
|
||||
function events() {
|
||||
return {
|
||||
|
@ -40,8 +40,6 @@
|
||||
command: null,
|
||||
cpu: null,
|
||||
memory: null,
|
||||
memory_size: null,
|
||||
memory_unit: "m",
|
||||
environment: null,
|
||||
workdir: null,
|
||||
labels: null
|
||||
@ -65,9 +63,8 @@
|
||||
// Initially clean fields that don't have any value.
|
||||
// Not only "null", blank too.
|
||||
for (var key in finalSpec) {
|
||||
if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null
|
||||
|| finalSpec[key] === ""
|
||||
|| key === "memory_size" || key === "memory_unit") {
|
||||
if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null ||
|
||||
finalSpec[key] === "") {
|
||||
delete finalSpec[key];
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@
|
||||
function containerWorkflow(basePath, dashboardWorkflow, gettext) {
|
||||
return dashboardWorkflow({
|
||||
title: gettext('Create Container'),
|
||||
|
||||
steps: [
|
||||
{
|
||||
title: gettext('Info'),
|
||||
@ -53,13 +52,11 @@
|
||||
templateUrl: basePath + 'containers/create/labels/labels.html',
|
||||
helpUrl: basePath + 'containers/create/labels/labels.help.html',
|
||||
formName: 'containerLabelsForm'
|
||||
},
|
||||
}
|
||||
],
|
||||
|
||||
btnText: {
|
||||
finish: gettext('Create')
|
||||
},
|
||||
|
||||
btnIcon: {
|
||||
finish: 'fa fa-check'
|
||||
}
|
||||
|
@ -39,7 +39,8 @@
|
||||
];
|
||||
|
||||
function createService(
|
||||
$location, policy, actionResult, gettext, $qExtensions, wizardModalService, toast, model, events, resourceType, createWorkflow
|
||||
$location, policy, actionResult, gettext, $qExtensions, wizardModalService,
|
||||
toast, model, events, resourceType, createWorkflow
|
||||
) {
|
||||
var scope;
|
||||
var message = {
|
||||
@ -78,7 +79,7 @@
|
||||
//return policy.ifAllowed({ rules: [['container', 'add_container']] });
|
||||
}
|
||||
|
||||
function submit(){
|
||||
function submit() {
|
||||
return model.createContainer().then(success);
|
||||
}
|
||||
|
||||
@ -87,9 +88,9 @@
|
||||
toast.add('success', interpolate(message.success, [response.data.id]));
|
||||
var result = actionResult.getActionResult()
|
||||
.created(resourceType, response.data.id);
|
||||
if(result.result.failed.length == 0 && result.result.created.length > 0){
|
||||
if (result.result.failed.length === 0 && result.result.created.length > 0) {
|
||||
$location.path('/project/container/containers');
|
||||
}else{
|
||||
} else {
|
||||
return result.result;
|
||||
}
|
||||
}
|
||||
|
@ -27,11 +27,8 @@
|
||||
.controller('createContainerSpecController', createContainerSpecController);
|
||||
|
||||
createContainerSpecController.$inject = [
|
||||
'$scope',
|
||||
'horizon.framework.util.i18n.gettext'
|
||||
];
|
||||
|
||||
function createContainerSpecController($scope, gettext) {
|
||||
var ctrl = this;
|
||||
function createContainerSpecController() {
|
||||
}
|
||||
})();
|
||||
|
@ -10,11 +10,11 @@
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="container-memory-size" translate>Memory Size</label>
|
||||
<input name="container-memory-size" type="number" min="1"
|
||||
class="form-control" ng-model="model.newContainerSpec.memory_size"
|
||||
<label class="control-label" for="container-memory" translate>Memory Size</label>
|
||||
<input name="container-memory" type="number" min="1"
|
||||
class="form-control" ng-model="model.newContainerSpec.memory"
|
||||
placeholder="{$ 'The container memory size in MiB.'|translate $}"
|
||||
id="container-memory-size">
|
||||
id="container-memory">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -15,6 +15,14 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.delete-force.service
|
||||
* @Description
|
||||
* Brings up the delete container forcely confirmation modal dialog.
|
||||
* On submit, delete selected resources.
|
||||
* On cancel, do nothing.
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.container.containers')
|
||||
.factory('horizon.dashboard.container.containers.delete-force.service', deleteForceService);
|
||||
@ -33,16 +41,9 @@
|
||||
'horizon.dashboard.container.containers.events'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.delete-force.service
|
||||
* @Description
|
||||
* Brings up the delete container forcely confirmation modal dialog.
|
||||
* On submit, delete selected resources.
|
||||
* On cancel, do nothing.
|
||||
*/
|
||||
function deleteForceService(
|
||||
$location, $q, zun, policy, actionResult, gettext, $qExtensions, deleteModal, toast, resourceType, events
|
||||
$location, $q, zun, policy, actionResult, gettext, $qExtensions, deleteModal,
|
||||
toast, resourceType, events
|
||||
) {
|
||||
var scope;
|
||||
var context = {
|
||||
@ -71,12 +72,12 @@
|
||||
// delete selected resource objects
|
||||
function perform(selected, newScope) {
|
||||
scope = newScope;
|
||||
var selected = angular.isArray(selected) ? selected : [selected];
|
||||
selected = angular.isArray(selected) ? selected : [selected];
|
||||
context.labels = labelize(selected.length);
|
||||
return $qExtensions.allSettled(selected.map(checkPermission)).then(afterCheck);
|
||||
}
|
||||
|
||||
function labelize(count){
|
||||
function labelize(count) {
|
||||
return {
|
||||
title: ngettext('Confirm Delete Container Forcely',
|
||||
'Confirm Delete Containers Forcely', count),
|
||||
@ -99,7 +100,7 @@
|
||||
}
|
||||
|
||||
// for batch delete
|
||||
function afterCheck(result){
|
||||
function afterCheck(result) {
|
||||
var outcome = $q.reject(); // Reject the promise by default
|
||||
if (result.fail.length > 0) {
|
||||
toast.add('error', getMessage(notAllowedMessage, result.fail));
|
||||
@ -121,9 +122,9 @@
|
||||
deleteModalResult.fail.forEach(function markFailed(item) {
|
||||
result.failed(resourceType, getEntity(item).id);
|
||||
});
|
||||
if(result.result.failed.length == 0 && result.result.deleted.length > 0){
|
||||
if (result.result.failed.length === 0 && result.result.deleted.length > 0) {
|
||||
$location.path('/project/container/containers');
|
||||
}else{
|
||||
} else {
|
||||
return result.result;
|
||||
}
|
||||
}
|
||||
@ -142,7 +143,7 @@
|
||||
}
|
||||
|
||||
// call delete REST API
|
||||
function deleteEntity(id){
|
||||
function deleteEntity(id) {
|
||||
return zun.deleteContainerForce(id, true);
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,14 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.delete.service
|
||||
* @Description
|
||||
* Brings up the delete containers confirmation modal dialog.
|
||||
* On submit, delete selected resources.
|
||||
* On cancel, do nothing.
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.container.containers')
|
||||
.factory('horizon.dashboard.container.containers.delete.service', deleteService);
|
||||
@ -33,16 +41,9 @@
|
||||
'horizon.dashboard.container.containers.events'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.delete.service
|
||||
* @Description
|
||||
* Brings up the delete containers confirmation modal dialog.
|
||||
* On submit, delete selected resources.
|
||||
* On cancel, do nothing.
|
||||
*/
|
||||
function deleteService(
|
||||
$location, $q, zun, policy, actionResult, gettext, $qExtensions, deleteModal, toast, resourceType, events
|
||||
$location, $q, zun, policy, actionResult, gettext, $qExtensions, deleteModal,
|
||||
toast, resourceType, events
|
||||
) {
|
||||
var scope;
|
||||
var context = {
|
||||
@ -71,12 +72,12 @@
|
||||
// delete selected resource objects
|
||||
function perform(selected, newScope) {
|
||||
scope = newScope;
|
||||
var selected = angular.isArray(selected) ? selected : [selected];
|
||||
selected = angular.isArray(selected) ? selected : [selected];
|
||||
context.labels = labelize(selected.length);
|
||||
return $qExtensions.allSettled(selected.map(checkPermission)).then(afterCheck);
|
||||
}
|
||||
|
||||
function labelize(count){
|
||||
function labelize(count) {
|
||||
return {
|
||||
title: ngettext('Confirm Delete Container',
|
||||
'Confirm Delete Containers', count),
|
||||
@ -99,7 +100,7 @@
|
||||
}
|
||||
|
||||
// for batch delete
|
||||
function afterCheck(result){
|
||||
function afterCheck(result) {
|
||||
var outcome = $q.reject(); // Reject the promise by default
|
||||
if (result.fail.length > 0) {
|
||||
toast.add('error', getMessage(notAllowedMessage, result.fail));
|
||||
@ -121,9 +122,9 @@
|
||||
deleteModalResult.fail.forEach(function markFailed(item) {
|
||||
result.failed(resourceType, getEntity(item).id);
|
||||
});
|
||||
if(result.result.failed.length == 0 && result.result.deleted.length > 0){
|
||||
if (result.result.failed.length === 0 && result.result.deleted.length > 0) {
|
||||
$location.path('/project/container/containers');
|
||||
}else{
|
||||
} else {
|
||||
return result.result;
|
||||
}
|
||||
}
|
||||
@ -142,7 +143,7 @@
|
||||
}
|
||||
|
||||
// call delete REST API
|
||||
function deleteEntity(id){
|
||||
function deleteEntity(id) {
|
||||
return zun.deleteContainer(id, true);
|
||||
}
|
||||
}
|
||||
|
@ -20,18 +20,11 @@
|
||||
|
||||
controller.$inject = [
|
||||
'$scope',
|
||||
'horizon.app.core.openstack-service-api.zun',
|
||||
'horizon.dashboard.container.containers.resourceType',
|
||||
'horizon.dashboard.container.containers.events',
|
||||
'horizon.framework.conf.resource-type-registry.service'
|
||||
'horizon.app.core.openstack-service-api.zun'
|
||||
];
|
||||
|
||||
function controller(
|
||||
$scope,
|
||||
zun,
|
||||
resourceType,
|
||||
events,
|
||||
registry
|
||||
$scope, zun
|
||||
) {
|
||||
var ctrl = this;
|
||||
ctrl.container = {};
|
||||
|
@ -15,6 +15,12 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngdoc factory
|
||||
* @name horizon.dashboard.container.containers.execute.service
|
||||
* @description
|
||||
* Service for the command execution in the container
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.container.containers')
|
||||
.factory(
|
||||
@ -29,12 +35,6 @@
|
||||
'horizon.framework.widgets.toast.service'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngdoc factory
|
||||
* @name horizon.dashboard.container.containers.execute.service
|
||||
* @description
|
||||
* Service for the command execution in the container
|
||||
*/
|
||||
function executeContainerService(
|
||||
zun, gettext, $qExtensions, modal, toast
|
||||
) {
|
||||
@ -110,7 +110,7 @@
|
||||
var name = context.model.name;
|
||||
delete context.model.id;
|
||||
delete context.model.name;
|
||||
return zun.executeContainer(id, context.model).then(function(response) {
|
||||
return zun.executeContainer(id, context.model).then(function() {
|
||||
toast.add('success', interpolate(message.success, [name]));
|
||||
});
|
||||
}
|
||||
|
@ -15,6 +15,12 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngdoc factory
|
||||
* @name horizon.dashboard.container.containers.kill.service
|
||||
* @description
|
||||
* Service to send kill signals to the container
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.container.containers')
|
||||
.factory(
|
||||
@ -30,12 +36,6 @@
|
||||
'horizon.framework.widgets.toast.service'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngdoc factory
|
||||
* @name horizon.dashboard.container.containers.kill.service
|
||||
* @description
|
||||
* Service to send kill signals to the container
|
||||
*/
|
||||
function killContainerService(
|
||||
zun, basePath, gettext, $qExtensions, modal, toast
|
||||
) {
|
||||
@ -95,8 +95,8 @@
|
||||
}
|
||||
|
||||
function allowed() {
|
||||
return $qExtensions.booleanAsPromise(true);
|
||||
}
|
||||
return $qExtensions.booleanAsPromise(true);
|
||||
}
|
||||
|
||||
function perform(selected) {
|
||||
model = {
|
||||
@ -120,7 +120,7 @@
|
||||
var name = context.model.name;
|
||||
delete context.model.id;
|
||||
delete context.model.name;
|
||||
return zun.killContainer(id, context.model).then(function(response) {
|
||||
return zun.killContainer(id, context.model).then(function() {
|
||||
toast.add('success', interpolate(message.success, [name]));
|
||||
});
|
||||
}
|
||||
|
@ -15,6 +15,12 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.pause.service
|
||||
* @Description
|
||||
* pause container.
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.container.containers')
|
||||
.factory('horizon.dashboard.container.containers.pause.service', pauseService);
|
||||
@ -22,17 +28,10 @@
|
||||
pauseService.$inject = [
|
||||
'horizon.framework.util.q.extensions',
|
||||
'horizon.framework.widgets.toast.service',
|
||||
'horizon.app.core.openstack-service-api.zun',
|
||||
'horizon.framework.widgets.modal-wait-spinner.service'
|
||||
'horizon.app.core.openstack-service-api.zun'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.pause.service
|
||||
* @Description
|
||||
* pause container.
|
||||
*/
|
||||
function pauseService($qExtensions, toast, zun, modalWaitSpinnerService) {
|
||||
function pauseService($qExtensions, toast, zun) {
|
||||
|
||||
var message = {
|
||||
success: gettext('Container %s was successfully paused.')
|
||||
@ -61,9 +60,9 @@
|
||||
// pause selected container
|
||||
return zun.pauseContainer(selected.id).then(success);
|
||||
|
||||
function success(response) {
|
||||
function success() {
|
||||
toast.add('success', interpolate(message.success, [selected.name]));
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
@ -15,6 +15,12 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.reboot.service
|
||||
* @Description
|
||||
* reboot container.
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.container.containers')
|
||||
.factory('horizon.dashboard.container.containers.reboot.service', rebootService);
|
||||
@ -25,12 +31,6 @@
|
||||
'horizon.app.core.openstack-service-api.zun'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.reboot.service
|
||||
* @Description
|
||||
* reboot container.
|
||||
*/
|
||||
function rebootService(
|
||||
$qExtensions, toast, zun
|
||||
) {
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
function perform(selected) {
|
||||
// reboot selected container
|
||||
return zun.rebootContainer(selected.id).success(function(response) {
|
||||
return zun.rebootContainer(selected.id).success(function() {
|
||||
toast.add('success', interpolate(message.success, [selected.name]));
|
||||
});
|
||||
}
|
||||
|
@ -15,6 +15,12 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.start.service
|
||||
* @Description
|
||||
* Start container.
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.container.containers')
|
||||
.factory('horizon.dashboard.container.containers.start.service', startService);
|
||||
@ -25,12 +31,6 @@
|
||||
'horizon.app.core.openstack-service-api.zun'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.start.service
|
||||
* @Description
|
||||
* Start container.
|
||||
*/
|
||||
function startService(
|
||||
$qExtensions, toast, zun
|
||||
) {
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
function perform(selected) {
|
||||
// start selected container
|
||||
return zun.startContainer(selected.id).success(function(response) {
|
||||
return zun.startContainer(selected.id).success(function() {
|
||||
toast.add('success', interpolate(message.success, [selected.name]));
|
||||
});
|
||||
}
|
||||
|
@ -15,6 +15,12 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.stop.service
|
||||
* @Description
|
||||
* Stop container.
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.container.containers')
|
||||
.factory('horizon.dashboard.container.containers.stop.service', stopService);
|
||||
@ -25,12 +31,6 @@
|
||||
'horizon.app.core.openstack-service-api.zun'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.stop.service
|
||||
* @Description
|
||||
* Stop container.
|
||||
*/
|
||||
function stopService(
|
||||
$qExtensions, toast, zun
|
||||
) {
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
function perform(selected) {
|
||||
// start selected container
|
||||
return zun.stopContainer(selected.id).success(function(response) {
|
||||
return zun.stopContainer(selected.id).success(function() {
|
||||
toast.add('success', interpolate(message.success, [selected.name]));
|
||||
});
|
||||
}
|
||||
|
@ -15,6 +15,12 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.unpause.service
|
||||
* @Description
|
||||
* unpause container.
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.container.containers')
|
||||
.factory('horizon.dashboard.container.containers.unpause.service', unpauseService);
|
||||
@ -25,12 +31,6 @@
|
||||
'horizon.app.core.openstack-service-api.zun'
|
||||
];
|
||||
|
||||
/**
|
||||
* @ngDoc factory
|
||||
* @name horizon.dashboard.container.containers.unpause.service
|
||||
* @Description
|
||||
* unpause container.
|
||||
*/
|
||||
function unpauseService(
|
||||
$qExtensions, toast, zun
|
||||
) {
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
function perform(selected) {
|
||||
// unpause selected container
|
||||
return zun.unpauseContainer(selected.id).success(function(response) {
|
||||
return zun.unpauseContainer(selected.id).success(function() {
|
||||
toast.add('success', interpolate(message.success, [selected.name]));
|
||||
});
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
function ZunAPI(apiService, toast, gettext) {
|
||||
var containersPath = '/api/zun/containers/';
|
||||
var imagesPath = '/api/zun/images/';
|
||||
var service = {
|
||||
createContainer: createContainer,
|
||||
getContainer: getContainer,
|
||||
|
Loading…
Reference in New Issue
Block a user