feat: 测试计划-增加定时任务、修改接口列表、接口自动化的按钮

测试计划-增加定时任务、修改接口列表、接口自动化的按钮
This commit is contained in:
song.tianyang 2021-01-19 14:26:58 +08:00
parent e2356c1849
commit e4b16c31d4
13 changed files with 82 additions and 29 deletions

View File

@ -27,5 +27,7 @@ public class TaskInfoResult {
private String creator;
//更新时间
private Long updateTime;
//定时任务类型 情景定时任务/范围计划任务
private String taskType;
}

View File

@ -50,10 +50,18 @@
AND create_time BETWEEN #{startTime} and #{endTime}
</select>
<select id="findRunningTaskInfoByProjectID" resultType="io.metersphere.api.dto.datacount.response.TaskInfoResult">
SELECT apiScene.id AS scenarioId,apiScene.`name` AS scenario,sch.id AS taskID,sch.`value` AS rule,sch.`enable` AS `taskStatus`,u.`name` AS creator,sch.update_time AS updateTime
SELECT apiScene.id AS scenarioId,apiScene.`name` AS scenario,sch.id AS taskID,sch.`value` AS rule,sch.`enable` AS `taskStatus`,u.`name` AS creator,sch.update_time AS updateTime,
'scenario' AS taskType
FROM api_scenario apiScene
INNER JOIN `schedule` sch ON apiScene.id = sch.resource_id
INNER JOIN `user` u ON u.id = sch.user_id
WHERE sch.`enable` = true AND apiScene.project_id = #{0,jdbcType=VARCHAR}
UNION
SELECT testPlan.id AS scenarioId,testPlan.`name` AS scenario,sch.id AS taskID,sch.`value` AS rule,sch.`enable` AS `taskStatus`,u.`name` AS creator,sch.update_time AS updateTime,
'testPlan' AS taskType
FROM test_plan testPlan
INNER JOIN `schedule` sch ON testPlan.id = sch.resource_id
INNER JOIN `user` u ON u.id = sch.user_id
WHERE sch.`enable` = true AND testPlan.project_id = #{0,jdbcType=VARCHAR}
</select>
</mapper>

View File

@ -98,7 +98,9 @@
<select id="list" resultType="io.metersphere.track.dto.TestPlanDTOWithMetric"
parameterType="io.metersphere.track.request.testcase.QueryTestPlanRequest">
select DISTINCT test_plan.*, user.name as user_name, project.name as projectName,schedule.id as scheduleId from test_plan
select DISTINCT test_plan.*, user.name as user_name, project.name as projectName,schedule.id as scheduleId,
IF(schedule.enable = true,true,false) as scheduleOpen
from test_plan
LEFT JOIN user ON user.id = test_plan.principal
LEFT JOIN schedule ON schedule.resource_id = test_plan.id
JOIN project on project.id = test_plan.project_id
@ -235,7 +237,7 @@
<select id="findIdByPerformanceReportId" resultType="java.lang.String">
SELECT report.id FROM test_plan_report report INNER JOIN test_plan_report_data reportData ON report.id = reportData.test_plan_report_id
WHERE reportData.performance_info like CONCAT('%', #{0}'%')
WHERE reportData.performance_info like CONCAT('%', #{0},'%')
</select>
</mapper>

View File

@ -22,8 +22,6 @@ public class LoadTestConsumer {
LoadTestReport loadTestReport = JSON.parseObject(record.value(), LoadTestReport.class);
Reflections reflections = new Reflections(Application.class);
Set<Class<? extends LoadTestFinishEvent>> subTypes = reflections.getSubTypesOf(LoadTestFinishEvent.class);
LogUtil.info("Execute Over: LoadTestConsumer");
System.out.println("Execute Over: LoadTestConsumer");
subTypes.forEach(s -> {
try {
CommonBeanFactory.getBean(s).execute(loadTestReport);

View File

@ -12,5 +12,13 @@ public class TestPlanDTO extends TestPlan {
private String projectName;
private String userName;
private List<String> projectIds;
/**
* 定时任务ID
*/
private String scheduleId;
/**
* 定时任务是否开启
*/
private boolean scheduleOpen;
}

View File

@ -65,14 +65,24 @@
<el-table-column :label="$t('commons.operating')" width="200px" v-if="!referenced">
<template v-slot:default="{row}">
<div v-if="trashEnable">
<el-button type="text" @click="reductionApi(row)" v-tester>{{ $t('commons.reduction') }}</el-button>
<el-button type="text" @click="remove(row)" v-tester>{{ $t('api_test.automation.remove') }}</el-button>
<!-- <el-button type="text" @click="reductionApi(row)" v-tester>{{ $t('commons.reduction') }}</el-button>-->
<!-- <el-button type="text" @click="remove(row)" v-tester>{{ $t('api_test.automation.remove') }}</el-button>-->
<ms-table-operator-button :tip="$t('commons.reduction')" icon="el-icon-refresh-left" @exec="reductionApi(row)" v-tester/>
<ms-table-operator-button :tip="$t('api_test.automation.remove')" icon="el-icon-delete" @exec="remove(row)" type="danger" v-tester/>
</div>
<div v-else>
<el-button type="text" @click="edit(row)" v-tester>{{ $t('api_test.automation.edit') }}</el-button>
<el-button type="text" @click="execute(row)" v-tester>{{ $t('api_test.automation.execute') }}</el-button>
<el-button type="text" @click="copy(row)" v-tester>{{ $t('api_test.automation.copy') }}</el-button>
<el-button type="text" @click="remove(row)" v-tester>{{ $t('api_test.automation.remove') }}</el-button>
<ms-table-operator-button :tip="$t('api_test.automation.edit')" icon="el-icon-edit" @exec="edit(row)" v-tester/>
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.automation.execute')"
icon="el-icon-video-play"
@exec="execute(row)" v-tester/>
<ms-table-operator-button :tip="$t('api_test.automation.copy')" icon="el-icon-document"
@exec="copy(row)"/>
<ms-table-operator-button :tip="$t('api_test.automation.remove')" icon="el-icon-delete" @exec="remove(row)" type="danger" v-tester/>
<!-- <el-button type="text" @click="edit(row)" v-tester>{{ $t('api_test.automation.edit') }}</el-button>-->
<!-- <el-button type="text" @click="execute(row)" v-tester>{{ $t('api_test.automation.execute') }}</el-button>-->
<!-- <el-button type="text" @click="copy(row)" v-tester>{{ $t('api_test.automation.copy') }}</el-button>-->
<!-- <el-button type="text" @click="remove(row)" v-tester>{{ $t('api_test.automation.remove') }}</el-button>-->
<ms-scenario-extend-buttons :row="row"/>
</div>
</template>
@ -109,6 +119,7 @@
import MsTestPlanList from "./testplan/TestPlanList";
import MsTableSelectAll from "../../../common/components/table/MsTableSelectAll";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
export default {
name: "MsApiScenarioList",
@ -121,7 +132,8 @@
MsTag,
MsApiReportDetail,
MsScenarioExtendButtons,
MsTestPlanList
MsTestPlanList,
MsTableOperatorButton
},
props: {
referenced: {
@ -426,5 +438,8 @@
/deep/ .el-drawer__header {
margin-bottom: 0px;
}
/deep/ .run-button {
background-color: #409EFF;
border-color: #409EFF;
}
</style>

View File

@ -9,7 +9,7 @@
<el-dropdown-item command="create_performance" v-tester>{{ $t('api_test.create_performance_test') }}</el-dropdown-item>
</el-dropdown-menu>
<ms-reference-view ref="viewRef"/>
<ms-schedule-maintain ref="scheduleMaintain" />
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="refreshTable" />
</el-dropdown>
</template>
@ -61,6 +61,9 @@
})
});
},
refreshTable(){
}
}
}
</script>

View File

@ -115,7 +115,6 @@
<span>{{ scope.row.actualEndTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</el-table>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"

View File

@ -203,6 +203,7 @@ export default {
this.$post(url, param, () => {
this.$success(this.$t('commons.save_success'));
this.$emit("refreshTable");
});
},
checkScheduleEdit() {

View File

@ -69,12 +69,13 @@
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130" align="center">
<template v-slot:default="scope">
<!--<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable">{{$t('commons.reduction')}}</el-button>-->
<el-button type="text" @click="handleTestCase(scope.row)" v-if="!trashEnable">{{ $t('commons.edit') }}
</el-button>
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C">{{ $t('commons.delete') }}
</el-button>
<!-- <el-button type="text" @click="handleTestCase(scope.row)" v-if="!trashEnable">{{ $t('commons.edit') }}-->
<!-- </el-button>-->
<!-- <el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C">{{ $t('commons.delete') }}-->
<!-- </el-button>-->
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleTestCase(scope.row)" v-tester/>
<ms-table-operator-button :tip="$t('commons.delete')" icon="el-icon-delete" @exec="handleDelete(scope.row)" type="danger" v-tester/>
<ms-api-case-table-extend-btns @showCaseRef="showCaseRef" @showEnvironment="showEnvironment" @createPerformance="createPerformance" :row="scope.row" v-tester/>
</template>
</el-table-column>

View File

@ -112,10 +112,20 @@
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130" align="center">
<template v-slot:default="scope">
<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable" v-tester>{{ $t('commons.reduction') }}</el-button>
<el-button type="text" @click="editApi(scope.row)" v-else v-tester>{{ $t('commons.edit') }}</el-button>
<el-button type="text" @click="handleTestCase(scope.row)">{{ $t('api_test.definition.request.case') }}</el-button>
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C" v-tester>{{ $t('commons.delete') }}</el-button>
<ms-table-operator-button :tip="$t('commons.reduction')" icon="el-icon-refresh-left" @exec="reductionApi(scope.row)" v-if="trashEnable" v-tester/>
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="editApi(scope.row)" v-else v-tester/>
<el-tooltip :content="$t('api_test.definition.request.case')"
placement="bottom"
:enterable="false"
effect="dark" >
<el-button @click="handleTestCase(scope.row)"
@keydown.enter.native.prevent
circle
style="padding: 9px 1px;font-size: 1px"
size="mini" >Case
</el-button>
</el-tooltip>
<ms-table-operator-button :tip="$t('commons.delete')" icon="el-icon-delete" @exec="handleDelete(scope.row)" type="danger" v-tester/>
</template>
</el-table-column>
</el-table>
@ -153,6 +163,7 @@
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {API_DEFINITION_CONFIGS} from "@/business/components/common/components/search/search-components";
import MsTipButton from "@/business/components/common/components/MsTipButton";
export default {
name: "ApiList",
@ -171,6 +182,7 @@
MsBottomContainer,
ShowMoreBtn,
MsBatchEdit,
MsTipButton,
MsTableAdvSearchBar
},
data() {

View File

@ -9,7 +9,7 @@
<el-table-column prop="index" :label="$t('api_test.home_page.running_task_list.table_coloum.index')" width="80" show-overflow-tooltip/>
<el-table-column prop="scenario" :label="$t('api_test.home_page.running_task_list.table_coloum.scenario')" width="200" >
<template v-slot:default="{row}">
<el-link type="info" @click="redirect(row.scenarioId)">
<el-link type="info" @click="redirect(row)">
{{ row.scenario }}
</el-link>
</template>
@ -88,7 +88,11 @@ export default {
});
},
redirect(param){
this.$emit('redirectPage','scenario','scenario', 'edit:'+param);
if(param.taskType === 'testPlan'){
this.$emit('redirectPage','testPlanEdit','', param.scenarioId);
}else{
this.$emit('redirectPage','scenario','scenario', 'edit:'+param.scenarioId);
}
}
},

View File

@ -128,10 +128,10 @@
@exec="openReport(scope.row.id, scope.row.reportId)"/>
</template>
</ms-table-operator>
<ms-table-operator-button style="margin-left: 10px;color:#85888E;border-color: #85888E; border-width: thin;" v-if="!scope.row.scheduleId" type="text"
<ms-table-operator-button style="margin-left: 10px;color:#85888E;border-color: #85888E; border-width: thin;" v-if="!scope.row.scheduleOpen" type="text"
:tip="$t('commons.trigger_mode.schedule')" icon="el-icon-time"
@exec="scheduleTask(scope.row)"/>
<ms-table-operator-button style="margin-left: 10px;color:#6C317C; border-color: #6C317C; border-width: thin;" v-if="scope.row.scheduleId" type="text"
<ms-table-operator-button style="margin-left: 10px;color:#6C317C; border-color: #6C317C; border-width: thin;" v-if="scope.row.scheduleOpen" type="text"
:tip="$t('commons.trigger_mode.schedule')" icon="el-icon-time"
@exec="scheduleTask(scope.row)"/>
</template>
@ -145,7 +145,7 @@
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm" :with-tip="enableDeleteTip">
{{$t('test_track.plan.plan_delete_tip')}}
</ms-delete-confirm>
<ms-schedule-maintain ref="scheduleMaintain" />
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="initTableData" />
</el-card>
</template>