You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ki...@apache.org on 2020/07/30 11:11:43 UTC

[shardingsphere-elasticjob-ui] branch master updated: Remove useless code (#29)

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

kimmking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob-ui.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c92667  Remove useless code (#29)
1c92667 is described below

commit 1c926671c7c1fd10d045439de97c4d7b339c16a7
Author: Haoran Meng <me...@gmail.com>
AuthorDate: Thu Jul 30 19:10:23 2020 +0800

    Remove useless code (#29)
---
 .../config/advice/ConsoleRestControllerAdvice.java | 67 ----------------------
 .../src/router/index.js                            |  5 ++
 .../config/advice/ConsoleRestControllerAdvice.java | 67 ----------------------
 .../src/router/index.js                            |  5 ++
 4 files changed, 10 insertions(+), 134 deletions(-)

diff --git a/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/cloud/ui/config/advice/ConsoleRestControllerAdvice.java b/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/cloud/ui/config/advice/ConsoleRestControllerAdvice.java
deleted file mode 100644
index 8dda139..0000000
--- a/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/cloud/ui/config/advice/ConsoleRestControllerAdvice.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.shardingsphere.elasticjob.cloud.ui.config.advice;
-
-import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.elasticjob.infra.exception.ExceptionUtils;
-import org.springframework.core.MethodParameter;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.server.ServerHttpRequest;
-import org.springframework.http.server.ServerHttpResponse;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
-
-/**
- * Console rest controller advice.
- **/
-@RestControllerAdvice
-@Slf4j
-public final class ConsoleRestControllerAdvice implements ResponseBodyAdvice<Object> {
-    
-    @Override
-    public boolean supports(final MethodParameter returnType, final Class<? extends HttpMessageConverter<?>> converterType) {
-        //only advice return void method.
-        if (null == returnType.getMethod()) {
-            return false;
-        }
-        return void.class.isAssignableFrom(returnType.getMethod().getReturnType());
-    }
-    
-    @Override
-    public Object beforeBodyWrite(final Object body, final MethodParameter returnType, final MediaType selectedContentType,
-                                  final Class<? extends HttpMessageConverter<?>> selectedConverterType, final ServerHttpRequest request, final ServerHttpResponse response) {
-        //if the method return void, then the value is true and returns.
-        return null == body ? true : body;
-    }
-    
-    /**
-     * Handle exception.
-     *
-     * @param ex exception
-     * @return response result
-     */
-    @ExceptionHandler(Exception.class)
-    public ResponseEntity<String> toResponse(final Exception ex) {
-        log.error("CONSOLE ERROR", ex);
-        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ExceptionUtils.transform(ex));
-    }
-}
diff --git a/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-frontend/src/router/index.js b/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-frontend/src/router/index.js
index fc6e200..646f3ff 100644
--- a/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-frontend/src/router/index.js
+++ b/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-frontend/src/router/index.js
@@ -22,6 +22,11 @@ Vue.use(Router)
 
 export const constantRouterMap = [
   {
+    path: '/',
+    component: () => import('@/views/login'),
+    hidden: true
+  },
+  {
     path: '/login',
     component: () => import('@/views/login'),
     hidden: true
diff --git a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/lite/ui/config/advice/ConsoleRestControllerAdvice.java b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/lite/ui/config/advice/ConsoleRestControllerAdvice.java
deleted file mode 100644
index fd4584c..0000000
--- a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/lite/ui/config/advice/ConsoleRestControllerAdvice.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.shardingsphere.elasticjob.lite.ui.config.advice;
-
-import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.elasticjob.infra.exception.ExceptionUtils;
-import org.springframework.core.MethodParameter;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.server.ServerHttpRequest;
-import org.springframework.http.server.ServerHttpResponse;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
-
-/**
- * Console rest controller advice.
- **/
-@RestControllerAdvice
-@Slf4j
-public final class ConsoleRestControllerAdvice implements ResponseBodyAdvice<Object> {
-    
-    @Override
-    public boolean supports(final MethodParameter returnType, final Class<? extends HttpMessageConverter<?>> converterType) {
-        //only advice return void method.
-        if (null == returnType.getMethod()) {
-            return false;
-        }
-        return void.class.isAssignableFrom(returnType.getMethod().getReturnType());
-    }
-    
-    @Override
-    public Object beforeBodyWrite(final Object body, final MethodParameter returnType, final MediaType selectedContentType,
-                                  final Class<? extends HttpMessageConverter<?>> selectedConverterType, final ServerHttpRequest request, final ServerHttpResponse response) {
-        //if the method return void, then the value is true and returns.
-        return null == body ? true : body;
-    }
-    
-    /**
-     * Handle exception.
-     *
-     * @param ex exception
-     * @return response result
-     */
-    @ExceptionHandler(Exception.class)
-    public ResponseEntity<String> toResponse(final Exception ex) {
-        log.error("CONSOLE ERROR", ex);
-        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ExceptionUtils.transform(ex));
-    }
-}
diff --git a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/router/index.js b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/router/index.js
index 6e1258c..08cad6a 100644
--- a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/router/index.js
+++ b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/router/index.js
@@ -22,6 +22,11 @@ Vue.use(Router)
 
 export const constantRouterMap = [
   {
+    path: '/',
+    component: () => import('@/views/login'),
+    hidden: true
+  },
+  {
     path: '/login',
     component: () => import('@/views/login'),
     hidden: true