Migrate to AngularJS v1.8.2
This patch aligns current code with AngularJS v1.8.2 requirements. It also updates zun-ui to use the Firefox browser instead of phantomjs browser to fix "nodjs-run-test" job because phantomjs browser has some issue with backticks. Change-Id: I61d9cfb795f7e789cd3c160934f05f54eb48fcda
This commit is contained in:
parent
4c63756e4b
commit
44697255ee
@ -129,15 +129,14 @@ module.exports = function (config) {
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
// browsers: ['Chrome'],
|
||||
browsers: ['PhantomJS'],
|
||||
browsers: ['Firefox'],
|
||||
|
||||
browserNoActivityTimeout: 60000,
|
||||
|
||||
reporters: ['progress', 'coverage', 'threshold'],
|
||||
|
||||
plugins: [
|
||||
'karma-chrome-launcher',
|
||||
'karma-phantomjs-launcher',
|
||||
'karma-firefox-launcher',
|
||||
'karma-jasmine',
|
||||
'karma-ng-html2js-preprocessor',
|
||||
'karma-coverage',
|
||||
|
@ -117,10 +117,10 @@
|
||||
|
||||
// for batch delete
|
||||
function afterCheck(result) {
|
||||
var outcome = $q.reject(); // Reject the promise by default
|
||||
var outcome = $q.reject().catch(angular.noop); // Reject the promise by default
|
||||
if (result.fail.length > 0) {
|
||||
toast.add('error', getMessage(notAllowedMessage, result.fail));
|
||||
outcome = $q.reject(result.fail);
|
||||
outcome = $q.reject(result.fail).catch(angular.noop);
|
||||
}
|
||||
if (result.pass.length > 0) {
|
||||
outcome = deleteModal.open(scope, result.pass.map(getEntity), context).then(createResult);
|
||||
|
@ -19,7 +19,8 @@
|
||||
|
||||
describe('horizon.dashboard.container-infra.clusters.create.service', function() {
|
||||
|
||||
var service, $scope, $q, deferred, magnum, workflow, spinnerModal, modalConfig, configDeferred;
|
||||
var service, $scope, $q, deferred, magnum, workflow, spinnerModal, modalConfig, configDeferred,
|
||||
$httpBackend;
|
||||
|
||||
var model = {
|
||||
id: 1,
|
||||
@ -53,8 +54,9 @@
|
||||
$provide.value('horizon.framework.widgets.form.ModalFormService', modal);
|
||||
}));
|
||||
|
||||
beforeEach(inject(function($injector, _$rootScope_, _$q_) {
|
||||
beforeEach(inject(function($injector, _$rootScope_, _$q_, _$httpBackend_) {
|
||||
$q = _$q_;
|
||||
$httpBackend = _$httpBackend_;
|
||||
$scope = _$rootScope_.$new();
|
||||
service = $injector.get('horizon.dashboard.container-infra.clusters.create.service');
|
||||
magnum = $injector.get('horizon.app.core.openstack-service-api.magnum');
|
||||
@ -99,6 +101,7 @@
|
||||
expect(modalConfig.title).toEqual('Create New Cluster');
|
||||
}, 0);
|
||||
|
||||
$httpBackend.expectGET('/static/dashboard/container-infra/clusters/panel.html').respond({});
|
||||
$timeout.flush();
|
||||
$scope.$apply();
|
||||
}));
|
||||
@ -113,6 +116,7 @@
|
||||
|
||||
service.perform(null, $scope);
|
||||
|
||||
$httpBackend.expectGET('/static/dashboard/container-infra/clusters/panel.html').respond({});
|
||||
$timeout.flush();
|
||||
$scope.$apply();
|
||||
}));
|
||||
|
@ -117,10 +117,10 @@
|
||||
|
||||
// for batch delete
|
||||
function afterCheck(result) {
|
||||
var outcome = $q.reject(); // Reject the promise by default
|
||||
var outcome = $q.reject().catch(angular.noop); // Reject the promise by default
|
||||
if (result.fail.length > 0) {
|
||||
toast.add('error', getMessage(notAllowedMessage, result.fail));
|
||||
outcome = $q.reject(result.fail);
|
||||
outcome = $q.reject(result.fail).catch(angular.noop);
|
||||
}
|
||||
if (result.pass.length > 0) {
|
||||
outcome = deleteModal.open(scope, result.pass.map(getEntity), context).then(createResult);
|
||||
|
@ -80,6 +80,7 @@
|
||||
|
||||
function hideSpinnerOnError(error) {
|
||||
spinnerModal.hideModalSpinner();
|
||||
deferred.promise.catch(angular.noop);
|
||||
return deferred.reject(error);
|
||||
}
|
||||
|
||||
|
@ -129,6 +129,7 @@
|
||||
|
||||
function onError(err) {
|
||||
spinnerModal.hideModalSpinner();
|
||||
deferred.promise.catch(angular.noop);
|
||||
return deferred.reject(err);
|
||||
}
|
||||
|
||||
|
@ -66,49 +66,49 @@
|
||||
|
||||
function createCluster(params) {
|
||||
return apiService.post('/api/container_infra/clusters/', params)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to create cluster.'));
|
||||
});
|
||||
}
|
||||
|
||||
function updateCluster(id, params) {
|
||||
return apiService.patch('/api/container_infra/clusters/' + id, params)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to update cluster.'));
|
||||
});
|
||||
}
|
||||
|
||||
function upgradeCluster(id, params) {
|
||||
return apiService.post('/api/container_infra/clusters/' + id + '/upgrade', params)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to perform rolling upgrade.'));
|
||||
});
|
||||
}
|
||||
|
||||
function getCluster(id) {
|
||||
return apiService.get('/api/container_infra/clusters/' + id)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to retrieve the cluster.'));
|
||||
});
|
||||
}
|
||||
|
||||
function getClusters() {
|
||||
return apiService.get('/api/container_infra/clusters/')
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to retrieve the clusters.'));
|
||||
});
|
||||
}
|
||||
|
||||
function getClusterNodes(id) {
|
||||
return apiService.get('/api/container_infra/clusters/' + id + '/resize')
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to get cluster\'s working nodes.'));
|
||||
});
|
||||
}
|
||||
|
||||
function resizeCluster(id, params) {
|
||||
return apiService.post('/api/container_infra/clusters/' + id + '/resize', params)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
var msg = gettext('Unable to resize given cluster id: %(id)s.');
|
||||
toastService.add('error', interpolate(msg, { id: id }, true));
|
||||
});
|
||||
@ -116,7 +116,7 @@
|
||||
|
||||
function deleteCluster(id, suppressError) {
|
||||
var promise = apiService.delete('/api/container_infra/clusters/', [id]);
|
||||
return suppressError ? promise : promise.error(function() {
|
||||
return suppressError ? promise : promise.catch(function onError() {
|
||||
var msg = gettext('Unable to delete the cluster with id: %(id)s');
|
||||
toastService.add('error', interpolate(msg, { id: id }, true));
|
||||
});
|
||||
@ -125,7 +125,7 @@
|
||||
// FIXME(shu-mutou): Unused for batch-delete in Horizon framework in Feb, 2016.
|
||||
function deleteClusters(ids) {
|
||||
return apiService.delete('/api/container_infra/clusters/', ids)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to delete the clusters.'));
|
||||
});
|
||||
}
|
||||
@ -136,21 +136,21 @@
|
||||
|
||||
function createClusterTemplate(params) {
|
||||
return apiService.post('/api/container_infra/cluster_templates/', params)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to create cluster template.'));
|
||||
});
|
||||
}
|
||||
|
||||
function updateClusterTemplate(id, params) {
|
||||
return apiService.patch('/api/container_infra/cluster_templates/' + id, params)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to update cluster template.'));
|
||||
});
|
||||
}
|
||||
|
||||
function getClusterTemplate(id) {
|
||||
return apiService.get('/api/container_infra/cluster_templates/' + id)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to retrieve the cluster template.'));
|
||||
});
|
||||
}
|
||||
@ -158,14 +158,14 @@
|
||||
function getClusterTemplates(relatedTemplateId) {
|
||||
var filterQuery = relatedTemplateId ? '?related_to=' + relatedTemplateId : '';
|
||||
return apiService.get('/api/container_infra/cluster_templates/' + filterQuery)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to retrieve the cluster templates.'));
|
||||
});
|
||||
}
|
||||
|
||||
function deleteClusterTemplate(id, suppressError) {
|
||||
var promise = apiService.delete('/api/container_infra/cluster_templates/', [id]);
|
||||
return suppressError ? promise : promise.error(function() {
|
||||
return suppressError ? promise : promise.catch(function onError() {
|
||||
var msg = gettext('Unable to delete the cluster template with id: %(id)s');
|
||||
toastService.add('error', interpolate(msg, { id: id }, true));
|
||||
});
|
||||
@ -174,7 +174,7 @@
|
||||
// FIXME(shu-mutou): Unused for batch-delete in Horizon framework in Feb, 2016.
|
||||
function deleteClusterTemplates(ids) {
|
||||
return apiService.delete('/api/container_infra/cluster_templates/', ids)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to delete the cluster templates.'));
|
||||
});
|
||||
}
|
||||
@ -185,21 +185,21 @@
|
||||
|
||||
function signCertificate(params) {
|
||||
return apiService.post('/api/container_infra/certificates/', params)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to sign certificate.'));
|
||||
});
|
||||
}
|
||||
|
||||
function showCertificate(id) {
|
||||
return apiService.get('/api/container_infra/certificates/' + id)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to retrieve the certificate.'));
|
||||
});
|
||||
}
|
||||
|
||||
function rotateCertificate(id) {
|
||||
return apiService.delete('/api/container_infra/certificates/' + id, [id])
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to rotate the certificate.'));
|
||||
});
|
||||
}
|
||||
@ -210,7 +210,7 @@
|
||||
|
||||
function getStats() {
|
||||
return apiService.get('/api/container_infra/stats/')
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to retrieve the stats.'));
|
||||
});
|
||||
}
|
||||
@ -222,7 +222,7 @@
|
||||
|
||||
function getIngressControllers() {
|
||||
return apiService.get('/api/container_infra/ingress_controllers/')
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error',
|
||||
gettext('Unable to retrieve available ingress controllers.'));
|
||||
});
|
||||
@ -234,7 +234,7 @@
|
||||
|
||||
function getAddons() {
|
||||
return apiService.get('/api/container_infra/available_addons/')
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error',
|
||||
gettext('Unable to retrieve available add-ons.'));
|
||||
});
|
||||
@ -246,28 +246,28 @@
|
||||
|
||||
function getQuotas() {
|
||||
return apiService.get('/api/container_infra/quotas/')
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to retrieve the quotas.'));
|
||||
});
|
||||
}
|
||||
|
||||
function getQuota(projectId, resource, suppressError) {
|
||||
var promise = apiService.get('/api/container_infra/quotas/' + projectId + '/' + resource);
|
||||
return suppressError ? promise : promise.error(function() {
|
||||
return suppressError ? promise : promise.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to retrieve the quota.'));
|
||||
});
|
||||
}
|
||||
|
||||
function createQuota(params) {
|
||||
return apiService.post('/api/container_infra/quotas/', params)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to create quota.'));
|
||||
});
|
||||
}
|
||||
|
||||
function updateQuota(projectId, resource, params) {
|
||||
return apiService.patch('/api/container_infra/quotas/' + projectId + '/' + resource, params)
|
||||
.error(function() {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to update quota.'));
|
||||
});
|
||||
}
|
||||
@ -275,7 +275,7 @@
|
||||
function deleteQuota(projectId, resource, suppressError) {
|
||||
var promise = apiService.delete('/api/container_infra/quotas/' + projectId + '/' + resource,
|
||||
{project_id: projectId, resource: resource});
|
||||
return suppressError ? promise : promise.error(function() {
|
||||
return suppressError ? promise : promise.catch(function onError() {
|
||||
var msg = gettext('Unable to delete the quota with project id: %(projectId)s and ' +
|
||||
'resource: %(resource)s.');
|
||||
toastService.add('error',
|
||||
@ -296,7 +296,7 @@
|
||||
*/
|
||||
function getNetworks() {
|
||||
return apiService.get('/api/container_infra/networks/')
|
||||
.error(function () {
|
||||
.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to retrieve the networks.'));
|
||||
});
|
||||
}
|
||||
|
@ -117,10 +117,10 @@
|
||||
|
||||
// for batch delete
|
||||
function afterCheck(result) {
|
||||
var outcome = $q.reject(); // Reject the promise by default
|
||||
var outcome = $q.reject().catch(angular.noop); // Reject the promise by default
|
||||
if (result.fail.length > 0) {
|
||||
toast.add('error', getMessage(notAllowedMessage, result.fail));
|
||||
outcome = $q.reject(result.fail);
|
||||
outcome = $q.reject(result.fail).catch(angular.noop);
|
||||
}
|
||||
if (result.pass.length > 0) {
|
||||
outcome = deleteModal.open(scope, result.pass.map(getEntity), context).then(createResult);
|
||||
|
@ -15,14 +15,12 @@
|
||||
"eslint-plugin-angular": "3.1.x",
|
||||
"jasmine-core": "2.8.x",
|
||||
"karma": "1.7.x",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-firefox-launcher": "2.1.0",
|
||||
"karma-cli": "1.0.x",
|
||||
"karma-coverage": "1.1.x",
|
||||
"karma-jasmine": "1.1.x",
|
||||
"karma-ng-html2js-preprocessor": "1.0.x",
|
||||
"karma-phantomjs-launcher": "1.0.x",
|
||||
"karma-threshold-reporter": "0.1.x",
|
||||
"phantomjs-prebuilt": "2.1.x"
|
||||
"karma-threshold-reporter": "0.1.x"
|
||||
},
|
||||
"dependencies": {},
|
||||
"scripts": {
|
||||
|
Loading…
Reference in New Issue
Block a user