This is an automated email from the ASF dual-hosted git repository.

xxyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/main by this push:
     new 8a44cac482 Kylin 5193 fix login page redirection (#1887)
8a44cac482 is described below

commit 8a44cac482bbf09843a26cf0663e0480954fbec6
Author: Tengting Xu <34978943+muk...@users.noreply.github.com>
AuthorDate: Thu Jun 16 10:02:20 2022 +0800

    Kylin 5193 fix login page redirection (#1887)
    
    * KYLIN-5193, fix login page redirection
    
    * minor, add refresh cube list button then not need to refresh whole page 
to update cube list
---
 webapp/app/js/config.js              | 5 +++--
 webapp/app/js/controllers/auth.js    | 4 ++++
 webapp/app/partials/cubes/cubes.html | 2 ++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/webapp/app/js/config.js b/webapp/app/js/config.js
index b9ae6a5203..89769a4b86 100644
--- a/webapp/app/js/config.js
+++ b/webapp/app/js/config.js
@@ -75,7 +75,7 @@ KylinApp.config(function ($routeProvider, $httpProvider, 
$locationProvider, $log
     $locationProvider.html5Mode(true);
 
     //configure $http to view a login whenever a 401 unauthorized response 
arrives
-    $httpProvider.responseInterceptors.push(function ($rootScope, $q) {
+    $httpProvider.responseInterceptors.push(function ($rootScope, $q, 
$location) {
       return function (promise) {
         return promise.then(
           //success -> don't intercept
@@ -84,7 +84,8 @@ KylinApp.config(function ($routeProvider, $httpProvider, 
$locationProvider, $log
           },
           //error -> if 401 save the request and broadcast an event
           function (response) {
-            if (response.status === 401 && 
!(response.config.url.indexOf("user/authentication") !== -1 && 
response.config.method === 'POST')) {
+            var isLogin = $location.$$path === "/login"
+            if (response.status === 401 && 
!(response.config.url.indexOf("user/authentication") !== -1 && 
response.config.method === 'POST') && !isLogin) {
               var deferred = $q.defer(),
                 req = {
                   config: response.config,
diff --git a/webapp/app/js/controllers/auth.js 
b/webapp/app/js/controllers/auth.js
index 09a50a9181..73453d03a9 100644
--- a/webapp/app/js/controllers/auth.js
+++ b/webapp/app/js/controllers/auth.js
@@ -94,5 +94,9 @@ KylinApp.controller('LoginCtrl', function ($scope, 
$rootScope, $location, $base6
     });
   };
 
+  AuthenticationService.ping(function () {
+    $location.path(UserService.getHomePage());
+  });
+
   $scope.init();
 });
diff --git a/webapp/app/partials/cubes/cubes.html 
b/webapp/app/partials/cubes/cubes.html
index 796ea27176..54ed59da23 100644
--- a/webapp/app/partials/cubes/cubes.html
+++ b/webapp/app/partials/cubes/cubes.html
@@ -31,6 +31,8 @@
             <input type="text" placeholder="Search by name" 
class="nav-search-input" ng-model="listParams.cubeName" />
             <i class="ace-icon fa fa-search blue" 
ng-click="cubeList.removeAll();reload()"></i>
           </span>
+        <!--Refresh cube list-->
+        <button class="btn btn-success btn-xs" style="margin-left: 10px" 
ng-click="cubeList.removeAll();reload()"><i class="fa fa-refresh"></i></button>
       </form>
       </div>
     </div>

Reply via email to