From cc5dd12f32c08071d97358ed0af2ebf4f3453f50 Mon Sep 17 00:00:00 2001 From: Shu Muto Date: Wed, 31 May 2017 17:36:49 +0900 Subject: [PATCH] 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 --- .../clusters/workflow/cluster-template.controller.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.controller.js b/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.controller.js index d5bca669..e17b9da2 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.controller.js +++ b/magnum_ui/static/dashboard/container-infra/clusters/workflow/cluster-template.controller.js @@ -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; + } } }