Merge "Update for ui bootstrap changes"

This commit is contained in:
Jenkins 2016-12-15 23:41:52 +00:00 committed by Gerrit Code Review
commit fc7f82400e
41 changed files with 185 additions and 184 deletions

View File

@ -61,7 +61,7 @@
* perform()'s final promise: * perform()'s final promise:
* ``` * ```
* function performUpdate(item) { * function performUpdate(item) {
* $modal.open(updateDialog).result.then(function result() { * $uibModal.open(updateDialog).result.then(function result() {
* return actionResult.updated('OS::Glance::Image', item.id).result; * return actionResult.updated('OS::Glance::Image', item.id).result;
* }); * });
* } * }

View File

@ -36,11 +36,11 @@
.controller('horizon.framework.widgets.form.ModalFormController', controller); .controller('horizon.framework.widgets.form.ModalFormController', controller);
controller.$inject = [ controller.$inject = [
'$modalInstance', '$uibModalInstance',
'context' 'context'
]; ];
function controller($modalInstance, context) { function controller($uibModalInstance, context) {
var ctrl = this; var ctrl = this;
ctrl.formTitle = context.title; ctrl.formTitle = context.title;
ctrl.form = context.form; ctrl.form = context.form;
@ -52,11 +52,11 @@
ctrl.cancel = cancel; ctrl.cancel = cancel;
function submit() { function submit() {
return $modalInstance.close(context); return $uibModalInstance.close(context);
} }
function cancel() { function cancel() {
return $modalInstance.dismiss(context); return $uibModalInstance.dismiss(context);
} }
return ctrl; return ctrl;

View File

@ -35,7 +35,7 @@
ctrl = $controller( ctrl = $controller(
'horizon.framework.widgets.form.ModalFormController', 'horizon.framework.widgets.form.ModalFormController',
{ {
$modalInstance: modalInstance, $uibModalInstance: modalInstance,
context: context context: context
}); });
})); }));

View File

@ -23,7 +23,7 @@
.factory('horizon.framework.widgets.form.ModalFormService', service); .factory('horizon.framework.widgets.form.ModalFormService', service);
service.$inject = [ service.$inject = [
'$modal', '$uibModal',
'horizon.framework.widgets.basePath' 'horizon.framework.widgets.basePath'
]; ];
@ -35,7 +35,7 @@
* Loads a Schema-Form (see modal-form.html) in a modal and returns the modal result promise. * Loads a Schema-Form (see modal-form.html) in a modal and returns the modal result promise.
*/ */
function service( function service(
$modal, $uibModal,
widgetsBasePath widgetsBasePath
) { ) {
@ -66,7 +66,7 @@
templateUrl: widgetsBasePath + 'form/modal-form.html' templateUrl: widgetsBasePath + 'form/modal-form.html'
}; };
return $modal.open(modalConfig).result; return $uibModal.open(modalConfig).result;
} }
} }
})(); })();

View File

@ -17,20 +17,20 @@
'use strict'; 'use strict';
describe('modal-form service', function () { describe('modal-form service', function () {
var service, $modal; var service, $uibModal;
beforeEach(module('horizon.framework.widgets')); beforeEach(module('horizon.framework.widgets'));
beforeEach(module('horizon.framework.widgets.form')); beforeEach(module('horizon.framework.widgets.form'));
beforeEach(inject(function ($injector, _$modal_) { beforeEach(inject(function ($injector, _$uibModal_) {
$modal = _$modal_; $uibModal = _$uibModal_;
service = $injector.get( service = $injector.get(
'horizon.framework.widgets.form.ModalFormService' 'horizon.framework.widgets.form.ModalFormService'
); );
})); }));
it('sets open parameters to modal resolve.context', function() { it('sets open parameters to modal resolve.context', function() {
spyOn($modal, 'open').and.callFake(function(config) { spyOn($uibModal, 'open').and.callFake(function(config) {
return { return {
result: config result: config
}; };
@ -54,7 +54,7 @@
}); });
it('sets default values for optional parameters', function() { it('sets default values for optional parameters', function() {
spyOn($modal, 'open').and.callFake(function(config) { spyOn($uibModal, 'open').and.callFake(function(config) {
return { return {
result: config result: config
}; };

View File

@ -19,7 +19,7 @@
.module('horizon.framework.widgets.modal-wait-spinner') .module('horizon.framework.widgets.modal-wait-spinner')
.factory('horizon.framework.widgets.modal-wait-spinner.service', WaitSpinnerService); .factory('horizon.framework.widgets.modal-wait-spinner.service', WaitSpinnerService);
WaitSpinnerService.$inject = ['$modal']; WaitSpinnerService.$inject = ['$uibModal'];
/* /*
* @ngdoc factory * @ngdoc factory
@ -32,7 +32,7 @@
* Over time, uses of the existing Horizon spinner ( horizon.modals.modal_spinner() ) * Over time, uses of the existing Horizon spinner ( horizon.modals.modal_spinner() )
* can be phased out, or refactored to use this component. * can be phased out, or refactored to use this component.
*/ */
function WaitSpinnerService ($modal) { function WaitSpinnerService ($uibModal) {
var spinner = this; var spinner = this;
var service = { var service = {
showModalSpinner: showModalSpinner, showModalSpinner: showModalSpinner,
@ -54,7 +54,7 @@
template: '<div wait-spinner class="modal-body" text="' + spinnerText + '"></div>', template: '<div wait-spinner class="modal-body" text="' + spinnerText + '"></div>',
windowClass: 'modal-wait-spinner modal_wrapper loading' windowClass: 'modal-wait-spinner modal_wrapper loading'
}; };
spinner.modalInstance = $modal.open(modalOptions); spinner.modalInstance = $uibModal.open(modalOptions);
} }
function hideModalSpinner() { function hideModalSpinner() {

View File

@ -36,16 +36,16 @@
expect(service.showModalSpinner).toBeDefined(); expect(service.showModalSpinner).toBeDefined();
}); });
it('opens modal with the correct object', inject(function($modal) { it('opens modal with the correct object', inject(function($uibModal) {
var wanted = { backdrop: 'static', var wanted = { backdrop: 'static',
template: '<div wait-spinner class="modal-body" text="my text"></div>', template: '<div wait-spinner class="modal-body" text="my text"></div>',
windowClass: 'modal-wait-spinner modal_wrapper loading' windowClass: 'modal-wait-spinner modal_wrapper loading'
}; };
spyOn($modal, 'open'); spyOn($uibModal, 'open');
service.showModalSpinner('my text'); service.showModalSpinner('my text');
expect($modal.open).toHaveBeenCalled(); expect($uibModal.open).toHaveBeenCalled();
expect($modal.open.calls.count()).toBe(1); expect($uibModal.open.calls.count()).toBe(1);
expect($modal.open.calls.argsFor(0)).toEqual([wanted]); expect($uibModal.open.calls.argsFor(0)).toEqual([wanted]);
})); }));
}); });
@ -56,9 +56,9 @@
expect(service.hideModalSpinner).toBeDefined(); expect(service.hideModalSpinner).toBeDefined();
}); });
it("dismisses modal when it has been opened", inject(function($modal) { it("dismisses modal when it has been opened", inject(function($uibModal) {
var modal = {dismiss: function() {}}; var modal = {dismiss: function() {}};
spyOn($modal, 'open').and.returnValue(modal); spyOn($uibModal, 'open').and.returnValue(modal);
service.showModalSpinner('asdf'); service.showModalSpinner('asdf');
spyOn(modal, 'dismiss'); spyOn(modal, 'dismiss');
service.hideModalSpinner(); service.hideModalSpinner();

View File

@ -37,18 +37,18 @@
.controller('SimpleModalController', SimpleModalController); .controller('SimpleModalController', SimpleModalController);
SimpleModalController.$inject = [ SimpleModalController.$inject = [
'$modalInstance', '$uibModalInstance',
'context' 'context'
]; ];
function SimpleModalController($modalInstance, context) { function SimpleModalController($uibModalInstance, context) {
var ctrl = this; var ctrl = this;
ctrl.context = context; ctrl.context = context;
ctrl.submit = function() { ctrl.submit = function() {
$modalInstance.close(); $uibModalInstance.close();
}; };
ctrl.cancel = function() { ctrl.cancel = function() {
$modalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
}; };
} // end of function } // end of function

View File

@ -25,7 +25,7 @@
* Horizon's wrapper for angular-bootstrap modal service. * Horizon's wrapper for angular-bootstrap modal service.
* It should only be use for small confirmation dialogs. * It should only be use for small confirmation dialogs.
* @param {object} the object containing title, body, submit, and cancel labels * @param {object} the object containing title, body, submit, and cancel labels
* @param {object} the object returned from angular-bootstrap $modal * @param {object} the object returned from angular-bootstrap $uibModal
* *
* @example: * @example:
* angular * angular
@ -55,12 +55,12 @@
.factory('horizon.framework.widgets.modal.simple-modal.service', modalService); .factory('horizon.framework.widgets.modal.simple-modal.service', modalService);
modalService.$inject = [ modalService.$inject = [
'$modal', '$uibModal',
'horizon.framework.widgets.basePath', 'horizon.framework.widgets.basePath',
'horizon.framework.util.i18n.gettext' 'horizon.framework.util.i18n.gettext'
]; ];
function modalService($modal, path, gettext) { function modalService($uibModal, path, gettext) {
var service = { var service = {
modal: modal modal: modal
}; };
@ -84,7 +84,7 @@
} }
} }
}; };
return $modal.open(options); return $uibModal.open(options);
} }
} // end of modalOptions function } // end of modalOptions function
} // end of modalService function } // end of modalService function

View File

@ -32,7 +32,7 @@
}; };
context = { what: 'is it' }; context = { what: 'is it' };
ctrl = $controller('SimpleModalController', ctrl = $controller('SimpleModalController',
{$modalInstance: modalInstance, {$uibModalInstance: modalInstance,
context: context}); context: context});
})); }));
@ -73,7 +73,7 @@
modal = { open: function() { modal = { open: function() {
return 'val'; return 'val';
}}; }};
$provide.value('$modal', modal); $provide.value('$uibModal', modal);
})); }));
beforeEach(inject(function($injector) { beforeEach(inject(function($injector) {

View File

@ -48,10 +48,10 @@
WizardModalService.$inject = [ WizardModalService.$inject = [
'$log', '$log',
'$modal' '$uibModal'
]; ];
function WizardModalService($log, $modal) { function WizardModalService($log, $uibModal) {
var service = { var service = {
modal: modal modal: modal
}; };
@ -88,7 +88,7 @@
options.scope = params.scope; options.scope = params.scope;
} }
return $modal.open(options); return $uibModal.open(options);
} }
} }
} }

View File

@ -23,7 +23,7 @@
modal = { modal = {
open: function() {} open: function() {}
}; };
$provide.value('$modal', modal); $provide.value('$uibModal', modal);
})); }));
beforeEach(inject(function($injector, _$rootScope_) { beforeEach(inject(function($injector, _$rootScope_) {

View File

@ -22,7 +22,7 @@
.controller('WizardModalController', WizardModalController); .controller('WizardModalController', WizardModalController);
WizardModalController.$inject = [ WizardModalController.$inject = [
'$modalInstance', '$uibModalInstance',
'$scope', '$scope',
'workflow', // WizardModalService injected 'workflow', // WizardModalService injected
'submit', // WizardModalService injected 'submit', // WizardModalService injected
@ -39,7 +39,7 @@
* This controller sets the modal actions and workflow on the given scope * This controller sets the modal actions and workflow on the given scope
* as the Wizard needs them defined on the scope. * as the Wizard needs them defined on the scope.
*/ */
function WizardModalController($modalInstance, $scope, workflow, submit, data) { function WizardModalController($uibModalInstance, $scope, workflow, submit, data) {
/* eslint-disable angular/controller-as */ /* eslint-disable angular/controller-as */
$scope.close = close; $scope.close = close;
@ -54,11 +54,11 @@
/* eslint-enable angular/controller-as */ /* eslint-enable angular/controller-as */
function close(args) { function close(args) {
$modalInstance.close(args); $uibModalInstance.close(args);
} }
function cancel() { function cancel() {
$modalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
} }
} }

View File

@ -21,7 +21,7 @@
describe(wizardCtrl, function() { describe(wizardCtrl, function() {
var modalCalls = [ 'close', 'dismiss' ]; var modalCalls = [ 'close', 'dismiss' ];
var modalInstance = jasmine.createSpyObj('$modalInstance', modalCalls); var modalInstance = jasmine.createSpyObj('$uibModalInstance', modalCalls);
var scope; var scope;
@ -31,7 +31,7 @@
beforeEach(inject(function($controller, $rootScope) { beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new(); scope = $rootScope.$new();
$controller(wizardCtrl, { $controller(wizardCtrl, {
$modalInstance: modalInstance, $uibModalInstance: modalInstance,
$scope: scope, $scope: scope,
workflow: { steps: 'somestep' }, workflow: { steps: 'somestep' },
submit: { api: 'someapi' }, submit: { api: 'someapi' },

View File

@ -21,7 +21,7 @@
.module('horizon.framework.widgets.wizard') .module('horizon.framework.widgets.wizard')
.controller('ModalContainerController', ModalContainerController); .controller('ModalContainerController', ModalContainerController);
ModalContainerController.$inject = ['$scope', '$modalInstance', 'launchContext']; ModalContainerController.$inject = ['$scope', '$uibModalInstance', 'launchContext'];
/** /**
* @ngdoc controller * @ngdoc controller
@ -29,16 +29,16 @@
* @description * @description
* Extends the bootstrap-ui modal widget * Extends the bootstrap-ui modal widget
*/ */
function ModalContainerController($scope, $modalInstance, launchContext) { function ModalContainerController($scope, $uibModalInstance, launchContext) {
// $scope is used because the methods are shared between // $scope is used because the methods are shared between
// wizard and modal-container controller // wizard and modal-container controller
/*eslint-disable angular/controller-as */ /*eslint-disable angular/controller-as */
$scope.launchContext = launchContext; $scope.launchContext = launchContext;
$scope.close = function(args) { $scope.close = function(args) {
$modalInstance.close(args); $uibModalInstance.close(args);
}; };
$scope.cancel = function() { $scope.cancel = function() {
$modalInstance.dismiss(); $uibModalInstance.dismiss();
}; };
/*eslint-enable angular/controller-as */ /*eslint-enable angular/controller-as */
} }

View File

@ -250,7 +250,7 @@
modalInstance = { close: angular.noop, dismiss: angular.noop }; modalInstance = { close: angular.noop, dismiss: angular.noop };
launchContext = { my: 'data' }; launchContext = { my: 'data' };
ctrl = $controller('ModalContainerController', ctrl = $controller('ModalContainerController',
{ $scope: scope, $modalInstance: modalInstance, { $scope: scope, $uibModalInstance: modalInstance,
launchContext: launchContext }); launchContext: launchContext });
})); }));

View File

@ -246,7 +246,7 @@ horizon.datatables.confirm = function(action) {
return; return;
} }
var $modal_parent = $action.closest('.modal'); var $uibModal_parent = $action.closest('.modal');
var name_array = []; var name_array = [];
var action_string = $action.text(); var action_string = $action.text();
var help_text = $action.attr("help_text") || ""; var help_text = $action.attr("help_text") || "";
@ -300,10 +300,10 @@ horizon.datatables.confirm = function(action) {
var modal = horizon.modals.create(title, body, action_string); var modal = horizon.modals.create(title, body, action_string);
modal.modal(); modal.modal();
if ($modal_parent.length) { if ($uibModal_parent.length) {
var child_backdrop = modal.next('.modal-backdrop'); var child_backdrop = modal.next('.modal-backdrop');
// re-arrange z-index for these stacking modal // re-arrange z-index for these stacking modal
child_backdrop.css('z-index', $modal_parent.css('z-index')+10); child_backdrop.css('z-index', $uibModal_parent.css('z-index')+10);
modal.css('z-index', child_backdrop.css('z-index')+10); modal.css('z-index', child_backdrop.css('z-index')+10);
} }

View File

@ -47,8 +47,8 @@
e.preventDefault(); e.preventDefault();
}); });
var $modal = $('#source-modal'); var $uibModal = $('#source-modal');
var $pre = $modal.find('pre'); var $pre = $uibModal.find('pre');
var $button = $('<div id="source-button" class="btn btn-primary btn-xs"><span class="fa fa-code"></span></div>') var $button = $('<div id="source-button" class="btn btn-primary btn-xs"><span class="fa fa-code"></span></div>')
.click(function(){ .click(function(){
@ -65,7 +65,7 @@
$fragment = stripChart($fragment); $fragment = stripChart($fragment);
var html = cleanSource($fragment.html()); var html = cleanSource($fragment.html());
$pre.text(unescapeHtml(html)); $pre.text(unescapeHtml(html));
$modal.modal(); $uibModal.modal();
}); });
var $component = $('.bs-component'); var $component = $('.bs-component');

View File

@ -11,11 +11,11 @@
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<accordion class="hz-container-accordion"> <uib-accordion class="hz-container-accordion">
<accordion-group ng-repeat="container in cc.model.containers" <div uib-accordion-group ng-repeat="container in cc.model.containers"
ng-class="{'panel-primary': container.name === cc.model.container.name}" ng-class="{'panel-primary': container.name === cc.model.container.name}"
ng-click="cc.selectContainer(container)"> ng-click="cc.selectContainer(container)">
<accordion-heading> <uib-accordion-heading>
<div ng-click="cc.selectContainer(container)"> <div ng-click="cc.selectContainer(container)">
<span class="hz-container-title truncate" <span class="hz-container-title truncate"
tooltip="{$ container.name $}" tooltip-placement="top" tooltip="{$ container.name $}" tooltip-placement="top"
@ -28,7 +28,7 @@
ng-if="container.name === cc.model.container.name" ng-if="container.name === cc.model.container.name"
ng-click="cc.deleteContainer(container); $event.stopPropagation()"></span> ng-click="cc.deleteContainer(container); $event.stopPropagation()"></span>
</div> </div>
</accordion-heading> </uib-accordion-heading>
<div ng-if="!container.is_fetched" class="horizon-loading-bar container-pending-bar"> <div ng-if="!container.is_fetched" class="horizon-loading-bar container-pending-bar">
<div class="progress progress-striped active"> <div class="progress progress-striped active">
@ -62,8 +62,8 @@
</span> </span>
</li> </li>
</ul> </ul>
</accordion-group> </div uib-accordion-group>
</accordion> </uib-accordion>
</div> </div>
</div> </div>
</div> </div>

View File

@ -22,9 +22,9 @@
class="text-danger" translate> class="text-danger" translate>
Encountered {$ ctrl.model.deleted.failures $} failures. Encountered {$ ctrl.model.deleted.failures $} failures.
</p> </p>
<progressbar ng-if="ctrl.model.mode === 'deletion'" <uib-progressbar ng-if="ctrl.model.mode === 'deletion'"
max="ctrl.model.counted.files + ctrl.model.counted.folders" max="ctrl.model.counted.files + ctrl.model.counted.folders"
value="ctrl.model.deleted.files + ctrl.model.deleted.folders + ctrl.model.deleted.failures"></progressbar> value="ctrl.model.deleted.files + ctrl.model.deleted.folders + ctrl.model.deleted.failures"></uib-progressbar>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">

View File

@ -23,10 +23,10 @@
DeleteObjectsModalController.$inject = [ DeleteObjectsModalController.$inject = [
'horizon.dashboard.project.containers.containers-model', 'horizon.dashboard.project.containers.containers-model',
'selected', '$modalInstance' 'selected', '$uibModalInstance'
]; ];
function DeleteObjectsModalController(model, selected, $modalInstance) { function DeleteObjectsModalController(model, selected, $uibModalInstance) {
var ctrl = this; var ctrl = this;
ctrl.model = { ctrl.model = {
@ -47,7 +47,7 @@
ctrl.dismiss = function dismiss() { ctrl.dismiss = function dismiss() {
ctrl.model.cancel = true; ctrl.model.cancel = true;
$modalInstance.dismiss(); $uibModalInstance.dismiss();
}; };
ctrl.action = function action() { ctrl.action = function action() {
@ -57,7 +57,7 @@
return model.recursiveDelete(ctrl.model, {tree: ctrl.model.collection}) return model.recursiveDelete(ctrl.model, {tree: ctrl.model.collection})
.then(function done() { ctrl.model.running = false; }); .then(function done() { ctrl.model.running = false; });
} else { } else {
$modalInstance.close(); $uibModalInstance.close();
} }
}; };
} }

View File

@ -23,14 +23,14 @@
beforeEach(module('horizon.dashboard.project')); beforeEach(module('horizon.dashboard.project'));
var $q, $rootScope, collectDeferred, controller, model; var $q, $rootScope, collectDeferred, controller, model;
var $modalInstance = { var $uibModalInstance = {
dismiss: angular.noop, dismiss: angular.noop,
close: angular.noop close: angular.noop
}; };
beforeEach(module('horizon.dashboard.project.containers')); beforeEach(module('horizon.dashboard.project.containers'));
beforeEach(inject(function ($injector, _$q_, _$modal_, _$rootScope_) { beforeEach(inject(function ($injector, _$q_, _$rootScope_) {
controller = $injector.get('$controller'); controller = $injector.get('$controller');
$q = _$q_; $q = _$q_;
$rootScope = _$rootScope_; $rootScope = _$rootScope_;
@ -41,7 +41,7 @@
function createController(selected) { function createController(selected) {
return controller('DeleteObjectsModalController', { return controller('DeleteObjectsModalController', {
$modalInstance: $modalInstance, $uibModalInstance: $uibModalInstance,
selected: selected selected: selected
}); });
} }
@ -67,30 +67,30 @@
}); });
it('should cancel collection on dismiss', function() { it('should cancel collection on dismiss', function() {
spyOn($modalInstance, 'dismiss'); spyOn($uibModalInstance, 'dismiss');
var ctrl = createController([]); var ctrl = createController([]);
expect(ctrl.model.cancel).toEqual(false); expect(ctrl.model.cancel).toEqual(false);
ctrl.dismiss(); ctrl.dismiss();
expect(ctrl.model.cancel).toEqual(true); expect(ctrl.model.cancel).toEqual(true);
expect($modalInstance.dismiss).toHaveBeenCalled(); expect($uibModalInstance.dismiss).toHaveBeenCalled();
}); });
it('should close perform delete on OK after collection', function() { it('should close perform delete on OK after collection', function() {
spyOn($modalInstance, 'close'); spyOn($uibModalInstance, 'close');
var ctrl = createController([]); var ctrl = createController([]);
ctrl.model.mode = 'deletion'; ctrl.model.mode = 'deletion';
ctrl.action(); ctrl.action();
expect($modalInstance.close).toHaveBeenCalled(); expect($uibModalInstance.close).toHaveBeenCalled();
}); });
it('should close dialog on OK after delete', function() { it('should close dialog on OK after delete', function() {
var deferred = $q.defer(); var deferred = $q.defer();
spyOn(model, 'recursiveDelete').and.returnValue(deferred.promise); spyOn(model, 'recursiveDelete').and.returnValue(deferred.promise);
spyOn($modalInstance, 'close'); spyOn($uibModalInstance, 'close');
var ctrl = createController([]); var ctrl = createController([]);
ctrl.model.mode = 'discovery'; ctrl.model.mode = 'discovery';

View File

@ -59,13 +59,13 @@
}); });
} }
function uploadModal(html, $modal) { function uploadModal(html, $uibModal) {
var localSpec = { var localSpec = {
backdrop: 'static', backdrop: 'static',
controller: 'horizon.dashboard.project.containers.UploadObjectModalController as ctrl', controller: 'horizon.dashboard.project.containers.UploadObjectModalController as ctrl',
templateUrl: html templateUrl: html
}; };
return $modal.open(localSpec).result; return $uibModal.open(localSpec).result;
} }
uploadService.$inject = [ uploadService.$inject = [
@ -75,17 +75,17 @@
'horizon.framework.util.q.extensions', 'horizon.framework.util.q.extensions',
'horizon.framework.widgets.modal-wait-spinner.service', 'horizon.framework.widgets.modal-wait-spinner.service',
'horizon.framework.widgets.toast.service', 'horizon.framework.widgets.toast.service',
'$modal' '$uibModal'
]; ];
function uploadService(swiftAPI, basePath, model, $qExtensions, modalWaitSpinnerService, function uploadService(swiftAPI, basePath, model, $qExtensions, modalWaitSpinnerService,
toastService, $modal) { toastService, $uibModal) {
var service = { var service = {
allowed: function allowed() { allowed: function allowed() {
return $qExtensions.booleanAsPromise(true); return $qExtensions.booleanAsPromise(true);
}, },
perform: function perform() { perform: function perform() {
uploadModal(basePath + 'upload-object-modal.html', $modal) uploadModal(basePath + 'upload-object-modal.html', $uibModal)
.then(service.uploadObjectCallback); .then(service.uploadObjectCallback);
}, },
uploadObjectCallback: uploadObjectCallback uploadObjectCallback: uploadObjectCallback
@ -121,16 +121,16 @@
'horizon.dashboard.project.containers.containers-model', 'horizon.dashboard.project.containers.containers-model',
'horizon.framework.util.q.extensions', 'horizon.framework.util.q.extensions',
'horizon.framework.widgets.toast.service', 'horizon.framework.widgets.toast.service',
'$modal' '$uibModal'
]; ];
function createFolderService(swiftAPI, basePath, model, $qExtensions, toastService, $modal) { function createFolderService(swiftAPI, basePath, model, $qExtensions, toastService, $uibModal) {
var service = { var service = {
allowed: function allowed() { allowed: function allowed() {
return $qExtensions.booleanAsPromise(true); return $qExtensions.booleanAsPromise(true);
}, },
perform: function perform() { perform: function perform() {
uploadModal(basePath + 'create-folder-modal.html', $modal) uploadModal(basePath + 'create-folder-modal.html', $uibModal)
.then(service.createFolderCallback); .then(service.createFolderCallback);
}, },
createFolderCallback: createFolderCallback createFolderCallback: createFolderCallback
@ -161,10 +161,10 @@
'horizon.dashboard.project.containers.basePath', 'horizon.dashboard.project.containers.basePath',
'horizon.framework.util.actions.action-result.service', 'horizon.framework.util.actions.action-result.service',
'horizon.framework.util.q.extensions', 'horizon.framework.util.q.extensions',
'$modal' '$uibModal'
]; ];
function deleteService(basePath, actionResultService, $qExtensions, $modal) { function deleteService(basePath, actionResultService, $qExtensions, $uibModal) {
return { return {
allowed: function allowed() { allowed: function allowed() {
return $qExtensions.booleanAsPromise(true); return $qExtensions.booleanAsPromise(true);
@ -181,7 +181,7 @@
} }
}; };
return $modal.open(localSpec).result.then(function finished() { return $uibModal.open(localSpec).result.then(function finished() {
return actionResultService.getActionResult().deleted( return actionResultService.getActionResult().deleted(
'OS::Swift::Object', 'DELETED' 'OS::Swift::Object', 'DELETED'
).result; ).result;

View File

@ -66,10 +66,10 @@
}); });
describe('uploadService', function test() { describe('uploadService', function test() {
var $modal, uploadService; var $uibModal, uploadService;
beforeEach(inject(function inject($injector, _$modal_) { beforeEach(inject(function inject($injector, _$uibModal_) {
$modal = _$modal_; $uibModal = _$uibModal_;
uploadService = $injector.get( uploadService = $injector.get(
'horizon.dashboard.project.containers.objects-batch-actions.upload' 'horizon.dashboard.project.containers.objects-batch-actions.upload'
); );
@ -87,14 +87,14 @@
it('should create "upload file" modals', function test() { it('should create "upload file" modals', function test() {
var deferred = $q.defer(); var deferred = $q.defer();
var result = { result: deferred.promise }; var result = { result: deferred.promise };
spyOn($modal, 'open').and.returnValue(result); spyOn($uibModal, 'open').and.returnValue(result);
model.container = {name: 'ham'}; model.container = {name: 'ham'};
spyOn(uploadService, 'uploadObjectCallback'); spyOn(uploadService, 'uploadObjectCallback');
uploadService.perform(); uploadService.perform();
expect($modal.open).toHaveBeenCalled(); expect($uibModal.open).toHaveBeenCalled();
var spec = $modal.open.calls.mostRecent().args[0]; var spec = $uibModal.open.calls.mostRecent().args[0];
expect(spec.backdrop).toBeDefined(); expect(spec.backdrop).toBeDefined();
expect(spec.controller).toBeDefined(); expect(spec.controller).toBeDefined();
expect(spec.templateUrl).toEqual('/base/path/upload-object-modal.html'); expect(spec.templateUrl).toEqual('/base/path/upload-object-modal.html');
@ -130,10 +130,10 @@
}); });
describe('createFolderService', function test() { describe('createFolderService', function test() {
var $modal, createFolderService; var $uibModal, createFolderService;
beforeEach(inject(function inject($injector, _$modal_) { beforeEach(inject(function inject($injector, _$uibModal_) {
$modal = _$modal_; $uibModal = _$uibModal_;
createFolderService = $injector.get( createFolderService = $injector.get(
'horizon.dashboard.project.containers.objects-batch-actions.create-folder' 'horizon.dashboard.project.containers.objects-batch-actions.create-folder'
); );
@ -151,13 +151,13 @@
it('should create "create folder" modals', function test() { it('should create "create folder" modals', function test() {
var deferred = $q.defer(); var deferred = $q.defer();
var result = {result: deferred.promise}; var result = {result: deferred.promise};
spyOn($modal, 'open').and.returnValue(result); spyOn($uibModal, 'open').and.returnValue(result);
spyOn(createFolderService, 'createFolderCallback'); spyOn(createFolderService, 'createFolderCallback');
createFolderService.perform(); createFolderService.perform();
expect($modal.open).toHaveBeenCalled(); expect($uibModal.open).toHaveBeenCalled();
var spec = $modal.open.calls.mostRecent().args[0]; var spec = $uibModal.open.calls.mostRecent().args[0];
expect(spec.backdrop).toBeDefined(); expect(spec.backdrop).toBeDefined();
expect(spec.controller).toBeDefined(); expect(spec.controller).toBeDefined();
expect(spec.templateUrl).toEqual('/base/path/create-folder-modal.html'); expect(spec.templateUrl).toEqual('/base/path/create-folder-modal.html');
@ -186,14 +186,14 @@
}); });
describe('deleteService', function test() { describe('deleteService', function test() {
var actionResultService, deleteService, $modal, $q; var actionResultService, deleteService, $uibModal, $q;
beforeEach(inject(function inject($injector, _$q_, _$modal_) { beforeEach(inject(function inject($injector, _$q_, _$uibModal_) {
actionResultService = $injector.get('horizon.framework.util.actions.action-result.service'); actionResultService = $injector.get('horizon.framework.util.actions.action-result.service');
deleteService = $injector.get( deleteService = $injector.get(
'horizon.dashboard.project.containers.objects-batch-actions.delete' 'horizon.dashboard.project.containers.objects-batch-actions.delete'
); );
$modal = _$modal_; $uibModal = _$uibModal_;
$q = _$q_; $q = _$q_;
})); }));
@ -210,13 +210,13 @@
// deferred to be resolved then the modal is "closed" in a bit // deferred to be resolved then the modal is "closed" in a bit
var deferred = $q.defer(); var deferred = $q.defer();
var result = {result: deferred.promise}; var result = {result: deferred.promise};
spyOn($modal, 'open').and.returnValue(result); spyOn($uibModal, 'open').and.returnValue(result);
spyOn(actionResultService, 'getActionResult').and.callThrough(); spyOn(actionResultService, 'getActionResult').and.callThrough();
deleteService.perform(['one', 'two']); deleteService.perform(['one', 'two']);
expect($modal.open).toHaveBeenCalled(); expect($uibModal.open).toHaveBeenCalled();
var spec = $modal.open.calls.mostRecent().args[0]; var spec = $uibModal.open.calls.mostRecent().args[0];
expect(spec.backdrop).toBeDefined(); expect(spec.backdrop).toBeDefined();
expect(spec.controller).toEqual('DeleteObjectsModalController as ctrl'); expect(spec.controller).toEqual('DeleteObjectsModalController as ctrl');
expect(spec.templateUrl).toEqual('/base/path/delete-objects-modal.html'); expect(spec.templateUrl).toEqual('/base/path/delete-objects-modal.html');

View File

@ -93,10 +93,10 @@
'horizon.dashboard.project.containers.basePath', 'horizon.dashboard.project.containers.basePath',
'horizon.dashboard.project.containers.containers-model', 'horizon.dashboard.project.containers.containers-model',
'horizon.framework.util.q.extensions', 'horizon.framework.util.q.extensions',
'$modal' '$uibModal'
]; ];
function viewService(swiftAPI, basePath, model, $qExtensions, $modal) { function viewService(swiftAPI, basePath, model, $qExtensions, $uibModal) {
return { return {
allowed: allowed, allowed: allowed,
perform: perform perform: perform
@ -124,7 +124,7 @@
} }
}; };
$modal.open(localSpec); $uibModal.open(localSpec);
} }
} }
@ -135,11 +135,11 @@
'horizon.framework.util.q.extensions', 'horizon.framework.util.q.extensions',
'horizon.framework.widgets.modal-wait-spinner.service', 'horizon.framework.widgets.modal-wait-spinner.service',
'horizon.framework.widgets.toast.service', 'horizon.framework.widgets.toast.service',
'$modal' '$uibModal'
]; ];
function editService(swiftAPI, basePath, model, $qExtensions, modalWaitSpinnerService, function editService(swiftAPI, basePath, model, $qExtensions, modalWaitSpinnerService,
toastService, $modal) { toastService, $uibModal) {
return { return {
allowed: allowed, allowed: allowed,
perform: perform perform: perform
@ -163,7 +163,7 @@
} }
} }
}; };
return $modal.open(localSpec).result.then(editObjectCallback); return $uibModal.open(localSpec).result.then(editObjectCallback);
} }
function editObjectCallback(uploadInfo) { function editObjectCallback(uploadInfo) {
@ -197,10 +197,10 @@
'horizon.dashboard.project.containers.basePath', 'horizon.dashboard.project.containers.basePath',
'horizon.framework.util.actions.action-result.service', 'horizon.framework.util.actions.action-result.service',
'horizon.framework.util.q.extensions', 'horizon.framework.util.q.extensions',
'$modal' '$uibModal'
]; ];
function deleteService(basePath, actionResultService, $qExtensions, $modal) { function deleteService(basePath, actionResultService, $qExtensions, $uibModal) {
return { return {
allowed: allowed, allowed: allowed,
perform: perform perform: perform
@ -222,7 +222,7 @@
} }
}; };
return $modal.open(localSpec).result.then(function finished() { return $uibModal.open(localSpec).result.then(function finished() {
return actionResultService.getActionResult().deleted( return actionResultService.getActionResult().deleted(
'OS::Swift::Object', file.name 'OS::Swift::Object', file.name
).result; ).result;

View File

@ -29,14 +29,14 @@
$provide.value('$window', $window); $provide.value('$window', $window);
})); }));
var rowActions, $modal, $rootScope, model; var rowActions, $uibModal, $rootScope, model;
beforeEach(inject(function inject($injector, _$modal_, _$rootScope_) { beforeEach(inject(function inject($injector, _$uibModal_, _$rootScope_) {
var resourceService = $injector.get('horizon.framework.conf.resource-type-registry.service'); var resourceService = $injector.get('horizon.framework.conf.resource-type-registry.service');
var objectResCode = $injector.get('horizon.dashboard.project.containers.object.resourceType'); var objectResCode = $injector.get('horizon.dashboard.project.containers.object.resourceType');
rowActions = resourceService.getResourceType(objectResCode).itemActions; rowActions = resourceService.getResourceType(objectResCode).itemActions;
model = $injector.get('horizon.dashboard.project.containers.containers-model'); model = $injector.get('horizon.dashboard.project.containers.containers-model');
$modal = _$modal_; $uibModal = _$uibModal_;
$rootScope = _$rootScope_; $rootScope = _$rootScope_;
})); }));
@ -100,7 +100,7 @@
}); });
it('should open a dialog on perform()', function test() { it('should open a dialog on perform()', function test() {
spyOn($modal, 'open'); spyOn($uibModal, 'open');
var deferred = $q.defer(); var deferred = $q.defer();
spyOn(swiftAPI, 'getObjectDetails').and.returnValue(deferred.promise); spyOn(swiftAPI, 'getObjectDetails').and.returnValue(deferred.promise);
model.container = {name: 'spam'}; model.container = {name: 'spam'};
@ -117,8 +117,8 @@
}}); }});
$rootScope.$apply(); $rootScope.$apply();
expect($modal.open).toHaveBeenCalled(); expect($uibModal.open).toHaveBeenCalled();
var spec = $modal.open.calls.mostRecent().args[0]; var spec = $uibModal.open.calls.mostRecent().args[0];
expect(spec.backdrop).toBeDefined(); expect(spec.backdrop).toBeDefined();
expect(spec.controller).toBeDefined(); expect(spec.controller).toBeDefined();
expect(spec.templateUrl).toEqual('/base/path/object-details-modal.html'); expect(spec.templateUrl).toEqual('/base/path/object-details-modal.html');
@ -150,14 +150,14 @@
// deferred to be resolved then the modal is "closed" in a bit // deferred to be resolved then the modal is "closed" in a bit
var deferred = $q.defer(); var deferred = $q.defer();
var result = { result: deferred.promise }; var result = { result: deferred.promise };
spyOn($modal, 'open').and.returnValue(result); spyOn($uibModal, 'open').and.returnValue(result);
spyOn(actionResultService, 'getActionResult').and.callThrough(); spyOn(actionResultService, 'getActionResult').and.callThrough();
deleteService.perform({name: 'ham'}); deleteService.perform({name: 'ham'});
$rootScope.$apply(); $rootScope.$apply();
expect($modal.open).toHaveBeenCalled(); expect($uibModal.open).toHaveBeenCalled();
var spec = $modal.open.calls.mostRecent().args[0]; var spec = $uibModal.open.calls.mostRecent().args[0];
expect(spec.controller).toBeDefined(); expect(spec.controller).toBeDefined();
expect(spec.templateUrl).toBeDefined(); expect(spec.templateUrl).toBeDefined();
expect(spec.resolve).toBeDefined(); expect(spec.resolve).toBeDefined();
@ -201,7 +201,7 @@
var modalDeferred = $q.defer(); var modalDeferred = $q.defer();
var apiDeferred = $q.defer(); var apiDeferred = $q.defer();
var result = { result: modalDeferred.promise }; var result = { result: modalDeferred.promise };
spyOn($modal, 'open').and.returnValue(result); spyOn($uibModal, 'open').and.returnValue(result);
spyOn(modalWaitSpinnerService, 'showModalSpinner'); spyOn(modalWaitSpinnerService, 'showModalSpinner');
spyOn(modalWaitSpinnerService, 'hideModalSpinner'); spyOn(modalWaitSpinnerService, 'hideModalSpinner');
spyOn(swiftAPI, 'uploadObject').and.returnValue(apiDeferred.promise); spyOn(swiftAPI, 'uploadObject').and.returnValue(apiDeferred.promise);
@ -219,7 +219,7 @@
$rootScope.$apply(); $rootScope.$apply();
// Check the string of functions called by this code path succeed // Check the string of functions called by this code path succeed
expect($modal.open).toHaveBeenCalled(); expect($uibModal.open).toHaveBeenCalled();
expect(modalWaitSpinnerService.showModalSpinner).toHaveBeenCalled(); expect(modalWaitSpinnerService.showModalSpinner).toHaveBeenCalled();
expect(swiftAPI.uploadObject).toHaveBeenCalled(); expect(swiftAPI.uploadObject).toHaveBeenCalled();
expect(toastService.add).toHaveBeenCalledWith('success', 'File /folder/ham uploaded.'); expect(toastService.add).toHaveBeenCalledWith('success', 'File /folder/ham uploaded.');
@ -232,7 +232,7 @@
var modalDeferred = $q.defer(); var modalDeferred = $q.defer();
var apiDeferred = $q.defer(); var apiDeferred = $q.defer();
var result = { result: modalDeferred.promise }; var result = { result: modalDeferred.promise };
spyOn($modal, 'open').and.returnValue(result); spyOn($uibModal, 'open').and.returnValue(result);
spyOn(modalWaitSpinnerService, 'showModalSpinner'); spyOn(modalWaitSpinnerService, 'showModalSpinner');
spyOn(modalWaitSpinnerService, 'hideModalSpinner'); spyOn(modalWaitSpinnerService, 'hideModalSpinner');
spyOn(swiftAPI, 'uploadObject').and.returnValue(apiDeferred.promise); spyOn(swiftAPI, 'uploadObject').and.returnValue(apiDeferred.promise);
@ -253,7 +253,7 @@
expect(modalWaitSpinnerService.showModalSpinner).toHaveBeenCalled(); expect(modalWaitSpinnerService.showModalSpinner).toHaveBeenCalled();
expect(swiftAPI.uploadObject).toHaveBeenCalled(); expect(swiftAPI.uploadObject).toHaveBeenCalled();
expect(modalWaitSpinnerService.hideModalSpinner).toHaveBeenCalled(); expect(modalWaitSpinnerService.hideModalSpinner).toHaveBeenCalled();
expect($modal.open).toHaveBeenCalled(); expect($uibModal.open).toHaveBeenCalled();
// Check the success branch is not called // Check the success branch is not called
expect(model.updateContainer).not.toHaveBeenCalled(); expect(model.updateContainer).not.toHaveBeenCalled();

View File

@ -22,7 +22,7 @@
.controller('LaunchInstanceCreateKeyPairController', LaunchInstanceCreateKeyPairController); .controller('LaunchInstanceCreateKeyPairController', LaunchInstanceCreateKeyPairController);
LaunchInstanceCreateKeyPairController.$inject = [ LaunchInstanceCreateKeyPairController.$inject = [
'$modalInstance', '$uibModalInstance',
'existingKeypairs', 'existingKeypairs',
'horizon.app.core.openstack-service-api.nova', 'horizon.app.core.openstack-service-api.nova',
'horizon.framework.widgets.toast.service', 'horizon.framework.widgets.toast.service',
@ -32,7 +32,7 @@
/** /**
* @ngdoc controller * @ngdoc controller
* @name LaunchInstanceCreateKeyPairController * @name LaunchInstanceCreateKeyPairController
* @param {Object} $modalInstance * @param {Object} $uibModalInstance
* @param {Object} existingKeypairs * @param {Object} existingKeypairs
* @param {Object} nova * @param {Object} nova
* @param {Object} toastService * @param {Object} toastService
@ -41,7 +41,7 @@
* Provide a dialog for creation of a new key pair. * Provide a dialog for creation of a new key pair.
* @returns {undefined} Returns nothing * @returns {undefined} Returns nothing
*/ */
function LaunchInstanceCreateKeyPairController($modalInstance, existingKeypairs, nova, function LaunchInstanceCreateKeyPairController($uibModalInstance, existingKeypairs, nova,
toastService, keypairDownloadService) { toastService, keypairDownloadService) {
var ctrl = this; var ctrl = this;
@ -87,7 +87,7 @@
keypairDownloadService.createAndDownloadKeypair(ctrl.keypair).then( keypairDownloadService.createAndDownloadKeypair(ctrl.keypair).then(
function success(createdKeypair) { function success(createdKeypair) {
createdKeypair.regenerateUrl = nova.getRegenerateKeypairUrl(createdKeypair.name); createdKeypair.regenerateUrl = nova.getRegenerateKeypairUrl(createdKeypair.name);
$modalInstance.close(createdKeypair); $uibModalInstance.close(createdKeypair);
}, },
function error() { function error() {
var errorMessage = interpolate(gettext('Unable to generate "%s". Please try again.'), var errorMessage = interpolate(gettext('Unable to generate "%s". Please try again.'),
@ -104,7 +104,7 @@
* Dismisses the modal * Dismisses the modal
*/ */
function cancel() { function cancel() {
$modalInstance.dismiss(); $uibModalInstance.dismiss();
} }
} }

View File

@ -47,7 +47,7 @@
beforeEach(module('horizon.dashboard.project')); beforeEach(module('horizon.dashboard.project'));
beforeEach(module(function ($provide) { beforeEach(module(function ($provide) {
$provide.value('$modalInstance', modalInstanceMock); $provide.value('$uibModalInstance', modalInstanceMock);
$provide.value('horizon.framework.widgets.toast.service', toastServiceMock); $provide.value('horizon.framework.widgets.toast.service', toastServiceMock);
$provide.value('existingKeypairs', mockExistingKeypairs); $provide.value('existingKeypairs', mockExistingKeypairs);
$provide.value( $provide.value(

View File

@ -22,7 +22,7 @@
.controller('LaunchInstanceImportKeyPairController', LaunchInstanceImportKeyPairController); .controller('LaunchInstanceImportKeyPairController', LaunchInstanceImportKeyPairController);
LaunchInstanceImportKeyPairController.$inject = [ LaunchInstanceImportKeyPairController.$inject = [
'$modalInstance', '$uibModalInstance',
'horizon.app.core.openstack-service-api.nova', 'horizon.app.core.openstack-service-api.nova',
'horizon.framework.widgets.toast.service', 'horizon.framework.widgets.toast.service',
'horizon.dashboard.project.workflow.launch-instance.basePath' 'horizon.dashboard.project.workflow.launch-instance.basePath'
@ -31,7 +31,7 @@
/** /**
* @ngdoc controller * @ngdoc controller
* @name LaunchInstanceImportKeyPairController * @name LaunchInstanceImportKeyPairController
* @param {Object} $modalInstance * @param {Object} $uibModalInstance
* @param {Object} novaAPI * @param {Object} novaAPI
* @param {Object} toastService * @param {Object} toastService
* @param {string} basePath * @param {string} basePath
@ -39,7 +39,8 @@
* Provide a dialog for import of an existing ssh public key. * Provide a dialog for import of an existing ssh public key.
* @returns {undefined} Returns nothing * @returns {undefined} Returns nothing
*/ */
function LaunchInstanceImportKeyPairController($modalInstance, novaAPI, toastService, basePath) { function LaunchInstanceImportKeyPairController($uibModalInstance, novaAPI,
toastService, basePath) {
var ctrl = this; var ctrl = this;
ctrl.submit = submit; ctrl.submit = submit;
@ -54,14 +55,14 @@
} }
function successCallback(data) { function successCallback(data) {
$modalInstance.close(data.data); $uibModalInstance.close(data.data);
var successMsg = gettext('Successfully imported key pair %(name)s.'); var successMsg = gettext('Successfully imported key pair %(name)s.');
toastService.add('success', interpolate(successMsg, { name: data.data.name }, true)); toastService.add('success', interpolate(successMsg, { name: data.data.name }, true));
} }
function cancel() { function cancel() {
$modalInstance.dismiss(); $uibModalInstance.dismiss();
} }
} }

View File

@ -33,7 +33,7 @@
beforeEach(inject(function($injector, $controller, _$q_, _$rootScope_) { beforeEach(inject(function($injector, $controller, _$q_, _$rootScope_) {
novaAPI = $injector.get('horizon.app.core.openstack-service-api.nova'); novaAPI = $injector.get('horizon.app.core.openstack-service-api.nova');
ctrl = $controller('LaunchInstanceImportKeyPairController', { ctrl = $controller('LaunchInstanceImportKeyPairController', {
$modalInstance: modalInstanceMock $uibModalInstance: modalInstanceMock
}); });
$q = _$q_; $q = _$q_;
$rootScope = _$rootScope_; $rootScope = _$rootScope_;

View File

@ -24,7 +24,7 @@
LaunchInstanceKeypairController.$inject = [ LaunchInstanceKeypairController.$inject = [
'horizon.dashboard.project.workflow.launch-instance.basePath', 'horizon.dashboard.project.workflow.launch-instance.basePath',
'launchInstanceModel', 'launchInstanceModel',
'$modal', '$uibModal',
'horizon.framework.widgets.toast.service', 'horizon.framework.widgets.toast.service',
'horizon.app.core.openstack-service-api.settings' 'horizon.app.core.openstack-service-api.settings'
]; ];
@ -34,7 +34,7 @@
* @name LaunchInstanceKeypairController * @name LaunchInstanceKeypairController
* @param {string} basePath * @param {string} basePath
* @param {Object} launchInstanceModel * @param {Object} launchInstanceModel
* @param {Object} $modal * @param {Object} $uibModal
* @param {Object} toastService * @param {Object} toastService
* @description * @description
* Allows selection of key pairs. * Allows selection of key pairs.
@ -43,7 +43,7 @@
function LaunchInstanceKeypairController( function LaunchInstanceKeypairController(
basePath, basePath,
launchInstanceModel, launchInstanceModel,
$modal, $uibModal,
toastService, toastService,
settingsService settingsService
) { ) {
@ -124,7 +124,7 @@
* @returns {undefined} No return value * @returns {undefined} No return value
*/ */
function createKeyPair() { function createKeyPair() {
$modal.open({ $uibModal.open({
templateUrl: basePath + 'keypair/create-keypair.html', templateUrl: basePath + 'keypair/create-keypair.html',
controller: 'LaunchInstanceCreateKeyPairController as ctrl', controller: 'LaunchInstanceCreateKeyPairController as ctrl',
windowClass: 'modal-dialog-wizard', windowClass: 'modal-dialog-wizard',
@ -160,7 +160,7 @@
* @returns {undefined} No return value * @returns {undefined} No return value
*/ */
function importKeyPair() { function importKeyPair() {
$modal.open({ $uibModal.open({
templateUrl: basePath + 'keypair/import-keypair.html', templateUrl: basePath + 'keypair/import-keypair.html',
controller: 'LaunchInstanceImportKeyPairController as ctrl', controller: 'LaunchInstanceImportKeyPairController as ctrl',
windowClass: 'modal-dialog-wizard' windowClass: 'modal-dialog-wizard'

View File

@ -20,7 +20,7 @@
describe('LaunchInstanceKeypairController', function() { describe('LaunchInstanceKeypairController', function() {
var ctrl, q, settings; var ctrl, q, settings;
var $modal = { open: angular.noop }; var $uibModal = { open: angular.noop };
var toastServiceMock = {add: angular.noop}; var toastServiceMock = {add: angular.noop};
beforeEach(module('horizon.dashboard.project')); beforeEach(module('horizon.dashboard.project'));
@ -34,7 +34,7 @@
}); });
beforeEach(module(function ($provide) { beforeEach(module(function ($provide) {
$provide.value('$modal', $modal); $provide.value('$uibModal', $uibModal);
$provide.value('horizon.framework.widgets.toast.service', toastServiceMock); $provide.value('horizon.framework.widgets.toast.service', toastServiceMock);
$provide.value('horizon.app.core.openstack-service-api.settings', { $provide.value('horizon.app.core.openstack-service-api.settings', {
getSetting: function(setting) { getSetting: function(setting) {
@ -100,25 +100,25 @@
}); });
it('createKeyPair opens a modal', function() { it('createKeyPair opens a modal', function() {
spyOn($modal, 'open').and.returnValue({result: {then: angular.noop}}); spyOn($uibModal, 'open').and.returnValue({result: {then: angular.noop}});
ctrl.createKeyPair(); ctrl.createKeyPair();
expect($modal.open).toHaveBeenCalled(); expect($uibModal.open).toHaveBeenCalled();
}); });
it('should pass the create keypair submodal the existing keypairs', function() { it('should pass the create keypair submodal the existing keypairs', function() {
spyOn($modal, 'open').and.returnValue({ spyOn($uibModal, 'open').and.returnValue({
result: {then: angular.noop} result: {then: angular.noop}
}); });
ctrl.createKeyPair(); ctrl.createKeyPair();
var modalParameters = $modal.open.calls.mostRecent().args[0]; var modalParameters = $uibModal.open.calls.mostRecent().args[0];
expect(modalParameters.resolve.existingKeypairs()).toEqual(['key1','key2']); expect(modalParameters.resolve.existingKeypairs()).toEqual(['key1','key2']);
}); });
function getCreateKeypairModalCallback() { function getCreateKeypairModalCallback() {
var result = {result: {then: angular.noop}}; var result = {result: {then: angular.noop}};
spyOn(result.result, 'then'); spyOn(result.result, 'then');
spyOn($modal, 'open').and.returnValue(result); spyOn($uibModal, 'open').and.returnValue(result);
ctrl.createKeyPair(); ctrl.createKeyPair();
@ -149,20 +149,20 @@
}); });
it('importKeyPair opens a modal', function() { it('importKeyPair opens a modal', function() {
spyOn($modal, 'open').and.returnValue({result: {then: angular.noop}}); spyOn($uibModal, 'open').and.returnValue({result: {then: angular.noop}});
ctrl.importKeyPair(); ctrl.importKeyPair();
expect($modal.open).toHaveBeenCalled(); expect($uibModal.open).toHaveBeenCalled();
}); });
it('importKeyPairCallback is called', function() { it('importKeyPairCallback is called', function() {
var result = {result: {then: angular.noop}}; var result = {result: {then: angular.noop}};
spyOn(result.result, 'then'); spyOn(result.result, 'then');
spyOn($modal, 'open').and.returnValue(result); spyOn($uibModal, 'open').and.returnValue(result);
ctrl.importKeyPair(); ctrl.importKeyPair();
var importKeypairModalcallback = result.result.then.calls.argsFor(0)[0]; var importKeypairModalcallback = result.result.then.calls.argsFor(0)[0];
var callbackInput = {name: "June"}; var callbackInput = {name: "June"};
$modal.open.calls.reset(); $uibModal.open.calls.reset();
importKeypairModalcallback(callbackInput); importKeypairModalcallback(callbackInput);
expect(callbackInput.id).toBe("June"); expect(callbackInput.id).toBe("June");
}); });

View File

@ -24,12 +24,12 @@
); );
LaunchInstanceModalService.$inject = [ LaunchInstanceModalService.$inject = [
'$modal', '$uibModal',
'$window', '$window',
'horizon.dashboard.project.workflow.launch-instance.modal-spec' 'horizon.dashboard.project.workflow.launch-instance.modal-spec'
]; ];
function LaunchInstanceModalService($modal, $window, modalSpec) { function LaunchInstanceModalService($uibModal, $window, modalSpec) {
var service = { var service = {
open: open open: open
}; };
@ -47,7 +47,7 @@
angular.extend(localSpec, modalSpec); angular.extend(localSpec, modalSpec);
var launchInstanceModal = $modal.open(localSpec); var launchInstanceModal = $uibModal.open(localSpec);
var handleModalClose = function (redirectPropertyName) { var handleModalClose = function (redirectPropertyName) {
return function () { return function () {
if (launchContext && launchContext[redirectPropertyName]) { if (launchContext && launchContext[redirectPropertyName]) {

View File

@ -31,8 +31,8 @@
} }
}; };
$window = { location: { href: '/' } }; $window = { location: { href: '/' } };
$provide.value('$modal', modal); $provide.value('$uibModal', modal);
$provide.value('$modalSpec', {}); $provide.value('$uibModalSpec', {});
$provide.value('$window', $window); $provide.value('$window', $window);
})); }));

View File

@ -32,7 +32,7 @@
<label class="btn btn-default" id="vol-create" <label class="btn btn-default" id="vol-create"
ng-repeat="option in ctrl.toggleButtonOptions" ng-repeat="option in ctrl.toggleButtonOptions"
ng-model="model.newInstanceSpec.vol_create" ng-model="model.newInstanceSpec.vol_create"
btn-radio="option.value">{$ ::option.label $}</label> uib-btn-radio="option.value">{$ ::option.label $}</label>
</div> </div>
</div> </div>
</div> </div>
@ -46,7 +46,7 @@
<label class="btn btn-default" <label class="btn btn-default"
ng-repeat="option in ctrl.toggleButtonOptions" ng-repeat="option in ctrl.toggleButtonOptions"
ng-model="model.newInstanceSpec.vol_delete_on_instance_delete" ng-model="model.newInstanceSpec.vol_delete_on_instance_delete"
btn-radio="option.value">{$ ::option.label $}</label> uib-btn-radio="option.value">{$ ::option.label $}</label>
</div> </div>
</div> </div>
</div> </div>
@ -85,7 +85,7 @@
<label class="btn btn-default" <label class="btn btn-default"
ng-repeat="option in ctrl.toggleButtonOptions" ng-repeat="option in ctrl.toggleButtonOptions"
ng-model="model.newInstanceSpec.vol_delete_on_instance_delete" ng-model="model.newInstanceSpec.vol_delete_on_instance_delete"
btn-radio="option.value">{$ ::option.label $}</label> uib-btn-radio="option.value">{$ ::option.label $}</label>
</div> </div>
</div> </div>
</div> </div>

View File

@ -62,7 +62,7 @@
<label class="btn btn-default btn-toggle" <label class="btn btn-default btn-toggle"
ng-repeat="option in ctrl.imageSourceOptions" ng-repeat="option in ctrl.imageSourceOptions"
ng-model="ctrl.image.source_type" ng-model="ctrl.image.source_type"
btn-radio="option.value">{$ ::option.label $}</label> uib-btn-radio="option.value">{$ ::option.label $}</label>
</div> </div>
</div> </div>
</div> </div>
@ -84,7 +84,7 @@
<input type="text" class="form-control" readonly ng-model="image_file.name"> <input type="text" class="form-control" readonly ng-model="image_file.name">
</div> </div>
<div ng-hide="ctrl.uploadProgress < 0" class="progress-text"> <div ng-hide="ctrl.uploadProgress < 0" class="progress-text">
<progressbar value="ctrl.uploadProgress"></progressbar> <uib-progressbar value="ctrl.uploadProgress"></uib-progressbar>
<span class="progress-bar-text">{$ ctrl.uploadProgress $}%</span> <span class="progress-bar-text">{$ ctrl.uploadProgress $}%</span>
</div> </div>
<p class="help-block alert alert-danger" <p class="help-block alert alert-danger"
@ -123,7 +123,7 @@
<label class="btn btn-default" <label class="btn btn-default"
ng-repeat="option in ctrl.imageCopyOptions" ng-repeat="option in ctrl.imageCopyOptions"
ng-model="ctrl.image.is_copying" ng-model="ctrl.image.is_copying"
btn-radio="option.value">{$ ::option.label $}</label> uib-btn-radio="option.value">{$ ::option.label $}</label>
</div> </div>
</div> </div>
</div> </div>
@ -234,7 +234,7 @@
<label class="btn btn-default" <label class="btn btn-default"
ng-repeat="option in ctrl.imageVisibilityOptions" ng-repeat="option in ctrl.imageVisibilityOptions"
ng-model="ctrl.image.visibility" ng-model="ctrl.image.visibility"
btn-radio="option.value">{$ ::option.label $}</label> uib-btn-radio="option.value">{$ ::option.label $}</label>
</div> </div>
</div> </div>
</div> </div>
@ -249,7 +249,7 @@
<label class="btn btn-default" <label class="btn btn-default"
ng-repeat="option in ctrl.imageProtectedOptions" ng-repeat="option in ctrl.imageProtectedOptions"
ng-model="ctrl.image.protected" ng-model="ctrl.image.protected"
btn-radio="option.value">{$ ::option.label $}</label> uib-btn-radio="option.value">{$ ::option.label $}</label>
</div> </div>
</div> </div>
</div> </div>

View File

@ -123,7 +123,7 @@
<label class="btn btn-default" <label class="btn btn-default"
ng-repeat="option in ctrl.imageVisibilityOptions" ng-repeat="option in ctrl.imageVisibilityOptions"
ng-model="ctrl.image.visibility" ng-model="ctrl.image.visibility"
btn-radio="option.value">{$ ::option.label $}</label> uib-btn-radio="option.value">{$ ::option.label $}</label>
</div> </div>
</div> </div>
</div> </div>
@ -136,7 +136,7 @@
<label class="btn btn-default" <label class="btn btn-default"
ng-repeat="option in ctrl.imageProtectedOptions" ng-repeat="option in ctrl.imageProtectedOptions"
ng-model="ctrl.image.protected" ng-model="ctrl.image.protected"
btn-radio="option.value">{$ ::option.label $}</label> uib-btn-radio="option.value">{$ ::option.label $}</label>
</div> </div>
</div> </div>
</div> </div>

View File

@ -22,11 +22,11 @@
.controller('MetadataModalController', MetadataModalController); .controller('MetadataModalController', MetadataModalController);
MetadataModalController.$inject = [ MetadataModalController.$inject = [
'$modalInstance', '$uibModalInstance',
'horizon.app.core.metadata.service', 'horizon.app.core.metadata.service',
'horizon.framework.widgets.metadata.tree.service', 'horizon.framework.widgets.metadata.tree.service',
'horizon.framework.widgets.toast.service', 'horizon.framework.widgets.toast.service',
// Dependencies injected with resolve by $modal.open // Dependencies injected with resolve by $uibModal.open
'available', 'available',
'existing', 'existing',
'params' 'params'
@ -39,7 +39,7 @@
* Controller used by `ModalService` * Controller used by `ModalService`
*/ */
function MetadataModalController( function MetadataModalController(
$modalInstance, metadataService, metadataTreeService, $uibModalInstance, metadataService, metadataTreeService,
toastService, available, existing, params toastService, available, existing, params
) { ) {
var ctrl = this; var ctrl = this;
@ -77,12 +77,12 @@
} }
function cancel() { function cancel() {
$modalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
} }
function onEditSuccess() { function onEditSuccess() {
toastService.add('success', gettext('Metadata was successfully updated.')); toastService.add('success', gettext('Metadata was successfully updated.'));
$modalInstance.close(); $uibModalInstance.close();
} }
function onEditFailure() { function onEditFailure() {

View File

@ -112,7 +112,7 @@
function createController() { function createController() {
//Purposely use different cases in available and existing. //Purposely use different cases in available and existing.
return $controller('MetadataModalController', { return $controller('MetadataModalController', {
'$modalInstance': modalInstance, '$uibModalInstance': modalInstance,
'horizon.framework.widgets.metadata.tree.service': treeService, 'horizon.framework.widgets.metadata.tree.service': treeService,
'horizon.app.core.metadata.service': metadataService, 'horizon.app.core.metadata.service': metadataService,
'available': {data: {items: [availableItem]}}, 'available': {data: {items: [availableItem]}},

View File

@ -21,7 +21,7 @@
.factory('horizon.app.core.metadata.modal.service', modalService); .factory('horizon.app.core.metadata.modal.service', modalService);
modalService.$inject = [ modalService.$inject = [
'$modal', '$uibModal',
'horizon.app.core.basePath', 'horizon.app.core.basePath',
'horizon.app.core.metadata.service', 'horizon.app.core.metadata.service',
'horizon.app.core.metadata.modal.constants' 'horizon.app.core.metadata.modal.constants'
@ -31,7 +31,7 @@
* @ngdoc service * @ngdoc service
* @name modalService * @name modalService
*/ */
function modalService($modal, path, metadataService, modalConstants) { function modalService($uibModal, path, metadataService, modalConstants) {
var service = { var service = {
open: open open: open
}; };
@ -66,7 +66,7 @@
resolve: resolve, resolve: resolve,
templateUrl: path + 'metadata/modal/modal.html' templateUrl: path + 'metadata/modal/modal.html'
}; };
return $modal.open(angular.extend(modalParams, modalConstants)); return $uibModal.open(angular.extend(modalParams, modalConstants));
} }
} }

View File

@ -19,12 +19,12 @@
describe('horizon.app.core.metadata.modal', function() { describe('horizon.app.core.metadata.modal', function() {
describe('service.modalservice', function() { describe('service.modalservice', function() {
var modalService, metadataService, $modal; var modalService, metadataService, $uibModal;
beforeEach(module('ui.bootstrap', function($provide) { beforeEach(module('ui.bootstrap', function($provide) {
$modal = jasmine.createSpyObj('$modal', ['open']); $uibModal = jasmine.createSpyObj('$uibModal', ['open']);
$provide.value('$modal', $modal); $provide.value('$uibModal', $uibModal);
})); }));
beforeEach(module('horizon.app.core', function($provide) { beforeEach(module('horizon.app.core', function($provide) {
@ -46,12 +46,12 @@
expect(modalService.open).toBeDefined(); expect(modalService.open).toBeDefined();
}); });
it('should invoke $modal.open with correct params', function() { it('should invoke $uibModal.open with correct params', function() {
modalService.open('resource', 'id'); modalService.open('resource', 'id');
expect($modal.open).toHaveBeenCalled(); expect($uibModal.open).toHaveBeenCalled();
var args = $modal.open.calls.argsFor(0)[0]; var args = $uibModal.open.calls.argsFor(0)[0];
expect(args.templateUrl).toEqual('/a/sample/path/metadata/modal/modal.html'); expect(args.templateUrl).toEqual('/a/sample/path/metadata/modal/modal.html');
expect(args.resolve.params()).toEqual({resource: 'resource', id: 'id'}); expect(args.resolve.params()).toEqual({resource: 'resource', id: 'id'});
}); });