Set keypair properly on Create Cluster dialog

When selected Cluster Template doesn't have Keypair setting,
Keypair doesn't be set properly on Create Cluster dialog.
This patch fixes it.

Change-Id: I6c17a8b742eda44392bc4c12e0aa069ac41b033f
Closes-Bug: #1694634
This commit is contained in:
Shu Muto 2017-05-31 17:36:49 +09:00
parent 915227a9d7
commit cc5dd12f32

View File

@ -56,8 +56,9 @@
function loadClusterTemplate(id, old) {
if (id !== old) {
if (id === '') {
if (id === '' || typeof id === 'undefined') {
$scope.model.keypair = "";
init();
} else {
magnum.getClusterTemplate(id).then(onGetClusterTemplate);
}
@ -67,7 +68,11 @@
function onGetClusterTemplate(response) {
ctrl.clusterTemplate = response.data;
if ($scope.model.keypair === "") {
$scope.model.keypair = response.data.keypair_id;
if (response.data.keypair_id === null) {
$scope.model.keypair = "";
} else {
$scope.model.keypair = response.data.keypair_id;
}
}
}