Repository: zeppelin Updated Branches: refs/heads/master 4c66689c2 -> d3082e359
[ZEPPELIN-1072] Saving Interpreter Setting dosen't notify when its finished ### What is this PR for? When user tries to save Interpreter Setting, it does not notify user when its done. In cases where saving setting includes adding dependencies, it can take longer than 10 seconds, depending on number of dependencies added. ### What type of PR is it? [Improvement] ### Todos * [x] - add fa-spin with OK button ### What is the Jira issue? * [ZEPPELIN-1072](https://issues.apache.org/jira/browse/ZEPPELIN-1072) ### How should this be tested? Try loading a dependency in any of the interpreter, you will notice "OK" button is replaced by loading icon. ### Screenshots (if appropriate)  ### Questions: * Does the licenses files need update? n/a * Is there breaking changes for older versions? n/a * Does this needs documentation? n/a Author: Prabhjyot Singh <[email protected]> Closes #1101 from prabhjyotsingh/ZEPPELIN-1072 and squashes the following commits: 4a22b10 [Prabhjyot Singh] Merge remote-tracking branch 'origin/master' into ZEPPELIN-1072 cbe2441 [Prabhjyot Singh] worry less, if modal dialog already closed 2a7abdc [Prabhjyot Singh] CI fix 971fd94 [Prabhjyot Singh] add fa-spin with OK button Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/d3082e35 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/d3082e35 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/d3082e35 Branch: refs/heads/master Commit: d3082e359f4524537702e1b98839be33d98f0a2b Parents: 4c66689 Author: Prabhjyot Singh <[email protected]> Authored: Wed Jun 29 08:32:37 2016 +0530 Committer: Prabhjyot Singh <[email protected]> Committed: Fri Jul 1 09:07:38 2016 +0530 ---------------------------------------------------------------------- .../org/apache/zeppelin/AbstractZeppelinIT.java | 18 +++++------------- .../apache/zeppelin/integration/ZeppelinIT.java | 13 +++++++++++-- .../src/app/interpreter/interpreter.controller.js | 17 ++++++++++++----- 3 files changed, 28 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d3082e35/zeppelin-server/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java index 4e08a89..c99bf0a 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java @@ -105,20 +105,12 @@ abstract public class AbstractZeppelinIT { } protected void createNewNote() { - List<WebElement> notebookLinks = driver.findElements(By - .xpath("//div[contains(@class, \"col-md-4\")]/div/ul/li")); - List<String> notebookTitles = new LinkedList<String>(); - for (WebElement el : notebookLinks) { - notebookTitles.add(el.getText()); - } - - WebElement createNoteLink = driver.findElement(By.xpath("//div[contains(@class, \"col-md-4\")]/div/h5/a[contains(.,'Create new note')]")); - createNoteLink.click(); + clickAndWait(By.xpath("//div[contains(@class, \"col-md-4\")]/div/h5/a[contains(.,'Create new" + + " note')]")); WebDriverWait block = new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC); - WebElement modal = block.until(ExpectedConditions.visibilityOfElementLocated(By.id("noteNameModal"))); - WebElement createNoteButton = modal.findElement(By.id("createNoteButton")); - createNoteButton.click(); + block.until(ExpectedConditions.visibilityOfElementLocated(By.id("noteNameModal"))); + clickAndWait(By.id("createNoteButton")); try { Thread.sleep(500); // wait for notebook list updated @@ -136,7 +128,7 @@ abstract public class AbstractZeppelinIT { } protected void clickAndWait(final By locator) { - driver.findElement(locator).click(); + pollingWait(locator, MAX_IMPLICIT_WAIT).click(); ZeppelinITUtils.sleep(1000, true); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d3082e35/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java index 6494dc5..60ec641 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java @@ -28,6 +28,7 @@ import org.junit.Test; import org.junit.rules.ErrorCollector; import org.openqa.selenium.By; import org.openqa.selenium.Keys; +import org.openqa.selenium.TimeoutException; import org.openqa.selenium.WebElement; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -210,8 +211,16 @@ public class ZeppelinIT extends AbstractZeppelinIT { String artifact = "org.apache.commons:commons-csv:1.1"; depArtifact.sendKeys(artifact); driver.findElement(By.xpath("//div[@id='spark']//form//button[1]")).click(); - driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to update this interpreter and restart with new settings?')]" + - "//div[@class='modal-footer']//button[contains(.,'OK')]")).click(); + clickAndWait(By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to update this interpreter and restart with new settings?')]" + + "//div[@class='modal-footer']//button[contains(.,'OK')]")); + + try { + clickAndWait(By.xpath("//div[@class='modal-dialog'][contains(.,'Do you want to " + + "update this interpreter and restart with new settings?')]//" + + "div[@class='bootstrap-dialog-close-button']/button")); + } catch (TimeoutException e) { + //Modal dialog got closed earlier than expected nothing to worry. + } driver.navigate().back(); createNewNote(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d3082e35/zeppelin-web/src/app/interpreter/interpreter.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index d787238..4df4ca6 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -102,7 +102,7 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, }; $scope.updateInterpreterSetting = function(form, settingId) { - BootstrapDialog.confirm({ + var thisConfirm = BootstrapDialog.confirm({ closable: true, title: '', message: 'Do you want to update this interpreter and restart with new settings?', @@ -133,16 +133,23 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, dependencies: angular.copy(setting.dependencies) }; - $http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId, request). - success(function (data, status, headers, config) { + thisConfirm.$modalFooter.find('button').addClass('disabled'); + thisConfirm.$modalFooter.find('button:contains("OK")') + .html('<i class="fa fa-circle-o-notch fa-spin"></i> Saving Setting'); + + $http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId, request) + .success(function(data, status, headers, config) { $scope.interpreterSettings[index] = data.body; removeTMPSettings(index); - }). - error(function (data, status, headers, config) { + thisConfirm.close(); + }) + .error(function(data, status, headers, config) { console.log('Error %o %o', status, data.message); ngToast.danger({content: data.message, verticalPosition: 'bottom'}); form.$show(); + thisConfirm.close(); }); + return false; } } });
