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 E5DF918154 for ; Tue, 8 Dec 2015 23:29:44 +0000 (UTC) Received: (qmail 69410 invoked by uid 500); 8 Dec 2015 23:29:44 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 69376 invoked by uid 500); 8 Dec 2015 23:29:44 -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 69367 invoked by uid 99); 8 Dec 2015 23:29:44 -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; Tue, 08 Dec 2015 23:29:44 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 96A0CE0972; Tue, 8 Dec 2015 23:29:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rzang@apache.org To: commits@ambari.apache.org Message-Id: <0bd5742132864036b30de345520cd2c0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-14261. Loading freeze after login as a view user (rzang) Date: Tue, 8 Dec 2015 23:29:44 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/trunk 5a5f16de9 -> f2ca027f0 AMBARI-14261. Loading freeze after login as a view user (rzang) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f2ca027f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f2ca027f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f2ca027f Branch: refs/heads/trunk Commit: f2ca027f0290211b683d8dffb668f11813d13125 Parents: 5a5f16d Author: Richard Zang Authored: Tue Dec 8 15:28:56 2015 -0800 Committer: Richard Zang Committed: Tue Dec 8 15:28:56 2015 -0800 ---------------------------------------------------------------------- ambari-web/app/app.js | 3 +++ ambari-web/app/controllers/application.js | 4 ++++ ambari-web/app/router.js | 5 ++--- ambari-web/app/routes/main.js | 11 ++++++++--- ambari-web/app/templates/application.hbs | 2 +- ambari-web/app/views/main/menu.js | 15 ++++++++------- 6 files changed, 26 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f2ca027f/ambari-web/app/app.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js index 881bfc3..9009c00 100644 --- a/ambari-web/app/app.js +++ b/ambari-web/app/app.js @@ -37,6 +37,9 @@ module.exports = Em.Application.create({ isOperator: false, isPermissionDataLoaded: false, auth: null, + isOnlyViewUser: function() { + return App.auth && (App.auth.length == 0 || (App.isAuthorized('VIEW.USE') && App.auth.length == 1)); + }.property('auth'), /** * @type {boolean} http://git-wip-us.apache.org/repos/asf/ambari/blob/f2ca027f/ambari-web/app/controllers/application.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/application.js b/ambari-web/app/controllers/application.js index 12d33eb..c623118 100644 --- a/ambari-web/app/controllers/application.js +++ b/ambari-web/app/controllers/application.js @@ -45,6 +45,10 @@ App.ApplicationController = Em.Controller.extend(App.UserPref, { isExistingClusterDataLoaded: Em.computed.and('App.router.clusterInstallCompleted', 'isClusterDataLoaded'), + enableLinks: function() { + return this.isExistingClusterDataLoaded && !App.get('isOnlyViewUser'); + }.property(), + /** * Determines if "Exit" menu-item should be shown * It should if cluster isn't installed http://git-wip-us.apache.org/repos/asf/ambari/blob/f2ca027f/ambari-web/app/router.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js index 36a2353..92b2bae 100644 --- a/ambari-web/app/router.js +++ b/ambari-web/app/router.js @@ -360,7 +360,6 @@ App.Router = Em.Router.extend({ var privileges = params.loginData.privileges || []; var router = this; var isAdmin = privileges.mapProperty('PrivilegeInfo.permission_name').contains('AMBARI.ADMINISTRATOR'); - var isOnlyViewUser = App.auth && (App.auth.length == 0 || (App.isAuthorized('VIEW.USE') && App.auth.length == 1)); App.set('isAdmin', isAdmin); @@ -377,13 +376,13 @@ App.Router = Em.Router.extend({ isOperator: true }); } - if (isOnlyViewUser) { + if (App.get('isOnlyViewUser')) { router.transitionToViews(); } else { router.transitionToApp(); } } else { - if (isOnlyViewUser) { + if (App.get('isOnlyViewUser')) { router.transitionToViews(); } else { router.transitionToAdminView(); http://git-wip-us.apache.org/repos/asf/ambari/blob/f2ca027f/ambari-web/app/routes/main.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js index 46315ae..cae1035 100644 --- a/ambari-web/app/routes/main.js +++ b/ambari-web/app/routes/main.js @@ -38,9 +38,14 @@ module.exports = Em.Route.extend(App.RouterRedirections, { } else { if (router.get('clusterInstallCompleted')) { App.router.get('clusterController').loadClientServerClockDistance().done(function () { - App.router.get('clusterController').checkDetailedRepoVersion().done(function () { - router.get('mainController').initialize(); - }); + if (!App.get('isOnlyViewUser')) { + App.router.get('clusterController').checkDetailedRepoVersion().done(function () { + router.get('mainController').initialize(); + }); + } else { + App.router.transitionTo('main.views.index'); + App.router.get('clusterController').set('isLoaded', true); // hide loading bar + } }); } else { http://git-wip-us.apache.org/repos/asf/ambari/blob/f2ca027f/ambari-web/app/templates/application.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/application.hbs b/ambari-web/app/templates/application.hbs index 190f439..9da0da5 100644 --- a/ambari-web/app/templates/application.hbs +++ b/ambari-web/app/templates/application.hbs @@ -21,7 +21,7 @@