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; + } } }