refactor: 首页只显示运行中的定时任务

This commit is contained in:
chenjianxing 2020-08-07 10:03:22 +08:00
parent e5c4885d3f
commit 18c7a30a03
11 changed files with 24 additions and 15 deletions

View File

@ -314,6 +314,7 @@ public class APITestService {
}
public List<ScheduleDao> listSchedule(QueryScheduleRequest request) {
request.setEnable(true);
List<ScheduleDao> schedules = scheduleService.list(request);
List<String> resourceIds = schedules.stream()
.map(Schedule::getResourceId)

View File

@ -10,6 +10,9 @@
<if test="request.workspaceId != null">
and schedule.workspace_id = #{request.workspaceId}
</if>
<if test="request.enable != null">
and schedule.enable = #{request.enable}
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">

View File

@ -420,6 +420,7 @@ public class PerformanceTestService {
}
public List<ScheduleDao> listSchedule(QueryScheduleRequest request) {
request.setEnable(true);
List<ScheduleDao> schedules = scheduleService.list(request);
List<String> resourceIds = schedules.stream()
.map(Schedule::getResourceId)

View File

@ -14,7 +14,7 @@
<ms-test-heatmap :values="values"/>
</el-col>
<el-col :span="12">
<ms-api-test-schedule-list :group="'API_TEST'"/>
<ms-schedule-list :group="'API_TEST'"/>
</el-col>
</el-row>
</ms-main-container>
@ -28,13 +28,13 @@
import MsApiTestRecentList from "./ApiTestRecentList";
import MsApiReportRecentList from "./ApiReportRecentList";
import MsTestHeatmap from "../../common/components/MsTestHeatmap";
import MsApiTestScheduleList from "./ApiTestScheduleList";
import MsScheduleList from "./ScheduleList";
export default {
name: "ApiTestHome",
components: {
MsApiTestScheduleList,
MsScheduleList,
MsTestHeatmap, MsApiReportRecentList, MsApiTestRecentList, MsMainContainer, MsContainer
},

View File

@ -1,7 +1,7 @@
<template>
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<span class="title">{{$t('commons.trigger_mode.schedule')}}</span>
<span class="title">{{$t('schedule.running_task')}}</span>
</template>
<el-table height="289" border :data="tableData" class="adjust-table table-content" @row-click="link">
<el-table-column prop="resourceName" :label="$t('schedule.test_name')" width="150" show-overflow-tooltip/>
@ -32,7 +32,7 @@
import {SCHEDULE_TYPE} from "../../../../common/js/constants";
export default {
name: "MsApiTestScheduleList",
name: "MsScheduleList",
components: {CrontabResult},
data() {
return {

View File

@ -7,10 +7,14 @@
</span>
<el-switch :disabled="!schedule.value || isReadOnly" v-model="schedule.enable" @change="scheduleChange"/>
<ms-schedule-edit :is-read-only="isReadOnly" :schedule="schedule" :save="save" :custom-validate="customValidate" ref="scheduleEdit"/>
<crontab-result v-show="false" :ex="schedule.value" ref="crontabResult" @resultListChange="resultListChange"/>
</div>
<div>
<span :class="{'disable-character': !schedule.enable}"> {{$t('schedule.next_execution_time')}}{{this.recentList.length > 0 && schedule.enable ? this.recentList[0] : $t('schedule.not_set')}} </span>
<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>
@ -59,9 +63,6 @@
scheduleChange() {
this.$emit('scheduleChange');
},
resultListChange(resultList) {
this.recentList = resultList;
},
flashResultList() {
this.$refs.crontabResult.expressionChange();
}

View File

@ -1,5 +1,5 @@
<template>
<div>
<span>
<span v-if="enableSimpleMode">{{resultList && resultList.length > 0 ? resultList[0] : ''}}</span>
<div v-if="!enableSimpleMode" class="popup-result">
<p class="title">{{$t('schedule.cron.recent_run_time')}}</p>
@ -9,7 +9,7 @@
</template>
</ul>
</div>
</div>
</span>
</template>
<script>

View File

@ -14,7 +14,7 @@
<ms-test-heatmap :values="values"/>
</el-col>
<el-col :span="12">
<ms-api-test-schedule-list :group="'PERFORMANCE_TEST'"/>
<ms-schedule-list :group="'PERFORMANCE_TEST'"/>
</el-col>
</el-row>
</ms-main-container>
@ -28,12 +28,12 @@
import MsPerformanceTestRecentList from "./PerformanceTestRecentList"
import MsPerformanceReportRecentList from "./PerformanceReportRecentList"
import MsTestHeatmap from "../../common/components/MsTestHeatmap";
import MsApiTestScheduleList from "../../api/home/ApiTestScheduleList";
import MsScheduleList from "../../api/home/ScheduleList";
export default {
name: "PerformanceTestHome",
components: {
MsApiTestScheduleList,
MsScheduleList,
MsTestHeatmap,
MsMainContainer,
MsContainer,

View File

@ -713,6 +713,7 @@ export default {
test_name: 'Test Name',
running_rule: 'Rule',
job_status: 'Status',
running_task: 'Running Task',
please_input_cron_expression: "Please Input Cron Expression",
generate_expression: "Generate Expression",
cron_expression_format_error: "Cron Expression Format Error",

View File

@ -710,6 +710,7 @@ export default {
test_name: '测试名称',
running_rule: '运行规则',
job_status: '任务状态',
running_task: '运行中的任务',
next_execution_time: "下次执行时间",
edit_timer_task: "编辑定时任务",
please_input_cron_expression: "请输入 Cron 表达式",

View File

@ -711,6 +711,7 @@ export default {
test_name: '測試名稱',
running_rule: '運行規則',
job_status: '任務狀態',
running_task: '運行中的任務',
please_input_cron_expression: "請輸入 Cron 表達式",
generate_expression: "生成表達式",
cron_expression_format_error: "Cron 表達式格式錯誤",