Repository: incubator-zeppelin Updated Branches: refs/heads/master 47eb95aee -> f99bb8397
fix bootstrap dialog default button ### What is this PR for? Fix default focus issue on bootstrap alert/confirm box ### What type of PR is it? Improvement ### Is there a relevant Jira issue? no ### How should this be tested? Click on any action which prompts the user with a confirm box. Press enter/return for OK. Esc or click outside for cancel Author: Renjith Kamath <[email protected]> Closes #532 from r-kamath/bootstrapDialogFix and squashes the following commits: 16b968e [Renjith Kamath] Merge remote-tracking branch 'upstream/master' into bootstrapDialogFix fe63851 [Renjith Kamath] Merge remote-tracking branch 'upstream/master' into bootstrapDialogFix c81bbbe [Renjith Kamath] enable Esc key close for all bootstrap alert and confirm dialogs 7d933f0 [Renjith Kamath] fix bootstrap dialog default button Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/f99bb839 Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/f99bb839 Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/f99bb839 Branch: refs/heads/master Commit: f99bb83973bafcef7ee8de09422a4c57ab8399d0 Parents: 47eb95a Author: Renjith Kamath <[email protected]> Authored: Thu Dec 17 12:52:53 2015 +0530 Committer: Damien CORNEAU <[email protected]> Committed: Mon Dec 21 09:52:01 2015 +0900 ---------------------------------------------------------------------- zeppelin-web/src/app/app.controller.js | 7 +++++-- .../src/app/interpreter/interpreter.controller.js | 5 +++++ zeppelin-web/src/app/notebook/notebook.controller.js | 11 ++++++++--- .../src/app/notebook/paragraph/paragraph.controller.js | 1 + 4 files changed, 19 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/f99bb839/zeppelin-web/src/app/app.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/app.controller.js b/zeppelin-web/src/app/app.controller.js index 3f51330..2c302b5 100644 --- a/zeppelin-web/src/app/app.controller.js +++ b/zeppelin-web/src/app/app.controller.js @@ -20,7 +20,7 @@ angular.module('zeppelinWebApp').controller('MainCtrl', function($scope, $rootSc var init = function() { $scope.asIframe = (($window.location.href.indexOf('asIframe') > -1) ? true : false); }; - + init(); $rootScope.$on('setIframe', function(event, data) { @@ -36,10 +36,13 @@ angular.module('zeppelinWebApp').controller('MainCtrl', function($scope, $rootSc event.preventDefault(); } }); - + // Set The lookAndFeel to default on every page $rootScope.$on('$routeChangeStart', function(event, next, current) { $rootScope.$broadcast('setLookAndFeel', 'default'); }); + BootstrapDialog.defaultOptions.onshown = function() { + angular.element('#' + this.id).find('.btn:last').focus(); + }; }); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/f99bb839/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 ea62b16..396a552 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -57,6 +57,7 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, $scope.updateInterpreterSetting = function(settingId) { BootstrapDialog.confirm({ + closable: true, title: '', message: 'Do you want to update this interpreter and restart with new settings?', callback: function(result) { @@ -89,6 +90,7 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, $scope.removeInterpreterSetting = function(settingId) { BootstrapDialog.confirm({ + closable: true, title: '', message: 'Do you want to delete this interpreter setting?', callback: function(result) { @@ -126,6 +128,7 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, $scope.restartInterpreterSetting = function(settingId) { BootstrapDialog.confirm({ + closable: true, title: '', message: 'Do you want to restart this interpreter?', callback: function(result) { @@ -146,6 +149,7 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, $scope.addNewInterpreterSetting = function() { if (!$scope.newInterpreterSetting.name || !$scope.newInterpreterSetting.group) { BootstrapDialog.alert({ + closable: true, title: 'Add interpreter', message: 'Please determine name and interpreter' }); @@ -154,6 +158,7 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, if (_.findIndex($scope.interpreterSettings, { 'name': $scope.newInterpreterSetting.name }) >= 0) { BootstrapDialog.alert({ + closable: true, title: 'Add interpreter', message: 'Name ' + $scope.newInterpreterSetting.name + ' already exists' }); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/f99bb839/zeppelin-web/src/app/notebook/notebook.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/notebook/notebook.controller.js b/zeppelin-web/src/app/notebook/notebook.controller.js index 9533dd1..54903ff 100644 --- a/zeppelin-web/src/app/notebook/notebook.controller.js +++ b/zeppelin-web/src/app/notebook/notebook.controller.js @@ -74,6 +74,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro /** TODO(anthony): In the nearly future, go back to the main page and telle to the dude that the note have been remove */ $scope.removeNote = function(noteId) { BootstrapDialog.confirm({ + closable: true, title: '', message: 'Do you want to delete this notebook?', callback: function(result) { @@ -94,6 +95,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro //Clone note $scope.cloneNote = function(noteId) { BootstrapDialog.confirm({ + closable: true, title: '', message: 'Do you want to clone this notebook?', callback: function(result) { @@ -107,6 +109,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro $scope.runNote = function() { BootstrapDialog.confirm({ + closable: true, title: '', message: 'Run all paragraphs?', callback: function(result) { @@ -130,6 +133,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro $scope.clearAllParagraphOutput = function() { BootstrapDialog.confirm({ + closable: true, title: '', message: 'Do you want to clear all output?', callback: function(result) { @@ -313,11 +317,11 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro $scope.$on('insertParagraph', function(event, paragraphId, position) { var newIndex = -1; for (var i=0; i<$scope.note.paragraphs.length; i++) { - if ( $scope.note.paragraphs[i].id === paragraphId ) { + if ( $scope.note.paragraphs[i].id === paragraphId ) { //determine position of where to add new paragraph; default is below - if ( position === 'above' ) { + if ( position === 'above' ) { newIndex = i; - } else { + } else { newIndex = i+1; } break; @@ -497,6 +501,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro $scope.closeSetting = function() { if (isSettingDirty()) { BootstrapDialog.confirm({ + closable: true, title: '', message: 'Changes will be discarded.', callback: function(result) { http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/f99bb839/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index 1a91c27..c7c4de3 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -298,6 +298,7 @@ angular.module('zeppelinWebApp') $scope.removeParagraph = function() { BootstrapDialog.confirm({ + closable: true, title: '', message: 'Do you want to delete this paragraph?', callback: function(result) {
