Merge "Update for ui bootstrap changes"

This commit is contained in:
Jenkins 2017-01-26 23:10:20 +00:00 committed by Gerrit Code Review
commit d83842cf80
31 changed files with 80 additions and 80 deletions

View File

@ -41,7 +41,7 @@
beforeEach(module('horizon.dashboard.project.lbaasv2'));
beforeEach(module(function($provide) {
$provide.value('$modal', {
$provide.value('$uibModal', {
open: function() {
return {
result: {

View File

@ -59,7 +59,7 @@
});
beforeEach(module(function($provide) {
$provide.value('$modal', {
$provide.value('$uibModal', {
open: function() {
return {
result: makePromise()

View File

@ -41,7 +41,7 @@
beforeEach(module('horizon.dashboard.project.lbaasv2'));
beforeEach(module(function($provide) {
$provide.value('$modal', {
$provide.value('$uibModal', {
open: function() {
return {
result: {

View File

@ -42,7 +42,7 @@
};
}
};
$provide.value('$modal', modal);
$provide.value('$uibModal', modal);
$provide.value('horizon.dashboard.project.lbaasv2.loadbalancers.service', {
isActionable: function() {
return $q.when();

View File

@ -51,7 +51,7 @@
});
beforeEach(module(function($provide) {
$provide.value('$modal', {
$provide.value('$uibModal', {
open: function() {
return {
result: makePromise()

View File

@ -64,7 +64,7 @@
};
}
};
$provide.value('$modal', modal);
$provide.value('$uibModal', modal);
}));
beforeEach(inject(function ($injector) {

View File

@ -48,7 +48,7 @@
beforeEach(module('horizon.dashboard.project.lbaasv2'));
beforeEach(module(function($provide) {
$provide.value('$modal', {});
$provide.value('$uibModal', {});
}));
beforeEach(inject(function($injector) {

View File

@ -46,7 +46,7 @@
beforeEach(module('horizon.dashboard.project.lbaasv2'));
beforeEach(module(function($provide) {
$provide.value('$modal', {});
$provide.value('$uibModal', {});
}));
beforeEach(inject(function($injector) {

View File

@ -21,10 +21,10 @@
.controller('AssociateFloatingIpModalController', AssociateFloatingIpModalController);
AssociateFloatingIpModalController.$inject = [
'$modalInstance',
'$uibModalInstance',
'horizon.app.core.openstack-service-api.network',
'horizon.framework.util.i18n.gettext',
// Dependencies injected with resolve by $modal.open
// Dependencies injected with resolve by $uibModal.open
'loadbalancer',
'floatingIps',
'floatingIpPools'
@ -37,7 +37,7 @@
* Controller used by the modal service for associating a floating IP address to a
* load balancer.
*
* @param $modalInstance The angular bootstrap $modalInstance service.
* @param $uibModalInstance The angular bootstrap $uibModalInstance service.
* @param api The horizon network API service.
* @param gettext The horizon gettext function for translation.
* @param loadbalancer The load balancer to associate the floating IP with.
@ -48,7 +48,7 @@
*/
function AssociateFloatingIpModalController(
$modalInstance, api, gettext, loadbalancer, floatingIps, floatingIpPools
$uibModalInstance, api, gettext, loadbalancer, floatingIps, floatingIpPools
) {
var ctrl = this;
var port = loadbalancer.vip_port_id + '_' + loadbalancer.vip_address;
@ -69,11 +69,11 @@
}
function cancel() {
$modalInstance.dismiss('cancel');
$uibModalInstance.dismiss('cancel');
}
function onSuccess() {
$modalInstance.close();
$uibModalInstance.close();
}
function onFailure() {

View File

@ -17,7 +17,7 @@
'use strict';
describe('LBaaS v2 Load Balancers Table Associate IP Controller', function() {
var ctrl, network, floatingIps, floatingIpPools, $controller, $modalInstance;
var ctrl, network, floatingIps, floatingIpPools, $controller, $uibModalInstance;
var associateFail = false;
beforeEach(module('horizon.framework.util.i18n'));
@ -41,7 +41,7 @@
}
};
};
$provide.value('$modalInstance', {
$provide.value('$uibModalInstance', {
close: angular.noop,
dismiss: angular.noop
});
@ -64,7 +64,7 @@
beforeEach(inject(function ($injector) {
network = $injector.get('horizon.app.core.openstack-service-api.network');
$controller = $injector.get('$controller');
$modalInstance = $injector.get('$modalInstance');
$uibModalInstance = $injector.get('$uibModalInstance');
}));
it('should define controller properties', function() {
@ -107,11 +107,11 @@
ctrl = $controller('AssociateFloatingIpModalController');
ctrl.selected = ctrl.options[0];
spyOn(network, 'associateFloatingIp').and.callThrough();
spyOn($modalInstance, 'close');
spyOn($uibModalInstance, 'close');
ctrl.save();
expect(ctrl.saving).toBe(true);
expect(network.associateFloatingIp).toHaveBeenCalledWith('ip2', 'port_address');
expect($modalInstance.close).toHaveBeenCalled();
expect($uibModalInstance.close).toHaveBeenCalled();
});
it('should allocate floating IP if floating IP pool selected', function() {
@ -119,28 +119,28 @@
ctrl.selected = ctrl.options[1];
spyOn(network, 'allocateFloatingIp').and.callThrough();
spyOn(network, 'associateFloatingIp').and.callThrough();
spyOn($modalInstance, 'close');
spyOn($uibModalInstance, 'close');
ctrl.save();
expect(ctrl.saving).toBe(true);
expect(network.allocateFloatingIp).toHaveBeenCalledWith('pool1');
expect(network.associateFloatingIp).toHaveBeenCalledWith('foo', 'port_address');
expect($modalInstance.close).toHaveBeenCalled();
expect($uibModalInstance.close).toHaveBeenCalled();
});
it('should dismiss modal if cancel clicked', function() {
ctrl = $controller('AssociateFloatingIpModalController');
spyOn($modalInstance, 'dismiss');
spyOn($uibModalInstance, 'dismiss');
ctrl.cancel();
expect($modalInstance.dismiss).toHaveBeenCalledWith('cancel');
expect($uibModalInstance.dismiss).toHaveBeenCalledWith('cancel');
});
it('should not dismiss modal if save fails', function() {
ctrl = $controller('AssociateFloatingIpModalController');
ctrl.selected = ctrl.options[0];
associateFail = true;
spyOn($modalInstance, 'dismiss');
spyOn($uibModalInstance, 'dismiss');
ctrl.save();
expect($modalInstance.dismiss).not.toHaveBeenCalled();
expect($uibModalInstance.dismiss).not.toHaveBeenCalled();
expect(ctrl.saving).toBe(false);
});

View File

@ -23,7 +23,7 @@
modalService.$inject = [
'$q',
'$modal',
'$uibModal',
'$route',
'horizon.dashboard.project.lbaasv2.basePath',
'horizon.app.core.openstack-service-api.policy',
@ -41,7 +41,7 @@
* Provides the service for the Load Balancer Associate Floating IP action.
*
* @param $q The angular service for promises.
* @param $modal The angular bootstrap $modal service.
* @param $uibModal The angular bootstrap $uibModal service.
* @param $route The angular $route service.
* @param basePath The LBaaS v2 module base path.
* @param policy The horizon policy service.
@ -55,7 +55,7 @@
function modalService(
$q,
$modal,
$uibModal,
$route,
basePath,
policy,
@ -110,7 +110,7 @@
}
}
};
$modal.open(spec).result.then(onModalClose);
$uibModal.open(spec).result.then(onModalClose);
}
function onModalClose() {

View File

@ -17,7 +17,7 @@
'use strict';
describe('LBaaS v2 Load Balancers Table Associate IP Service', function() {
var service, policy, $scope, $route, item, $modal, toast;
var service, policy, $scope, $route, item, $uibModal, toast;
function allowed(item) {
spyOn(policy, 'ifAllowed').and.returnValue(true);
@ -52,7 +52,7 @@
}
};
};
$provide.value('$modal', {
$provide.value('$uibModal', {
open: function() {
return {
result: fakePromise()
@ -74,7 +74,7 @@
toast = $injector.get('horizon.framework.widgets.toast.service');
$scope = $injector.get('$rootScope').$new();
$route = $injector.get('$route');
$modal = $injector.get('$modal');
$uibModal = $injector.get('$uibModal');
service = $injector.get(
'horizon.dashboard.project.lbaasv2.loadbalancers.actions.associate-ip.modal.service');
}));
@ -94,18 +94,18 @@
});
it('should open the modal', function() {
spyOn($modal, 'open').and.callThrough();
spyOn($uibModal, 'open').and.callThrough();
service.perform(item);
$scope.$apply();
expect($modal.open.calls.count()).toBe(1);
expect($uibModal.open.calls.count()).toBe(1);
});
it('should resolve data for passing into the modal', function() {
spyOn($modal, 'open').and.callThrough();
spyOn($uibModal, 'open').and.callThrough();
service.perform(item);
$scope.$apply();
var resolve = $modal.open.calls.argsFor(0)[0].resolve;
var resolve = $uibModal.open.calls.argsFor(0)[0].resolve;
expect(resolve).toBeDefined();
expect(resolve.loadbalancer).toBeDefined();
expect(resolve.loadbalancer()).toEqual(item);

View File

@ -42,7 +42,7 @@
};
}
};
$provide.value('$modal', modal);
$provide.value('$uibModal', modal);
}));
beforeEach(inject(function ($injector) {

View File

@ -51,7 +51,7 @@
});
beforeEach(module(function($provide) {
$provide.value('$modal', {
$provide.value('$uibModal', {
open: function() {
return {
result: makePromise()

View File

@ -50,7 +50,7 @@
func();
}
};
$provide.value('$modal', {
$provide.value('$uibModal', {
open: function() {
return {
result: fakePromise

View File

@ -56,7 +56,7 @@
};
}
};
$provide.value('$modal', modal);
$provide.value('$uibModal', modal);
}));
beforeEach(inject(function ($injector) {

View File

@ -36,7 +36,7 @@
beforeEach(module('horizon.dashboard.project.lbaasv2'));
beforeEach(module(function($provide) {
$provide.value('$modal', {});
$provide.value('$uibModal', {});
}));
beforeEach(inject(function($injector) {

View File

@ -42,7 +42,7 @@
beforeEach(module('horizon.dashboard.project.lbaasv2'));
beforeEach(module(function($provide) {
$provide.value('$modal', {});
$provide.value('$uibModal', {});
}));
beforeEach(inject(function($injector) {

View File

@ -42,7 +42,7 @@
};
}
};
$provide.value('$modal', modal);
$provide.value('$uibModal', modal);
}));
beforeEach(inject(function ($injector) {

View File

@ -21,10 +21,10 @@
.controller('EditWeightModalController', EditWeightModalController);
EditWeightModalController.$inject = [
'$modalInstance',
'$uibModalInstance',
'horizon.app.core.openstack-service-api.lbaasv2',
'horizon.framework.util.i18n.gettext',
// Dependencies injected with resolve by $modal.open
// Dependencies injected with resolve by $uibModal.open
'poolId',
'member'
];
@ -35,7 +35,7 @@
* @description
* Controller used by the modal service for editing the weight of a pool member.
*
* @param $modalInstance The angular bootstrap $modalInstance service.
* @param $uibModalInstance The angular bootstrap $uibModalInstance service.
* @param api The LBaaS v2 API service.
* @param gettext The horizon gettext function for translation.
* @param poolId The pool ID.
@ -44,7 +44,7 @@
* @returns The Edit Weight modal controller.
*/
function EditWeightModalController($modalInstance, api, gettext, poolId, member) {
function EditWeightModalController($uibModalInstance, api, gettext, poolId, member) {
var ctrl = this;
ctrl.weight = member.weight;
@ -60,11 +60,11 @@
}
function cancel() {
$modalInstance.dismiss('cancel');
$uibModalInstance.dismiss('cancel');
}
function onSuccess() {
$modalInstance.close();
$uibModalInstance.close();
}
function onFailure() {

View File

@ -17,7 +17,7 @@
'use strict';
describe('LBaaS v2 Member Edit Weight Controller', function() {
var ctrl, api, $controller, $modalInstance, $scope, $q;
var ctrl, api, $controller, $uibModalInstance, $scope, $q;
var fail = false;
function makePromise(reject) {
@ -30,7 +30,7 @@
beforeEach(module('horizon.dashboard.project.lbaasv2'));
beforeEach(module(function($provide) {
$provide.value('$modalInstance', {
$provide.value('$uibModalInstance', {
close: angular.noop,
dismiss: angular.noop
});
@ -49,7 +49,7 @@
beforeEach(inject(function ($injector) {
api = $injector.get('horizon.app.core.openstack-service-api.lbaasv2');
$controller = $injector.get('$controller');
$modalInstance = $injector.get('$modalInstance');
$uibModalInstance = $injector.get('$uibModalInstance');
$scope = $injector.get('$rootScope').$new();
$q = $injector.get('$q');
ctrl = $controller('EditWeightModalController');
@ -65,26 +65,26 @@
it('should edit member weight', function() {
spyOn(api, 'editMember').and.callThrough();
spyOn($modalInstance, 'close');
spyOn($uibModalInstance, 'close');
ctrl.save();
$scope.$apply();
expect(ctrl.saving).toBe(true);
expect(api.editMember).toHaveBeenCalledWith('pool1', 'member1', { weight: 1 });
expect($modalInstance.close).toHaveBeenCalled();
expect($uibModalInstance.close).toHaveBeenCalled();
});
it('should dismiss modal if cancel clicked', function() {
spyOn($modalInstance, 'dismiss');
spyOn($uibModalInstance, 'dismiss');
ctrl.cancel();
expect($modalInstance.dismiss).toHaveBeenCalledWith('cancel');
expect($uibModalInstance.dismiss).toHaveBeenCalledWith('cancel');
});
it('should not dismiss modal if save fails', function() {
fail = true;
spyOn($modalInstance, 'dismiss');
spyOn($uibModalInstance, 'dismiss');
ctrl.save();
$scope.$apply();
expect($modalInstance.dismiss).not.toHaveBeenCalled();
expect($uibModalInstance.dismiss).not.toHaveBeenCalled();
expect(ctrl.saving).toBe(false);
});

View File

@ -23,7 +23,7 @@
modalService.$inject = [
'$q',
'$modal',
'$uibModal',
'$route',
'horizon.dashboard.project.lbaasv2.basePath',
'horizon.app.core.openstack-service-api.policy',
@ -39,7 +39,7 @@
* Provides the service for the pool member Edit Weight action.
*
* @param $q The angular service for promises.
* @param $modal The angular bootstrap $modal service.
* @param $uibModal The angular bootstrap $uibModal service.
* @param $route The angular $route service.
* @param basePath The LBaaS v2 module base path.
* @param policy The horizon policy service.
@ -51,7 +51,7 @@
function modalService(
$q,
$modal,
$uibModal,
$route,
basePath,
policy,
@ -110,7 +110,7 @@
}
}
};
$modal.open(spec).result.then(onModalClose);
$uibModal.open(spec).result.then(onModalClose);
}
function onModalClose() {

View File

@ -17,7 +17,7 @@
'use strict';
describe('LBaaS v2 Member Edit Weight Service', function() {
var service, policy, $scope, $route, $modal, toast;
var service, policy, $scope, $route, $uibModal, toast;
var member = { id: 'member1' };
var fakePromise = function(response) {
@ -49,7 +49,7 @@
beforeEach(module('horizon.dashboard.project.lbaasv2'));
beforeEach(module(function($provide) {
$provide.value('$modal', {
$provide.value('$uibModal', {
open: function() {
return {
result: fakePromise()
@ -63,7 +63,7 @@
toast = $injector.get('horizon.framework.widgets.toast.service');
$scope = $injector.get('$rootScope').$new();
$route = $injector.get('$route');
$modal = $injector.get('$modal');
$uibModal = $injector.get('$uibModal');
service = $injector.get(
'horizon.dashboard.project.lbaasv2.members.actions.edit-weight.modal.service');
service.init('pool1', fakePromise());
@ -79,18 +79,18 @@
});
it('should open the modal', function() {
spyOn($modal, 'open').and.callThrough();
spyOn($uibModal, 'open').and.callThrough();
service.perform(member);
$scope.$apply();
expect($modal.open.calls.count()).toBe(1);
expect($uibModal.open.calls.count()).toBe(1);
});
it('should resolve data for passing into the modal', function() {
spyOn($modal, 'open').and.callThrough();
spyOn($uibModal, 'open').and.callThrough();
service.perform(member);
$scope.$apply();
var resolve = $modal.open.calls.argsFor(0)[0].resolve;
var resolve = $uibModal.open.calls.argsFor(0)[0].resolve;
expect(resolve).toBeDefined();
expect(resolve.poolId()).toBe('pool1');
expect(resolve.member()).toBe(member);

View File

@ -56,7 +56,7 @@
};
}
};
$provide.value('$modal', modal);
$provide.value('$uibModal', modal);
}));
beforeEach(inject(function ($injector) {

View File

@ -48,7 +48,7 @@
beforeEach(module('horizon.dashboard.project.lbaasv2'));
beforeEach(module(function($provide) {
$provide.value('$modal', {});
$provide.value('$uibModal', {});
$provide.value('horizon.dashboard.project.lbaasv2.members.actions.rowActions', {
init: function() {
return {

View File

@ -42,7 +42,7 @@
beforeEach(module('horizon.dashboard.project.lbaasv2'));
beforeEach(module(function($provide) {
$provide.value('$modal', {});
$provide.value('$uibModal', {});
}));
beforeEach(inject(function($injector) {

View File

@ -56,7 +56,7 @@
};
}
};
$provide.value('$modal', modal);
$provide.value('$uibModal', modal);
}));
beforeEach(inject(function ($injector) {

View File

@ -58,7 +58,7 @@
});
beforeEach(module(function($provide) {
$provide.value('$modal', {
$provide.value('$uibModal', {
open: function() {
return {
result: makePromise()

View File

@ -56,7 +56,7 @@
};
}
};
$provide.value('$modal', modal);
$provide.value('$uibModal', modal);
}));
beforeEach(inject(function ($injector) {

View File

@ -21,7 +21,7 @@
.factory('horizon.dashboard.project.lbaasv2.workflow.modal', modalService);
modalService.$inject = [
'$modal',
'$uibModal',
'horizon.framework.widgets.toast.service'
];
@ -32,12 +32,12 @@
* @description
* Provides the service for opening the LBaaS create / edit modal.
*
* @param $modal The angular bootstrap $modal service.
* @param $uibModal The angular bootstrap $uibModal service.
* @param toastService The horizon toast service.
* @returns The modal service for the LBaaS workflow.
*/
function modalService($modal, toastService) {
function modalService($uibModal, toastService) {
var service = {
init: init
@ -93,7 +93,7 @@
}
}
};
$modal.open(spec).result.then(onModalClose);
$uibModal.open(spec).result.then(onModalClose);
}
function onModalClose(response) {

View File

@ -42,7 +42,7 @@
}
};
$provide.value('$modal', modal);
$provide.value('$uibModal', modal);
}));
beforeEach(inject(function ($injector) {