From b215364a609f268af428a8e6590b3c885714a99c Mon Sep 17 00:00:00 2001 From: AhyoungRyu Date: Sat, 9 Jul 2016 23:58:01 +0900 Subject: [PATCH] Redirect to home with error message when status is 401 --- .../app/configuration/configuration.controller.js | 12 +++++++++++- .../src/app/interpreter/interpreter.controller.js | 10 ++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/zeppelin-web/src/app/configuration/configuration.controller.js b/zeppelin-web/src/app/configuration/configuration.controller.js index 9c77a33bf3a..6ac3065a7b4 100644 --- a/zeppelin-web/src/app/configuration/configuration.controller.js +++ b/zeppelin-web/src/app/configuration/configuration.controller.js @@ -14,7 +14,7 @@ 'use strict'; angular.module('zeppelinWebApp').controller('ConfigurationCtrl', function($scope, $route, $routeParams, $location, - $rootScope, $http, baseUrlSrv) { + $rootScope, $http, baseUrlSrv, ngToast) { $scope.configrations = []; $scope._ = _; @@ -24,6 +24,16 @@ angular.module('zeppelinWebApp').controller('ConfigurationCtrl', function($scope $scope.configurations = data.body; }). error(function(data, status, headers, config) { + if (status === 401) { + ngToast.danger({ + content: 'You don\'t have permission on this page', + verticalPosition: 'bottom', + timeout: '3000' + }); + setTimeout(function() { + window.location.replace('/'); + }, 3000); + } console.log('Error %o %o', status, data.message); }); }; diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index 5a90b79cd26..be64c7809f1 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -27,6 +27,16 @@ angular.module('zeppelinWebApp').controller('InterpreterCtrl', $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting').success(function(data, status, headers, config) { $scope.interpreterSettings = data.body; }).error(function(data, status, headers, config) { + if (status === 401) { + ngToast.danger({ + content: 'You don\'t have permission on this page', + verticalPosition: 'bottom', + timeout: '3000' + }); + setTimeout(function() { + window.location.replace('/'); + }, 3000); + } console.log('Error %o %o', status, data.message); }); };