From 0f7bff4f4581bbac1022dde428236dce52aec095 Mon Sep 17 00:00:00 2001 From: DuyHai DOAN Date: Sun, 27 Mar 2016 11:40:18 +0200 Subject: [PATCH] [ZEPPELIN-696] Add notification system for AngularJS z functions --- zeppelin-web/src/app/app.js | 3 +-- .../app/interpreter/interpreter.controller.js | 6 +++--- .../paragraph/paragraph.controller.js | 19 +++++++++++++++++-- .../src/assets/styles/looknfeel/default.css | 4 ++++ .../src/assets/styles/looknfeel/report.css | 4 ++++ .../src/assets/styles/looknfeel/simple.css | 4 ++++ 6 files changed, 33 insertions(+), 7 deletions(-) diff --git a/zeppelin-web/src/app/app.js b/zeppelin-web/src/app/app.js index ff2be77ffd5..16fad36c4dd 100644 --- a/zeppelin-web/src/app/app.js +++ b/zeppelin-web/src/app/app.js @@ -81,8 +81,7 @@ ngToastProvider.configure({ dismissButton: true, dismissOnClick: false, - timeout: 6000, - verticalPosition: 'bottom' + timeout: 6000 }); }); diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index ab660330654..195360a4207 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -75,7 +75,7 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, // add missing field of option if (!setting.option) { setting.option = {}; - } + } if (setting.option.remote === undefined) { // remote always true for now setting.option.remote = true; @@ -94,7 +94,7 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, }). error(function (data, status, headers, config) { console.log('Error %o %o', status, data.message); - ngToast.danger(data.message); + ngToast.danger({content: data.message, verticalPosition: 'bottom'}); form.$show(); }); } @@ -210,7 +210,7 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, }). error(function(data, status, headers, config) { console.log('Error %o %o', status, data.message); - ngToast.danger(data.message); + ngToast.danger({content: data.message, verticalPosition: 'bottom'}); }); }; diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index bb9bc89cc33..599ed901fa6 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -16,7 +16,7 @@ angular.module('zeppelinWebApp') .controller('ParagraphCtrl', function($scope,$rootScope, $route, $window, $element, $routeParams, $location, - $timeout, $compile, websocketMsgSrv) { + $timeout, $compile, websocketMsgSrv, ngToast) { var ANGULAR_FUNCTION_OBJECT_NAME_PREFIX = '_Z_ANGULAR_FUNC_'; $scope.parentNote = null; $scope.paragraph = null; @@ -39,8 +39,13 @@ angular.module('zeppelinWebApp') websocketMsgSrv.runParagraph(paragraph.id, paragraph.title, paragraph.text, paragraph.config, paragraph.settings.params); } else { - // Error message here + ngToast.danger({content: 'Cannot find a paragraph with id \'' + paragraphId + '\'', + verticalPosition: 'top', dismissOnTimeout: false}); } + } else { + ngToast.danger({ + content: 'Please provide a \'paragraphId\' when calling z.runParagraph(paragraphId)', + verticalPosition: 'top', dismissOnTimeout: false}); } }, @@ -49,6 +54,11 @@ angular.module('zeppelinWebApp') // Only push to server if there paragraphId is defined if (paragraphId) { websocketMsgSrv.clientBindAngularObject($routeParams.noteId, varName, value, paragraphId); + } else { + ngToast.danger({ + content: 'Please provide a \'paragraphId\' when calling ' + + 'z.angularBind(varName, value, \'PUT_HERE_PARAGRAPH_ID\')', + verticalPosition: 'top', dismissOnTimeout: false}); } }, @@ -57,6 +67,11 @@ angular.module('zeppelinWebApp') // Only push to server if paragraphId is defined if (paragraphId) { websocketMsgSrv.clientUnbindAngularObject($routeParams.noteId, varName, paragraphId); + } else { + ngToast.danger({ + content: 'Please provide a \'paragraphId\' when calling ' + + 'z.angularUnbind(varName, \'PUT_HERE_PARAGRAPH_ID\')', + verticalPosition: 'top', dismissOnTimeout: false}); } } }; diff --git a/zeppelin-web/src/assets/styles/looknfeel/default.css b/zeppelin-web/src/assets/styles/looknfeel/default.css index 3e0c4614d12..9803bc2946a 100644 --- a/zeppelin-web/src/assets/styles/looknfeel/default.css +++ b/zeppelin-web/src/assets/styles/looknfeel/default.css @@ -33,3 +33,7 @@ body { border-color: white; } +.ng-toast.ng-toast--top { + top: 100px; +} + diff --git a/zeppelin-web/src/assets/styles/looknfeel/report.css b/zeppelin-web/src/assets/styles/looknfeel/report.css index 0a15e8a59a6..8c850efc95f 100644 --- a/zeppelin-web/src/assets/styles/looknfeel/report.css +++ b/zeppelin-web/src/assets/styles/looknfeel/report.css @@ -73,3 +73,7 @@ body { .noteAction button.btn { border-radius: 4px !important; } + +.ng-toast.ng-toast--top { + top: 100px; +} diff --git a/zeppelin-web/src/assets/styles/looknfeel/simple.css b/zeppelin-web/src/assets/styles/looknfeel/simple.css index 7817da28ec8..8373114a366 100644 --- a/zeppelin-web/src/assets/styles/looknfeel/simple.css +++ b/zeppelin-web/src/assets/styles/looknfeel/simple.css @@ -89,3 +89,7 @@ body { .nv-controlsWrap { display: block; } + +.ng-toast.ng-toast--top { + top: 100px; +}