Fix eslint errors on Cluster Templates
This patch fixes eslint errors on Cluster Templates namespace. Change-Id: Ie1bc94a588a0ddeb4925f4cf43c4d3cd2219beab Partial-Bug: #1622475
This commit is contained in:
parent
22dc448cf3
commit
04d0257d71
@ -22,8 +22,12 @@
|
|||||||
* @description
|
* @description
|
||||||
* Provides all of the actions for cluster templates.
|
* Provides all of the actions for cluster templates.
|
||||||
*/
|
*/
|
||||||
angular.module('horizon.dashboard.container-infra.cluster-templates.actions', ['horizon.framework', 'horizon.dashboard.container-infra'])
|
angular.module('horizon.dashboard.container-infra.cluster-templates.actions',
|
||||||
.run(registerClusterTemplateActions);
|
[
|
||||||
|
'horizon.framework',
|
||||||
|
'horizon.dashboard.container-infra'
|
||||||
|
])
|
||||||
|
.run(registerClusterTemplateActions);
|
||||||
|
|
||||||
registerClusterTemplateActions.$inject = [
|
registerClusterTemplateActions.$inject = [
|
||||||
'horizon.framework.conf.resource-type-registry.service',
|
'horizon.framework.conf.resource-type-registry.service',
|
||||||
@ -31,7 +35,7 @@
|
|||||||
'horizon.dashboard.container-infra.cluster-templates.create.service',
|
'horizon.dashboard.container-infra.cluster-templates.create.service',
|
||||||
'horizon.dashboard.container-infra.cluster-templates.delete.service',
|
'horizon.dashboard.container-infra.cluster-templates.delete.service',
|
||||||
'horizon.dashboard.container-infra.clusters.create.service',
|
'horizon.dashboard.container-infra.clusters.create.service',
|
||||||
'horizon.dashboard.container-infra.cluster-templates.resourceType',
|
'horizon.dashboard.container-infra.cluster-templates.resourceType'
|
||||||
];
|
];
|
||||||
|
|
||||||
function registerClusterTemplateActions(
|
function registerClusterTemplateActions(
|
||||||
@ -40,8 +44,8 @@
|
|||||||
createClusterTemplateService,
|
createClusterTemplateService,
|
||||||
deleteClusterTemplateService,
|
deleteClusterTemplateService,
|
||||||
createClusterService,
|
createClusterService,
|
||||||
resourceType)
|
resourceType) {
|
||||||
{
|
|
||||||
var templateResourceType = registry.getResourceType(resourceType);
|
var templateResourceType = registry.getResourceType(resourceType);
|
||||||
templateResourceType.itemActions
|
templateResourceType.itemActions
|
||||||
.append({
|
.append({
|
||||||
@ -78,5 +82,4 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -21,26 +21,29 @@
|
|||||||
* @ngdoc overview
|
* @ngdoc overview
|
||||||
* @name horizon.dashboard.container-infra.cluster-templates
|
* @name horizon.dashboard.container-infra.cluster-templates
|
||||||
* @ngModule
|
* @ngModule
|
||||||
*
|
|
||||||
* @description
|
* @description
|
||||||
* Provides all the services and widgets require to display the cluster template
|
* Provides all the services and widgets require to display the cluster template
|
||||||
* panel
|
* panel
|
||||||
*/
|
*/
|
||||||
angular
|
angular
|
||||||
.module('horizon.dashboard.container-infra.cluster-templates', [
|
.module('horizon.dashboard.container-infra.cluster-templates',
|
||||||
|
[
|
||||||
'ngRoute',
|
'ngRoute',
|
||||||
'horizon.dashboard.container-infra.cluster-templates.actions',
|
'horizon.dashboard.container-infra.cluster-templates.actions',
|
||||||
'horizon.dashboard.container-infra.cluster-templates.details'
|
'horizon.dashboard.container-infra.cluster-templates.details'
|
||||||
])
|
])
|
||||||
.constant('horizon.dashboard.container-infra.cluster-templates.events', events())
|
.constant('horizon.dashboard.container-infra.cluster-templates.events', events())
|
||||||
.constant('horizon.dashboard.container-infra.cluster-templates.resourceType', 'OS::Magnum::ClusterTemplate')
|
.constant(
|
||||||
|
'horizon.dashboard.container-infra.cluster-templates.resourceType',
|
||||||
|
'OS::Magnum::ClusterTemplate')
|
||||||
.run(run)
|
.run(run)
|
||||||
.config(config);
|
.config(config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngdoc constant
|
* @ngdoc constant
|
||||||
* @name horizon.dashboard.container-infra.cluster-templates.events
|
* @name events
|
||||||
* @description A list of events used by cluster templates
|
* @returns {Object} The event object
|
||||||
|
* @description A list of events for cluster templates
|
||||||
*/
|
*/
|
||||||
function events() {
|
function events() {
|
||||||
return {
|
return {
|
||||||
@ -118,7 +121,7 @@
|
|||||||
{label: gettext('Kubernetes'), key: 'kubernetes'},
|
{label: gettext('Kubernetes'), key: 'kubernetes'},
|
||||||
{label: gettext('Mesos'), key: 'mesos'}
|
{label: gettext('Mesos'), key: 'mesos'}
|
||||||
]
|
]
|
||||||
})
|
});
|
||||||
|
|
||||||
function listFunction(params) {
|
function listFunction(params) {
|
||||||
return magnum.getClusterTemplates(params).then(modifyResponse);
|
return magnum.getClusterTemplates(params).then(modifyResponse);
|
||||||
@ -126,9 +129,9 @@
|
|||||||
function modifyResponse(response) {
|
function modifyResponse(response) {
|
||||||
return {data: {items: response.data.items.map(addTrackBy)}};
|
return {data: {items: response.data.items.map(addTrackBy)}};
|
||||||
|
|
||||||
function addTrackBy(cluster_template) {
|
function addTrackBy(clusterTemplate) {
|
||||||
cluster_template.trackBy = cluster_template.id;
|
clusterTemplate.trackBy = clusterTemplate.id;
|
||||||
return cluster_template;
|
return clusterTemplate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,8 +152,8 @@
|
|||||||
* @param {Object} $provide
|
* @param {Object} $provide
|
||||||
* @param {Object} $windowProvider
|
* @param {Object} $windowProvider
|
||||||
* @param {Object} $routeProvider
|
* @param {Object} $routeProvider
|
||||||
* @description Routes used by this module.
|
|
||||||
* @returns {undefined} Returns nothing
|
* @returns {undefined} Returns nothing
|
||||||
|
* @description Routes used by this module.
|
||||||
*/
|
*/
|
||||||
function config($provide, $windowProvider, $routeProvider) {
|
function config($provide, $windowProvider, $routeProvider) {
|
||||||
var path = $windowProvider.$get().STATIC_URL + 'dashboard/container-infra/cluster-templates/';
|
var path = $windowProvider.$get().STATIC_URL + 'dashboard/container-infra/cluster-templates/';
|
||||||
|
@ -89,8 +89,9 @@
|
|||||||
// "network_drivers" and "volume_drivers" are used for pull-down options.
|
// "network_drivers" and "volume_drivers" are used for pull-down options.
|
||||||
// These are not for submittion.
|
// These are not for submittion.
|
||||||
for (var key in finalSpec) {
|
for (var key in finalSpec) {
|
||||||
if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null || finalSpec[key] === ""
|
if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null || finalSpec[key] === "" ||
|
||||||
|| key === "network_drivers" || key === "volume_drivers" || key === "docker_storage_drivers") {
|
key === "network_drivers" || key === "volume_drivers" ||
|
||||||
|
key === "docker_storage_drivers") {
|
||||||
delete finalSpec[key];
|
delete finalSpec[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
|
|
||||||
angular
|
angular
|
||||||
.module('horizon.dashboard.container-infra.cluster-templates')
|
.module('horizon.dashboard.container-infra.cluster-templates')
|
||||||
.factory('horizon.dashboard.container-infra.cluster-templates.workflow', ClusterTemplateWorkflow);
|
.factory(
|
||||||
|
'horizon.dashboard.container-infra.cluster-templates.workflow',
|
||||||
|
ClusterTemplateWorkflow);
|
||||||
|
|
||||||
ClusterTemplateWorkflow.$inject = [
|
ClusterTemplateWorkflow.$inject = [
|
||||||
'horizon.dashboard.container-infra.basePath',
|
'horizon.dashboard.container-infra.basePath',
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
function createService(
|
function createService(
|
||||||
policy, actionResult, gettext, $qExtensions, wizardModalService, toast, model, events, resourceType, createWorkflow
|
policy, actionResult, gettext, $qExtensions, wizardModalService,
|
||||||
|
toast, model, events, resourceType, createWorkflow
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var scope;
|
var scope;
|
||||||
@ -79,7 +80,7 @@
|
|||||||
return $qExtensions.booleanAsPromise(true);
|
return $qExtensions.booleanAsPromise(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function submit(){
|
function submit() {
|
||||||
return model.createClusterTemplate().then(success);
|
return model.createClusterTemplate().then(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,19 +63,26 @@
|
|||||||
mesos: [{name:"", label: gettext("Choose a Volume Driver")},
|
mesos: [{name:"", label: gettext("Choose a Volume Driver")},
|
||||||
{name:"rexray", label: gettext("Rexray")}]};
|
{name:"rexray", label: gettext("Rexray")}]};
|
||||||
|
|
||||||
$scope.changeCoes = function(){
|
$scope.changeCoes = function() {
|
||||||
if($scope.model.newClusterTemplateSpec.coe){
|
if ($scope.model.newClusterTemplateSpec.coe) {
|
||||||
$scope.model.newClusterTemplateSpec.network_drivers = ctrl.supportedNetworkDrivers[$scope.model.newClusterTemplateSpec.coe];
|
$scope.model.newClusterTemplateSpec.network_drivers =
|
||||||
$scope.model.newClusterTemplateSpec.network_driver = ctrl.supportedNetworkDrivers[$scope.model.newClusterTemplateSpec.coe][0].name;
|
ctrl.supportedNetworkDrivers[$scope.model.newClusterTemplateSpec.coe];
|
||||||
$scope.model.newClusterTemplateSpec.volume_drivers = ctrl.supportedVolumeDrivers[$scope.model.newClusterTemplateSpec.coe];
|
$scope.model.newClusterTemplateSpec.network_driver =
|
||||||
$scope.model.newClusterTemplateSpec.volume_driver = ctrl.supportedVolumeDrivers[$scope.model.newClusterTemplateSpec.coe][0].name;
|
ctrl.supportedNetworkDrivers[$scope.model.newClusterTemplateSpec.coe][0].name;
|
||||||
}else{
|
$scope.model.newClusterTemplateSpec.volume_drivers =
|
||||||
$scope.model.newClusterTemplateSpec.network_drivers = ctrl.supportedNetworkDrivers.initial;
|
ctrl.supportedVolumeDrivers[$scope.model.newClusterTemplateSpec.coe];
|
||||||
$scope.model.newClusterTemplateSpec.network_driver = ctrl.supportedNetworkDrivers.initial[0].name;
|
$scope.model.newClusterTemplateSpec.volume_driver =
|
||||||
$scope.model.newClusterTemplateSpec.volume_drivers = ctrl.supportedVolumeDrivers.initial;
|
ctrl.supportedVolumeDrivers[$scope.model.newClusterTemplateSpec.coe][0].name;
|
||||||
$scope.model.newClusterTemplateSpec.volume_driver = ctrl.supportedVolumeDrivers.initial[0].name;
|
} else {
|
||||||
|
$scope.model.newClusterTemplateSpec.network_drivers =
|
||||||
|
ctrl.supportedNetworkDrivers.initial;
|
||||||
|
$scope.model.newClusterTemplateSpec.network_driver =
|
||||||
|
ctrl.supportedNetworkDrivers.initial[0].name;
|
||||||
|
$scope.model.newClusterTemplateSpec.volume_drivers =
|
||||||
|
ctrl.supportedVolumeDrivers.initial;
|
||||||
|
$scope.model.newClusterTemplateSpec.volume_driver =
|
||||||
|
ctrl.supportedVolumeDrivers.initial[0].name;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -30,14 +30,9 @@
|
|||||||
.controller('createClusterTemplateLabelsController', createClusterTemplateLabelsController);
|
.controller('createClusterTemplateLabelsController', createClusterTemplateLabelsController);
|
||||||
|
|
||||||
createClusterTemplateLabelsController.$inject = [
|
createClusterTemplateLabelsController.$inject = [
|
||||||
'$q',
|
|
||||||
'$scope',
|
|
||||||
'horizon.dashboard.container-infra.basePath',
|
|
||||||
'horizon.app.core.openstack-service-api.magnum'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
function createClusterTemplateLabelsController($q, $scope, basePath, magnum) {
|
function createClusterTemplateLabelsController() {
|
||||||
var ctrl = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -30,14 +30,9 @@
|
|||||||
.controller('createClusterTemplateNetworkController', createClusterTemplateNetworkController);
|
.controller('createClusterTemplateNetworkController', createClusterTemplateNetworkController);
|
||||||
|
|
||||||
createClusterTemplateNetworkController.$inject = [
|
createClusterTemplateNetworkController.$inject = [
|
||||||
'$q',
|
|
||||||
'$scope',
|
|
||||||
'horizon.dashboard.container-infra.basePath',
|
|
||||||
'horizon.app.core.openstack-service-api.magnum'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
function createClusterTemplateNetworkController($q, $scope, basePath, magnum) {
|
function createClusterTemplateNetworkController() {
|
||||||
var ctrl = this;
|
}
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -55,25 +55,23 @@
|
|||||||
|
|
||||||
function onGetImages(response) {
|
function onGetImages(response) {
|
||||||
angular.forEach(response.items, function(item) {
|
angular.forEach(response.items, function(item) {
|
||||||
this.push({id: item.name, name: item.name});
|
ctrl.images.push({id: item.name, name: item.name});
|
||||||
}, ctrl.images);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onGetFlavors(response) {
|
function onGetFlavors(response) {
|
||||||
angular.forEach(response.items, function(item) {
|
angular.forEach(response.items, function(item) {
|
||||||
this.push({id: item.name, name: item.name});
|
ctrl.nflavors.push({id: item.name, name: item.name});
|
||||||
}, ctrl.nflavors);
|
});
|
||||||
angular.forEach(response.items, function(item) {
|
angular.forEach(response.items, function(item) {
|
||||||
this.push({id: item.name, name: item.name});
|
ctrl.mflavors.push({id: item.name, name: item.name});
|
||||||
}, ctrl.mflavors);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onGetKeypairs(response) {
|
function onGetKeypairs(response) {
|
||||||
angular.forEach(response.items, function(item) {
|
angular.forEach(response.items, function(item) {
|
||||||
this.push({id: item.keypair.name, name: item.keypair.name});
|
ctrl.keypairs.push({id: item.keypair.name, name: item.keypair.name});
|
||||||
}, ctrl.keypairs);
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -35,15 +35,27 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngDoc factory
|
* @ngDoc factory
|
||||||
* @name horizon.dashboard.container-infra.cluster-templates.delete.service
|
* @name delete.service
|
||||||
*
|
* @param {Object} $location
|
||||||
|
* @param {Object} $q
|
||||||
|
* @param {Object} magnum service
|
||||||
|
* @param {Object} policy
|
||||||
|
* @param {Object} actionResult
|
||||||
|
* @param {Object} gettext
|
||||||
|
* @param {Object} $qExtensions
|
||||||
|
* @param {Object} deleteModal
|
||||||
|
* @param {Object} toast
|
||||||
|
* @param {Object} resourceType
|
||||||
|
* @param {Object} events
|
||||||
|
* @returns {Object} delete service
|
||||||
* @Description
|
* @Description
|
||||||
* Brings up the delete cluster templates confirmation modal dialog.
|
* Brings up the delete cluster templates confirmation modal dialog.
|
||||||
* On submit, delete selected resources.
|
* On submit, delete selected resources.
|
||||||
* On cancel, do nothing.
|
* On cancel, do nothing.
|
||||||
*/
|
*/
|
||||||
function deleteService(
|
function deleteService(
|
||||||
$location, $q, magnum, policy, actionResult, gettext, $qExtensions, deleteModal, toast, resourceType, events
|
$location, $q, magnum, policy, actionResult, gettext, $qExtensions, deleteModal, toast,
|
||||||
|
resourceType, events
|
||||||
) {
|
) {
|
||||||
var scope;
|
var scope;
|
||||||
var context = {
|
var context = {
|
||||||
@ -74,12 +86,12 @@
|
|||||||
|
|
||||||
// delete selected resource objects
|
// delete selected resource objects
|
||||||
function perform(selected) {
|
function perform(selected) {
|
||||||
var selected = angular.isArray(selected) ? selected : [selected];
|
selected = angular.isArray(selected) ? selected : [selected];
|
||||||
context.labels = labelize(selected.length);
|
context.labels = labelize(selected.length);
|
||||||
return $qExtensions.allSettled(selected.map(checkPermission)).then(afterCheck);
|
return $qExtensions.allSettled(selected.map(checkPermission)).then(afterCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
function labelize(count){
|
function labelize(count) {
|
||||||
return {
|
return {
|
||||||
title: ngettext('Confirm Delete Cluster Template',
|
title: ngettext('Confirm Delete Cluster Template',
|
||||||
'Confirm Delete Cluster Templates', count),
|
'Confirm Delete Cluster Templates', count),
|
||||||
@ -102,7 +114,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// for batch delete
|
// for batch delete
|
||||||
function afterCheck(result){
|
function afterCheck(result) {
|
||||||
var outcome = $q.reject(); // Reject the promise by default
|
var outcome = $q.reject(); // Reject the promise by default
|
||||||
if (result.fail.length > 0) {
|
if (result.fail.length > 0) {
|
||||||
toast.add('error', getMessage(notAllowedMessage, result.fail));
|
toast.add('error', getMessage(notAllowedMessage, result.fail));
|
||||||
@ -124,9 +136,9 @@
|
|||||||
deleteModalResult.fail.forEach(function markFailed(item) {
|
deleteModalResult.fail.forEach(function markFailed(item) {
|
||||||
result.failed(resourceType, getEntity(item).id);
|
result.failed(resourceType, getEntity(item).id);
|
||||||
});
|
});
|
||||||
if(result.result.failed.length == 0 && result.result.deleted.length > 0){
|
if (result.result.failed.length === 0 && result.result.deleted.length > 0) {
|
||||||
$location.path("/project/cluster_templates");
|
$location.path("/project/cluster_templates");
|
||||||
}else{
|
} else {
|
||||||
return result.result;
|
return result.result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,7 +157,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// call delete REST API
|
// call delete REST API
|
||||||
function deleteEntity(id){
|
function deleteEntity(id) {
|
||||||
return magnum.deleteClusterTemplate(id, true);
|
return magnum.deleteClusterTemplate(id, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,9 @@
|
|||||||
.controller('horizon.dashboard.container-infra.cluster-templates.DrawerController', controller);
|
.controller('horizon.dashboard.container-infra.cluster-templates.DrawerController', controller);
|
||||||
|
|
||||||
controller.$inject = [
|
controller.$inject = [
|
||||||
'horizon.app.core.openstack-service-api.magnum',
|
|
||||||
'horizon.dashboard.container-infra.cluster-templates.resourceType'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
function controller(magnum, resourceType) {
|
function controller() {
|
||||||
var ctrl = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -20,24 +20,16 @@
|
|||||||
|
|
||||||
ClusterTemplateOverviewController.$inject = [
|
ClusterTemplateOverviewController.$inject = [
|
||||||
'$scope',
|
'$scope',
|
||||||
'horizon.app.core.openstack-service-api.glance',
|
'horizon.app.core.openstack-service-api.glance'
|
||||||
'horizon.dashboard.container-infra.cluster-templates.resourceType',
|
|
||||||
'horizon.dashboard.container-infra.cluster-templates.events',
|
|
||||||
'horizon.dashboard.container-infra.clusters.events',
|
|
||||||
'horizon.framework.conf.resource-type-registry.service'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
function ClusterTemplateOverviewController(
|
function ClusterTemplateOverviewController(
|
||||||
$scope,
|
$scope,
|
||||||
glance,
|
glance
|
||||||
resourceType,
|
|
||||||
events,
|
|
||||||
clusterEvents,
|
|
||||||
registry
|
|
||||||
) {
|
) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
ctrl.cluster_template = {};
|
ctrl.cluster_template = {};
|
||||||
ctrl.image_uuid;
|
ctrl.image_uuid = "";
|
||||||
|
|
||||||
$scope.context.loadPromise.then(onGetClusterTemplate);
|
$scope.context.loadPromise.then(onGetClusterTemplate);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user