This is an automated email from the ASF dual-hosted git repository. qiaojialin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/iotdb-web-workbench.git
commit 161c24e294afa7f626ed59bef66d018150cf5ccc Author: zhengqiang-cisdi <[email protected]> AuthorDate: Thu Mar 3 17:22:15 2022 +0800 Update documents. (#11) * Update documents. Co-authored-by: wenjin <[email protected]> Co-authored-by: julian <[email protected]> Co-authored-by: haungrui777 <[email protected]> Co-authored-by: qhy <[email protected]> Co-authored-by: qhy <[email protected]> Co-authored-by: benqhy <[email protected]> Co-authored-by: wangdan-cisdi <[email protected]> Co-authored-by: shuhong.liu <[email protected]> Co-authored-by: curiosityLiu <[email protected]> Co-authored-by: Xiangdong Huang <[email protected]> --- README.md | 22 +++++++- backend/doc/deploy.md | 21 +++++--- backend/doc/image/login.png | Bin 0 -> 758774 bytes backend/doc/image/proxyConfig.png | Bin 0 -> 6257 bytes backend/doc/image/spotless.png | Bin 0 -> 40447 bytes backend/doc/image/welcome.PNG | Bin 26247 -> 40692 bytes backend/doc/intro.md | 28 +++++++--- backend/doc/maven.md | 2 +- backend/doc/rest.md | 16 +++++- backend/doc/rule.md | 57 ++++++++++++++++++--- backend/doc/swagger.md | 2 +- backend/doc/validate.md | 7 +-- .../src/main/resources/application-dev.properties | 2 +- frontend/README.md | 6 +++ frontend/vue.config.js | 2 +- 15 files changed, 137 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index c2a9c75..6624231 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,25 @@ +<!-- + + 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. + +--> + [](https://www.apache.org/licenses/LICENSE-2.0.html) -[](https://github.com/loveher147/iotdb-admin/releases)  # IoTDB-Workbench diff --git a/backend/doc/deploy.md b/backend/doc/deploy.md index c608a17..f6a3a0e 100644 --- a/backend/doc/deploy.md +++ b/backend/doc/deploy.md @@ -23,7 +23,9 @@ ## 后端部署 -1 通过backend/src/main/resources/application-xxx.properties文件配置项目,注意修改数据源的路径。 +1 通过backend/src/main/resources/application.properties指定配置文件为prod:`spring.profiles.active=prod` + +在application-prod.properties中可按照自己需求修改端口号,并注意修改数据源的路径:  @@ -31,10 +33,12 @@  -3 打包之后,将jar包上传到指定服务器并运行。 +3 打包之后,将jar包上传到你的服务器并运行: 首先请确定服务器上安装了sqlite3(一般Linux系统自带sqlite3,如果没有请安装)。 + 通过如下命令将jar包挂载到后台运行: + nohup java -jar xxx.jar >/dev/null 2>&1 & 至此后端部署完成。 @@ -55,10 +59,15 @@ yum install -y nginx  -黄框内容为监听端口号配置; -红框内容以“/”映射前端资源文件,请指定为你的dist文件路径; -绿框以“/api”映射后台服务地址,与application-xxx.properties文件中配置的端口号和上下文根保持一致; -如果你需要多个服务则需配置多个server +其中: + +- 黄框内容为监听端口号配置; + +- 红框内容以“/”映射前端资源文件,请指定为你的dist文件夹路径(dist文件夹是由前端打包产生的); + +- 绿框以“/api”映射后台服务地址,其端口号与application-prod.properties文件中配置的端口号保持一致 。 + +如果你需要多个服务则需配置多个server。 4 保存配置后,命令行输入nginx启动nginx diff --git a/backend/doc/image/login.png b/backend/doc/image/login.png new file mode 100644 index 0000000..28fe2bb Binary files /dev/null and b/backend/doc/image/login.png differ diff --git a/backend/doc/image/proxyConfig.png b/backend/doc/image/proxyConfig.png new file mode 100644 index 0000000..ab4484f Binary files /dev/null and b/backend/doc/image/proxyConfig.png differ diff --git a/backend/doc/image/spotless.png b/backend/doc/image/spotless.png new file mode 100644 index 0000000..513018c Binary files /dev/null and b/backend/doc/image/spotless.png differ diff --git a/backend/doc/image/welcome.PNG b/backend/doc/image/welcome.PNG index 1eac27b..b446d4c 100644 Binary files a/backend/doc/image/welcome.PNG and b/backend/doc/image/welcome.PNG differ diff --git a/backend/doc/intro.md b/backend/doc/intro.md index 7984784..a28f633 100644 --- a/backend/doc/intro.md +++ b/backend/doc/intro.md @@ -44,14 +44,30 @@ 由于是开源软件,使用的所有库都应该是maven公有仓库能找的,满足轻量、稳定2个特性。 -## 快速启动 +## 启动后端 -项目提供maven、gradle两种构建工具,以maven为例启动项目: -首先通过IntelliJ IDEA打开本项目,右键点击pom.xml,点击Add as Maven Project导入项目相关依赖。 +项目提供maven、gradle两种构建工具,以maven为例启动项目: + +首先通过IntelliJ IDEA打开本项目,右键点击pom.xml,点击Add as Maven Project导入项目相关依赖。  + 导入完成后启动AdminApplication项目,启动成功后你应该能看到如下界面。 +  -接着,你可以通过浏览器访问127.0.0.1:8080/api/,看到如下页面则代表后端启动成功。 + +接着,你可以通过浏览器访问127.0.0.1:9090/api/,看到如下页面则代表后端启动成功。  -具体部署步骤请参考[部署文档](deploy.md) -本系统默认登录用户为root,密码为123456。 \ No newline at end of file + +## 启动前端 + +在启动前端之前请先确保frontend/vue.config.js中配置的proxy的目标地址为后端服务的ip+端口,如图: + + + +进入frontend目录,命令行输入`npm run serve`启动前端(具体步骤请参考[前端文档](../../frontend/README.md) ),启动成功后通过浏览器访问127.0.0.1:8080,你将进入登陆界面: + + + +输入默认账号root、密码123456,点击登录,你就可以使用本系统了。 + +如果你想将本项目部署到服务器上,请参考[部署文档](deploy.md) 。 \ No newline at end of file diff --git a/backend/doc/maven.md b/backend/doc/maven.md index 6b03b5a..1ace60e 100644 --- a/backend/doc/maven.md +++ b/backend/doc/maven.md @@ -25,7 +25,7 @@ ## Maven 安装 -无论你是mac电脑还是window电脑,都可以到Maven官网直接下载[Maven 3.8.2](https://dlcdn.apache.org/maven/maven-3/3.8.2/binaries/apache-maven-3.8.2-bin.tar.gz) +无论你是mac电脑还是window电脑,都可以到[Maven官网](https://archive.apache.org/dist/maven/maven-3/)直接下载,选择3.3.9或以上版本即可。 然后找一个目录解压,路径最好不要有中文,然后在Idea中引用该Maven。在下图中找到"Maven Setting" diff --git a/backend/doc/rest.md b/backend/doc/rest.md index 0b25e53..8481fa1 100644 --- a/backend/doc/rest.md +++ b/backend/doc/rest.md @@ -21,11 +21,23 @@ # 接口规范 -有时候,会犯一些错误,例如直接会定义如下的一些接口: +有时候,我们可能直接会定义如下的一些接口: - /user/delete - /user/add - /user/update - /user/select -这样的接口太数据库化,读起来虽然比较容易 +但这样的接口太数据库化,读起来虽然比较容易。 + +## RESTful API + +这里建议使用RESTful风格的API,例如: + +- 查询 /user?name=tom GET +- 详情 /user/1 GET +- 创建 /user POST +- 修改 /user/1 PUT +- 删除 /user/1 DELETE + +它是一种互联网应用程序的API设计理念:URL定位资源,用HTTP动词(GET,POST,DELETE,PUT)描述操作。 diff --git a/backend/doc/rule.md b/backend/doc/rule.md index 31b6225..7da684c 100644 --- a/backend/doc/rule.md +++ b/backend/doc/rule.md @@ -25,13 +25,58 @@ 需使用idea(版本2018.3+)安装插件,自动检查代码规范,具体操作步骤如下: -1、Mac:IntelliJ IDEA -> Preferences -> Plugins -> Installed plugins from Disk -> 选择doc目录下的code-guidelines进行安装 - Windows:File -> Settings -> Plugins -> Installed plugins from Disk -> 选择doc目录下的code-guidelines进行安装 +## 本地安装Alibaba Java Coding Guidelines + +1、安装 + +- Mac:IntelliJ IDEA -> Preferences -> Plugins -> Installed plugins from Disk -> 选择doc目录下的code-guidelines进行安装 +- Windows:File -> Settings -> Plugins -> Installed plugins from Disk -> 选择doc目录下的code-guidelines进行安装 + +2、重启idea + +## 在线安装Alibaba Java Coding Guidelines + +1、安装 + +- Mac:IntelliJ IDEA -> Preferences -> Plugins -> Browse repositories -> 搜索Alibaba Java Coding Guidelines -> 直接install进行在线安装 +- Windows:File -> Settings -> Plugins -> Marketplace -> 搜索Alibaba Java Coding Guidelines -> 直接install进行在线安装 2、重启idea -##在线安装java规范checkstyle -1、Mac:IntelliJ IDEA -> Preferences -> Plugins -> Browse repositories -> 搜索Alibaba Java Coding Guidelines -> 直接install进行在线安装 - Windows:File -> Settings -> Plugins -> Marketplace -> 搜索Alibaba Java Coding Guidelines -> 直接install进行在线安装 +# spotless插件规范代码 + +另外,我们还使用了spotless这款插件来规范代码。在backend/pom.xml中添加spotless插件: + +``` +<plugin> + <groupId>com.diffplug.spotless</groupId> + <artifactId>spotless-maven-plugin</artifactId> + <version>${spotless.version}</version> + <configuration> + <java> + <googleJavaFormat> + <version>1.7</version> + <style>GOOGLE</style> + </googleJavaFormat> + <importOrder> + <order>org.apache.iotdb,,javax,java,\#</order> + </importOrder> + <removeUnusedImports/> + </java> + <lineEndings>UNIX</lineEndings> + </configuration> + <executions> + <execution> + <id>spotless-check</id> + <phase>validate</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> +</plugin> +``` + +添加成功后我们可以看见在Maven出现了spotless插件,点击check可检查代码是否满足规范,点击apply可自动格式化代码使其满足规范。此外,在Maven打包时会自动check,如果没通过,打包就不会成功。 -2、重启idea \ No newline at end of file + diff --git a/backend/doc/swagger.md b/backend/doc/swagger.md index 37e9b0d..7ca7a42 100644 --- a/backend/doc/swagger.md +++ b/backend/doc/swagger.md @@ -44,7 +44,7 @@ swagger在前后端联调开发中,启动非常重要的作用,如下: ## 网页地址 -你可以通过http://localhost:8080/swagger-ui.html这个地址获得接口信息。 +你可以通过 http://localhost:9090/api/swagger-ui.html 这个地址获得接口信息。 ## 生产环境、测试环境、开发环境配置 diff --git a/backend/doc/validate.md b/backend/doc/validate.md index ceb0f5b..0c90d74 100644 --- a/backend/doc/validate.md +++ b/backend/doc/validate.md @@ -26,16 +26,17 @@ 1. 直接写在controller中,有时候,特别是新人,98%会忘记写参数验证 2. 切面,注解形式的参数验证 -我们认为第2种方式会好于第一种方式,所以我们使用了成熟的hibernat验证框架对参数进行验证 +我们认为第2种方式会好于第一种方式,所以我们使用了成熟的hibernate验证框架对参数进行验证 -## hibernat参数验证配置 +## hibernate参数验证配置 在开发中经常需要写一些字段校验的代码,比如字段非空,字段长度限制,邮箱格式验证等等,写这些与业务逻辑关系不大的代码有几个麻烦: 1. 验证代码繁琐,重复劳动 2. 方法内代码显得冗长 3. 每次要看哪些参数验证是否完整,需要去翻阅验证逻辑代码 -hibernate validator(官方文档)提供了一套比较完善、便捷的验证实现方式。 + +[hibernate validator](http://hibernate.org/validator/documentation/) 提供了一套比较完善、便捷的验证实现方式。 spring-boot-starter-web包里面有hibernate-validator包,不需要引用hibernate validator依赖。 diff --git a/backend/src/main/resources/application-dev.properties b/backend/src/main/resources/application-dev.properties index b547fb9..bd75be1 100644 --- a/backend/src/main/resources/application-dev.properties +++ b/backend/src/main/resources/application-dev.properties @@ -21,7 +21,7 @@ logging.config=classpath:log4j2.xml # Set port and context path -server.port=8080 +server.port=9090 server.servlet.context-path=/api # The following data source configuration method will cause data loss after the project is repackaged. diff --git a/frontend/README.md b/frontend/README.md index 260c866..527092b 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -46,6 +46,12 @@ npm run serve npm run test:unit ``` +## 打包 + +``` +npm run build +``` + ## 技术栈 **Vue3.0** + **Scss**(css modules) + **Element Plus** + **Eslint,Stylelint,Prettier,Husky** 统一代码风格与规范。 diff --git a/frontend/vue.config.js b/frontend/vue.config.js index a1e6b53..1624e93 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -36,7 +36,7 @@ module.exports = { devServer: { proxy: { '/.*': { - target: 'http://119.84.128.59:8079', + target: 'http://127.0.0.1:9090', changeOrigin: true, }, },
