Skip to content

Commit a438d39

Browse files
mdeme01mcserepintjftw
authored
New frontend in React (#595)
Co-authored-by: Máté Cserép <mcserep@gmail.com> Co-authored-by: Anett Fekete <anett.fekete@ericsson.com>
1 parent c87243b commit a438d39

File tree

83 files changed

+19787
-0
lines changed

Some content is hidden

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

83 files changed

+19787
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ add_subdirectory(service)
3333
add_subdirectory(util)
3434
add_subdirectory(plugins) # must precede webgui
3535
add_subdirectory(webgui)
36+
add_subdirectory(webgui-new)
3637
add_subdirectory(webserver)
3738

3839
# Install java libraries

Config.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ set(INSTALL_AUTH_DIR "${INSTALL_LIB_DIR}/${INSTALL_AUTH_DIR_NAME}")
2626
# Installation directory of web GUI
2727
set(INSTALL_WEBROOT_DIR "${CMAKE_INSTALL_PREFIX}/share/codecompass/webgui")
2828

29+
# Installation directory of the new React-based web GUI
30+
set(INSTALL_WEBROOT_REACT_DIR "${CMAKE_INSTALL_PREFIX}/share/codecompass/webgui-new")
31+
2932
# Installation directory of SQL files
3033
set(INSTALL_SQL_DIR "${CMAKE_INSTALL_PREFIX}/share/codecompass/sql")
3134

docker/dev/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN set -x && apt-get update -qq \
1111
cmake make \
1212
default-jdk \
1313
ctags \
14+
curl \
1415
doxygen \
1516
gcc-9 gcc-9-plugin-dev g++-9 \
1617
libboost-filesystem-dev \
@@ -31,6 +32,9 @@ RUN set -x && apt-get update -qq \
3132
ln -s /usr/bin/gcc-9 /usr/bin/gcc && \
3233
ln -s /usr/bin/g++-9 /usr/bin/g++
3334

35+
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
36+
apt-get install -y nodejs
37+
3438
# Build GTest.
3539
RUN cd /usr/src/googletest && \
3640
mkdir build && \

docker/web/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ RUN set -x && apt-get update -qq \
3232
# To switch user and exec command.
3333
gosu \
3434
tini \
35+
curl \
3536
&& apt-get clean \
3637
&& rm -rf /var/lib/apt/lists/ \
3738
&& set +x
3839

40+
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
41+
apt-get install -y nodejs
42+
3943
ARG CC_GID=960
4044
ARG CC_UID=960
4145

webgui-new/.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PUBLIC_URL=
2+
BACKEND_URL=http://localhost:8080
3+
DEVSERVER_PORT=3000

webgui-new/.eslintrc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"plugins": ["@typescript-eslint", "react-hooks"],
4+
"extends": [
5+
"next/core-web-vitals",
6+
"eslint:recommended",
7+
"plugin:react/recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"plugin:react-hooks/recommended"
10+
],
11+
"globals": {
12+
"JSX": true
13+
}
14+
}

webgui-new/.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# dependencies
2+
node_modules
3+
.pnp
4+
.pnp.js
5+
6+
# testing
7+
coverage
8+
9+
# next.js
10+
.next/
11+
out/
12+
13+
# production
14+
build
15+
16+
# misc
17+
.DS_Store
18+
*.pem
19+
20+
# debug
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
.pnpm-debug.log*
25+
26+
# local env files
27+
.env*.local
28+
29+
# vercel
30+
.vercel
31+
32+
# typescript
33+
*.tsbuildinfo
34+
next-env.d.ts
35+
36+
# thrift generated files
37+
generated/

webgui-new/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v18.13.0

webgui-new/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
install(DIRECTORY
2+
public src
3+
DESTINATION ${INSTALL_WEBROOT_REACT_DIR}/app
4+
USE_SOURCE_PERMISSIONS
5+
FILES_MATCHING PATTERN "[^.]*")
6+
7+
install(FILES
8+
tsconfig.json
9+
next.config.js
10+
thrift-codegen.sh
11+
.env
12+
DESTINATION ${INSTALL_WEBROOT_REACT_DIR}/app)
13+
14+
# Install React application
15+
install(CODE "set(CC_PACKAGE \"${CMAKE_CURRENT_SOURCE_DIR}/package.json\")")
16+
install(CODE "set(INSTALL_WEBROOT_DIR ${INSTALL_WEBROOT_DIR})")
17+
install(CODE "set(INSTALL_WEBROOT_REACT_DIR ${INSTALL_WEBROOT_REACT_DIR})")
18+
install(CODE "set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE})")
19+
install(CODE "set(CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})")
20+
install(SCRIPT InstallReact.cmake)

webgui-new/InstallReact.cmake

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Utility functions
2+
include(${CMAKE_SOURCE_DIR}/Functions.cmake)
3+
4+
message("Install npm packages...")
5+
6+
if(${CC_PACKAGE} IS_NEWER_THAN ${INSTALL_WEBROOT_REACT_DIR}/app/package.json)
7+
execute_process(
8+
COMMAND ${CMAKE_COMMAND} -E copy ${CC_PACKAGE} ${INSTALL_WEBROOT_REACT_DIR}/app/package.json
9+
WORKING_DIRECTORY ${INSTALL_WEBROOT_REACT_DIR})
10+
11+
execute_process(
12+
COMMAND npm install
13+
WORKING_DIRECTORY ${INSTALL_WEBROOT_REACT_DIR}/app)
14+
endif()
15+
16+
message("Installation of npm packages are finished.")
17+
18+
# Generate TypeScript from Thrift
19+
execute_process(
20+
COMMAND bash -c "chmod +x thrift-codegen.sh"
21+
WORKING_DIRECTORY ${INSTALL_WEBROOT_REACT_DIR}/app)
22+
23+
execute_process(
24+
COMMAND bash thrift-codegen.sh --thrift-source ${CMAKE_SOURCE_DIR}
25+
WORKING_DIRECTORY ${INSTALL_WEBROOT_REACT_DIR}/app)
26+
27+
message("Building React App...")
28+
29+
execute_process(
30+
COMMAND npm run build
31+
WORKING_DIRECTORY ${INSTALL_WEBROOT_REACT_DIR}/app)
32+
33+
# Move build directory out of application directory
34+
file(REMOVE_RECURSE ${INSTALL_WEBROOT_REACT_DIR}/out)
35+
file(RENAME ${INSTALL_WEBROOT_REACT_DIR}/app/out ${INSTALL_WEBROOT_REACT_DIR}/out)
36+
37+
# Create symbolic link
38+
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../webgui-new/out ${INSTALL_WEBROOT_DIR}/new)
39+
40+
if (CMAKE_BUILD_TYPE STREQUAL "Release")
41+
# Remove application source code in case of Release build
42+
file(REMOVE ${INSTALL_WEBROOT_REACT_DIR}/app)
43+
endif()
44+
45+
message("Building React App finished.")

0 commit comments

Comments
 (0)