Update for ui bootstrap changes

UI Bootstrap decided to prefix all of their services/functions, so we
need to add these prefixes for the code to continue to function.

This patch primarily addresses functionality - some styling is broken
even with this patch, but those breakages can be fixed once this
patch lands.

Change-Id: Ia6f593e27f81b2b00b6376426cc469a776c4add7
Depends-On: I7d8ebd4e9018332c1974672a0b99080c152ce6c3
This commit is contained in:
Rob Cresswell 2016-11-23 12:34:39 +00:00
parent c6d656a0b1
commit c89633c9b0
41 changed files with 185 additions and 184 deletions

View File

@ -61,7 +61,7 @@
* perform()'s final promise:
* ```
* 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;
* });
* }

View File

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

View File

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

View File

@ -23,7 +23,7 @@
.factory('horizon.framework.widgets.form.ModalFormService', service);
service.$inject = [
'$modal',
'$uibModal',
'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.
*/
function service(
$modal,
$uibModal,
widgetsBasePath
) {
@ -66,7 +66,7 @@
templateUrl: widgetsBasePath + 'form/modal-form.html'
};
return $modal.open(modalConfig).result;
return $uibModal.open(modalConfig).result;
}
}
})();

View File

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

View File

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

View File

@ -36,16 +36,16 @@
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',
template: '<div wait-spinner class="modal-body" text="my text"></div>',
windowClass: 'modal-wait-spinner modal_wrapper loading'
};
spyOn($modal, 'open');
spyOn($uibModal, 'open');
service.showModalSpinner('my text');
expect($modal.open).toHaveBeenCalled();
expect($modal.open.calls.count()).toBe(1);
expect($modal.open.calls.argsFor(0)).toEqual([wanted]);
expect($uibModal.open).toHaveBeenCalled();
expect($uibModal.open.calls.count()).toBe(1);
expect($uibModal.open.calls.argsFor(0)).toEqual([wanted]);
}));
});
@ -56,9 +56,9 @@
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() {}};
spyOn($modal, 'open').and.returnValue(modal);
spyOn($uibModal, 'open').and.returnValue(modal);
service.showModalSpinner('asdf');
spyOn(modal, 'dismiss');
service.hideModalSpinner();

View File

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

View File

@ -25,7 +25,7 @@
* Horizon's wrapper for angular-bootstrap modal service.
* It should only be use for small confirmation dialogs.
* @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:
* angular
@ -55,12 +55,12 @@
.factory('horizon.framework.widgets.modal.simple-modal.service', modalService);
modalService.$inject = [
'$modal',
'$uibModal',
'horizon.framework.widgets.basePath',
'horizon.framework.util.i18n.gettext'
];
function modalService($modal, path, gettext) {
function modalService($uibModal, path, gettext) {
var service = {
modal: modal
};
@ -84,7 +84,7 @@
}
}
};
return $modal.open(options);
return $uibModal.open(options);
}
} // end of modalOptions function
} // end of modalService function

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
.module('horizon.framework.widgets.wizard')
.controller('ModalContainerController', ModalContainerController);
ModalContainerController.$inject = ['$scope', '$modalInstance', 'launchContext'];
ModalContainerController.$inject = ['$scope', '$uibModalInstance', 'launchContext'];
/**
* @ngdoc controller
@ -29,16 +29,16 @@
* @description
* 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
// wizard and modal-container controller
/*eslint-disable angular/controller-as */
$scope.launchContext = launchContext;
$scope.close = function(args) {
$modalInstance.close(args);
$uibModalInstance.close(args);
};
$scope.cancel = function() {
$modalInstance.dismiss();
$uibModalInstance.dismiss();
};
/*eslint-enable angular/controller-as */
}

View File

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

View File

@ -246,7 +246,7 @@ horizon.datatables.confirm = function(action) {
return;
}
var $modal_parent = $action.closest('.modal');
var $uibModal_parent = $action.closest('.modal');
var name_array = [];
var action_string = $action.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);
modal.modal();
if ($modal_parent.length) {
if ($uibModal_parent.length) {
var child_backdrop = modal.next('.modal-backdrop');
// 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);
}

View File

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

View File

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

View File

@ -22,9 +22,9 @@
class="text-danger" translate>
Encountered {$ ctrl.model.deleted.failures $} failures.
</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"
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 class="modal-footer">

View File

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

View File

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

View File

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

View File

@ -66,10 +66,10 @@
});
describe('uploadService', function test() {
var $modal, uploadService;
var $uibModal, uploadService;
beforeEach(inject(function inject($injector, _$modal_) {
$modal = _$modal_;
beforeEach(inject(function inject($injector, _$uibModal_) {
$uibModal = _$uibModal_;
uploadService = $injector.get(
'horizon.dashboard.project.containers.objects-batch-actions.upload'
);
@ -87,14 +87,14 @@
it('should create "upload file" modals', function test() {
var deferred = $q.defer();
var result = { result: deferred.promise };
spyOn($modal, 'open').and.returnValue(result);
spyOn($uibModal, 'open').and.returnValue(result);
model.container = {name: 'ham'};
spyOn(uploadService, 'uploadObjectCallback');
uploadService.perform();
expect($modal.open).toHaveBeenCalled();
var spec = $modal.open.calls.mostRecent().args[0];
expect($uibModal.open).toHaveBeenCalled();
var spec = $uibModal.open.calls.mostRecent().args[0];
expect(spec.backdrop).toBeDefined();
expect(spec.controller).toBeDefined();
expect(spec.templateUrl).toEqual('/base/path/upload-object-modal.html');
@ -130,10 +130,10 @@
});
describe('createFolderService', function test() {
var $modal, createFolderService;
var $uibModal, createFolderService;
beforeEach(inject(function inject($injector, _$modal_) {
$modal = _$modal_;
beforeEach(inject(function inject($injector, _$uibModal_) {
$uibModal = _$uibModal_;
createFolderService = $injector.get(
'horizon.dashboard.project.containers.objects-batch-actions.create-folder'
);
@ -151,13 +151,13 @@
it('should create "create folder" modals', function test() {
var deferred = $q.defer();
var result = {result: deferred.promise};
spyOn($modal, 'open').and.returnValue(result);
spyOn($uibModal, 'open').and.returnValue(result);
spyOn(createFolderService, 'createFolderCallback');
createFolderService.perform();
expect($modal.open).toHaveBeenCalled();
var spec = $modal.open.calls.mostRecent().args[0];
expect($uibModal.open).toHaveBeenCalled();
var spec = $uibModal.open.calls.mostRecent().args[0];
expect(spec.backdrop).toBeDefined();
expect(spec.controller).toBeDefined();
expect(spec.templateUrl).toEqual('/base/path/create-folder-modal.html');
@ -186,14 +186,14 @@
});
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');
deleteService = $injector.get(
'horizon.dashboard.project.containers.objects-batch-actions.delete'
);
$modal = _$modal_;
$uibModal = _$uibModal_;
$q = _$q_;
}));
@ -210,13 +210,13 @@
// deferred to be resolved then the modal is "closed" in a bit
var deferred = $q.defer();
var result = {result: deferred.promise};
spyOn($modal, 'open').and.returnValue(result);
spyOn($uibModal, 'open').and.returnValue(result);
spyOn(actionResultService, 'getActionResult').and.callThrough();
deleteService.perform(['one', 'two']);
expect($modal.open).toHaveBeenCalled();
var spec = $modal.open.calls.mostRecent().args[0];
expect($uibModal.open).toHaveBeenCalled();
var spec = $uibModal.open.calls.mostRecent().args[0];
expect(spec.backdrop).toBeDefined();
expect(spec.controller).toEqual('DeleteObjectsModalController as ctrl');
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.containers-model',
'horizon.framework.util.q.extensions',
'$modal'
'$uibModal'
];
function viewService(swiftAPI, basePath, model, $qExtensions, $modal) {
function viewService(swiftAPI, basePath, model, $qExtensions, $uibModal) {
return {
allowed: allowed,
perform: perform
@ -124,7 +124,7 @@
}
};
$modal.open(localSpec);
$uibModal.open(localSpec);
}
}
@ -135,11 +135,11 @@
'horizon.framework.util.q.extensions',
'horizon.framework.widgets.modal-wait-spinner.service',
'horizon.framework.widgets.toast.service',
'$modal'
'$uibModal'
];
function editService(swiftAPI, basePath, model, $qExtensions, modalWaitSpinnerService,
toastService, $modal) {
toastService, $uibModal) {
return {
allowed: allowed,
perform: perform
@ -163,7 +163,7 @@
}
}
};
return $modal.open(localSpec).result.then(editObjectCallback);
return $uibModal.open(localSpec).result.then(editObjectCallback);
}
function editObjectCallback(uploadInfo) {
@ -197,10 +197,10 @@
'horizon.dashboard.project.containers.basePath',
'horizon.framework.util.actions.action-result.service',
'horizon.framework.util.q.extensions',
'$modal'
'$uibModal'
];
function deleteService(basePath, actionResultService, $qExtensions, $modal) {
function deleteService(basePath, actionResultService, $qExtensions, $uibModal) {
return {
allowed: allowed,
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(
'OS::Swift::Object', file.name
).result;

View File

@ -29,14 +29,14 @@
$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 objectResCode = $injector.get('horizon.dashboard.project.containers.object.resourceType');
rowActions = resourceService.getResourceType(objectResCode).itemActions;
model = $injector.get('horizon.dashboard.project.containers.containers-model');
$modal = _$modal_;
$uibModal = _$uibModal_;
$rootScope = _$rootScope_;
}));
@ -100,7 +100,7 @@
});
it('should open a dialog on perform()', function test() {
spyOn($modal, 'open');
spyOn($uibModal, 'open');
var deferred = $q.defer();
spyOn(swiftAPI, 'getObjectDetails').and.returnValue(deferred.promise);
model.container = {name: 'spam'};
@ -117,8 +117,8 @@
}});
$rootScope.$apply();
expect($modal.open).toHaveBeenCalled();
var spec = $modal.open.calls.mostRecent().args[0];
expect($uibModal.open).toHaveBeenCalled();
var spec = $uibModal.open.calls.mostRecent().args[0];
expect(spec.backdrop).toBeDefined();
expect(spec.controller).toBeDefined();
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
var deferred = $q.defer();
var result = { result: deferred.promise };
spyOn($modal, 'open').and.returnValue(result);
spyOn($uibModal, 'open').and.returnValue(result);
spyOn(actionResultService, 'getActionResult').and.callThrough();
deleteService.perform({name: 'ham'});
$rootScope.$apply();
expect($modal.open).toHaveBeenCalled();
var spec = $modal.open.calls.mostRecent().args[0];
expect($uibModal.open).toHaveBeenCalled();
var spec = $uibModal.open.calls.mostRecent().args[0];
expect(spec.controller).toBeDefined();
expect(spec.templateUrl).toBeDefined();
expect(spec.resolve).toBeDefined();
@ -201,7 +201,7 @@
var modalDeferred = $q.defer();
var apiDeferred = $q.defer();
var result = { result: modalDeferred.promise };
spyOn($modal, 'open').and.returnValue(result);
spyOn($uibModal, 'open').and.returnValue(result);
spyOn(modalWaitSpinnerService, 'showModalSpinner');
spyOn(modalWaitSpinnerService, 'hideModalSpinner');
spyOn(swiftAPI, 'uploadObject').and.returnValue(apiDeferred.promise);
@ -219,7 +219,7 @@
$rootScope.$apply();
// Check the string of functions called by this code path succeed
expect($modal.open).toHaveBeenCalled();
expect($uibModal.open).toHaveBeenCalled();
expect(modalWaitSpinnerService.showModalSpinner).toHaveBeenCalled();
expect(swiftAPI.uploadObject).toHaveBeenCalled();
expect(toastService.add).toHaveBeenCalledWith('success', 'File /folder/ham uploaded.');
@ -232,7 +232,7 @@
var modalDeferred = $q.defer();
var apiDeferred = $q.defer();
var result = { result: modalDeferred.promise };
spyOn($modal, 'open').and.returnValue(result);
spyOn($uibModal, 'open').and.returnValue(result);
spyOn(modalWaitSpinnerService, 'showModalSpinner');
spyOn(modalWaitSpinnerService, 'hideModalSpinner');
spyOn(swiftAPI, 'uploadObject').and.returnValue(apiDeferred.promise);
@ -253,7 +253,7 @@
expect(modalWaitSpinnerService.showModalSpinner).toHaveBeenCalled();
expect(swiftAPI.uploadObject).toHaveBeenCalled();
expect(modalWaitSpinnerService.hideModalSpinner).toHaveBeenCalled();
expect($modal.open).toHaveBeenCalled();
expect($uibModal.open).toHaveBeenCalled();
// Check the success branch is not called
expect(model.updateContainer).not.toHaveBeenCalled();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@
describe('LaunchInstanceKeypairController', function() {
var ctrl, q, settings;
var $modal = { open: angular.noop };
var $uibModal = { open: angular.noop };
var toastServiceMock = {add: angular.noop};
beforeEach(module('horizon.dashboard.project'));
@ -34,7 +34,7 @@
});
beforeEach(module(function ($provide) {
$provide.value('$modal', $modal);
$provide.value('$uibModal', $uibModal);
$provide.value('horizon.framework.widgets.toast.service', toastServiceMock);
$provide.value('horizon.app.core.openstack-service-api.settings', {
getSetting: function(setting) {
@ -100,25 +100,25 @@
});
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();
expect($modal.open).toHaveBeenCalled();
expect($uibModal.open).toHaveBeenCalled();
});
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}
});
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']);
});
function getCreateKeypairModalCallback() {
var result = {result: {then: angular.noop}};
spyOn(result.result, 'then');
spyOn($modal, 'open').and.returnValue(result);
spyOn($uibModal, 'open').and.returnValue(result);
ctrl.createKeyPair();
@ -149,20 +149,20 @@
});
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();
expect($modal.open).toHaveBeenCalled();
expect($uibModal.open).toHaveBeenCalled();
});
it('importKeyPairCallback is called', function() {
var result = {result: {then: angular.noop}};
spyOn(result.result, 'then');
spyOn($modal, 'open').and.returnValue(result);
spyOn($uibModal, 'open').and.returnValue(result);
ctrl.importKeyPair();
var importKeypairModalcallback = result.result.then.calls.argsFor(0)[0];
var callbackInput = {name: "June"};
$modal.open.calls.reset();
$uibModal.open.calls.reset();
importKeypairModalcallback(callbackInput);
expect(callbackInput.id).toBe("June");
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
.factory('horizon.app.core.metadata.modal.service', modalService);
modalService.$inject = [
'$modal',
'$uibModal',
'horizon.app.core.basePath',
'horizon.app.core.metadata.service',
'horizon.app.core.metadata.modal.constants'
@ -31,7 +31,7 @@
* @ngdoc service
* @name modalService
*/
function modalService($modal, path, metadataService, modalConstants) {
function modalService($uibModal, path, metadataService, modalConstants) {
var service = {
open: open
};
@ -66,7 +66,7 @@
resolve: resolve,
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('service.modalservice', function() {
var modalService, metadataService, $modal;
var modalService, metadataService, $uibModal;
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) {
@ -46,12 +46,12 @@
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');
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.resolve.params()).toEqual({resource: 'resource', id: 'id'});
});