ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [1/2] ambari git commit: AMBARI-9290 Delete repo version not available when there is no cluster. (ababiichuk)
Date Fri, 23 Jan 2015 10:41:58 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk ba121b523 -> 91adc8dbf


AMBARI-9290 Delete repo version not available when there is no cluster. (ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7a75ff61
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7a75ff61
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7a75ff61

Branch: refs/heads/trunk
Commit: 7a75ff614c5b5cd2c5cec4f97f832c734ac1dde8
Parents: ba121b5
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Fri Jan 23 11:51:29 2015 +0200
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Fri Jan 23 12:42:00 2015 +0200

----------------------------------------------------------------------
 .../stackVersions/StackVersionsEditCtrl.js      |  6 ++++-
 .../stackVersions/StackVersionsListCtrl.js      | 28 +++++++++++---------
 2 files changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7a75ff61/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
index 47e4bd3..cd1ceb0 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
@@ -158,7 +158,11 @@ angular.module('ambariAdminConsole')
   };
 
   $scope.fetchRepoClusterStatus = function () {
-    var clusterName = $scope.clusters[0].Clusters.cluster_name; // only support one cluster
at the moment
+    var clusterName = ($scope.clusters && $scope.clusters.length > 0)
+      ? $scope.clusters[0].Clusters.cluster_name : null; // only support one cluster at the
moment
+    if (!clusterName) {
+      return null;
+    }
     return Cluster.getRepoVersionStatus(clusterName, $scope.id).then(function (response)
{
       $scope.repoStatus = response.status;
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/7a75ff61/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
index 089bda8..a9d3edb 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
@@ -65,17 +65,19 @@ angular.module('ambariAdminConsole')
   };
 
   $scope.fetchRepoClusterStatus = function () {
-    var clusterName = $scope.clusters[0].Clusters.cluster_name; // only support one cluster
at the moment
-    angular.forEach($scope.repos, function (repo) {
-      Cluster.getRepoVersionStatus(clusterName, repo.id).then(function (response) {
-        repo.status = response.status;
-        repo.totalHosts = response.totalHosts;
-        repo.currentHosts = response.currentHosts;
-        repo.installedHosts = response.installedHosts;
-        repo.stackVersionId = response.stackVersionId;
-        repo.cluster = (repo.status == 'current' || repo.status == 'installed')? clusterName
: '';
+    var clusterName = ($scope.clusters && $scope.clusters.length > 0) ? $scope.clusters[0].Clusters.cluster_name
: null; // only support one cluster at the moment
+    if (clusterName) {
+      angular.forEach($scope.repos, function (repo) {
+        Cluster.getRepoVersionStatus(clusterName, repo.id).then(function (response) {
+          repo.status = response.status;
+          repo.totalHosts = response.totalHosts;
+          repo.currentHosts = response.currentHosts;
+          repo.installedHosts = response.installedHosts;
+          repo.stackVersionId = response.stackVersionId;
+          repo.cluster = (repo.status == 'current' || repo.status == 'installed')? clusterName
: '';
+        });
       });
-    });
+    }
   };
 
   $scope.fetchRepos = function () {
@@ -105,8 +107,10 @@ angular.module('ambariAdminConsole')
 
   $scope.fetchClusters = function () {
     return Cluster.getAllClusters().then(function (clusters) {
-      $scope.clusters = clusters;
-      $scope.fillClusters(clusters);
+      if (clusters && clusters.length > 0) {
+        $scope.clusters = clusters;
+        $scope.fillClusters(clusters);
+      }
     });
   };
 


Mime
View raw message