Skip to content

Commit 659db56

Browse files
authored
Merge pull request #1 from morningman/doris-ui
[CodeRefactor] Clean up some code
2 parents 851b24f + df3f0b0 commit 659db56

52 files changed

Lines changed: 637 additions & 425 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎build.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ cd ${DORIS_HOME}/docs
175175
./build_help_zip.sh
176176
cd ${DORIS_HOME}
177177

178+
which npm
178179
# Clean and build Frontend
179180
if [ ${BUILD_FE} -eq 1 ] ; then
180181
echo "Build Frontend UI"
@@ -200,15 +201,14 @@ mkdir -p ${DORIS_OUTPUT}
200201
#Copy Frontend and Backend
201202
if [ ${BUILD_FE} -eq 1 ]; then
202203
install -d ${DORIS_OUTPUT}/fe/bin ${DORIS_OUTPUT}/fe/conf \
203-
${DORIS_OUTPUT}/fe/webroot/ ${DORIS_OUTPUT}/fe/lib/
204+
${DORIS_OUTPUT}/fe/lib/
204205

205206
cp -r -p ${DORIS_HOME}/bin/*_fe.sh ${DORIS_OUTPUT}/fe/bin/
206207
cp -r -p ${DORIS_HOME}/conf/fe.conf ${DORIS_OUTPUT}/fe/conf/
207208
rm -rf ${DORIS_OUTPUT}/fe/lib/*
208209
cp -r -p ${DORIS_HOME}/fe/target/lib/* ${DORIS_OUTPUT}/fe/lib/
209210
cp -r -p ${DORIS_HOME}/fe/target/palo-fe.jar ${DORIS_OUTPUT}/fe/lib/
210211
cp -r -p ${DORIS_HOME}/docs/build/help-resource.zip ${DORIS_OUTPUT}/fe/lib/
211-
cp -r -p ${DORIS_HOME}/webroot/* ${DORIS_OUTPUT}/fe/webroot/
212212
cp -p ${DORIS_HOME}/fe/src/main/resources/application.yml ${DORIS_OUTPUT}/fe/conf
213213
fi
214214
if [ ${BUILD_BE} -eq 1 ]; then

‎fe/pom.xml‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ under the License.
119119
<groupId>org.hibernate.validator</groupId>
120120
<artifactId>hibernate-validator</artifactId>
121121
</exclusion>
122+
<exclusion>
123+
<groupId>ch.qos.logback</groupId>
124+
<artifactId>logback-classic</artifactId>
125+
</exclusion>
126+
<exclusion>
127+
<groupId>org.slf4j</groupId>
128+
<artifactId>slf4j-log4j12</artifactId>
129+
</exclusion>
122130
</exclusions>
123131
</dependency>
124132

@@ -144,23 +152,24 @@ under the License.
144152
<groupId>org.apache.logging.log4j</groupId>
145153
<artifactId>*</artifactId>
146154
</exclusion>
155+
<exclusion>
156+
<groupId>ch.qos.logback</groupId>
157+
<artifactId>logback-classic</artifactId>
158+
</exclusion>
147159
</exclusions>
148160
</dependency>
161+
149162
<dependency>
150163
<groupId>net.java.dev.jna</groupId>
151164
<artifactId>jna</artifactId>
152165
<version>5.5.0</version>
153166
</dependency>
167+
154168
<dependency>
155169
<groupId>net.java.dev.jna</groupId>
156170
<artifactId>jna-platform</artifactId>
157171
<version>5.5.0</version>
158172
</dependency>
159-
<dependency>
160-
<groupId>com.alibaba</groupId>
161-
<artifactId>fastjson</artifactId>
162-
<version>1.2.47</version>
163-
</dependency>
164173

165174
<!-- https://mvnrepository.com/artifact/cglib/cglib -->
166175
<dependency>
@@ -627,6 +636,11 @@ under the License.
627636
<version>2.4.5</version>
628637
<scope>provided</scope>
629638
</dependency>
639+
640+
<dependency>
641+
<groupId>org.yaml</groupId>
642+
<artifactId>snakeyaml</artifactId>
643+
</dependency>
630644
</dependencies>
631645

632646
<build>

‎fe/src/main/java/org/apache/doris/PaloFe.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,10 @@ public static void start(String dorisHomeDir, String pidDir, String[] args) {
112112
QeService qeService = new QeService(Config.query_port, Config.mysql_service_nio_enabled, ExecuteEnv.getInstance().getScheduler());
113113
FeServer feServer = new FeServer(Config.rpc_port);
114114
HttpServer httpServer = new HttpServer();
115-
httpServer.setup();
116115

117116
feServer.start();
118-
// httpServer.start();
119117
qeService.start();
118+
httpServer.start();
120119

121120
ThreadPoolManager.registerAllThreadPoolMetric();
122121

‎fe/src/main/java/org/apache/doris/http/HttpAuthManager.java‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
118
package org.apache.doris.http;
219

3-
import com.google.common.base.Strings;
420
import org.apache.doris.analysis.UserIdentity;
521

22+
import com.google.common.base.Strings;
623
import com.google.common.cache.Cache;
724
import com.google.common.cache.CacheBuilder;
825

‎fe/src/main/java/org/apache/doris/http/HttpServer.java‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
118
package org.apache.doris.http;
219

320
import org.springframework.boot.SpringApplication;
@@ -17,7 +34,7 @@ protected SpringApplicationBuilder configure(SpringApplicationBuilder applicatio
1734
return application.sources(HttpServer.class);
1835
}
1936

20-
public void setup(){
37+
public void start() {
2138
SpringApplication.run(HttpServer.class);
2239
}
2340
}

‎fe/src/main/java/org/apache/doris/http/config/WebConfigurer.java‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
118
package org.apache.doris.http.config;
219

320
import org.apache.doris.http.interceptor.AuthInterceptor;
21+
422
import org.springframework.context.annotation.Configuration;
523
import org.springframework.web.servlet.config.annotation.CorsRegistry;
624
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
725
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
8-
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
9-
1026

1127
@Configuration
1228
public class WebConfigurer implements WebMvcConfigurer {
@@ -30,7 +46,5 @@ public void addCorsMappings(CorsRegistry registry) {
3046
.maxAge(3600);
3147

3248
}
33-
34-
3549
}
3650

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,51 @@
1-
package org.apache.doris.http.controller;
2-
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
317

18+
package org.apache.doris.http.controller;
419

5-
import java.util.*;
6-
20+
import org.apache.doris.catalog.Catalog;
721
import org.apache.doris.http.entity.HttpStatus;
822
import org.apache.doris.http.entity.ResponseEntity;
9-
import org.apache.logging.log4j.LogManager;
10-
import org.apache.logging.log4j.Logger;
11-
12-
import org.apache.doris.catalog.Catalog;
1323
import org.apache.doris.system.Backend;
24+
1425
import com.google.common.collect.ImmutableMap;
1526

27+
import org.apache.logging.log4j.LogManager;
28+
import org.apache.logging.log4j.Logger;
1629
import org.springframework.web.bind.annotation.RequestMapping;
1730
import org.springframework.web.bind.annotation.RequestMethod;
1831
import org.springframework.web.bind.annotation.RestController;
1932

33+
import java.util.HashMap;
34+
import java.util.Map;
35+
2036
@RestController
2137
@RequestMapping("/rest/v1")
2238
public class BackendController {
23-
2439
private static final Logger LOG = LogManager.getLogger(BackendController.class);
2540

26-
2741
@RequestMapping(path = "/backend",method = RequestMethod.GET)
2842
public Object backend(){
2943
ImmutableMap<Long, Backend> backendMap = Catalog.getCurrentSystemInfo().getIdToBackend();
3044
Map<String,Backend> result = new HashMap<>();
3145
for(long key : backendMap.keySet()){
3246
result.put(Long.toString(key),backendMap.get(key));
3347
}
34-
ResponseEntity entity = ResponseEntity.status(HttpStatus.OK).build(result);
48+
ResponseEntity<Map> entity = ResponseEntity.status(HttpStatus.OK).build(result);
3549
return entity;
3650
}
3751
}

‎fe/src/main/java/org/apache/doris/http/controller/BaseController.java‎

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,51 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
118
package org.apache.doris.http.controller;
219

3-
import com.google.common.base.Preconditions;
4-
import com.google.common.base.Strings;
5-
import com.google.common.collect.Lists;
620
import org.apache.doris.analysis.CompoundPredicate;
721
import org.apache.doris.analysis.UserIdentity;
822
import org.apache.doris.catalog.Catalog;
923
import org.apache.doris.cluster.ClusterNamespace;
1024
import org.apache.doris.http.HttpAuthManager;
25+
import org.apache.doris.http.HttpAuthManager.SessionValue;
1126
import org.apache.doris.http.exception.UnauthorizedException;
1227
import org.apache.doris.mysql.privilege.PaloPrivilege;
1328
import org.apache.doris.mysql.privilege.PrivBitSet;
1429
import org.apache.doris.mysql.privilege.PrivPredicate;
1530
import org.apache.doris.qe.ConnectContext;
1631
import org.apache.doris.system.SystemInfoService;
17-
import org.apache.doris.http.HttpAuthManager.SessionValue;
32+
33+
import com.google.common.base.Preconditions;
34+
import com.google.common.base.Strings;
35+
import com.google.common.collect.Lists;
1836

1937
import org.apache.logging.log4j.LogManager;
2038
import org.apache.logging.log4j.Logger;
2139

22-
import javax.servlet.http.Cookie;
23-
import javax.servlet.http.HttpServletRequest;
24-
import javax.servlet.http.HttpServletResponse;
2540
import java.util.HashMap;
2641
import java.util.List;
2742
import java.util.Map;
2843
import java.util.UUID;
2944

45+
import javax.servlet.http.Cookie;
46+
import javax.servlet.http.HttpServletRequest;
47+
import javax.servlet.http.HttpServletResponse;
48+
3049
public class BaseController {
3150

3251
private static final Logger LOG = LogManager.getLogger(BaseController.class);
@@ -122,7 +141,6 @@ public String getCookieValue(HttpServletRequest request, String cookieName, Http
122141
return null;
123142
}
124143

125-
126144
public void updateCookieAge(HttpServletRequest request, String cookieName, int age,HttpServletResponse response) {
127145
Cookie[] cookies = request.getCookies();
128146
for(Cookie cookie :cookies){
@@ -146,7 +164,6 @@ public boolean needAdmin() {
146164
return true;
147165
}
148166

149-
150167
public static class ActionAuthorizationInfo {
151168
public String fullUserName;
152169
public String remoteIp;

‎fe/src/main/java/org/apache/doris/http/controller/HaController.java‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,18 @@
2525
import org.apache.doris.persist.Storage;
2626
import org.apache.doris.system.Frontend;
2727

28-
import java.io.IOException;
29-
import java.net.InetSocketAddress;
30-
import java.util.*;
31-
3228
import org.springframework.web.bind.annotation.RequestMapping;
3329
import org.springframework.web.bind.annotation.RequestMethod;
3430
import org.springframework.web.bind.annotation.RestController;
3531

32+
import java.io.IOException;
33+
import java.net.InetSocketAddress;
34+
import java.util.ArrayList;
35+
import java.util.Date;
36+
import java.util.HashMap;
37+
import java.util.List;
38+
import java.util.Map;
39+
3640
@RestController
3741
@RequestMapping("/rest/v1")
3842
public class HaController {
@@ -48,7 +52,7 @@ public Object ha(){
4852
appendDbNames(result);
4953
appendFe(result);
5054
appendRemovedFe(result);
51-
ResponseEntity entity = ResponseEntity.status(HttpStatus.OK).build(result);
55+
ResponseEntity<Map> entity = ResponseEntity.status(HttpStatus.OK).build(result);
5256
return entity;
5357
}
5458

0 commit comments

Comments
 (0)