From cf123cebc67d718c86e535a60bbf69ca1a2e3995 Mon Sep 17 00:00:00 2001 From: Rajat Vig Date: Thu, 7 Jan 2016 11:36:20 -0800 Subject: [PATCH] Obey Naming Conventions for Angular Images Panel Services/Controllers This is based off the discussion in the mailing list about how to name Angular Services and controllers. To test set DISABLED = False in _1051_project_ng_images_panel.py Change-Id: Ib16d7e23f2e415a0521d24afb0cf548be847543a Partially-Implements: blueprint angularize-images-table --- ...ion.service.js => batch-delete.service.js} | 6 ++-- ...e.spec.js => batch-delete.service.spec.js} | 6 ++-- .../images/actions/create-volume.service.js | 10 +++---- .../actions/create-volume.service.spec.js | 6 ++-- .../images/actions/delete-image.service.js | 4 +-- .../actions/delete-image.service.spec.js | 4 +-- ...ction.service.js => row-delete.service.js} | 6 ++-- ...ice.spec.js => row-delete.service.spec.js} | 6 ++-- .../static/app/core/images/images.scss | 2 +- .../images/table/batch-actions.service.js | 8 ++--- .../table/batch-actions.service.spec.js | 6 ++-- .../app/core/images/table/images-table.html | 2 +- ...ble.controller.js => images.controller.js} | 30 +++++++++---------- ...ller.spec.js => images.controller.spec.js} | 7 ++--- .../core/images/table/row-actions.service.js | 10 +++---- .../images/table/row-actions.service.spec.js | 8 ++--- .../create-volume.service.js} | 8 ++--- .../create-volume.service.spec.js} | 4 +-- 18 files changed, 66 insertions(+), 67 deletions(-) rename openstack_dashboard/static/app/core/images/actions/{batch-delete.action.service.js => batch-delete.service.js} (91%) rename openstack_dashboard/static/app/core/images/actions/{batch-delete.action.service.spec.js => batch-delete.service.spec.js} (92%) rename openstack_dashboard/static/app/core/images/actions/{delete.action.service.js => row-delete.service.js} (90%) rename openstack_dashboard/static/app/core/images/actions/{delete.action.service.spec.js => row-delete.service.spec.js} (86%) rename openstack_dashboard/static/app/core/images/table/{images-table.controller.js => images.controller.js} (87%) rename openstack_dashboard/static/app/core/images/table/{images-table.controller.spec.js => images.controller.spec.js} (94%) rename openstack_dashboard/static/app/core/images/{actions/create-volume.workflow.service.js => workflows/create-volume.service.js} (83%) rename openstack_dashboard/static/app/core/images/{actions/create-volume.workflow.service.spec.js => workflows/create-volume.service.spec.js} (89%) diff --git a/openstack_dashboard/static/app/core/images/actions/batch-delete.action.service.js b/openstack_dashboard/static/app/core/images/actions/batch-delete.service.js similarity index 91% rename from openstack_dashboard/static/app/core/images/actions/batch-delete.action.service.js rename to openstack_dashboard/static/app/core/images/actions/batch-delete.service.js index dc1a8d1099..1a37c308a2 100644 --- a/openstack_dashboard/static/app/core/images/actions/batch-delete.action.service.js +++ b/openstack_dashboard/static/app/core/images/actions/batch-delete.service.js @@ -17,17 +17,17 @@ angular .module('horizon.app.core.images') - .factory('horizon.app.core.images.actions.batchDeleteService', batchDeleteService); + .factory('horizon.app.core.images.actions.batch-delete.service', batchDeleteService); batchDeleteService.$inject = [ - 'horizon.app.core.images.actions.deleteImageService', + 'horizon.app.core.images.actions.delete-image.service', 'horizon.app.core.openstack-service-api.policy', 'horizon.framework.util.i18n.gettext' ]; /** * @ngDoc factory - * @name horizon.app.core.images.actions.batchDeleteService + * @name horizon.app.core.images.actions.batch-delete.service * * @Description * Brings up the delete images confirmation modal dialog. diff --git a/openstack_dashboard/static/app/core/images/actions/batch-delete.action.service.spec.js b/openstack_dashboard/static/app/core/images/actions/batch-delete.service.spec.js similarity index 92% rename from openstack_dashboard/static/app/core/images/actions/batch-delete.action.service.spec.js rename to openstack_dashboard/static/app/core/images/actions/batch-delete.service.spec.js index 3e3abc42e4..d09010652e 100644 --- a/openstack_dashboard/static/app/core/images/actions/batch-delete.action.service.spec.js +++ b/openstack_dashboard/static/app/core/images/actions/batch-delete.service.spec.js @@ -15,7 +15,7 @@ (function() { 'use strict'; - describe('horizon.app.core.images.actions.batchDeleteService', function() { + describe('horizon.app.core.images.actions.batch-delete.service', function() { var deleteImageService = { initScope: function() {}, @@ -42,11 +42,11 @@ $provide.value('horizon.app.core.openstack-service-api.policy', policyAPI); })); beforeEach(module('horizon.app.core.images', function($provide) { - $provide.value('horizon.app.core.images.actions.deleteImageService', deleteImageService); + $provide.value('horizon.app.core.images.actions.delete-image.service', deleteImageService); })); beforeEach(inject(function($injector, _$rootScope_) { $scope = _$rootScope_.$new(); - service = $injector.get('horizon.app.core.images.actions.batchDeleteService'); + service = $injector.get('horizon.app.core.images.actions.batch-delete.service'); })); it('should init the deleteImageService', function() { diff --git a/openstack_dashboard/static/app/core/images/actions/create-volume.service.js b/openstack_dashboard/static/app/core/images/actions/create-volume.service.js index 988af6c10f..2073b1397d 100644 --- a/openstack_dashboard/static/app/core/images/actions/create-volume.service.js +++ b/openstack_dashboard/static/app/core/images/actions/create-volume.service.js @@ -18,14 +18,14 @@ angular .module('horizon.app.core.images') - .factory('horizon.app.core.images.actions.createVolumeService', createVolumeService); + .factory('horizon.app.core.images.actions.create-volume.service', createVolumeService); createVolumeService.$inject = [ '$q', 'horizon.app.core.openstack-service-api.cinder', 'horizon.app.core.openstack-service-api.policy', 'horizon.app.core.openstack-service-api.serviceCatalog', - 'horizon.app.core.images.actions.createVolumeWorkflow', + 'horizon.app.core.images.workflows.create-volume.service', 'horizon.app.core.images.events', 'horizon.framework.util.q.extensions', 'horizon.framework.widgets.modal.wizard-modal.service', @@ -34,7 +34,7 @@ /** * @ngDoc factory - * @name horizon.app.core.images.actions.createVolumeService + * @name horizon.app.core.images.actions.create-volume.service * * @Description * Brings up the Create Volume modal. @@ -44,7 +44,7 @@ cinder, policy, serviceCatalog, - createVolumeWorkflow, + createVolumeWorkflowService, events, $qExtensions, wizardModalService, @@ -93,7 +93,7 @@ scope.image = image; wizardModalService.modal({ scope: scope, - workflow: createVolumeWorkflow, + workflow: createVolumeWorkflowService, submit: submit }); } diff --git a/openstack_dashboard/static/app/core/images/actions/create-volume.service.spec.js b/openstack_dashboard/static/app/core/images/actions/create-volume.service.spec.js index 8a717c063b..566561f9b7 100644 --- a/openstack_dashboard/static/app/core/images/actions/create-volume.service.spec.js +++ b/openstack_dashboard/static/app/core/images/actions/create-volume.service.spec.js @@ -16,7 +16,7 @@ (function() { 'use strict'; - describe('horizon.app.core.images.actions.createVolumeService', function() { + describe('horizon.app.core.images.actions.create-volume.service', function() { var service, $scope, toast, events, workflow; var wizardModalService = { @@ -67,10 +67,10 @@ beforeEach(inject(function($injector, _$rootScope_) { $scope = _$rootScope_.$new(); - service = $injector.get('horizon.app.core.images.actions.createVolumeService'); + service = $injector.get('horizon.app.core.images.actions.create-volume.service'); toast = $injector.get('horizon.framework.widgets.toast.service'); events = $injector.get('horizon.app.core.images.events'); - workflow = $injector.get('horizon.app.core.images.actions.createVolumeWorkflow'); + workflow = $injector.get('horizon.app.core.images.workflows.create-volume.service'); })); describe('perform', function() { diff --git a/openstack_dashboard/static/app/core/images/actions/delete-image.service.js b/openstack_dashboard/static/app/core/images/actions/delete-image.service.js index 0ce16075c3..3a3c18c668 100644 --- a/openstack_dashboard/static/app/core/images/actions/delete-image.service.js +++ b/openstack_dashboard/static/app/core/images/actions/delete-image.service.js @@ -17,7 +17,7 @@ angular .module('horizon.app.core.images') - .factory('horizon.app.core.images.actions.deleteImageService', deleteImageService); + .factory('horizon.app.core.images.actions.delete-image.service', deleteImageService); deleteImageService.$inject = [ '$q', @@ -33,7 +33,7 @@ /** * @ngDoc factory - * @name horizon.app.core.images.actions.deleteImageService + * @name horizon.app.core.images.actions.delete-image.service * * @Description * Brings up the delete images confirmation modal dialog. diff --git a/openstack_dashboard/static/app/core/images/actions/delete-image.service.spec.js b/openstack_dashboard/static/app/core/images/actions/delete-image.service.spec.js index 75016fb117..61e4141900 100644 --- a/openstack_dashboard/static/app/core/images/actions/delete-image.service.spec.js +++ b/openstack_dashboard/static/app/core/images/actions/delete-image.service.spec.js @@ -15,7 +15,7 @@ (function() { 'use strict'; - describe('horizon.app.core.images.actions.deleteImageService', function() { + describe('horizon.app.core.images.actions.delete-image.service', function() { var context = { title: gettext('Confirm Delete Images'), @@ -79,7 +79,7 @@ beforeEach(inject(function($injector, _$rootScope_) { $scope = _$rootScope_.$new(); - service = $injector.get('horizon.app.core.images.actions.deleteImageService'); + service = $injector.get('horizon.app.core.images.actions.delete-image.service'); })); it('should open the delete modal with correct messages', function() { diff --git a/openstack_dashboard/static/app/core/images/actions/delete.action.service.js b/openstack_dashboard/static/app/core/images/actions/row-delete.service.js similarity index 90% rename from openstack_dashboard/static/app/core/images/actions/delete.action.service.js rename to openstack_dashboard/static/app/core/images/actions/row-delete.service.js index 155c09df4b..2f389d7da5 100644 --- a/openstack_dashboard/static/app/core/images/actions/delete.action.service.js +++ b/openstack_dashboard/static/app/core/images/actions/row-delete.service.js @@ -17,16 +17,16 @@ angular .module('horizon.app.core.images') - .factory('horizon.app.core.images.actions.deleteService', deleteService); + .factory('horizon.app.core.images.actions.row-delete.service', deleteService); deleteService.$inject = [ - 'horizon.app.core.images.actions.deleteImageService', + 'horizon.app.core.images.actions.delete-image.service', 'horizon.framework.util.i18n.gettext' ]; /** * @ngDoc factory - * @name horizon.app.core.images.actions.deleteService + * @name horizon.app.core.images.actions.row-delete.service * * @Description * Brings up the delete image confirmation modal dialog. diff --git a/openstack_dashboard/static/app/core/images/actions/delete.action.service.spec.js b/openstack_dashboard/static/app/core/images/actions/row-delete.service.spec.js similarity index 86% rename from openstack_dashboard/static/app/core/images/actions/delete.action.service.spec.js rename to openstack_dashboard/static/app/core/images/actions/row-delete.service.spec.js index cdbd93ceec..9ce71bb930 100644 --- a/openstack_dashboard/static/app/core/images/actions/delete.action.service.spec.js +++ b/openstack_dashboard/static/app/core/images/actions/row-delete.service.spec.js @@ -15,7 +15,7 @@ (function() { 'use strict'; - describe('horizon.app.core.images.actions.deleteService', function() { + describe('horizon.app.core.images.actions.row-delete.service', function() { var deleteImageService = { initScope: function() {}, @@ -35,12 +35,12 @@ beforeEach(module('horizon.app.core')); beforeEach(module('horizon.app.core.images', function($provide) { - $provide.value('horizon.app.core.images.actions.deleteImageService', deleteImageService); + $provide.value('horizon.app.core.images.actions.delete-image.service', deleteImageService); })); beforeEach(inject(function($injector, _$rootScope_) { $scope = _$rootScope_.$new(); - service = $injector.get('horizon.app.core.images.actions.deleteService'); + service = $injector.get('horizon.app.core.images.actions.row-delete.service'); })); it('should init the deleteImageService', function() { diff --git a/openstack_dashboard/static/app/core/images/images.scss b/openstack_dashboard/static/app/core/images/images.scss index bf91b4ee66..9e487ede8a 100644 --- a/openstack_dashboard/static/app/core/images/images.scss +++ b/openstack_dashboard/static/app/core/images/images.scss @@ -1,4 +1,4 @@ -table[ng-controller="imagesTableController as table"] { +table[ng-controller="horizon.app.core.images.table.ImagesController as table"] { .detail-expanded .row { background: none; diff --git a/openstack_dashboard/static/app/core/images/table/batch-actions.service.js b/openstack_dashboard/static/app/core/images/table/batch-actions.service.js index f40bb31b70..fae205a66c 100644 --- a/openstack_dashboard/static/app/core/images/table/batch-actions.service.js +++ b/openstack_dashboard/static/app/core/images/table/batch-actions.service.js @@ -17,10 +17,10 @@ angular .module('horizon.app.core.images') - .factory('horizon.app.core.images.batch-actions.service', tableBatchActions); + .factory('horizon.app.core.images.table.batch-actions.service', batchActionsService); - tableBatchActions.$inject = [ - 'horizon.app.core.images.actions.batchDeleteService', + batchActionsService.$inject = [ + 'horizon.app.core.images.actions.batch-delete.service', 'horizon.framework.util.i18n.gettext' ]; @@ -29,7 +29,7 @@ * @name horizon.app.core.images.table.batch-actions.service * @description A list of table batch actions. */ - function tableBatchActions( + function batchActionsService( deleteService, gettext ) { diff --git a/openstack_dashboard/static/app/core/images/table/batch-actions.service.spec.js b/openstack_dashboard/static/app/core/images/table/batch-actions.service.spec.js index c3aa392d58..1fe3830f42 100644 --- a/openstack_dashboard/static/app/core/images/table/batch-actions.service.spec.js +++ b/openstack_dashboard/static/app/core/images/table/batch-actions.service.spec.js @@ -15,7 +15,7 @@ (function() { 'use strict'; - describe('horizon.app.core.images.batch-actions.service', function() { + describe('horizon.app.core.images.table.batch-actions.service', function() { var service; var batchDeleteService = { @@ -27,11 +27,11 @@ beforeEach(module('horizon.framework')); beforeEach(module('horizon.app.core.images', function($provide) { - $provide.value('horizon.app.core.images.actions.batchDeleteService', batchDeleteService); + $provide.value('horizon.app.core.images.actions.batch-delete.service', batchDeleteService); })); beforeEach(inject(function ($injector) { - service = $injector.get('horizon.app.core.images.batch-actions.service'); + service = $injector.get('horizon.app.core.images.table.batch-actions.service'); })); it('should call initScope on batchDeleteService', function() { diff --git a/openstack_dashboard/static/app/core/images/table/images-table.html b/openstack_dashboard/static/app/core/images/table/images-table.html index b7ba39716a..76506c91af 100644 --- a/openstack_dashboard/static/app/core/images/table/images-table.html +++ b/openstack_dashboard/static/app/core/images/table/images-table.html @@ -1,6 +1,6 @@ -