You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2015/12/09 21:16:50 UTC
incubator-zeppelin git commit: Replace standard alert and confirm
with BootstrapDialog
Repository: incubator-zeppelin
Updated Branches:
refs/heads/master 8e8393321 -> b358ad265
Replace standard alert and confirm with BootstrapDialog
Before
<img width="566" alt="screen shot 2015-12-01 at 4 56 45 pm" src="https://cloud.githubusercontent.com/assets/2031306/11523424/303e835a-98e8-11e5-9f97-c4618b2905ee.png">
<hr />
After
<img width="789" alt="screen shot 2015-12-01 at 4 57 27 pm" src="https://cloud.githubusercontent.com/assets/2031306/11523423/3038205a-98e8-11e5-95b5-90983f6ae323.png">
Author: Renjith Kamath <re...@gmail.com>
Closes #501 from r-kamath/bootstrapDialog and squashes the following commits:
657795f [Renjith Kamath] add license for bootstrap3-dialog
8d18e2d [Renjith Kamath] replace standard alert and confirm with BootstrapDialog
Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/b358ad26
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/b358ad26
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/b358ad26
Branch: refs/heads/master
Commit: b358ad26518681a52a859efadf9de4817cb3a63c
Parents: 8e83933
Author: Renjith Kamath <re...@gmail.com>
Authored: Wed Dec 9 11:51:09 2015 +0530
Committer: Lee moon soo <mo...@apache.org>
Committed: Thu Dec 10 05:17:52 2015 +0900
----------------------------------------------------------------------
zeppelin-distribution/src/bin_license/LICENSE | 1 +
zeppelin-web/.jshintrc | 3 +-
zeppelin-web/bower.json | 3 +-
zeppelin-web/src/app/home/home.css | 4 +
.../app/interpreter/interpreter.controller.js | 105 +++++++++++--------
.../src/app/notebook/notebook.controller.js | 80 +++++++++-----
.../notebook/paragraph/paragraph.controller.js | 15 ++-
zeppelin-web/src/index.html | 2 +
zeppelin-web/test/karma.conf.js | 1 +
9 files changed, 134 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b358ad26/zeppelin-distribution/src/bin_license/LICENSE
----------------------------------------------------------------------
diff --git a/zeppelin-distribution/src/bin_license/LICENSE b/zeppelin-distribution/src/bin_license/LICENSE
index 9aebb40..d59f80c 100644
--- a/zeppelin-distribution/src/bin_license/LICENSE
+++ b/zeppelin-distribution/src/bin_license/LICENSE
@@ -81,6 +81,7 @@ The text of each license is also included at licenses/LICENSE-[project]-[version
(The MIT License) es5-shim v3.1.0 (https://github.com/es-shims/es5-shim) - https://github.com/es-shims/es5-shim/blob/v3.1.0/LICENSE
(The MIT License) bootstrap v3.2.0 (http://getbootstrap.com/) - https://github.com/twbs/bootstrap/blob/v3.2.0/LICENSE
(The MIT License) UI Bootstrap v0.13.0 (http://angular-ui.github.io/bootstrap/) - https://github.com/angular-ui/bootstrap/blob/0.13.0/LICENSE
+ (The MIT License) bootstrap3-dialog v1.34.7 (https://github.com/nakupanda/bootstrap3-dialog/tree/v1.34.7) - https://github.com/nakupanda/bootstrap3-dialog/tree/v1.34.7
(The MIT License) Angular Websocket v1.0.13 (http://angularclass.github.io/angular-websocket/) - https://github.com/AngularClass/angular-websocket/blob/v1.0.13/LICENSE
(The MIT License) UI.Ace v0.1.1 (http://angularclass.github.io/angular-websocket/) - https://github.com/angular-ui/ui-ace/blob/master/LICENSE
(The MIT License) jquery.scrollTo v1.4.13 (https://github.com/flesler/jquery.scrollTo) - https://github.com/flesler/jquery.scrollTo/blob/1.4.13/LICENSE
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b358ad26/zeppelin-web/.jshintrc
----------------------------------------------------------------------
diff --git a/zeppelin-web/.jshintrc b/zeppelin-web/.jshintrc
index 623ffed..d15bbb9 100644
--- a/zeppelin-web/.jshintrc
+++ b/zeppelin-web/.jshintrc
@@ -30,6 +30,7 @@
"alert": false,
"nv": false,
"ace": false,
- "d3": false
+ "d3": false,
+ "BootstrapDialog": false
}
}
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b358ad26/zeppelin-web/bower.json
----------------------------------------------------------------------
diff --git a/zeppelin-web/bower.json b/zeppelin-web/bower.json
index 04bdbf8..37ab9cd 100644
--- a/zeppelin-web/bower.json
+++ b/zeppelin-web/bower.json
@@ -26,7 +26,8 @@
"highlightjs": "~8.4.0",
"lodash": "~3.9.3",
"angular-filter": "~0.5.4",
- "ngtoast": "~1.5.5"
+ "ngtoast": "~1.5.5",
+ "bootstrap3-dialog": "bootstrap-dialog#~1.34.7"
},
"devDependencies": {
"angular-mocks": "1.3.8"
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b358ad26/zeppelin-web/src/app/home/home.css
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/home/home.css b/zeppelin-web/src/app/home/home.css
index 7594a3e..c5f79e1 100644
--- a/zeppelin-web/src/app/home/home.css
+++ b/zeppelin-web/src/app/home/home.css
@@ -683,3 +683,7 @@ This part should be removed when new version of bootstrap handles this issue.
-webkit-transform: translateY(0);
opacity: 1;
}
+
+.bootstrap-dialog.type-primary .modal-header {
+ background: #3071a9;
+}
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b358ad26/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 db000c8..e4c772a 100644
--- a/zeppelin-web/src/app/interpreter/interpreter.controller.js
+++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js
@@ -55,25 +55,26 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope,
};
$scope.updateInterpreterSetting = function(settingId) {
- var result = confirm('Do you want to update this interpreter and restart with new settings?');
- if (!result) {
- return;
- }
-
- var index = _.findIndex($scope.interpreterSettings, { 'id': settingId });
-
- var request = {
- properties : angular.copy($scope.interpreterSettings[index].properties),
- };
-
-
- $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);
+ BootstrapDialog.confirm({
+ 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 request = {
+ properties: angular.copy($scope.interpreterSettings[index].properties),
+ };
+
+ $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);
+ });
+ }
+ }
});
};
@@ -86,19 +87,22 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope,
};
$scope.removeInterpreterSetting = function(settingId) {
- var result = confirm('Do you want to delete this interpreter setting?');
- if (!result) {
- return;
- }
-
- $http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId).
- success(function(data, status, headers, config) {
-
- var index = _.findIndex($scope.interpreterSettings, { 'id': settingId });
- $scope.interpreterSettings.splice(index, 1);
- }).
- error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
+ BootstrapDialog.confirm({
+ title: '',
+ message: 'Do you want to delete this interpreter setting?',
+ callback: function(result) {
+ if (result) {
+ $http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId).
+ success(function(data, status, headers, config) {
+
+ var index = _.findIndex($scope.interpreterSettings, { 'id': settingId });
+ $scope.interpreterSettings.splice(index, 1);
+ }).
+ error(function(data, status, headers, config) {
+ console.log('Error %o %o', status, data.message);
+ });
+ }
+ }
});
};
@@ -120,29 +124,38 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope,
};
$scope.restartInterpreterSetting = function(settingId) {
- var result = confirm('Do you want to restart this interpreter?');
- if (!result) {
- return;
- }
-
- $http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/restart/' + settingId).
- success(function(data, status, headers, config) {
- var index = _.findIndex($scope.interpreterSettings, { 'id': settingId });
- $scope.interpreterSettings[index] = data.body;
- }).
- error(function(data, status, headers, config) {
- console.log('Error %o %o', status, data.message);
+ BootstrapDialog.confirm({
+ title: '',
+ message: 'Do you want to restart this interpreter?',
+ callback: function(result) {
+ if (result) {
+ $http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/restart/' + settingId).
+ success(function(data, status, headers, config) {
+ var index = _.findIndex($scope.interpreterSettings, { 'id': settingId });
+ $scope.interpreterSettings[index] = data.body;
+ }).
+ error(function(data, status, headers, config) {
+ console.log('Error %o %o', status, data.message);
+ });
+ }
+ }
});
};
$scope.addNewInterpreterSetting = function() {
if (!$scope.newInterpreterSetting.name || !$scope.newInterpreterSetting.group) {
- alert('Please determine name and interpreter');
+ BootstrapDialog.alert({
+ title: 'Add interpreter',
+ message: 'Please determine name and interpreter'
+ });
return;
}
if (_.findIndex($scope.interpreterSettings, { 'name': $scope.newInterpreterSetting.name }) >= 0) {
- alert('Name ' + $scope.newInterpreterSetting.name + ' already exists');
+ BootstrapDialog.alert({
+ title: 'Add interpreter',
+ message: 'Name ' + $scope.newInterpreterSetting.name + ' already exists'
+ });
return;
}
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b358ad26/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 6c3fc4e..b767e4e 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.js
@@ -73,11 +73,16 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
/** Remove the note and go back tot he main page */
/** 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) {
- var result = confirm('Do you want to delete this notebook?');
- if (result) {
- websocketMsgSrv.deleteNotebook(noteId);
- $location.path('/#');
- }
+ BootstrapDialog.confirm({
+ title: '',
+ message: 'Do you want to delete this notebook?',
+ callback: function(result) {
+ if (result) {
+ websocketMsgSrv.deleteNotebook(noteId);
+ $location.path('/#');
+ }
+ }
+ });
};
//Export notebook
@@ -88,20 +93,30 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
//Clone note
$scope.cloneNote = function(noteId) {
- var result = confirm('Do you want to clone this notebook?');
- if (result) {
- websocketMsgSrv.cloneNotebook(noteId);
- $location.path('/#');
- }
+ BootstrapDialog.confirm({
+ title: '',
+ message: 'Do you want to clone this notebook?',
+ callback: function(result) {
+ if (result) {
+ websocketMsgSrv.cloneNotebook(noteId);
+ $location.path('/#');
+ }
+ }
+ });
};
$scope.runNote = function() {
- var result = confirm('Run all paragraphs?');
- if (result) {
- _.forEach($scope.note.paragraphs, function(n, key) {
- angular.element('#' + n.id + '_paragraphColumn_main').scope().runParagraph(n.text);
- });
- }
+ BootstrapDialog.confirm({
+ title: '',
+ message: 'Run all paragraphs?',
+ callback: function(result) {
+ if (result) {
+ _.forEach($scope.note.paragraphs, function (n, key) {
+ angular.element('#' + n.id + '_paragraphColumn_main').scope().runParagraph(n.text);
+ });
+ }
+ }
+ });
};
$scope.saveNote = function() {
@@ -114,12 +129,17 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
};
$scope.clearAllParagraphOutput = function() {
- var result = confirm('Do you want to clear all output?');
- if (result) {
- _.forEach($scope.note.paragraphs, function(n, key) {
- angular.element('#' + n.id + '_paragraphColumn_main').scope().clearParagraphOutput();
- });
- }
+ BootstrapDialog.confirm({
+ title: '',
+ message: 'Do you want to clear all output?',
+ callback: function(result) {
+ if (result) {
+ _.forEach($scope.note.paragraphs, function(n, key) {
+ angular.element('#' + n.id + '_paragraphColumn_main').scope().clearParagraphOutput();
+ });
+ }
+ }
+ });
};
$scope.toggleAllEditor = function() {
@@ -477,12 +497,18 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
$scope.closeSetting = function() {
if (isSettingDirty()) {
- var result = confirm('Changes will be discarded');
- if (!result) {
- return;
- }
+ BootstrapDialog.confirm({
+ title: '',
+ message: 'Changes will be discarded',
+ callback: function(result) {
+ if (result) {
+ $scope.$apply(function () {
+ $scope.showSetting = false;
+ });
+ }
+ }
+ });
}
- $scope.showSetting = false;
};
$scope.saveSetting = function() {
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b358ad26/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 3c15715..dd66a59 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -298,11 +298,16 @@ angular.module('zeppelinWebApp')
};
$scope.removeParagraph = function() {
- var result = confirm('Do you want to delete this paragraph?');
- if (result) {
- console.log('Remove paragraph');
- websocketMsgSrv.removeParagraph($scope.paragraph.id);
- }
+ BootstrapDialog.confirm({
+ title: '',
+ message: 'Do you want to delete this paragraph?',
+ callback: function(result) {
+ if (result) {
+ console.log('Remove paragraph');
+ websocketMsgSrv.removeParagraph($scope.paragraph.id);
+ }
+ }
+ });
};
$scope.clearParagraphOutput = function() {
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b358ad26/zeppelin-web/src/index.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/index.html b/zeppelin-web/src/index.html
index 0d065a5..44186a0 100644
--- a/zeppelin-web/src/index.html
+++ b/zeppelin-web/src/index.html
@@ -43,6 +43,7 @@ limitations under the License.
<link rel="stylesheet" href="bower_components/angular-xeditable/dist/css/xeditable.css" />
<link rel="stylesheet" href="bower_components/highlightjs/styles/github.css" />
<link rel="stylesheet" href="bower_components/ngtoast/dist/ngToast.css" />
+ <link rel="stylesheet" href="bower_components/bootstrap3-dialog/dist/css/bootstrap-dialog.min.css" />
<!-- endbower -->
<link rel="stylesheet" href="bower_components/jquery-ui/themes/base/all.css" />
<!-- endbuild -->
@@ -119,6 +120,7 @@ limitations under the License.
<script src="bower_components/lodash/lodash.js"></script>
<script src="bower_components/angular-filter/dist/angular-filter.min.js"></script>
<script src="bower_components/ngtoast/dist/ngToast.js"></script>
+ <script src="bower_components/bootstrap3-dialog/dist/js/bootstrap-dialog.min.js"></script>
<!-- endbower -->
<!-- endbuild -->
<!-- build:js({.tmp,src}) scripts/scripts.js -->
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b358ad26/zeppelin-web/test/karma.conf.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/test/karma.conf.js b/zeppelin-web/test/karma.conf.js
index b4813f0..82331c5 100644
--- a/zeppelin-web/test/karma.conf.js
+++ b/zeppelin-web/test/karma.conf.js
@@ -54,6 +54,7 @@ module.exports = function(config) {
'bower_components/lodash/lodash.js',
'bower_components/angular-filter/dist/angular-filter.min.js',
'bower_components/ngtoast/dist/ngToast.js',
+ 'bower_components/bootstrap3-dialog/dist/js/bootstrap-dialog.min.js',
'bower_components/angular-mocks/angular-mocks.js',
// endbower
'src/app/app.js',