Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C72F710CE3 for ; Fri, 23 Jan 2015 10:41:59 +0000 (UTC) Received: (qmail 69054 invoked by uid 500); 23 Jan 2015 10:41:59 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 69024 invoked by uid 500); 23 Jan 2015 10:41:59 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 69014 invoked by uid 99); 23 Jan 2015 10:41:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Jan 2015 10:41:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2D130E03AB; Fri, 23 Jan 2015 10:41:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ababiichuk@apache.org To: commits@ambari.apache.org Date: Fri, 23 Jan 2015 10:41:58 -0000 Message-Id: <26514aeed4b441e893cdbb0b40959da7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] ambari git commit: AMBARI-9290 Delete repo version not available when there is no cluster. (ababiichuk) 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 Authored: Fri Jan 23 11:51:29 2015 +0200 Committer: aBabiichuk 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); + } }); };