From a0baf573979c86ce99c066f4fc4b101fe4aaf292 Mon Sep 17 00:00:00 2001 From: madhuka Date: Fri, 28 Aug 2015 23:29:17 +0530 Subject: [PATCH 1/5] Adding Error Msg and Notifications feature --- zeppelin-web/bower.json | 3 ++- zeppelin-web/src/app/app.js | 3 ++- .../paragraph/paragraph.controller.js | 6 ++++- .../ui-notification/notification-config.js | 27 +++++++++++++++++++ zeppelin-web/src/index.html | 3 +++ zeppelin-web/test/karma.conf.js | 1 + 6 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 zeppelin-web/src/components/ui-notification/notification-config.js diff --git a/zeppelin-web/bower.json b/zeppelin-web/bower.json index b5b439ae7f7..3dc996bd474 100644 --- a/zeppelin-web/bower.json +++ b/zeppelin-web/bower.json @@ -25,7 +25,8 @@ "angular-xeditable": "0.1.8", "highlightjs": "~8.4.0", "lodash": "~3.9.3", - "angular-filter": "~0.5.4" + "angular-filter": "~0.5.4", + "angular-ui-notification": "0.0.14" }, "devDependencies": { "angular-mocks": "1.3.8" diff --git a/zeppelin-web/src/app/app.js b/zeppelin-web/src/app/app.js index 6dfa8e5d911..e6693eda35d 100644 --- a/zeppelin-web/src/app/app.js +++ b/zeppelin-web/src/app/app.js @@ -30,7 +30,8 @@ angular.module('zeppelinWebApp', [ 'angular.filter', 'monospaced.elastic', 'puElasticInput', - 'xeditable' + 'xeditable', + 'ui-notification' ]) .filter('breakFilter', function() { return function (text) { diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index be4578bbb4d..c0dbe950e13 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -17,7 +17,7 @@ angular.module('zeppelinWebApp') .controller('ParagraphCtrl', function($scope,$rootScope, $route, $window, $element, $routeParams, $location, - $timeout, $compile, websocketMsgSrv) { + $timeout, $compile, websocketMsgSrv, Notification) { $scope.paragraph = null; $scope.editor = null; @@ -63,6 +63,7 @@ angular.module('zeppelinWebApp') $('#p'+$scope.paragraph.id+'_html').find('pre code').each(function(i, e) { hljs.highlightBlock(e); }); } catch(err) { + Notification.error('HTML rendering error'); console.log('HTML rendering error %o', err); } } else { @@ -81,6 +82,7 @@ angular.module('zeppelinWebApp') $compile(angular.element('#p'+$scope.paragraph.id+'_angular').contents())($rootScope.compiledScope); } catch(err) { + Notification.error('ANGULAR rendering error'); console.log('ANGULAR rendering error %o', err); } } else { @@ -826,6 +828,7 @@ angular.module('zeppelinWebApp') try { renderTable(); } catch(err) { + Notification.error('Chart drawing error'); console.log('Chart drawing error %o', err); } } else { @@ -954,6 +957,7 @@ angular.module('zeppelinWebApp') try { renderChart(); } catch(err) { + Notification.error('Chart drawing error'); console.log('Chart drawing error %o', err); } } else { diff --git a/zeppelin-web/src/components/ui-notification/notification-config.js b/zeppelin-web/src/components/ui-notification/notification-config.js new file mode 100644 index 00000000000..957c1b3ec78 --- /dev/null +++ b/zeppelin-web/src/components/ui-notification/notification-config.js @@ -0,0 +1,27 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +angular.module('zeppelinWebApp') + .config(function(NotificationProvider) { + NotificationProvider.setOptions({ + delay: 10000, + startTop: 20, + startRight: 10, + verticalSpacing: 20, + horizontalSpacing: 20, + positionX: 'right', + positionY: 'top' + }); + }); diff --git a/zeppelin-web/src/index.html b/zeppelin-web/src/index.html index 90b3f0a0569..3f6b5a3f76a 100644 --- a/zeppelin-web/src/index.html +++ b/zeppelin-web/src/index.html @@ -42,6 +42,7 @@ + @@ -112,6 +113,7 @@ + @@ -133,6 +135,7 @@ + diff --git a/zeppelin-web/test/karma.conf.js b/zeppelin-web/test/karma.conf.js index ffbc99699bb..cce4f96f064 100644 --- a/zeppelin-web/test/karma.conf.js +++ b/zeppelin-web/test/karma.conf.js @@ -53,6 +53,7 @@ module.exports = function(config) { 'bower_components/highlightjs/highlight.pack.js', 'bower_components/lodash/lodash.js', 'bower_components/angular-filter/dist/angular-filter.min.js', + 'bower_components/angular-ui-notification/dist/angular-ui-notification.min.js', 'bower_components/angular-mocks/angular-mocks.js', // endbower 'src/app/app.js', From 9b131f280b6cf3eaeb1c37bf717f8daf4bf63301 Mon Sep 17 00:00:00 2001 From: madhuka Date: Sat, 29 Aug 2015 00:01:33 +0530 Subject: [PATCH 2/5] using bower to update --- zeppelin-web/src/index.html | 2 -- zeppelin-web/test/karma.conf.js | 1 - 2 files changed, 3 deletions(-) diff --git a/zeppelin-web/src/index.html b/zeppelin-web/src/index.html index 3f6b5a3f76a..db85c551998 100644 --- a/zeppelin-web/src/index.html +++ b/zeppelin-web/src/index.html @@ -42,7 +42,6 @@ - @@ -113,7 +112,6 @@ - diff --git a/zeppelin-web/test/karma.conf.js b/zeppelin-web/test/karma.conf.js index cce4f96f064..ffbc99699bb 100644 --- a/zeppelin-web/test/karma.conf.js +++ b/zeppelin-web/test/karma.conf.js @@ -53,7 +53,6 @@ module.exports = function(config) { 'bower_components/highlightjs/highlight.pack.js', 'bower_components/lodash/lodash.js', 'bower_components/angular-filter/dist/angular-filter.min.js', - 'bower_components/angular-ui-notification/dist/angular-ui-notification.min.js', 'bower_components/angular-mocks/angular-mocks.js', // endbower 'src/app/app.js', From 35d7469169819eb83bbc2932b730755cdb89af01 Mon Sep 17 00:00:00 2001 From: madhuka Date: Tue, 1 Sep 2015 08:52:17 +0530 Subject: [PATCH 3/5] fixing hover, delay time and cleaning error msg --- .../src/app/notebook/paragraph/paragraph.controller.js | 4 ---- zeppelin-web/src/assets/styles/looknfeel/default.css | 6 +++++- .../src/components/ui-notification/notification-config.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index c0dbe950e13..09494b57ff8 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -63,7 +63,6 @@ angular.module('zeppelinWebApp') $('#p'+$scope.paragraph.id+'_html').find('pre code').each(function(i, e) { hljs.highlightBlock(e); }); } catch(err) { - Notification.error('HTML rendering error'); console.log('HTML rendering error %o', err); } } else { @@ -82,7 +81,6 @@ angular.module('zeppelinWebApp') $compile(angular.element('#p'+$scope.paragraph.id+'_angular').contents())($rootScope.compiledScope); } catch(err) { - Notification.error('ANGULAR rendering error'); console.log('ANGULAR rendering error %o', err); } } else { @@ -828,7 +826,6 @@ angular.module('zeppelinWebApp') try { renderTable(); } catch(err) { - Notification.error('Chart drawing error'); console.log('Chart drawing error %o', err); } } else { @@ -957,7 +954,6 @@ angular.module('zeppelinWebApp') try { renderChart(); } catch(err) { - Notification.error('Chart drawing error'); console.log('Chart drawing error %o', err); } } else { diff --git a/zeppelin-web/src/assets/styles/looknfeel/default.css b/zeppelin-web/src/assets/styles/looknfeel/default.css index 8aeee956399..0227e71eb54 100644 --- a/zeppelin-web/src/assets/styles/looknfeel/default.css +++ b/zeppelin-web/src/assets/styles/looknfeel/default.css @@ -64,4 +64,8 @@ body { .executionTime, .nv-controlsWrap { display:block; -} \ No newline at end of file +} + +.ui-notification:hover{ + opacity:.9 !important; +} diff --git a/zeppelin-web/src/components/ui-notification/notification-config.js b/zeppelin-web/src/components/ui-notification/notification-config.js index 957c1b3ec78..0233c5d44c6 100644 --- a/zeppelin-web/src/components/ui-notification/notification-config.js +++ b/zeppelin-web/src/components/ui-notification/notification-config.js @@ -16,7 +16,7 @@ angular.module('zeppelinWebApp') .config(function(NotificationProvider) { NotificationProvider.setOptions({ - delay: 10000, + delay: 6000, startTop: 20, startRight: 10, verticalSpacing: 20, From 460d3645259266bc645fc09b0e7ba30d11c0cdab Mon Sep 17 00:00:00 2001 From: Damien Corneau Date: Tue, 1 Sep 2015 15:15:22 +0900 Subject: [PATCH 4/5] Remove angular-ui-notification for ngToast --- zeppelin-web/bower.json | 2 +- zeppelin-web/src/app/app.js | 2 +- .../paragraph/paragraph.controller.js | 2 +- .../src/assets/styles/looknfeel/default.css | 4 --- .../ui-notification/notification-config.js | 27 ------------------- zeppelin-web/src/index.html | 6 ++++- 6 files changed, 8 insertions(+), 35 deletions(-) delete mode 100644 zeppelin-web/src/components/ui-notification/notification-config.js diff --git a/zeppelin-web/bower.json b/zeppelin-web/bower.json index 3dc996bd474..04bdbf86b70 100644 --- a/zeppelin-web/bower.json +++ b/zeppelin-web/bower.json @@ -26,7 +26,7 @@ "highlightjs": "~8.4.0", "lodash": "~3.9.3", "angular-filter": "~0.5.4", - "angular-ui-notification": "0.0.14" + "ngtoast": "~1.5.5" }, "devDependencies": { "angular-mocks": "1.3.8" diff --git a/zeppelin-web/src/app/app.js b/zeppelin-web/src/app/app.js index e6693eda35d..85bd1d4a4c6 100644 --- a/zeppelin-web/src/app/app.js +++ b/zeppelin-web/src/app/app.js @@ -31,7 +31,7 @@ angular.module('zeppelinWebApp', [ 'monospaced.elastic', 'puElasticInput', 'xeditable', - 'ui-notification' + 'ngToast' ]) .filter('breakFilter', function() { return function (text) { diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index 09494b57ff8..be4578bbb4d 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -17,7 +17,7 @@ angular.module('zeppelinWebApp') .controller('ParagraphCtrl', function($scope,$rootScope, $route, $window, $element, $routeParams, $location, - $timeout, $compile, websocketMsgSrv, Notification) { + $timeout, $compile, websocketMsgSrv) { $scope.paragraph = null; $scope.editor = null; diff --git a/zeppelin-web/src/assets/styles/looknfeel/default.css b/zeppelin-web/src/assets/styles/looknfeel/default.css index 0227e71eb54..56db526d3b9 100644 --- a/zeppelin-web/src/assets/styles/looknfeel/default.css +++ b/zeppelin-web/src/assets/styles/looknfeel/default.css @@ -65,7 +65,3 @@ body { .nv-controlsWrap { display:block; } - -.ui-notification:hover{ - opacity:.9 !important; -} diff --git a/zeppelin-web/src/components/ui-notification/notification-config.js b/zeppelin-web/src/components/ui-notification/notification-config.js deleted file mode 100644 index 0233c5d44c6..00000000000 --- a/zeppelin-web/src/components/ui-notification/notification-config.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -'use strict'; - -angular.module('zeppelinWebApp') - .config(function(NotificationProvider) { - NotificationProvider.setOptions({ - delay: 6000, - startTop: 20, - startRight: 10, - verticalSpacing: 20, - horizontalSpacing: 20, - positionX: 'right', - positionY: 'top' - }); - }); diff --git a/zeppelin-web/src/index.html b/zeppelin-web/src/index.html index db85c551998..2aac2a3971e 100644 --- a/zeppelin-web/src/index.html +++ b/zeppelin-web/src/index.html @@ -42,6 +42,8 @@ + + @@ -60,6 +62,7 @@ +
@@ -112,6 +115,8 @@ + + @@ -133,7 +138,6 @@ - From 3ece1ebe51f6af797107a50acea792c5f29b1de9 Mon Sep 17 00:00:00 2001 From: Damien Corneau Date: Tue, 1 Sep 2015 16:28:42 +0900 Subject: [PATCH 5/5] configure and style ngToast --- zeppelin-web/src/app/app.js | 8 +++++++- zeppelin-web/src/app/home/home.css | 22 ++++++++++++++++++++++ zeppelin-web/src/index.html | 2 -- zeppelin-web/test/karma.conf.js | 1 + 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/zeppelin-web/src/app/app.js b/zeppelin-web/src/app/app.js index 85bd1d4a4c6..28a84e07a3c 100644 --- a/zeppelin-web/src/app/app.js +++ b/zeppelin-web/src/app/app.js @@ -40,7 +40,7 @@ angular.module('zeppelinWebApp', [ } }; }) - .config(function ($routeProvider) { + .config(function ($routeProvider, ngToastProvider) { $routeProvider .when('/', { templateUrl: 'app/home/home.html', @@ -61,4 +61,10 @@ angular.module('zeppelinWebApp', [ .otherwise({ redirectTo: '/' }); + + ngToastProvider.configure({ + dismissButton: true, + dismissOnClick: false, + timeout: 6000 + }); }); diff --git a/zeppelin-web/src/app/home/home.css b/zeppelin-web/src/app/home/home.css index 5d5e1159808..c42b4695089 100644 --- a/zeppelin-web/src/app/home/home.css +++ b/zeppelin-web/src/app/home/home.css @@ -285,6 +285,28 @@ kbd { min-height: 400px; } +/* ngToast style */ + +.ng-toast .alert { + color: white !important; + border: none !important; +} + +.ng-toast .alert-danger { + background-color: #A94442 !important; +} + +.ng-toast .alert-warning { + background-color: #CE9532 !important; +} + +.ng-toast .alert-info { + background-color: #589EC1 !important; +} + +.ng-toast .alert-success { + background-color: #428443 !important; +} /* temporary fix for bootstrap issue (https://github.com/twbs/bootstrap/issues/5865) diff --git a/zeppelin-web/src/index.html b/zeppelin-web/src/index.html index 2aac2a3971e..9e41b30060c 100644 --- a/zeppelin-web/src/index.html +++ b/zeppelin-web/src/index.html @@ -42,7 +42,6 @@ - @@ -115,7 +114,6 @@ - diff --git a/zeppelin-web/test/karma.conf.js b/zeppelin-web/test/karma.conf.js index ffbc99699bb..d76f72cb661 100644 --- a/zeppelin-web/test/karma.conf.js +++ b/zeppelin-web/test/karma.conf.js @@ -53,6 +53,7 @@ module.exports = function(config) { 'bower_components/highlightjs/highlight.pack.js', 'bower_components/lodash/lodash.js', 'bower_components/angular-filter/dist/angular-filter.min.js', + 'bower_components/ngtoast/dist/ngToast.js', 'bower_components/angular-mocks/angular-mocks.js', // endbower 'src/app/app.js',