From 3ffe71a6572c49fa6559bb920fb7270d19e550ed Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 1 Dec 2022 19:30:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE=E6=94=AF=E6=8C=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=B8=AE=E5=8A=A9=E6=96=87=E6=A1=A3=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #20355 --- .../frontend/src/components/head/HeaderUser.vue | 14 +++++++++++++- .../io/metersphere/dto/BaseSystemConfigDTO.java | 1 + .../commons/constants/ParamConstants.java | 3 ++- .../service/SystemParameterService.java | 3 +++ .../src/business/system/setting/BaseSetting.vue | 9 ++++++++- 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/framework/sdk-parent/frontend/src/components/head/HeaderUser.vue b/framework/sdk-parent/frontend/src/components/head/HeaderUser.vue index 72c02d72e1..e87c502596 100644 --- a/framework/sdk-parent/frontend/src/components/head/HeaderUser.vue +++ b/framework/sdk-parent/frontend/src/components/head/HeaderUser.vue @@ -30,6 +30,7 @@ import {hasPermissions} from "../../utils/permission"; import AboutUs from "./AboutUs"; import {useUserStore} from "@/store"; import MsPersonRouter from "../personal/PersonRouter"; +import {getSystemBaseSetting} from "../../api/system"; const userStore = useUserStore(); @@ -67,7 +68,18 @@ export default { this.$refs.aboutUs.open(); break; case "help": - window.open('https://metersphere.io/docs/index.html', "_blank"); + getSystemBaseSetting() + .then(res => { + if (res.data.docUrl) { + let docUrl = res.data.docUrl; + window.open(docUrl, "_blank"); + } else { + window.open('https://metersphere.io/docs/index.html', "_blank"); + } + }) + .catch(() =>{ + window.open('https://metersphere.io/docs/index.html', "_blank"); + }) break; case "ApiHelp": window.open('/swagger-ui.html', "_blank"); diff --git a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/BaseSystemConfigDTO.java b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/BaseSystemConfigDTO.java index 4dfacbc2cf..8daf5d82ed 100644 --- a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/BaseSystemConfigDTO.java +++ b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/dto/BaseSystemConfigDTO.java @@ -11,4 +11,5 @@ public class BaseSystemConfigDTO { private String prometheusHost; private String seleniumDockerUrl; private String runMode; + private String docUrl; } diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/ParamConstants.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/ParamConstants.java index 6e1b6a1d83..a7b7e4c6ef 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/ParamConstants.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/constants/ParamConstants.java @@ -116,7 +116,8 @@ public interface ParamConstants { GRID_CONCURRENCY("base.grid.concurrency"), PROMETHEUS_HOST("base.prometheus.host"), SELENIUM_DOCKER_URL("base.selenium.docker.url"), - RUN_MODE("base.run.mode"); + RUN_MODE("base.run.mode"), + DOC_URL("base.doc.url"); private String value; diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/SystemParameterService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/SystemParameterService.java index acdf70b5dd..d58ba34751 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/SystemParameterService.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/SystemParameterService.java @@ -239,6 +239,9 @@ public class SystemParameterService { if (StringUtils.equals(param.getParamKey(), ParamConstants.BASE.RUN_MODE.getValue())) { baseSystemConfigDTO.setRunMode(param.getParamValue()); } + if (StringUtils.equals(param.getParamKey(), ParamConstants.BASE.DOC_URL.getValue())) { + baseSystemConfigDTO.setDocUrl(param.getParamValue()); + } } } return baseSystemConfigDTO; diff --git a/system-setting/frontend/src/business/system/setting/BaseSetting.vue b/system-setting/frontend/src/business/system/setting/BaseSetting.vue index 7d208980fc..e72a735813 100644 --- a/system-setting/frontend/src/business/system/setting/BaseSetting.vue +++ b/system-setting/frontend/src/business/system/setting/BaseSetting.vue @@ -19,6 +19,9 @@ ({{ $t('commons.examples') }}:http://localhost:4444) + + + @@ -44,7 +47,7 @@ export default { name: "BaseSetting", data() { return { - formInline: {runMode: true}, + formInline: {runMode: true, docUrl: 'https://metersphere.io/docs/index.html'}, input: '', visible: true, showEdit: true, @@ -83,6 +86,9 @@ export default { if(!res.data.runMode) { res.data.runMode = 'LOCAL' } + if(!res.data.docUrl) { + res.data.docUrl = 'https://metersphere.io/docs/index.html' + } this.formInline = res.data; this.$nextTick(() => { if (this.$refs.formInline) { @@ -125,6 +131,7 @@ export default { {paramKey: "base.concurrency", paramValue: this.formInline.concurrency, type: "text", sort: 2}, {paramKey: "base.prometheus.host", paramValue: this.formInline.prometheusHost, type: "text", sort: 1}, {paramKey: "base.selenium.docker.url", paramValue: this.formInline.seleniumDockerUrl, type: "text", sort: 1}, + {paramKey: "base.doc.url", paramValue: this.formInline.docUrl, type: "text", sort: 1}, {paramKey: "base.run.mode", paramValue: this.formInline.runMode, type: "text", sort: 5} ]; this.loading = saveSystemBaseSetting(param).then(res => {