Merge "Update for ui bootstrap changes"
This commit is contained in:
commit
d83842cf80
@ -41,7 +41,7 @@
|
|||||||
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {
|
$provide.value('$uibModal', {
|
||||||
open: function() {
|
open: function() {
|
||||||
return {
|
return {
|
||||||
result: {
|
result: {
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {
|
$provide.value('$uibModal', {
|
||||||
open: function() {
|
open: function() {
|
||||||
return {
|
return {
|
||||||
result: makePromise()
|
result: makePromise()
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {
|
$provide.value('$uibModal', {
|
||||||
open: function() {
|
open: function() {
|
||||||
return {
|
return {
|
||||||
result: {
|
result: {
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$provide.value('$modal', modal);
|
$provide.value('$uibModal', modal);
|
||||||
$provide.value('horizon.dashboard.project.lbaasv2.loadbalancers.service', {
|
$provide.value('horizon.dashboard.project.lbaasv2.loadbalancers.service', {
|
||||||
isActionable: function() {
|
isActionable: function() {
|
||||||
return $q.when();
|
return $q.when();
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {
|
$provide.value('$uibModal', {
|
||||||
open: function() {
|
open: function() {
|
||||||
return {
|
return {
|
||||||
result: makePromise()
|
result: makePromise()
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$provide.value('$modal', modal);
|
$provide.value('$uibModal', modal);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function ($injector) {
|
beforeEach(inject(function ($injector) {
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {});
|
$provide.value('$uibModal', {});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function($injector) {
|
beforeEach(inject(function($injector) {
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {});
|
$provide.value('$uibModal', {});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function($injector) {
|
beforeEach(inject(function($injector) {
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
.controller('AssociateFloatingIpModalController', AssociateFloatingIpModalController);
|
.controller('AssociateFloatingIpModalController', AssociateFloatingIpModalController);
|
||||||
|
|
||||||
AssociateFloatingIpModalController.$inject = [
|
AssociateFloatingIpModalController.$inject = [
|
||||||
'$modalInstance',
|
'$uibModalInstance',
|
||||||
'horizon.app.core.openstack-service-api.network',
|
'horizon.app.core.openstack-service-api.network',
|
||||||
'horizon.framework.util.i18n.gettext',
|
'horizon.framework.util.i18n.gettext',
|
||||||
// Dependencies injected with resolve by $modal.open
|
// Dependencies injected with resolve by $uibModal.open
|
||||||
'loadbalancer',
|
'loadbalancer',
|
||||||
'floatingIps',
|
'floatingIps',
|
||||||
'floatingIpPools'
|
'floatingIpPools'
|
||||||
@ -37,7 +37,7 @@
|
|||||||
* Controller used by the modal service for associating a floating IP address to a
|
* Controller used by the modal service for associating a floating IP address to a
|
||||||
* load balancer.
|
* load balancer.
|
||||||
*
|
*
|
||||||
* @param $modalInstance The angular bootstrap $modalInstance service.
|
* @param $uibModalInstance The angular bootstrap $uibModalInstance service.
|
||||||
* @param api The horizon network API service.
|
* @param api The horizon network API service.
|
||||||
* @param gettext The horizon gettext function for translation.
|
* @param gettext The horizon gettext function for translation.
|
||||||
* @param loadbalancer The load balancer to associate the floating IP with.
|
* @param loadbalancer The load balancer to associate the floating IP with.
|
||||||
@ -48,7 +48,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function AssociateFloatingIpModalController(
|
function AssociateFloatingIpModalController(
|
||||||
$modalInstance, api, gettext, loadbalancer, floatingIps, floatingIpPools
|
$uibModalInstance, api, gettext, loadbalancer, floatingIps, floatingIpPools
|
||||||
) {
|
) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
var port = loadbalancer.vip_port_id + '_' + loadbalancer.vip_address;
|
var port = loadbalancer.vip_port_id + '_' + loadbalancer.vip_address;
|
||||||
@ -69,11 +69,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
$modalInstance.dismiss('cancel');
|
$uibModalInstance.dismiss('cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSuccess() {
|
function onSuccess() {
|
||||||
$modalInstance.close();
|
$uibModalInstance.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFailure() {
|
function onFailure() {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
describe('LBaaS v2 Load Balancers Table Associate IP Controller', function() {
|
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;
|
var associateFail = false;
|
||||||
|
|
||||||
beforeEach(module('horizon.framework.util.i18n'));
|
beforeEach(module('horizon.framework.util.i18n'));
|
||||||
@ -41,7 +41,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
$provide.value('$modalInstance', {
|
$provide.value('$uibModalInstance', {
|
||||||
close: angular.noop,
|
close: angular.noop,
|
||||||
dismiss: angular.noop
|
dismiss: angular.noop
|
||||||
});
|
});
|
||||||
@ -64,7 +64,7 @@
|
|||||||
beforeEach(inject(function ($injector) {
|
beforeEach(inject(function ($injector) {
|
||||||
network = $injector.get('horizon.app.core.openstack-service-api.network');
|
network = $injector.get('horizon.app.core.openstack-service-api.network');
|
||||||
$controller = $injector.get('$controller');
|
$controller = $injector.get('$controller');
|
||||||
$modalInstance = $injector.get('$modalInstance');
|
$uibModalInstance = $injector.get('$uibModalInstance');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should define controller properties', function() {
|
it('should define controller properties', function() {
|
||||||
@ -107,11 +107,11 @@
|
|||||||
ctrl = $controller('AssociateFloatingIpModalController');
|
ctrl = $controller('AssociateFloatingIpModalController');
|
||||||
ctrl.selected = ctrl.options[0];
|
ctrl.selected = ctrl.options[0];
|
||||||
spyOn(network, 'associateFloatingIp').and.callThrough();
|
spyOn(network, 'associateFloatingIp').and.callThrough();
|
||||||
spyOn($modalInstance, 'close');
|
spyOn($uibModalInstance, 'close');
|
||||||
ctrl.save();
|
ctrl.save();
|
||||||
expect(ctrl.saving).toBe(true);
|
expect(ctrl.saving).toBe(true);
|
||||||
expect(network.associateFloatingIp).toHaveBeenCalledWith('ip2', 'port_address');
|
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() {
|
it('should allocate floating IP if floating IP pool selected', function() {
|
||||||
@ -119,28 +119,28 @@
|
|||||||
ctrl.selected = ctrl.options[1];
|
ctrl.selected = ctrl.options[1];
|
||||||
spyOn(network, 'allocateFloatingIp').and.callThrough();
|
spyOn(network, 'allocateFloatingIp').and.callThrough();
|
||||||
spyOn(network, 'associateFloatingIp').and.callThrough();
|
spyOn(network, 'associateFloatingIp').and.callThrough();
|
||||||
spyOn($modalInstance, 'close');
|
spyOn($uibModalInstance, 'close');
|
||||||
ctrl.save();
|
ctrl.save();
|
||||||
expect(ctrl.saving).toBe(true);
|
expect(ctrl.saving).toBe(true);
|
||||||
expect(network.allocateFloatingIp).toHaveBeenCalledWith('pool1');
|
expect(network.allocateFloatingIp).toHaveBeenCalledWith('pool1');
|
||||||
expect(network.associateFloatingIp).toHaveBeenCalledWith('foo', 'port_address');
|
expect(network.associateFloatingIp).toHaveBeenCalledWith('foo', 'port_address');
|
||||||
expect($modalInstance.close).toHaveBeenCalled();
|
expect($uibModalInstance.close).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should dismiss modal if cancel clicked', function() {
|
it('should dismiss modal if cancel clicked', function() {
|
||||||
ctrl = $controller('AssociateFloatingIpModalController');
|
ctrl = $controller('AssociateFloatingIpModalController');
|
||||||
spyOn($modalInstance, 'dismiss');
|
spyOn($uibModalInstance, 'dismiss');
|
||||||
ctrl.cancel();
|
ctrl.cancel();
|
||||||
expect($modalInstance.dismiss).toHaveBeenCalledWith('cancel');
|
expect($uibModalInstance.dismiss).toHaveBeenCalledWith('cancel');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not dismiss modal if save fails', function() {
|
it('should not dismiss modal if save fails', function() {
|
||||||
ctrl = $controller('AssociateFloatingIpModalController');
|
ctrl = $controller('AssociateFloatingIpModalController');
|
||||||
ctrl.selected = ctrl.options[0];
|
ctrl.selected = ctrl.options[0];
|
||||||
associateFail = true;
|
associateFail = true;
|
||||||
spyOn($modalInstance, 'dismiss');
|
spyOn($uibModalInstance, 'dismiss');
|
||||||
ctrl.save();
|
ctrl.save();
|
||||||
expect($modalInstance.dismiss).not.toHaveBeenCalled();
|
expect($uibModalInstance.dismiss).not.toHaveBeenCalled();
|
||||||
expect(ctrl.saving).toBe(false);
|
expect(ctrl.saving).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
modalService.$inject = [
|
modalService.$inject = [
|
||||||
'$q',
|
'$q',
|
||||||
'$modal',
|
'$uibModal',
|
||||||
'$route',
|
'$route',
|
||||||
'horizon.dashboard.project.lbaasv2.basePath',
|
'horizon.dashboard.project.lbaasv2.basePath',
|
||||||
'horizon.app.core.openstack-service-api.policy',
|
'horizon.app.core.openstack-service-api.policy',
|
||||||
@ -41,7 +41,7 @@
|
|||||||
* Provides the service for the Load Balancer Associate Floating IP action.
|
* Provides the service for the Load Balancer Associate Floating IP action.
|
||||||
*
|
*
|
||||||
* @param $q The angular service for promises.
|
* @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 $route The angular $route service.
|
||||||
* @param basePath The LBaaS v2 module base path.
|
* @param basePath The LBaaS v2 module base path.
|
||||||
* @param policy The horizon policy service.
|
* @param policy The horizon policy service.
|
||||||
@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
function modalService(
|
function modalService(
|
||||||
$q,
|
$q,
|
||||||
$modal,
|
$uibModal,
|
||||||
$route,
|
$route,
|
||||||
basePath,
|
basePath,
|
||||||
policy,
|
policy,
|
||||||
@ -110,7 +110,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$modal.open(spec).result.then(onModalClose);
|
$uibModal.open(spec).result.then(onModalClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onModalClose() {
|
function onModalClose() {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
describe('LBaaS v2 Load Balancers Table Associate IP Service', function() {
|
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) {
|
function allowed(item) {
|
||||||
spyOn(policy, 'ifAllowed').and.returnValue(true);
|
spyOn(policy, 'ifAllowed').and.returnValue(true);
|
||||||
@ -52,7 +52,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
$provide.value('$modal', {
|
$provide.value('$uibModal', {
|
||||||
open: function() {
|
open: function() {
|
||||||
return {
|
return {
|
||||||
result: fakePromise()
|
result: fakePromise()
|
||||||
@ -74,7 +74,7 @@
|
|||||||
toast = $injector.get('horizon.framework.widgets.toast.service');
|
toast = $injector.get('horizon.framework.widgets.toast.service');
|
||||||
$scope = $injector.get('$rootScope').$new();
|
$scope = $injector.get('$rootScope').$new();
|
||||||
$route = $injector.get('$route');
|
$route = $injector.get('$route');
|
||||||
$modal = $injector.get('$modal');
|
$uibModal = $injector.get('$uibModal');
|
||||||
service = $injector.get(
|
service = $injector.get(
|
||||||
'horizon.dashboard.project.lbaasv2.loadbalancers.actions.associate-ip.modal.service');
|
'horizon.dashboard.project.lbaasv2.loadbalancers.actions.associate-ip.modal.service');
|
||||||
}));
|
}));
|
||||||
@ -94,18 +94,18 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should open the modal', function() {
|
it('should open the modal', function() {
|
||||||
spyOn($modal, 'open').and.callThrough();
|
spyOn($uibModal, 'open').and.callThrough();
|
||||||
service.perform(item);
|
service.perform(item);
|
||||||
$scope.$apply();
|
$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() {
|
it('should resolve data for passing into the modal', function() {
|
||||||
spyOn($modal, 'open').and.callThrough();
|
spyOn($uibModal, 'open').and.callThrough();
|
||||||
service.perform(item);
|
service.perform(item);
|
||||||
$scope.$apply();
|
$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).toBeDefined();
|
||||||
expect(resolve.loadbalancer).toBeDefined();
|
expect(resolve.loadbalancer).toBeDefined();
|
||||||
expect(resolve.loadbalancer()).toEqual(item);
|
expect(resolve.loadbalancer()).toEqual(item);
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$provide.value('$modal', modal);
|
$provide.value('$uibModal', modal);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function ($injector) {
|
beforeEach(inject(function ($injector) {
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {
|
$provide.value('$uibModal', {
|
||||||
open: function() {
|
open: function() {
|
||||||
return {
|
return {
|
||||||
result: makePromise()
|
result: makePromise()
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$provide.value('$modal', {
|
$provide.value('$uibModal', {
|
||||||
open: function() {
|
open: function() {
|
||||||
return {
|
return {
|
||||||
result: fakePromise
|
result: fakePromise
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$provide.value('$modal', modal);
|
$provide.value('$uibModal', modal);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function ($injector) {
|
beforeEach(inject(function ($injector) {
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {});
|
$provide.value('$uibModal', {});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function($injector) {
|
beforeEach(inject(function($injector) {
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {});
|
$provide.value('$uibModal', {});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function($injector) {
|
beforeEach(inject(function($injector) {
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$provide.value('$modal', modal);
|
$provide.value('$uibModal', modal);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function ($injector) {
|
beforeEach(inject(function ($injector) {
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
.controller('EditWeightModalController', EditWeightModalController);
|
.controller('EditWeightModalController', EditWeightModalController);
|
||||||
|
|
||||||
EditWeightModalController.$inject = [
|
EditWeightModalController.$inject = [
|
||||||
'$modalInstance',
|
'$uibModalInstance',
|
||||||
'horizon.app.core.openstack-service-api.lbaasv2',
|
'horizon.app.core.openstack-service-api.lbaasv2',
|
||||||
'horizon.framework.util.i18n.gettext',
|
'horizon.framework.util.i18n.gettext',
|
||||||
// Dependencies injected with resolve by $modal.open
|
// Dependencies injected with resolve by $uibModal.open
|
||||||
'poolId',
|
'poolId',
|
||||||
'member'
|
'member'
|
||||||
];
|
];
|
||||||
@ -35,7 +35,7 @@
|
|||||||
* @description
|
* @description
|
||||||
* Controller used by the modal service for editing the weight of a pool member.
|
* 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 api The LBaaS v2 API service.
|
||||||
* @param gettext The horizon gettext function for translation.
|
* @param gettext The horizon gettext function for translation.
|
||||||
* @param poolId The pool ID.
|
* @param poolId The pool ID.
|
||||||
@ -44,7 +44,7 @@
|
|||||||
* @returns The Edit Weight modal controller.
|
* @returns The Edit Weight modal controller.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function EditWeightModalController($modalInstance, api, gettext, poolId, member) {
|
function EditWeightModalController($uibModalInstance, api, gettext, poolId, member) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
|
|
||||||
ctrl.weight = member.weight;
|
ctrl.weight = member.weight;
|
||||||
@ -60,11 +60,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
$modalInstance.dismiss('cancel');
|
$uibModalInstance.dismiss('cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSuccess() {
|
function onSuccess() {
|
||||||
$modalInstance.close();
|
$uibModalInstance.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFailure() {
|
function onFailure() {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
describe('LBaaS v2 Member Edit Weight Controller', function() {
|
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;
|
var fail = false;
|
||||||
|
|
||||||
function makePromise(reject) {
|
function makePromise(reject) {
|
||||||
@ -30,7 +30,7 @@
|
|||||||
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modalInstance', {
|
$provide.value('$uibModalInstance', {
|
||||||
close: angular.noop,
|
close: angular.noop,
|
||||||
dismiss: angular.noop
|
dismiss: angular.noop
|
||||||
});
|
});
|
||||||
@ -49,7 +49,7 @@
|
|||||||
beforeEach(inject(function ($injector) {
|
beforeEach(inject(function ($injector) {
|
||||||
api = $injector.get('horizon.app.core.openstack-service-api.lbaasv2');
|
api = $injector.get('horizon.app.core.openstack-service-api.lbaasv2');
|
||||||
$controller = $injector.get('$controller');
|
$controller = $injector.get('$controller');
|
||||||
$modalInstance = $injector.get('$modalInstance');
|
$uibModalInstance = $injector.get('$uibModalInstance');
|
||||||
$scope = $injector.get('$rootScope').$new();
|
$scope = $injector.get('$rootScope').$new();
|
||||||
$q = $injector.get('$q');
|
$q = $injector.get('$q');
|
||||||
ctrl = $controller('EditWeightModalController');
|
ctrl = $controller('EditWeightModalController');
|
||||||
@ -65,26 +65,26 @@
|
|||||||
|
|
||||||
it('should edit member weight', function() {
|
it('should edit member weight', function() {
|
||||||
spyOn(api, 'editMember').and.callThrough();
|
spyOn(api, 'editMember').and.callThrough();
|
||||||
spyOn($modalInstance, 'close');
|
spyOn($uibModalInstance, 'close');
|
||||||
ctrl.save();
|
ctrl.save();
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
expect(ctrl.saving).toBe(true);
|
expect(ctrl.saving).toBe(true);
|
||||||
expect(api.editMember).toHaveBeenCalledWith('pool1', 'member1', { weight: 1 });
|
expect(api.editMember).toHaveBeenCalledWith('pool1', 'member1', { weight: 1 });
|
||||||
expect($modalInstance.close).toHaveBeenCalled();
|
expect($uibModalInstance.close).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should dismiss modal if cancel clicked', function() {
|
it('should dismiss modal if cancel clicked', function() {
|
||||||
spyOn($modalInstance, 'dismiss');
|
spyOn($uibModalInstance, 'dismiss');
|
||||||
ctrl.cancel();
|
ctrl.cancel();
|
||||||
expect($modalInstance.dismiss).toHaveBeenCalledWith('cancel');
|
expect($uibModalInstance.dismiss).toHaveBeenCalledWith('cancel');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not dismiss modal if save fails', function() {
|
it('should not dismiss modal if save fails', function() {
|
||||||
fail = true;
|
fail = true;
|
||||||
spyOn($modalInstance, 'dismiss');
|
spyOn($uibModalInstance, 'dismiss');
|
||||||
ctrl.save();
|
ctrl.save();
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
expect($modalInstance.dismiss).not.toHaveBeenCalled();
|
expect($uibModalInstance.dismiss).not.toHaveBeenCalled();
|
||||||
expect(ctrl.saving).toBe(false);
|
expect(ctrl.saving).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
modalService.$inject = [
|
modalService.$inject = [
|
||||||
'$q',
|
'$q',
|
||||||
'$modal',
|
'$uibModal',
|
||||||
'$route',
|
'$route',
|
||||||
'horizon.dashboard.project.lbaasv2.basePath',
|
'horizon.dashboard.project.lbaasv2.basePath',
|
||||||
'horizon.app.core.openstack-service-api.policy',
|
'horizon.app.core.openstack-service-api.policy',
|
||||||
@ -39,7 +39,7 @@
|
|||||||
* Provides the service for the pool member Edit Weight action.
|
* Provides the service for the pool member Edit Weight action.
|
||||||
*
|
*
|
||||||
* @param $q The angular service for promises.
|
* @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 $route The angular $route service.
|
||||||
* @param basePath The LBaaS v2 module base path.
|
* @param basePath The LBaaS v2 module base path.
|
||||||
* @param policy The horizon policy service.
|
* @param policy The horizon policy service.
|
||||||
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
function modalService(
|
function modalService(
|
||||||
$q,
|
$q,
|
||||||
$modal,
|
$uibModal,
|
||||||
$route,
|
$route,
|
||||||
basePath,
|
basePath,
|
||||||
policy,
|
policy,
|
||||||
@ -110,7 +110,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$modal.open(spec).result.then(onModalClose);
|
$uibModal.open(spec).result.then(onModalClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onModalClose() {
|
function onModalClose() {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
describe('LBaaS v2 Member Edit Weight Service', function() {
|
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 member = { id: 'member1' };
|
||||||
|
|
||||||
var fakePromise = function(response) {
|
var fakePromise = function(response) {
|
||||||
@ -49,7 +49,7 @@
|
|||||||
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {
|
$provide.value('$uibModal', {
|
||||||
open: function() {
|
open: function() {
|
||||||
return {
|
return {
|
||||||
result: fakePromise()
|
result: fakePromise()
|
||||||
@ -63,7 +63,7 @@
|
|||||||
toast = $injector.get('horizon.framework.widgets.toast.service');
|
toast = $injector.get('horizon.framework.widgets.toast.service');
|
||||||
$scope = $injector.get('$rootScope').$new();
|
$scope = $injector.get('$rootScope').$new();
|
||||||
$route = $injector.get('$route');
|
$route = $injector.get('$route');
|
||||||
$modal = $injector.get('$modal');
|
$uibModal = $injector.get('$uibModal');
|
||||||
service = $injector.get(
|
service = $injector.get(
|
||||||
'horizon.dashboard.project.lbaasv2.members.actions.edit-weight.modal.service');
|
'horizon.dashboard.project.lbaasv2.members.actions.edit-weight.modal.service');
|
||||||
service.init('pool1', fakePromise());
|
service.init('pool1', fakePromise());
|
||||||
@ -79,18 +79,18 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should open the modal', function() {
|
it('should open the modal', function() {
|
||||||
spyOn($modal, 'open').and.callThrough();
|
spyOn($uibModal, 'open').and.callThrough();
|
||||||
service.perform(member);
|
service.perform(member);
|
||||||
$scope.$apply();
|
$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() {
|
it('should resolve data for passing into the modal', function() {
|
||||||
spyOn($modal, 'open').and.callThrough();
|
spyOn($uibModal, 'open').and.callThrough();
|
||||||
service.perform(member);
|
service.perform(member);
|
||||||
$scope.$apply();
|
$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).toBeDefined();
|
||||||
expect(resolve.poolId()).toBe('pool1');
|
expect(resolve.poolId()).toBe('pool1');
|
||||||
expect(resolve.member()).toBe(member);
|
expect(resolve.member()).toBe(member);
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$provide.value('$modal', modal);
|
$provide.value('$uibModal', modal);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function ($injector) {
|
beforeEach(inject(function ($injector) {
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {});
|
$provide.value('$uibModal', {});
|
||||||
$provide.value('horizon.dashboard.project.lbaasv2.members.actions.rowActions', {
|
$provide.value('horizon.dashboard.project.lbaasv2.members.actions.rowActions', {
|
||||||
init: function() {
|
init: function() {
|
||||||
return {
|
return {
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
beforeEach(module('horizon.dashboard.project.lbaasv2'));
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {});
|
$provide.value('$uibModal', {});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function($injector) {
|
beforeEach(inject(function($injector) {
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$provide.value('$modal', modal);
|
$provide.value('$uibModal', modal);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function ($injector) {
|
beforeEach(inject(function ($injector) {
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(module(function($provide) {
|
beforeEach(module(function($provide) {
|
||||||
$provide.value('$modal', {
|
$provide.value('$uibModal', {
|
||||||
open: function() {
|
open: function() {
|
||||||
return {
|
return {
|
||||||
result: makePromise()
|
result: makePromise()
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$provide.value('$modal', modal);
|
$provide.value('$uibModal', modal);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function ($injector) {
|
beforeEach(inject(function ($injector) {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
.factory('horizon.dashboard.project.lbaasv2.workflow.modal', modalService);
|
.factory('horizon.dashboard.project.lbaasv2.workflow.modal', modalService);
|
||||||
|
|
||||||
modalService.$inject = [
|
modalService.$inject = [
|
||||||
'$modal',
|
'$uibModal',
|
||||||
'horizon.framework.widgets.toast.service'
|
'horizon.framework.widgets.toast.service'
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -32,12 +32,12 @@
|
|||||||
* @description
|
* @description
|
||||||
* Provides the service for opening the LBaaS create / edit modal.
|
* 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.
|
* @param toastService The horizon toast service.
|
||||||
* @returns The modal service for the LBaaS workflow.
|
* @returns The modal service for the LBaaS workflow.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function modalService($modal, toastService) {
|
function modalService($uibModal, toastService) {
|
||||||
|
|
||||||
var service = {
|
var service = {
|
||||||
init: init
|
init: init
|
||||||
@ -93,7 +93,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$modal.open(spec).result.then(onModalClose);
|
$uibModal.open(spec).result.then(onModalClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onModalClose(response) {
|
function onModalClose(response) {
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$provide.value('$modal', modal);
|
$provide.value('$uibModal', modal);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(inject(function ($injector) {
|
beforeEach(inject(function ($injector) {
|
||||||
|
Loading…
Reference in New Issue
Block a user