AMBARI-21851. Allow Hidden Repos To Become Visible So They Can Be Made Visible Permanently (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2fc74535 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2fc74535 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2fc74535 Branch: refs/heads/feature-branch-AMBARI-21307 Commit: 2fc74535d79e4f677233f6caf12166bc7f837c2a Parents: 7758a51 Author: Alex Antonenko <aantone...@hortonworks.com> Authored: Thu Aug 31 11:56:35 2017 +0300 Committer: Alex Antonenko <aantone...@hortonworks.com> Committed: Thu Aug 31 11:56:35 2017 +0300 ---------------------------------------------------------------------- .../stackVersions/StackVersionsListCtrl.js | 18 ++++++++++++++++++ .../ui/admin-web/app/scripts/i18n.config.js | 1 + .../admin-web/app/views/stackVersions/list.html | 2 ++ 3 files changed, 21 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc74535/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 8d75e79..03088d5 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 @@ -192,4 +192,22 @@ angular.module('ambariAdminConsole') || (filter.cluster.current && filter.cluster.current.value) || (filter.stack.current && filter.stack.current.value)); }, true); + + $scope.toggleVisibility = function (repo) { + repo.isProccessing = true; + var payload = { + RepositoryVersions:{ + hidden: repo.hidden + } + } + Stack.updateRepo(repo.stack_name, repo.stack_version, repo.id, payload).then( null, function () { + repo.hidden = !repo.hidden; + }).finally( function () { + delete repo.isProccessing; + }); + } + + $scope.isHideCheckBoxEnabled = function ( repo ) { + return !repo.isProccessing && ( !repo.cluster || repo.isPatch && ( repo.status === 'installed' || repo.status === 'install_failed') ); + } }]); http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc74535/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js ---------------------------------------------------------------------- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js index 239b149..1711543 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js +++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js @@ -159,6 +159,7 @@ angular.module('ambariAdminConsole') 'common.alerts.cannotUpdateAdminStatus': 'Cannot update User Admin status', 'common.alerts.checkFailed': 'CHECK FAILED', 'common.alerts.onlySimpleChars': 'Must contain only simple characters.', + 'common.hidden' : 'Hidden', 'main.title': 'Welcome to Apache Ambari', 'main.noClusterDescription': 'Provision a cluster, manage who can access the cluster, and customize views for Ambari users.', http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc74535/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html ---------------------------------------------------------------------- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html index 70212c0..bf19a62 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html +++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html @@ -59,6 +59,7 @@ ></select> </th> <th class="col-small"></th> + <th class="col-small text-center vertical-top">{{'common.hidden' | translate}}</th> </tr> </thead> <tbody> @@ -106,6 +107,7 @@ </div> </div> </td> + <td class="text-center"><input type="checkbox" data-ng-model="repo.hidden" data-ng-change="toggleVisibility(repo)" data-ng-disabled="!isHideCheckBoxEnabled(repo)"/></td> </tr> </tbody> </table>