Repository: incubator-zeppelin Updated Branches: refs/heads/master 105538caa -> ca8563fbf
Use bootstrap dialog in place of standard confirm ### What is this PR for? Use bootstrap dialog in place of standard confirm ### What type of PR is it? Improvement ### Todos ### What is the Jira issue? NA ### How should this be tested? ### Screenshots (if appropriate) Before:  After:  ### Questions: * Does the licenses files need update?no * Is there breaking changes for older versions?no * Does this needs documentation?no Author: Ravi Ranjan <[email protected]> Closes #837 from ravicodder/dependencyLoader and squashes the following commits: 6db39cc [Ravi Ranjan] Fix indentation 87eb1fe [Ravi Ranjan] Merge branch 'dependencyLoader' of https://github.com/ravicodder/incubator-zeppelin into dependencyLoader 0e3e4d1 [Ravi Ranjan] Update Test e33f0d1 [Ravi Ranjan] Update Test 846b226 [Ravi Ranjan] use bootstrap dialog in place of standard confirm Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/ca8563fb Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/ca8563fb Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/ca8563fb Branch: refs/heads/master Commit: ca8563fbf7f77264487a1582fa65614611ecd41c Parents: 105538c Author: Ravi Ranjan <[email protected]> Authored: Mon Apr 18 09:50:27 2016 +0530 Committer: Felix Cheung <[email protected]> Committed: Fri Apr 22 19:54:10 2016 -0700 ---------------------------------------------------------------------- .../apache/zeppelin/integration/ZeppelinIT.java | 6 +- .../app/interpreter/interpreter.controller.js | 76 ++++++++++---------- 2 files changed, 44 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/ca8563fb/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 bad8b84..6d14f6f 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 @@ -205,7 +205,8 @@ public class ZeppelinIT extends AbstractZeppelinIT { String artifact = "org.apache.commons:commons-csv:1.1"; depArtifact.sendKeys(artifact); driver.findElement(By.xpath("//button[contains(.,'Save')]")).submit(); - driver.switchTo().alert().accept(); + 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(); driver.navigate().back(); createNewNote(); @@ -241,7 +242,8 @@ public class ZeppelinIT extends AbstractZeppelinIT { sleep(5000, true); testDepRemoveBtn.click(); driver.findElement(By.xpath("//button[contains(.,'Save')]")).submit(); - driver.switchTo().alert().accept(); + 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(); } catch (Exception e) { handleException("Exception in ZeppelinIT while testSparkInterpreterDependencyLoading ", e); } http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/ca8563fb/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 195360a..ee72c3f 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -60,44 +60,48 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, interpreterSettingsTmp[index] = angular.copy($scope.interpreterSettings[index]); }; - $scope.updateInterpreterSetting = function(form, settingId) { - var result = confirm('Do you want to update this interpreter and restart with new settings?'); - if (result) { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - var setting = $scope.interpreterSettings[index]; - if (setting.propertyKey !== '' || setting.propertyKey) { - $scope.addNewInterpreterProperty(settingId); - } - if (setting.depArtifact !== '' || setting.depArtifact) { - $scope.addNewInterpreterDependency(settingId); - } + $scope.updateInterpreterSetting = function (form, settingId) { + BootstrapDialog.confirm({ + closable: true, + title: '', + message: 'Do you want to update this interpreter and restart with new settings?', + callback: function (result) { + if (result) { + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + var setting = $scope.interpreterSettings[index]; + if (setting.propertyKey !== '' || setting.propertyKey) { + $scope.addNewInterpreterProperty(settingId); + } + if (setting.depArtifact !== '' || setting.depArtifact) { + $scope.addNewInterpreterDependency(settingId); + } + // add missing field of option + if (!setting.option) { + setting.option = {}; + } + if (setting.option.remote === undefined) { + // remote always true for now + setting.option.remote = true; + } + var request = { + option: angular.copy(setting.option), + properties: angular.copy(setting.properties), + dependencies: angular.copy(setting.dependencies) + }; - // add missing field of option - if (!setting.option) { - setting.option = {}; - } - if (setting.option.remote === undefined) { - // remote always true for now - setting.option.remote = true; + $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) { + console.log('Error %o %o', status, data.message); + ngToast.danger({content: data.message, verticalPosition: 'bottom'}); + form.$show(); + }); + } } - - var request = { - option: angular.copy(setting.option), - properties: angular.copy(setting.properties), - dependencies: angular.copy(setting.dependencies) - }; - - $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) { - console.log('Error %o %o', status, data.message); - ngToast.danger({content: data.message, verticalPosition: 'bottom'}); - form.$show(); - }); - } + }); }; $scope.resetInterpreterSetting = function(settingId){
