feat: 增加帮助文档跳转

This commit is contained in:
wenyann 2020-08-31 17:40:56 +08:00
parent 98194ab778
commit 8d88ff7f6e
6 changed files with 384 additions and 267 deletions

View File

@ -1,22 +1,92 @@
<template> <template>
<el-dialog width="35%" class="schedule-edit" :title="$t('schedule.edit_timer_task')" :visible.sync="dialogVisible" @close="close"> <el-dialog :close-on-click-modal="false" width="35%" class="schedule-edit" :visible.sync="dialogVisible"
<div id="app"> @close="close">
<template>
<div>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane :label="$t('schedule.edit_timer_task')" name="first">
<el-form :model="form" :rules="rules" ref="from"> <el-form :model="form" :rules="rules" ref="from">
<el-form-item <el-form-item
prop="cronValue"> prop="cronValue">
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp" :placeholder="$t('schedule.please_input_cron_expression')"/> <el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
<!-- <el-button type="primary" @click="showCronDialog">{{$t('schedule.generate_expression')}}</el-button>--> :placeholder="$t('schedule.please_input_cron_expression')"/>
<!-- <el-button type="primary" @click="showCronDialog">{{$t('schedule.generate_expression')}}</el-button>-->
<el-button :disabled="isReadOnly" type="primary" @click="saveCron">{{$t('commons.save')}}</el-button> <el-button :disabled="isReadOnly" type="primary" @click="saveCron">{{$t('commons.save')}}</el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-link :disabled="isReadOnly" type="primary" @click="showCronDialog">{{$t('schedule.generate_expression')}}</el-link> <el-link :disabled="isReadOnly" type="primary" @click="showCronDialog">
{{$t('schedule.generate_expression')}}
</el-link>
</el-form-item> </el-form-item>
<crontab-result :ex="form.cronValue" ref="crontabResult" /> <crontab-result :ex="form.cronValue" ref="crontabResult"/>
</el-form> </el-form>
<el-dialog :title="$t('schedule.generate_expression')" :visible.sync="showCron" :modal="false"> <el-dialog :title="$t('schedule.generate_expression')" :visible.sync="showCron" :modal="false">
<crontab @hide="showCron=false" @fill="crontabFill" :expression="schedule.value" ref="crontab"/> <crontab @hide="showCron=false" @fill="crontabFill" :expression="schedule.value" ref="crontab"/>
</el-dialog> </el-dialog>
</el-tab-pane>
<el-tab-pane :label="$t('schedule.task_notification')" name="second">
<template>
<el-table
:data="tableData"
style="width: 100%">
<el-table-column
prop="event"
:label="$t('schedule.event')"
>
</el-table-column>
<el-table-column
prop="receiver"
:label="$t('schedule.receiver')"
width="200"
>
<template v-slot:default="{row}">
<el-input
size="mini"
type="textarea"
:rows="1"
class="edit-input"
v-model="row.receiver"
:placeholder="$t('schedule.receiver')"
clearable>
</el-input>
</template>
</el-table-column>
<el-table-column
prop="email"
:label="$t('schedule.receiving_mode')"
width="300">
<template v-slot:default="{row}">
<el-input
size="mini"
type="textarea"
:rows="1"
class="edit-input"
v-model="row.email"
:placeholder="$t('schedule.input_email')"
clearable>
</el-input>
</template>
</el-table-column>
<el-table-column
align="center"
:label="$t('schedule.operation')"
show-overflow-tooltip>
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
:active-value="1"
:inactive-value="2"
active-color="#13ce66"
inactive-color="#ff4949"
/>
</template>
</el-table-column>
</el-table>
</template>
</el-tab-pane>
</el-tabs>
</div> </div>
</template>
</el-dialog> </el-dialog>
</template> </template>
@ -27,7 +97,9 @@
import {cronValidate} from "../../../../common/js/cron"; import {cronValidate} from "../../../../common/js/cron";
import {listenGoBack, removeGoBackListener} from "../../../../common/js/utils"; import {listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
function defaultCustomValidate() {return {pass: true};} function defaultCustomValidate() {
return {pass: true};
}
export default { export default {
name: "MsScheduleEdit", name: "MsScheduleEdit",
@ -60,24 +132,44 @@
// else if(!this.intervalShortValidate()) { // else if(!this.intervalShortValidate()) {
// callback(new Error(this.$t('schedule.cron_expression_interval_short_error'))); // callback(new Error(this.$t('schedule.cron_expression_interval_short_error')));
// } // }
else if (!customValidate.pass){ else if (!customValidate.pass) {
callback(new Error(customValidate.info)); callback(new Error(customValidate.info));
} else { } else {
callback(); callback();
} }
}; };
return { return {
operation: true,
dialogVisible: false, dialogVisible: false,
showCron: false, showCron: false,
form: { form: {
cronValue: "" cronValue: ""
}, },
tableData: [
{
event: '执行成功',
receiver: '',
email: '',
operation: 1
}, {
event: '执行成功',
receiver: '',
email: '',
operation: 2
}
],
email: "",
enable: true,
activeName: 'first',
rules: { rules: {
cronValue :[{required: true, validator: validateCron, trigger: 'blur'}], cronValue: [{required: true, validator: validateCron, trigger: 'blur'}],
} }
} }
}, },
methods: { methods: {
handleClick() {
},
open() { open() {
this.dialogVisible = true; this.dialogVisible = true;
this.form.cronValue = this.schedule.value; this.form.cronValue = this.schedule.value;
@ -92,7 +184,7 @@
showCronDialog() { showCronDialog() {
this.showCron = true; this.showCron = true;
}, },
saveCron () { saveCron() {
this.$refs['from'].validate((valid) => { this.$refs['from'].validate((valid) => {
if (valid) { if (valid) {
this.intervalShortValidate(); this.intervalShortValidate();
@ -113,7 +205,7 @@
removeGoBackListener(this.close); removeGoBackListener(this.close);
}, },
intervalShortValidate() { intervalShortValidate() {
if (this.getIntervalTime() < 3*60*1000) { if (this.getIntervalTime() < 3 * 60 * 1000) {
// return false; // return false;
this.$info(this.$t('schedule.cron_expression_interval_short_error')); this.$info(this.$t('schedule.cron_expression_interval_short_error'));
} }

View File

@ -6,8 +6,9 @@
<template v-slot:dropdown> <template v-slot:dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item command="personal">{{$t('commons.personal_information')}}</el-dropdown-item> <el-dropdown-item command="personal">{{$t('commons.personal_information')}}</el-dropdown-item>
<el-dropdown-item command="logout">{{$t('commons.exit_system')}}</el-dropdown-item>
<el-dropdown-item command="about">{{$t('commons.about_us')}} <i class="el-icon-info"/></el-dropdown-item> <el-dropdown-item command="about">{{$t('commons.about_us')}} <i class="el-icon-info"/></el-dropdown-item>
<el-dropdown-item command="help">{{$t('commons.help_documentation')}}</el-dropdown-item>
<el-dropdown-item command="logout">{{$t('commons.exit_system')}}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
@ -54,6 +55,9 @@
case "about": case "about":
this.$refs.aboutUs.open(); this.$refs.aboutUs.open();
break; break;
case "help":
window.location.href = "https://metersphere.io/docs/index.html";
break;
default: default:
break; break;
} }

View File

@ -109,9 +109,9 @@
</template> </template>
<script> <script>
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton"; import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
export default { export default {
name: "PerformanceAdvancedConfig", name: "PerformanceAdvancedConfig",
components: {MsTableOperatorButton}, components: {MsTableOperatorButton},
data() { data() {
@ -242,36 +242,36 @@ export default {
}; };
}, },
} }
} }
</script> </script>
<style scoped> <style scoped>
.el-row { .el-row {
margin-bottom: 10px; margin-bottom: 10px;
} }
.edit-input { .edit-input {
padding-right: 0px; padding-right: 0px;
} }
.tb-edit .el-textarea { .tb-edit .el-textarea {
display: none; display: none;
} }
.tb-edit .current-row .el-textarea { .tb-edit .current-row .el-textarea {
display: block; display: block;
} }
.tb-edit .current-row .el-textarea + span { .tb-edit .current-row .el-textarea + span {
display: none; display: none;
} }
.el-col { .el-col {
text-align: left; text-align: left;
} }
.el-col .el-table { .el-col .el-table {
align: center; align: center;
} }
</style> </style>

View File

@ -1,5 +1,6 @@
export default { export default {
commons: { commons: {
help_documentation: 'Help documentation',
delete_cancelled: 'Delete cancelled', delete_cancelled: 'Delete cancelled',
workspace: 'Workspace', workspace: 'Workspace',
organization: 'Organization', organization: 'Organization',
@ -805,6 +806,12 @@ export default {
mapping_cannot_be_empty: 'LDAP mapping cannot be empty', mapping_cannot_be_empty: 'LDAP mapping cannot be empty',
}, },
schedule: { schedule: {
input_email: "Please input email account",
event: "event",
receiving_mode: "Receiving mode",
receiver: "Receiver",
operation: "operation",
task_notification: "Task notification",
not_set: "Not Set", not_set: "Not Set",
next_execution_time: "Next Execution Time", next_execution_time: "Next Execution Time",
edit_timer_task: "Edit Timer Task", edit_timer_task: "Edit Timer Task",

View File

@ -1,5 +1,6 @@
export default { export default {
commons: { commons: {
help_documentation: '帮助文档',
delete_cancelled: '已取消删除', delete_cancelled: '已取消删除',
workspace: '工作空间', workspace: '工作空间',
organization: '组织', organization: '组织',
@ -807,6 +808,12 @@ export default {
password_cannot_be_empty: 'LDAP 密码不能为空', password_cannot_be_empty: 'LDAP 密码不能为空',
}, },
schedule: { schedule: {
input_email: "请输入邮箱账号",
event: "事件",
receiving_mode: "接收方式",
receiver: "接收人",
operation: "操作",
task_notification: "任务通知",
not_set: "未设置", not_set: "未设置",
test_name: '测试名称', test_name: '测试名称',
running_rule: '运行规则', running_rule: '运行规则',

View File

@ -1,5 +1,6 @@
export default { export default {
commons: { commons: {
help_documentation: '幫助文檔',
delete_cancelled: '已取消删除', delete_cancelled: '已取消删除',
workspace: '工作空間', workspace: '工作空間',
organization: '組織', organization: '組織',
@ -804,6 +805,12 @@ export default {
mapping_cannot_be_empty: 'LDAP 用戶屬性映射不能為空', mapping_cannot_be_empty: 'LDAP 用戶屬性映射不能為空',
}, },
schedule: { schedule: {
input_email: "請輸入郵箱帳號",
event: "事件",
receiving_mode: "接收管道",
receiver: "接收人",
operation: "操作",
task_notification: "任務通知",
not_set: "未設置", not_set: "未設置",
next_execution_time: "下次執行時間", next_execution_time: "下次執行時間",
edit_timer_task: "編輯定時任務", edit_timer_task: "編輯定時任務",