This commit is contained in:
fit2-zhao 2021-01-27 19:55:34 +08:00
commit 19fe757774
10 changed files with 160 additions and 19 deletions

View File

@ -1,11 +1,11 @@
create table swagger_url_project
(
id varchar(255) not null,
project_id varchar(255) null,
id varchar(30) not null,
project_id varchar(30) null,
swagger_url varchar(255) null,
module_id varchar(255) null,
module_id varchar(30) null,
module_path varchar(255) null,
mode_id varchar(255) null,
mode_id varchar(30) null,
primary key (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

View File

@ -8,12 +8,22 @@
<el-form :model="form" :rules="rules" ref="from">
<el-form-item
prop="cronValue">
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
:placeholder="$t('schedule.please_input_cron_expression')"/>
<el-button :disabled="isReadOnly" type="primary" @click="saveCron" v-tester>{{
$t('commons.save')
}}
</el-button>
<el-row>
<el-col :span="18">
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
:placeholder="$t('schedule.please_input_cron_expression')"/>
<el-button :disabled="isReadOnly" type="primary" @click="saveCron" v-tester>{{
$t('commons.save')
}}
</el-button>
</el-col>
<el-col :span="6">
<schedule-switch :schedule="schedule" @scheduleChange="scheduleChange"></schedule-switch>
</el-col>
</el-row>
</el-form-item>
<el-form-item>
<el-link :disabled="isReadOnly" type="primary" @click="showCronDialog">
@ -44,6 +54,7 @@ import Crontab from "@/business/components/common/cron/Crontab";
import CrontabResult from "@/business/components/common/cron/CrontabResult";
import {cronValidate} from "@/common/js/cron";
import MsScheduleNotification from "./ScheduleNotification";
import ScheduleSwitch from "@/business/components/api/automation/schedule/ScheduleSwitch";
function defaultCustomValidate() {
return {pass: true};
@ -55,7 +66,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
export default {
name: "MsScheduleMaintain",
components: {CrontabResult, Crontab, MsScheduleNotification, "NoticeTemplate": noticeTemplate.default},
components: {CrontabResult, ScheduleSwitch,Crontab, MsScheduleNotification, "NoticeTemplate": noticeTemplate.default},
props: {
customValidate: {
@ -100,6 +111,7 @@ export default {
form: {
cronValue: ""
},
paramRow:{},
activeName: 'first',
rules: {
cronValue: [{required: true, validator: validateCron, trigger: 'blur'}],
@ -110,6 +122,35 @@ export default {
currentUser: () => {
return getCurrentUser();
},
scheduleChange(){
let flag = this.schedule.enable;
this.$confirm(this.$t('api_test.home_page.running_task_list.confirm.close_title'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
let param = {};
param.taskID = this.schedule.id;
param.enable = flag;
this.updateTask(param);
}).catch(() => {
});
},
updateTask(param){
this.result = this.$post('/api/schedule/updateEnableByPrimyKey', param, response => {
let paramTestId = "";
if (this.paramRow.redirectFrom == 'testPlan') {
paramTestId = this.paramRow.id;
this.scheduleTaskType = "TEST_PLAN_TEST";
} else {
paramTestId = this.paramRow.id;
this.scheduleTaskType = "API_SCENARIO_TEST";
}
this.taskID = paramTestId;
this.findSchedule(paramTestId);
});
},
initUserList() {
let param = {
name: '',
@ -132,6 +173,7 @@ export default {
open(row) {
//
let paramTestId = "";
this.paramRow = row;
if (row.redirectFrom == 'testPlan') {
paramTestId = row.id;
this.scheduleTaskType = "TEST_PLAN_TEST";

View File

@ -0,0 +1,82 @@
<template>
<div class="schedule-config">
<div>
<span class="cron-ico">
<i class="el-icon-date" size="small"></i>
<span class="character">SCHEDULER</span>
</span>
<!-- <el-switch :disabled="!schedule.value || isReadOnly" v-model="schedule.enable" @change="scheduleChange"/>-->
<!-- <el-switch :disabled="!schedule.value || isReadOnly" v-model="schedule.enable" />-->
<el-switch :disabled="!schedule.value" v-model="schedule.enable" @change="scheduleChange"/>
</div>
<div>
<span>
{{ $t('schedule.next_execution_time') }}
<span :class="{'disable-character': !schedule.enable}"
v-if="!schedule.enable">{{ $t('schedule.not_set') }}</span>
<crontab-result v-if="schedule.enable" :enable-simple-mode="true" :ex="schedule.value" ref="crontabResult"/>
</span>
</div>
</div>
</template>
<script>
import CrontabResult from "@/business/components/common/cron/CrontabResult";
export default {
name: "ScheduleSwitch",
components: {CrontabResult},
data() {
return {
}
},
props: {
testId: String,
schedule: Object,
isReadOnly: {
type: Boolean,
default: false
}
},
methods: {
scheduleChange() {
this.$emit('scheduleChange');
},
},
watch: {
}
}
</script>
<style scoped>
.schedule-config {
float: right;
width: 250px;
height: 15px;
line-height: 25px;
}
.el-icon-date {
font-size: 20px;
margin-left: 5px;
}
.character {
font-weight: bold;
margin: 0 5px;
}
.disable-character {
color: #cccccc;
}
.el-switch {
margin: 0 5px;
}
.cron-ico {
cursor: pointer;
}
</style>

View File

@ -3,7 +3,7 @@
<el-dialog
:title="$t('api_test.environment.select_environment')"
:visible.sync="dialogVisible"
width="20%"
width="15%"
:destroy-on-close="true"
@close="handleClose"
>

View File

@ -274,7 +274,12 @@
},
},
created: function () {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
}
else {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
}
this.initTable();
this.getMaintainerOptions();
},

View File

@ -14,7 +14,7 @@
<el-tab-pane v-if="hasLicense()" :label="$t('display.title')" name="display">
<ms-display/>
</el-tab-pane>
<el-tab-pane v-if="hasLicense()" :label="'认证设置'" name="auth">
<el-tab-pane v-if="hasLicense()" :label="$t('auth_source.title')" name="auth">
<ms-auth/>
</el-tab-pane>
</el-tabs>

View File

@ -19,8 +19,8 @@
</el-table-column>
<el-table-column prop="tagNames" :label="$t('api_test.automation.tag')" width="200px">
<template v-slot:default="scope">
<div v-for="itemName in scope.row.tagNames" :key="itemName">
<ms-tag type="success" effect="plain" :content="itemName"/>
<div v-for="itemName in getTagString(scope.row.tags)" :key="itemName">
<ms-tag type="success" effect="plain" :content="itemName.substring(1, itemName.length-1)"/>
</div>
</template>
</el-table-column>
@ -101,6 +101,15 @@
},
},
methods: {
getTagString(tagsString) {
// if(tagsString.length == 2) {
if(tagsString.length >= 2 && tagsString[0] == '[' && tagsString[1] == ']') {
return null;
}
tagsString = tagsString.substring(1, tagsString.length - 1);
let tagList = tagsString.split(',');
return tagList;
},
search() {
this.selectRows = new Set();
this.loading = true;

View File

@ -1501,6 +1501,7 @@ export default {
format: "Output format",
},
auth_source: {
delete_prompt: 'This operation will delete the authentication source, do you want to continue? '
delete_prompt: 'This operation will delete the authentication source, do you want to continue? ',
title: 'Auth Source'
}
};

View File

@ -1504,6 +1504,7 @@ export default {
format: "输出格式",
},
auth_source: {
delete_prompt: '此操作会删除认证源,是否继续?'
delete_prompt: '此操作会删除认证源,是否继续?',
title: '认证设置'
}
};

View File

@ -1502,6 +1502,7 @@ export default {
format: "輸出格式",
},
auth_source: {
delete_prompt: '此操作會刪除認證源,是否繼續? '
delete_prompt: '此操作會刪除認證源,是否繼續? ',
title: '認證設置'
}
};