Repository: zeppelin Updated Branches: refs/heads/master 32fe23f2e -> 55de3fba7
[hotfix] does not showing notebooklist on navbar ### What is this PR for? Currently, if you enabled for shiro then not showing notebook list on navbar. (If you refresh, it's well viewwing.) i resolve this problem. ### What type of PR is it? Bug Fix ### Todos - [x] fixed a bug ( navbar.controller.js) - [x] added testcase ### How should this be tested? 1. endabled shiro (per user login) 2. login. 3. on click to notebook menu on navbar. ### Screenshots (if appropriate) #### before  #### resolve after (on this pr)  ### Questions: * Does the licenses files need update? no * Is there breaking changes for older versions? no * Does this needs documentation? no Author: CloverHearts <[email protected]> Closes #1586 from cloverhearts/ZEPPELIN-NOTEBOOKLIST-SHIRO and squashes the following commits: 1a9aec9 [CloverHearts] remove console log 0378d76 [CloverHearts] fixed test case throws exception 72ff950 [CloverHearts] fixed notebook list count testcase in AuthIT 27451a4 [CloverHearts] bug fixed can't load for notebook list when enabled shiro Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/55de3fba Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/55de3fba Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/55de3fba Branch: refs/heads/master Commit: 55de3fba71bc8141b13cf1538ab29f43811d985b Parents: 32fe23f Author: CloverHearts <[email protected]> Authored: Thu Nov 3 15:55:43 2016 +0900 Committer: Alexander Bezzubov <[email protected]> Committed: Thu Nov 3 18:37:27 2016 +0900 ---------------------------------------------------------------------- .../zeppelin/integration/AuthenticationIT.java | 21 +++++++++++++++++++- .../src/components/navbar/navbar.controller.js | 17 +++++++++------- 2 files changed, 30 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55de3fba/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java index fea67d6..decd713 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java @@ -39,6 +39,8 @@ import java.io.IOException; import java.net.URI; import java.util.List; +import static org.junit.Assert.assertTrue; + /** * Created for org.apache.zeppelin.integration on 13/06/16. @@ -119,6 +121,23 @@ public class AuthenticationIT extends AbstractZeppelinIT { ZeppelinITUtils.sleep(1000, false); } + private void testShowNotebookListOnNavbar() throws Exception { + if (!endToEndTestEnabled()) { + return; + } + try { + pollingWait(By.xpath("//li[@class='dropdown notebook-list-dropdown']"), + MAX_BROWSER_TIMEOUT_SEC).click(); + assertTrue(driver.findElements(By.xpath("//a[@class=\"notebook-list-item ng-scope\"]")).size() > 0); + pollingWait(By.xpath("//li[@class='dropdown notebook-list-dropdown']"), + MAX_BROWSER_TIMEOUT_SEC).click(); + pollingWait(By.xpath("//li[@class='dropdown notebook-list-dropdown']"), + MAX_BROWSER_TIMEOUT_SEC).click(); + } catch (Exception e) { + handleException("Exception in ParagraphActionsIT while testShowNotebookListOnNavbar ", e); + } + } + private void logoutUser(String userName) { ZeppelinITUtils.sleep(500, false); driver.findElement(By.xpath("//div[contains(@class, 'navbar-collapse')]//li[contains(.,'" + @@ -144,7 +163,7 @@ public class AuthenticationIT extends AbstractZeppelinIT { authenticationIT.logoutUser("admin"); } catch (Exception e) { - handleException("Exception in ParagraphActionsIT while testCreateNewButton ", e); + handleException("Exception in AuthenticationIT while testCreateNewButton ", e); } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55de3fba/zeppelin-web/src/components/navbar/navbar.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/navbar/navbar.controller.js b/zeppelin-web/src/components/navbar/navbar.controller.js index 4778669..8d024ad 100644 --- a/zeppelin-web/src/components/navbar/navbar.controller.js +++ b/zeppelin-web/src/components/navbar/navbar.controller.js @@ -114,6 +114,7 @@ $scope.$on('setNoteMenu', function(event, notes) { noteListDataFactory.setNotes(notes); + initNotebookListEventListener(); }); $scope.$on('setConnectedStatus', function(event, param) { @@ -127,15 +128,17 @@ /* ** Performance optimization for Browser Render. */ - angular.element(document).ready(function() { - angular.element('.notebook-list-dropdown').on('show.bs.dropdown', function() { - $scope.isDrawNavbarNoteList = true; - }); + function initNotebookListEventListener() { + angular.element(document).ready(function() { + angular.element('.notebook-list-dropdown').on('show.bs.dropdown', function() { + $scope.isDrawNavbarNoteList = true; + }); - angular.element('.notebook-list-dropdown').on('hide.bs.dropdown', function() { - $scope.isDrawNavbarNoteList = false; + angular.element('.notebook-list-dropdown').on('hide.bs.dropdown', function() { + $scope.isDrawNavbarNoteList = false; + }); }); - }); + } } })();
