Add flavor, master flavor and labels for cluster create
This patch adds flavor_id, master_flavor_id and labels for cluster creation. Change-Id: Ie56e19daf7371e3b22c803b4bfa2813826797d7a
This commit is contained in:
parent
b6c3e6ef7e
commit
36a2116822
@ -79,6 +79,16 @@
|
||||
? response.data.keypair : "";
|
||||
config.model.docker_volume_size = response.data.docker_volume_size
|
||||
? response.data.docker_volume_size : "";
|
||||
var labels = "";
|
||||
for (var key in response.data.labels) {
|
||||
if (response.data.labels.hasOwnProperty(key)) {
|
||||
if (labels !== "") {
|
||||
labels += ",";
|
||||
}
|
||||
labels += key + "=" + response.data.labels[key];
|
||||
}
|
||||
}
|
||||
config.model.labels = labels;
|
||||
}
|
||||
|
||||
return modal.open(config).then(submit);
|
||||
|
@ -0,0 +1 @@
|
||||
<p translate>Arbitrary labels in the form of key=value pairs to associate with a clusters. May be used multiple times.</p>
|
@ -37,7 +37,7 @@
|
||||
};
|
||||
|
||||
function init(action, title, $scope) {
|
||||
var schema, form, model;
|
||||
var schema, form, model, nflavors, mflavors;
|
||||
var clusterTemplates = [{value:"", name: gettext("Choose a Cluster Template")}];
|
||||
var keypairs = [{value:"", name: gettext("Choose a Keypair")}];
|
||||
var dockerVolumeSizeDescription = gettext(
|
||||
@ -82,9 +82,21 @@
|
||||
title: gettext('Docker Volume Size (GB)'),
|
||||
type: 'number'
|
||||
},
|
||||
'master_flavor_id': {
|
||||
title: gettext('Master Flavor ID'),
|
||||
type: 'string'
|
||||
},
|
||||
'flavor_id': {
|
||||
title: gettext('Node Flavor ID'),
|
||||
type: 'string'
|
||||
},
|
||||
'rollback': {
|
||||
title: gettext('Rollback cluster on update failure'),
|
||||
type: 'boolean'
|
||||
},
|
||||
'labels': {
|
||||
title: gettext('Labels'),
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -188,9 +200,53 @@
|
||||
readonly: action === 'update'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'section',
|
||||
htmlClass: 'col-xs-6',
|
||||
items: [
|
||||
{
|
||||
key: 'master_flavor_id',
|
||||
type: 'select',
|
||||
titleMap: mflavors,
|
||||
readonly: action === 'update'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'section',
|
||||
htmlClass: 'col-xs-6',
|
||||
items: [
|
||||
{
|
||||
key: 'flavor_id',
|
||||
type: 'select',
|
||||
titleMap: nflavors,
|
||||
readonly: action === 'update'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
required: true
|
||||
},
|
||||
{
|
||||
title: gettext('Labels'),
|
||||
help: basePath + 'clusters/workflow/labels.help.html',
|
||||
type: 'section',
|
||||
htmlClass: 'row',
|
||||
items: [
|
||||
{
|
||||
type: 'section',
|
||||
htmlClass: 'col-xs-12',
|
||||
items: [
|
||||
{
|
||||
key: 'labels',
|
||||
type: 'textarea',
|
||||
placeholder: gettext('KEY1=VALUE1, KEY2=VALUE2...'),
|
||||
readonly: action === 'update'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -198,6 +254,7 @@
|
||||
|
||||
magnum.getClusterTemplates().then(onGetClusterTemplates);
|
||||
nova.getKeypairs().then(onGetKeypairs);
|
||||
nova.getFlavors(false, false).then(onGetFlavors);
|
||||
|
||||
function onGetKeypairs(response) {
|
||||
angular.forEach(response.data.items, function(item) {
|
||||
@ -205,6 +262,17 @@
|
||||
});
|
||||
}
|
||||
|
||||
function onGetFlavors(response) {
|
||||
nflavors = [{value:"", name: gettext("Choose a Flavor for the Node")}];
|
||||
mflavors = [{value:"", name: gettext("Choose a Flavor for the Master Node")}];
|
||||
angular.forEach(response.data.items, function(item) {
|
||||
nflavors.push({value: item.name, name: item.name});
|
||||
mflavors.push({value: item.name, name: item.name});
|
||||
});
|
||||
form[0].tabs[2].items[1].items[0].titleMap = nflavors;
|
||||
form[0].tabs[2].items[2].items[0].titleMap = mflavors;
|
||||
}
|
||||
|
||||
function onGetClusterTemplates(response) {
|
||||
angular.forEach(response.data.items, function(item) {
|
||||
clusterTemplates.push({value: item.id, name: item.name});
|
||||
@ -220,7 +288,10 @@
|
||||
rollback: false,
|
||||
discovery_url: "",
|
||||
create_timeout: null,
|
||||
keypair: ""
|
||||
keypair: "",
|
||||
flavor_id: "",
|
||||
master_flavor_id: "",
|
||||
labels: ""
|
||||
};
|
||||
|
||||
var config = {
|
||||
|
@ -37,8 +37,8 @@
|
||||
keyDeferred = $q.defer();
|
||||
keyDeferred.resolve({data:{items:{1:{keypair:{name:1}},2:{keypair:{name:2}}}}});
|
||||
spyOn(magnum, 'getClusterTemplates').and.returnValue(deferred.promise);
|
||||
spyOn(nova, 'getFlavors').and.returnValue(deferred.promise);
|
||||
spyOn(nova, 'getKeypairs').and.returnValue(keyDeferred.promise);
|
||||
|
||||
}));
|
||||
|
||||
it('should be init', inject(function($timeout) {
|
||||
|
Loading…
Reference in New Issue
Block a user