Update angular bootstrap components

With the recent update to the angular-bootstrap version, a lot of
components are deprecated and now expect a 'uib' prefix. This patch
updates the components that were printing deprecation warnings in the
console. The library angular-confirm-modal was also updated due to the
older version also yielding similar deprecation warnings.

Change-Id: I201c2709e03041fce431070910491eb425c1e383
This commit is contained in:
Paul Van Eck 2016-02-25 15:24:29 -08:00
parent 2895164a84
commit d6124e0117
11 changed files with 46 additions and 45 deletions

View File

@ -8,7 +8,7 @@
"angular-resource": "1.3.15",
"angular-bootstrap": "0.14.3",
"angular-busy": "4.1.3",
"angular-confirm-modal": "1.1.0",
"angular-confirm-modal": "1.2.3",
"bootstrap": "3.3.2"
},
"devDependencies": {

View File

@ -11,14 +11,14 @@ variable 'capabilities'.
Status: <span class="{{ctrl.targetCapabilities[capability.id]}}">{{ctrl.targetCapabilities[capability.id]}}</span><br />
<span ng-if="capability.project">Project: {{capability.project | capitalize}}<br /></span>
<a ng-click="showAchievements = !hshowAchievements">Achievements ({{capability.achievements.length}})</a><br />
<ol collapse="!showAchievements" class="list-inline">
<ol uib-collapse="!showAchievements" class="list-inline">
<li ng-repeat="achievement in capability.achievements">
{{achievement}}
</li>
</ol>
<a ng-click="showTests = !showTests">Tests ({{ctrl.getObjectLength(capability.tests)}})</a>
<ul collapse="!showTests">
<ul uib-collapse="!showTests">
<li ng-if="ctrl.capabilities.schema === '1.2'" ng-repeat="test in capability.tests">
<span ng-class="{'glyphicon glyphicon-flag text-warning': capability.flagged.indexOf(test) > -1}"></span>
{{test}}
@ -38,7 +38,7 @@ variable 'capabilities'.
<div ng-show="ctrl.capabilities" class="criteria">
<hr>
<h4><a ng-click="showCriteria = !showCriteria">Criteria</a></h4>
<div collapse="showCriteria">
<div uib-collapse="showCriteria">
<ul>
<li ng-repeat="(key, criterion) in ctrl.capabilities.criteria">
<span class="criterion-name">{{criterion.name}}</span><br />

View File

@ -35,7 +35,7 @@
ProfileController.$inject = [
'$scope', '$http', 'refstackApiUrl', 'PubKeys',
'$modal', 'raiseAlert', '$state'
'$uibModal', 'raiseAlert', '$state'
];
/**
@ -44,7 +44,7 @@
* account-specific information.
*/
function ProfileController($scope, $http, refstackApiUrl,
PubKeys, $modal, raiseAlert, $state) {
PubKeys, $uibModal, raiseAlert, $state) {
var ctrl = this;
@ -85,7 +85,7 @@
* for importing a public key.
*/
function openImportPubKeyModal() {
$modal.open({
$uibModal.open({
templateUrl: '/components/profile/importPubKeyModal.html',
backdrop: true,
windowClass: 'modal',
@ -101,7 +101,7 @@
* @param {Object} pubKey resource
*/
function openShowPubKeyModal(pubKey) {
$modal.open({
$uibModal.open({
templateUrl: '/components/profile/showPubKeyModal.html',
backdrop: true,
windowClass: 'modal',
@ -124,7 +124,7 @@
.controller('ImportPubKeyModalController', ImportPubKeyModalController);
ImportPubKeyModalController.$inject = [
'$modalInstance', 'PubKeys', 'raiseAlert'
'$uibModalInstance', 'PubKeys', 'raiseAlert'
];
/**
@ -132,7 +132,9 @@
* This controller is for the modal that appears if a user wants to import
* a public key.
*/
function ImportPubKeyModalController($modalInstance, PubKeys, raiseAlert) {
function ImportPubKeyModalController($uibModalInstance,
PubKeys, raiseAlert) {
var ctrl = this;
ctrl.importPubKey = importPubKey;
@ -148,7 +150,7 @@
newPubKey.$save(
function(newPubKey_) {
raiseAlert('success', '', 'Public key saved successfully');
$modalInstance.close(newPubKey_);
$uibModalInstance.close(newPubKey_);
},
function(httpResp) {
raiseAlert('danger',
@ -162,7 +164,7 @@
* This function will dismiss the modal.
*/
function cancel() {
$modalInstance.dismiss('cancel');
$uibModalInstance.dismiss('cancel');
}
}
@ -171,7 +173,7 @@
.controller('ShowPubKeyModalController', ShowPubKeyModalController);
ShowPubKeyModalController.$inject = [
'$modalInstance', 'raiseAlert', 'pubKey'
'$uibModalInstance', 'raiseAlert', 'pubKey'
];
/**
@ -179,7 +181,7 @@
* This controller is for the modal that appears if a user wants to see the
* full details of one of their public keys.
*/
function ShowPubKeyModalController($modalInstance, raiseAlert, pubKey) {
function ShowPubKeyModalController($uibModalInstance, raiseAlert, pubKey) {
var ctrl = this;
ctrl.deletePubKey = deletePubKey;
@ -197,7 +199,7 @@
function() {
raiseAlert('success',
'', 'Public key deleted successfully');
$modalInstance.close(ctrl.pubKey.id);
$uibModalInstance.close(ctrl.pubKey.id);
},
function(httpResp) {
raiseAlert('danger',
@ -211,7 +213,7 @@
* This method will dismiss the modal.
*/
function cancel() {
$modalInstance.dismiss('cancel');
$uibModalInstance.dismiss('cancel');
}
}
})();

View File

@ -3,8 +3,8 @@ HTML for each accordion group that separates the status types on the results
report page.
-->
<accordion-group is-open="isOpen" is-disabled="ctrl.caps[status].caps.length == 0">
<accordion-heading>
<uib-accordion-group is-open="isOpen" is-disabled="ctrl.caps[status].caps.length == 0">
<uib-accordion-heading>
{{status | capitalize}}
<small>
(<strong>Total:</strong> {{ctrl.caps[status].caps.length}} capabilities, {{ctrl.caps[status].count}} tests)
@ -15,7 +15,7 @@ report page.
<i class="pull-right glyphicon"
ng-class="{'glyphicon-chevron-down': isOpen, 'glyphicon-chevron-right': !isOpen}">
</i>
</accordion-heading>
</uib-accordion-heading>
<ol class="capabilities">
<li ng-repeat="capability in ctrl.caps[status].caps | orderBy:'id'"
ng-if="ctrl.isCapabilityShown(capability)">
@ -41,7 +41,7 @@ report page.
capability.notPassedTests.length}}]
</span>
<ul class="list-unstyled" collapse="!showTests">
<ul class="list-unstyled" uib-collapse="!showTests">
<!-- Start passed test list -->
<li ng-repeat="test in capability.passedTests | orderBy:'toString()'"
ng-if="ctrl.isTestShown(test, capability)">
@ -72,4 +72,4 @@ report page.
</ul>
</li>
</ol>
</accordion-group>
</uib-accordion-group>

View File

@ -108,7 +108,7 @@
</label>
</div>
<accordion close-others=false>
<uib-accordion close-others=false>
<!-- The ng-repeat is used to pass in a local variable to the template. -->
<ng-include
ng-repeat="status in ['required']"
@ -130,7 +130,7 @@
ng-repeat="status in ['removed']"
src="ctrl.detailsTemplate">
</ng-include>
</accordion>
</uib-accordion>
</div>
</div>

View File

@ -21,7 +21,7 @@
ResultsReportController.$inject = [
'$http', '$stateParams', '$window',
'$modal', 'refstackApiUrl', 'raiseAlert'
'$uibModal', 'refstackApiUrl', 'raiseAlert'
];
/**
@ -30,7 +30,7 @@
* view details for a specific test run.
*/
function ResultsReportController($http, $stateParams, $window,
$modal, refstackApiUrl, raiseAlert) {
$uibModal, refstackApiUrl, raiseAlert) {
var ctrl = this;
@ -566,7 +566,7 @@
* tests for the current results.
*/
function openFullTestListModal() {
$modal.open({
$uibModal.open({
templateUrl: '/components/results-report/partials' +
'/fullTestListModal.html',
backdrop: true,
@ -589,14 +589,14 @@
.module('refstackApp')
.controller('FullTestListModalController', FullTestListModalController);
FullTestListModalController.$inject = ['$modalInstance', 'tests'];
FullTestListModalController.$inject = ['$uibModalInstance', 'tests'];
/**
* Full Test List Modal Controller
* This controller is for the modal that appears if a user wants to see the
* full list of passed tests on a report page.
*/
function FullTestListModalController($modalInstance, tests) {
function FullTestListModalController($uibModalInstance, tests) {
var ctrl = this;
ctrl.tests = tests;
@ -605,7 +605,7 @@
* This function will close/dismiss the modal.
*/
ctrl.close = function () {
$modalInstance.dismiss('exit');
$uibModalInstance.dismiss('exit');
};
/**

View File

@ -8,7 +8,7 @@
<label for="cpid">Start Date</label>
<p class="input-group">
<input type="text" class="form-control"
datepicker-popup="{{ctrl.format}}"
uib-datepicker-popup="{{ctrl.format}}"
ng-model="ctrl.startDate" is-open="ctrl.startOpen"
close-text="Close" />
<span class="input-group-btn">
@ -22,7 +22,7 @@
<label for="cpid">End Date</label>
<p class="input-group">
<input type="text" class="form-control"
datepicker-popup="{{ctrl.format}}"
uib-datepicker-popup="{{ctrl.format}}"
ng-model="ctrl.endDate" is-open="ctrl.endOpen"
close-text="Close" />
<span class="input-group-btn">
@ -149,7 +149,7 @@
</table>
<div class="pages">
<pagination
<uib-pagination
total-items="ctrl.totalItems"
ng-model="ctrl.currentPage"
items-per-page="ctrl.itemsPerPage"
@ -159,7 +159,7 @@
rotate="false"
num-pages="ctrl.numPages"
ng-change="ctrl.update()">
</pagination>
</uib-pagination>
</div>
</div>

View File

@ -19,15 +19,15 @@
.module('refstackApp')
.factory('raiseAlert', raiseAlert);
raiseAlert.$inject = ['$modal'];
raiseAlert.$inject = ['$uibModal'];
/**
* This allows alert pop-ups to be raised. Just inject it as a dependency
* in the calling controller.
*/
function raiseAlert($modal) {
function raiseAlert($uibModal) {
return function(mode, title, text) {
$modal.open({
$uibModal.open({
templateUrl: '/shared/alerts/alertModal.html',
controller: 'RaiseAlertModalController as alert',
backdrop: true,
@ -51,12 +51,12 @@
.module('refstackApp')
.controller('RaiseAlertModalController', RaiseAlertModalController);
RaiseAlertModalController.$inject = ['$modalInstance', 'data'];
RaiseAlertModalController.$inject = ['$uibModalInstance', 'data'];
/**
* This is the controller for the alert pop-up.
*/
function RaiseAlertModalController($modalInstance, data) {
function RaiseAlertModalController($uibModalInstance, data) {
var ctrl = this;
ctrl.close = close;
@ -68,7 +68,7 @@
* modal.
*/
function close() {
$modalInstance.close();
$uibModalInstance.close();
}
}
})();

View File

@ -13,7 +13,7 @@ RefStack
</button>
</div>
<div class="collapse navbar-collapse" id="navbar" collapse="header.navbarCollapsed">
<div class="collapse navbar-collapse" id="navbar" uib-collapse="header.navbarCollapsed">
<ul class="nav navbar-nav">
<li ng-class="{ active: header.isActive('/')}"><a ui-sref="home">Home</a></li>
<li ng-class="{ active: header.isActive('/about')}"><a ui-sref="about">About</a></li>

View File

@ -9,7 +9,6 @@ module.exports = function (config) {
// Angular libraries.
'app/assets/lib/angular/angular.js',
'app/assets/lib/angular-ui-router/release/angular-ui-router.js',
'app/assets/lib/angular-bootstrap/ui-bootstrap.min.js',
'app/assets/lib/angular-mocks/angular-mocks.js',
'app/assets/lib/angular-bootstrap/ui-bootstrap-tpls.min.js',
'app/assets/lib/angular-busy/dist/angular-busy.min.js',

View File

@ -614,8 +614,8 @@ describe('Refstack controllers', function () {
it('should have a method to open a modal for the full passed test list',
function () {
var modal;
inject(function ($modal) {
modal = $modal;
inject(function ($uibModal) {
modal = $uibModal;
});
spyOn(modal, 'open');
ctrl.openFullTestListModal();
@ -631,7 +631,7 @@ describe('Refstack controllers', function () {
dismiss: jasmine.createSpy('modalInstance.dismiss')
};
ctrl = $controller('FullTestListModalController',
{$modalInstance: modalInstance, tests: ['t1', 't2']}
{$uibModalInstance: modalInstance, tests: ['t1', 't2']}
);
}));
@ -668,7 +668,7 @@ describe('Refstack controllers', function () {
close: jasmine.createSpy('modalInstance.close')
};
ctrl = $controller('RaiseAlertModalController',
{$modalInstance: modalInstance, data: data}
{$uibModalInstance: modalInstance, data: data}
);
}));