diff --git a/zun_ui/static/dashboard/container/container.module.js b/zun_ui/static/dashboard/container/container.module.js index a94af1a..faf3a9b 100644 --- a/zun_ui/static/dashboard/container/container.module.js +++ b/zun_ui/static/dashboard/container/container.module.js @@ -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); } diff --git a/zun_ui/static/dashboard/container/containers/actions.module.js b/zun_ui/static/dashboard/container/containers/actions.module.js index 8cfc06d..48f83f2 100644 --- a/zun_ui/static/dashboard/container/containers/actions.module.js +++ b/zun_ui/static/dashboard/container/containers/actions.module.js @@ -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 diff --git a/zun_ui/static/dashboard/container/containers/containers.module.js b/zun_ui/static/dashboard/container/containers/containers.module.js index 538911a..d50bbdc 100644 --- a/zun_ui/static/dashboard/container/containers/containers.module.js +++ b/zun_ui/static/dashboard/container/containers/containers.module.js @@ -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 { diff --git a/zun_ui/static/dashboard/container/containers/create/container-model.js b/zun_ui/static/dashboard/container/containers/create/container-model.js index d98748e..95294a5 100644 --- a/zun_ui/static/dashboard/container/containers/create/container-model.js +++ b/zun_ui/static/dashboard/container/containers/create/container-model.js @@ -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]; } } diff --git a/zun_ui/static/dashboard/container/containers/create/create-workflow.service.js b/zun_ui/static/dashboard/container/containers/create/create-workflow.service.js index 97cb011..1909ff7 100644 --- a/zun_ui/static/dashboard/container/containers/create/create-workflow.service.js +++ b/zun_ui/static/dashboard/container/containers/create/create-workflow.service.js @@ -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' } diff --git a/zun_ui/static/dashboard/container/containers/create/create.service.js b/zun_ui/static/dashboard/container/containers/create/create.service.js index 10e4306..b783152 100644 --- a/zun_ui/static/dashboard/container/containers/create/create.service.js +++ b/zun_ui/static/dashboard/container/containers/create/create.service.js @@ -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; } } diff --git a/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js b/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js index c6d98eb..aa621a4 100644 --- a/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js +++ b/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js @@ -27,11 +27,8 @@ .controller('createContainerSpecController', createContainerSpecController); createContainerSpecController.$inject = [ - '$scope', - 'horizon.framework.util.i18n.gettext' ]; - function createContainerSpecController($scope, gettext) { - var ctrl = this; + function createContainerSpecController() { } })(); diff --git a/zun_ui/static/dashboard/container/containers/create/spec/spec.html b/zun_ui/static/dashboard/container/containers/create/spec/spec.html index b6dac57..a083de2 100644 --- a/zun_ui/static/dashboard/container/containers/create/spec/spec.html +++ b/zun_ui/static/dashboard/container/containers/create/spec/spec.html @@ -10,11 +10,11 @@
- - Memory Size + + id="container-memory">
diff --git a/zun_ui/static/dashboard/container/containers/delete/delete-force.service.js b/zun_ui/static/dashboard/container/containers/delete/delete-force.service.js index e48667c..f765db1 100644 --- a/zun_ui/static/dashboard/container/containers/delete/delete-force.service.js +++ b/zun_ui/static/dashboard/container/containers/delete/delete-force.service.js @@ -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); } } diff --git a/zun_ui/static/dashboard/container/containers/delete/delete.service.js b/zun_ui/static/dashboard/container/containers/delete/delete.service.js index 3782b8f..443f9bd 100644 --- a/zun_ui/static/dashboard/container/containers/delete/delete.service.js +++ b/zun_ui/static/dashboard/container/containers/delete/delete.service.js @@ -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); } } diff --git a/zun_ui/static/dashboard/container/containers/details/logs.controller.js b/zun_ui/static/dashboard/container/containers/details/logs.controller.js index 5840dc9..bfb827a 100644 --- a/zun_ui/static/dashboard/container/containers/details/logs.controller.js +++ b/zun_ui/static/dashboard/container/containers/details/logs.controller.js @@ -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 = {}; diff --git a/zun_ui/static/dashboard/container/containers/operations/execute.service.js b/zun_ui/static/dashboard/container/containers/operations/execute.service.js index 9901d29..723d3dc 100644 --- a/zun_ui/static/dashboard/container/containers/operations/execute.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/execute.service.js @@ -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])); }); } diff --git a/zun_ui/static/dashboard/container/containers/operations/kill.service.js b/zun_ui/static/dashboard/container/containers/operations/kill.service.js index 4d1b9ec..edaaa8d 100644 --- a/zun_ui/static/dashboard/container/containers/operations/kill.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/kill.service.js @@ -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])); }); } diff --git a/zun_ui/static/dashboard/container/containers/operations/pause.service.js b/zun_ui/static/dashboard/container/containers/operations/pause.service.js index 5d2e8a4..bb1d78c 100644 --- a/zun_ui/static/dashboard/container/containers/operations/pause.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/pause.service.js @@ -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])); - }; + } } } })(); diff --git a/zun_ui/static/dashboard/container/containers/operations/reboot.service.js b/zun_ui/static/dashboard/container/containers/operations/reboot.service.js index 8b7749f..8f87e31 100644 --- a/zun_ui/static/dashboard/container/containers/operations/reboot.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/reboot.service.js @@ -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])); }); } diff --git a/zun_ui/static/dashboard/container/containers/operations/start.service.js b/zun_ui/static/dashboard/container/containers/operations/start.service.js index d80d864..d24342f 100644 --- a/zun_ui/static/dashboard/container/containers/operations/start.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/start.service.js @@ -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])); }); } diff --git a/zun_ui/static/dashboard/container/containers/operations/stop.service.js b/zun_ui/static/dashboard/container/containers/operations/stop.service.js index d7faac1..43db7fd 100644 --- a/zun_ui/static/dashboard/container/containers/operations/stop.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/stop.service.js @@ -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])); }); } diff --git a/zun_ui/static/dashboard/container/containers/operations/unpause.service.js b/zun_ui/static/dashboard/container/containers/operations/unpause.service.js index b86d2e7..1f84f93 100644 --- a/zun_ui/static/dashboard/container/containers/operations/unpause.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/unpause.service.js @@ -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])); }); } diff --git a/zun_ui/static/dashboard/container/zun.service.js b/zun_ui/static/dashboard/container/zun.service.js index 2027729..a0ae046 100644 --- a/zun_ui/static/dashboard/container/zun.service.js +++ b/zun_ui/static/dashboard/container/zun.service.js @@ -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,