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 50D3117A6A for ; Thu, 23 Oct 2014 10:49:06 +0000 (UTC) Received: (qmail 39160 invoked by uid 500); 23 Oct 2014 10:49:06 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 39132 invoked by uid 500); 23 Oct 2014 10:49:06 -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 39123 invoked by uid 99); 23 Oct 2014 10:49:06 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2014 10:49:06 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EEE351609C; Thu, 23 Oct 2014 10:49:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: atkach@apache.org To: commits@ambari.apache.org Message-Id: <4f9a8e5aea514be9b7c893d71a62a612@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: AMBARI-7852 Broken Dashboard after routing to Views. (Ievgen Fialkovskyi via atkach) Date: Thu, 23 Oct 2014 10:49:05 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/trunk 37299ab31 -> 59b0f6597 AMBARI-7852 Broken Dashboard after routing to Views. (Ievgen Fialkovskyi via atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/59b0f659 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/59b0f659 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/59b0f659 Branch: refs/heads/trunk Commit: 59b0f65977498eedd723dc0412d8c5405d1ea451 Parents: 37299ab Author: atkach Authored: Thu Oct 23 13:48:46 2014 +0300 Committer: atkach Committed: Thu Oct 23 13:48:46 2014 +0300 ---------------------------------------------------------------------- ambari-web/app/assets/test/tests.js | 1 + ambari-web/app/views/main/menu.js | 7 ++-- ambari-web/test/views/main/menu_test.js | 55 ++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/59b0f659/ambari-web/app/assets/test/tests.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js index 65082ab..bfa5cd2 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -141,6 +141,7 @@ var files = ['test/init_model_test', 'test/views/common/rolling_restart_view_test', 'test/views/common/configs/config_history_flow_test', 'test/views/main/dashboard_test', + 'test/views/main/menu_test', 'test/views/main/dashboard/config_history_view_test', 'test/views/main/dashboard/widget_test', 'test/views/main/dashboard/widgets_test', http://git-wip-us.apache.org/repos/asf/ambari/blob/59b0f659/ambari-web/app/views/main/menu.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js index 69d0e45..89e9ac8 100644 --- a/ambari-web/app/views/main/menu.js +++ b/ambari-web/app/views/main/menu.js @@ -34,7 +34,7 @@ App.MainMenuView = Em.CollectionView.extend({ var result = []; if (App.router.get('loggedIn')) { - if (App.router.get('clusterController.isLoaded') && App.get('clusterName')) { + if (App.router.get('clusterController.isLoaded') && App.get('router.clusterInstallCompleted')) { result.push( { label:Em.I18n.t('menu.item.dashboard'), routing:'dashboard', active:'active'}, @@ -61,8 +61,9 @@ App.MainMenuView = Em.CollectionView.extend({ } return result; - }.property('App.router.loggedIn', 'App.router.clusterController.isLoaded', 'App.supports.views', 'App.supports.mirroring', - 'App.supports.secureCluster', 'App.supports.highAvailability', 'views.length'), + }.property('App.router.loggedIn', 'App.supports.views', 'App.supports.mirroring', + 'App.supports.secureCluster', 'App.supports.highAvailability', 'views.length', + 'App.router.clusterController.isLoaded', 'App.router.clusterInstallCompleted'), itemViewClass:Em.View.extend({ http://git-wip-us.apache.org/repos/asf/ambari/blob/59b0f659/ambari-web/test/views/main/menu_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/menu_test.js b/ambari-web/test/views/main/menu_test.js new file mode 100644 index 0000000..d60bace --- /dev/null +++ b/ambari-web/test/views/main/menu_test.js @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +var App = require('app'); +require('views/main/menu'); + +var mainMenuView = App.MainMenuView.create(); +describe('App.MainMenuView', function () { + + describe('#content', function () { + var supportsMirroring; + beforeEach(function () { + supportsMirroring = Em.get('App.supports.mirroring'); + Em.set('App.supports.mirroring', false); + sinon.stub(App, 'get').returns(false); + sinon.stub(App.router, 'get') + .withArgs('clusterController.isLoaded').returns(true) + .withArgs('loggedIn').returns(true); + }); + afterEach(function () { + Em.set('App.supports.mirroring', supportsMirroring); + App.get.restore(); + App.router.get.restore(); + }); + + it('menu should be populated if cluster installation is completed', function () { + App.get.withArgs('router.clusterInstallCompleted').returns(true); + App.router.notifyPropertyChange('clusterInstallCompleted'); + expect(mainMenuView.get('content').length > 0).to.be.true; + }); + + it('menu should not be populated if cluster installation is not completed', function () { + App.get.withArgs('router.clusterInstallCompleted').returns(false); + App.router.notifyPropertyChange('clusterInstallCompleted'); + expect(mainMenuView.get('content').length > 0).to.be.false; + }); + + }); +});