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
This commit is contained in:
Rajat Vig 2016-01-07 11:36:20 -08:00
parent d1c6ad8829
commit cf123cebc6
18 changed files with 66 additions and 67 deletions

View File

@ -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.

View File

@ -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() {

View File

@ -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
});
}

View File

@ -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() {

View File

@ -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.

View File

@ -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() {

View File

@ -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.

View File

@ -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() {

View File

@ -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;

View File

@ -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
) {

View File

@ -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() {

View File

@ -1,6 +1,6 @@
<hz-page-header header="{$ 'Images' | translate $}"></hz-page-header>
<table ng-controller="imagesTableController as table"
<table ng-controller="horizon.app.core.images.table.ImagesController as table"
hz-table ng-cloak
st-table="table.images"
st-safe-src="table.imagesSrc"

View File

@ -17,34 +17,34 @@
(function() {
'use strict';
/**
* @ngdoc controller
* @name ImagesTableController
*
* @description
* Controller for the images table.
* Serves as the focal point for table actions.
*/
angular
.module('horizon.app.core.images')
.controller('imagesTableController', ImagesTableController);
.controller('horizon.app.core.images.table.ImagesController', ImagesTableController);
ImagesTableController.$inject = [
'$q',
'$scope',
'horizon.app.core.images.batch-actions.service',
'horizon.app.core.images.row-actions.service',
'horizon.app.core.images.table.batch-actions.service',
'horizon.app.core.images.table.row-actions.service',
'horizon.app.core.images.events',
'horizon.app.core.openstack-service-api.glance',
'horizon.app.core.openstack-service-api.userSession',
'imageVisibilityFilter'
];
/**
* @ngdoc controller
* @name horizon.app.core.images.table.ImagesTableController
*
* @description
* Controller for the images table.
* Serves as the focal point for table actions.
*/
function ImagesTableController(
$q,
$scope,
batchActions,
rowActions,
batchActionsService,
rowActionsService,
events,
glance,
userSession,
@ -57,10 +57,10 @@
ctrl.images = [];
ctrl.imagesSrc = [];
ctrl.batchActions = batchActions;
ctrl.batchActions = batchActionsService;
ctrl.batchActions.initScope($scope);
ctrl.rowActions = rowActions;
ctrl.rowActions = rowActionsService;
ctrl.rowActions.initScope($scope);
var deleteWatcher = $scope.$on(events.DELETE_SUCCESS, onDeleteSuccess);

View File

@ -58,9 +58,8 @@
beforeEach(module('ui.bootstrap'));
beforeEach(module('horizon.framework'));
beforeEach(module('horizon.framework.conf'));
beforeEach(module('horizon.framework.util.http'));
beforeEach(module('horizon.framework.widgets.toast'));
beforeEach(module('horizon.framework'));
beforeEach(module('horizon.app.core'));
beforeEach(module('horizon.app.core.openstack-service-api', function($provide) {
$provide.value('horizon.app.core.openstack-service-api.glance', glanceAPI);
$provide.value('horizon.app.core.openstack-service-api.userSession', userSession);
@ -79,7 +78,7 @@
}));
function createController() {
return controller('imagesTableController', {
return controller('horizon.app.core.images.table.ImagesController', {
glanceAPI: glanceAPI,
userSession: userSession,
$q: mockQ,

View File

@ -17,11 +17,11 @@
angular
.module('horizon.app.core.images')
.factory('horizon.app.core.images.row-actions.service', rowActions);
.factory('horizon.app.core.images.table.row-actions.service', rowActionsService);
rowActions.$inject = [
'horizon.app.core.images.actions.createVolumeService',
'horizon.app.core.images.actions.deleteService',
rowActionsService.$inject = [
'horizon.app.core.images.actions.create-volume.service',
'horizon.app.core.images.actions.row-delete.service',
'horizon.framework.util.i18n.gettext'
];
@ -30,7 +30,7 @@
* @name horizon.app.core.images.table.row-actions.service
* @description A list of row actions.
*/
function rowActions(
function rowActionsService(
createVolumeService,
deleteService,
gettext

View File

@ -15,7 +15,7 @@
(function() {
'use strict';
describe('horizon.app.core.images.row-actions.service', function() {
describe('horizon.app.core.images.table.row-actions.service', function() {
var service;
var deleteService = {
initScope: angular.noop
@ -29,12 +29,12 @@
beforeEach(module('horizon.framework'));
beforeEach(module('horizon.app.core.images', function($provide) {
$provide.value('horizon.app.core.images.actions.deleteService', deleteService);
$provide.value('horizon.app.core.images.actions.createVolumeService', createVolumeService);
$provide.value('horizon.app.core.images.actions.create-volume.service', createVolumeService);
$provide.value('horizon.app.core.images.actions.row-delete.service', deleteService);
}));
beforeEach(inject(function ($injector) {
service = $injector.get('horizon.app.core.images.row-actions.service');
service = $injector.get('horizon.app.core.images.table.row-actions.service');
}));
it('should call initScope on services', function() {

View File

@ -18,9 +18,9 @@
angular
.module('horizon.app.core.images')
.factory('horizon.app.core.images.actions.createVolumeWorkflow', createVolumeWorkflow);
.factory('horizon.app.core.images.workflows.create-volume.service', createVolumeService);
createVolumeWorkflow.$inject = [
createVolumeService.$inject = [
'horizon.app.core.images.basePath',
'horizon.app.core.workflow.factory',
'horizon.framework.util.i18n.gettext'
@ -28,10 +28,10 @@
/**
* @ngdoc factory
* @name horizon.app.core.images.createVolumeWorkflow
* @name horizon.app.core.images.workflows.create-volume.service
* @description A workflow for the create volume action.
*/
function createVolumeWorkflow(basePath, workflowService, gettext) {
function createVolumeService(basePath, workflowService, gettext) {
var workflow = workflowService({
title: gettext('Create Volume'),
btnText: { finish: gettext('Create Volume') },

View File

@ -16,7 +16,7 @@
(function() {
'use strict';
describe('horizon.app.core.images.actions.createVolumeWorkflow', function() {
describe('horizon.app.core.images.workflows.create-volume.service', function() {
var mockWorkflow = function(params) {
return params;
@ -38,7 +38,7 @@
}));
beforeEach(inject(function($injector) {
service = $injector.get('horizon.app.core.images.actions.createVolumeWorkflow');
service = $injector.get('horizon.app.core.images.workflows.create-volume.service');
}));
it('create the workflow for creating a volume', function() {