feat(系统设置): 系统设置支持配置帮助文档地址

Closes #20355
This commit is contained in:
CaptainB 2022-12-01 19:30:30 +08:00 committed by 刘瑞斌
parent fdacec0a7f
commit 3ffe71a657
5 changed files with 27 additions and 3 deletions

View File

@ -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":
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");

View File

@ -11,4 +11,5 @@ public class BaseSystemConfigDTO {
private String prometheusHost;
private String seleniumDockerUrl;
private String runMode;
private String docUrl;
}

View File

@ -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;

View File

@ -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;

View File

@ -19,6 +19,9 @@
<el-input v-model="formInline.seleniumDockerUrl" :placeholder="$t('system_config.selenium_docker.url_tip')"/>
<i>({{ $t('commons.examples') }}:http://localhost:4444)</i>
</el-form-item>
<el-form-item :label="$t('commons.help_documentation')" prop="docUrl">
<el-input v-model="formInline.docUrl" placeholder="https://metersphere.io/docs/index.html"/>
</el-form-item>
<el-form-item :label="$t('system.api_default_run')" prop="runMode" v-if="hasLicense()">
<el-switch active-value="LOCAL" inactive-value="POOL" v-model="formInline.runMode" @change="modeChange"/>
</el-form-item>
@ -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 => {