feat(测试跟踪): 已归档的测试计划不可执行

--user=郭雨琦
--bug=1007448
https://www.tapd.cn/55049933/prong/stories/view/1155049933001007448?url_cache_key=from_url_story_list_2a3025da4c2d5d63c2ec0ca99fdfe730&action_entry_type=stories
This commit is contained in:
guoyuqi 2022-05-07 20:02:21 +08:00 committed by f2c-ci-robot[bot]
parent e86dd0d4b8
commit 951574d2ae
16 changed files with 125 additions and 69 deletions

View File

@ -1,5 +1,5 @@
package io.metersphere.commons.constants;
public enum TestPlanStatus {
Prepare, Underway, Completed, Finished
Prepare, Underway, Completed, Finished,Archived
}

View File

@ -470,6 +470,10 @@ public class TestPlanService {
statusList.addAll(testPlanScenarioCaseService.getExecResultByPlanId(testPlanId));
statusList.addAll(testPlanLoadCaseService.getStatus(testPlanId));
TestPlanWithBLOBs testPlanWithBLOBs = testPlanMapper.selectByPrimaryKey(testPlanId);
//如果测试计划是已归档状态不处理
if(testPlanWithBLOBs.getStatus().equals(TestPlanStatus.Archived.name())){
return;
}
testPlanWithBLOBs.setId(testPlanId);
if (statusList.size() == 0) { // 原先status不是prepare, 但删除所有关联用例的情况
testPlanWithBLOBs.setStatus(TestPlanStatus.Prepare.name());

View File

@ -521,16 +521,6 @@ export default {
</script>
<style scoped>
.el-table__header-wrapper,.el-table__body-wrapper,.el-table__footer-wrapper{overflow:visible;}
.el-table__body-wrapper{
overflow-x:visible !important;
}
/* 这个是为了解决前面样式覆盖之后伪类带出来的竖线 */
.el-table::after{
position: relative;
}
.batch-popper {
top: 300px;
color: #1FDD02;

View File

@ -265,9 +265,12 @@
</ms-table-column>
</span>
<template v-slot:opt-before="scope">
<ms-table-operator-button :tip="$t('api_test.run')" icon="el-icon-video-play" class="run-button"
<ms-table-operator-button :tip="$t('api_test.run')" icon="el-icon-video-play" :class="[scope.row.status==='Archived'?'disable-run':'run-button']" :disabled="scope.row.status === 'Archived'"
@exec="handleRun(scope.row)" v-permission="['PROJECT_TRACK_PLAN:READ+RUN']"
style="margin-right: 10px;"/>
/>
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit"
@exec="handleEdit(scope.row)" v-permission="['PROJECT_TRACK_PLAN:READ+EDIT']" :disabled="scope.row.status === 'Archived'"
style="margin-right: 10px"/>
</template>
<template v-slot:opt-behind="scope">
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" v-if="!scope.row.showFollow">
@ -286,10 +289,10 @@
<el-icon class="el-icon-more"></el-icon>
</el-link>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="delete" v-permission="['PROJECT_TRACK_PLAN:READ+DELETE']">
<el-dropdown-item command="delete" v-permission="['PROJECT_TRACK_PLAN:READ+DELETE']" :disabled="scope.row.status === 'Archived'" >
{{ $t('commons.delete') }}
</el-dropdown-item>
<el-dropdown-item command="schedule_task" v-permission="['PROJECT_TRACK_PLAN:READ+SCHEDULE']">
<el-dropdown-item command="schedule_task" v-permission="['PROJECT_TRACK_PLAN:READ+SCHEDULE']" :disabled="scope.row.status === 'Archived'" >
{{ $t('commons.trigger_mode.schedule') }}
</el-dropdown-item>
</el-dropdown-menu>
@ -442,12 +445,6 @@ export default {
}
],
simpleOperators: [
{
tip: this.$t('commons.edit'),
icon: "el-icon-edit",
exec: this.handleEdit,
permissions: ['PROJECT_TRACK_PLAN:READ+EDIT']
},
{
tip: this.$t('commons.copy'),
icon: "el-icon-copy-document",

View File

@ -21,12 +21,12 @@
</ms-test-plan-header-bar>
<test-plan-functional v-if="activeIndex === 'functional'" :redirectCharType="redirectCharType"
:clickType="clickType" :plan-id="planId" :version-enable="versionEnable"
:clickType="clickType" :plan-id="planId" :version-enable="versionEnable" :plan-status="currentPlan.status"
ref="testPlanFunctional"/>
<test-plan-api v-if="activeIndex === 'api'" :redirectCharType="redirectCharType" :clickType="clickType"
:plan-id="planId" :version-enable="versionEnable"/>
:plan-id="planId" :version-enable="versionEnable" :plan-status="currentPlan.status"/>
<test-plan-load v-if="activeIndex === 'load'" :redirectCharType="redirectCharType" :clickType="clickType"
:plan-id="planId" :version-enable="versionEnable"/>
:plan-id="planId" :version-enable="versionEnable" :plan-status="currentPlan.status"/>
<test-plan-report-content class="plan-report" v-if="activeIndex === 'report'" :plan-id="planId" :version-enable="versionEnable"/>
<is-change-confirm

View File

@ -9,6 +9,7 @@
@refreshTable="refreshTable"
@setModuleOptions="setModuleOptions"
:plan-id="planId"
:plan-status="planStatus"
:is-read-only="true"
:redirectCharType="redirectCharType"
ref="apiNodeTree">
@ -27,6 +28,7 @@
@setModuleOptions="setModuleOptions"
:is-read-only="true"
:plan-id="planId"
:plan-status="planStatus"
ref="scenarioNodeTree">
<template v-slot:header>
<div class="model-change-radio">
@ -50,6 +52,7 @@
:version-enable="versionEnable"
:model="'plan'"
:plan-id="planId"
:plan-status="planStatus"
:clickType="clickType"
@refresh="refreshTree"
@relevanceCase="openTestCaseRelevanceDialog"
@ -61,6 +64,7 @@
:trash-enable="trashEnable"
:version-enable="versionEnable"
:plan-id="planId"
:plan-status="planStatus"
:clickType="clickType"
@refresh="refreshTree"
@relevanceCase="openTestCaseRelevanceDialog"
@ -128,6 +132,7 @@
'redirectCharType',
'clickType',
'versionEnable',
'planStatus'
],
mounted() {
this.checkRedirectCharType();

View File

@ -6,6 +6,7 @@
:project-id="getProjectId()"
:condition="condition"
:plan-id="planId"
:plan-status="planStatus"
@refresh="initTable"
@relevanceCase="$emit('relevanceCase')"
@setEnvironment="setEnvironment"
@ -194,7 +195,7 @@ import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
import {TEST_PLAN_API_CASE} from "@/common/js/constants";
import {
buildBatchParam,
checkTableRowIsSelect, deepClone, getCustomTableHeader, getCustomTableWidth,
deepClone, getCustomTableHeader, getCustomTableWidth,
} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
@ -250,20 +251,22 @@ export default {
{
tip: this.$t('api_test.run'), icon: "el-icon-video-play",
exec: this.singleRun,
class: 'run-button',
class: this.planStatus==='Archived'?'disable-run':'run-button',
isDisable: this.planStatus==='Archived',
permissions: ['PROJECT_TRACK_PLAN:READ+RUN']
},
{
tip: this.$t('test_track.plan_view.cancel_relevance'), icon: "el-icon-unlock",
exec: this.handleDelete,
type: 'danger',
isDisable: this.planStatus==='Archived',
permissions: ['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']
}
],
buttons: [
{name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch, permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']},
{name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute, permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN']},
{name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit, permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT']}
{name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch, isDisable: this.planStatus==='Archived', permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']},
{name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute, isDisable: this.planStatus==='Archived', permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN']},
{name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit, isDisable: this.planStatus==='Archived', permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT']}
],
typeArr: [
{id: 'projectEnv', name: this.$t('api_test.definition.request.run_env')},
@ -325,6 +328,7 @@ export default {
}
},
planId: String,
planStatus: String,
reviewId: String,
clickType: String,
versionEnable: Boolean,

View File

@ -5,6 +5,7 @@
<test-plan-scenario-list-header
:condition="condition"
:projectId="projectId"
:plan-status="planStatus"
@refresh="search"
@relevanceCase="$emit('relevanceCase', 'scenario')"/>
</template>
@ -251,6 +252,7 @@ export default {
selectNodeIds: Array,
reviewId: String,
planId: String,
planStatus: String,
clickType: String,
versionEnable: Boolean,
},
@ -282,25 +284,27 @@ export default {
{
tip: this.$t('api_test.run'), icon: "el-icon-video-play",
exec: this.execute,
class: 'run-button',
class: this.planStatus==='Archived'?'disable-run':'run-button',
isDisable: this.planStatus==='Archived',
permissions: ['PROJECT_TRACK_PLAN:READ+RUN']
},
{
tip: this.$t('test_track.plan_view.cancel_relevance'), icon: "el-icon-unlock",
exec: this.remove,
type: 'danger',
isDisable: this.planStatus==='Archived',
permissions: ['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']
}
],
buttons: [
{
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch, permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch, isDisable: this.planStatus==='Archived', permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']
},
{
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute, permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN']
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute, isDisable: this.planStatus==='Archived', permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN']
},
{
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit, permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT']
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit, isDisable: this.planStatus==='Archived', permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT']
}
],
typeArr: [

View File

@ -9,7 +9,7 @@
</template>
<template v-slot:button>
<ms-table-button v-permission="['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']" icon="el-icon-connection"
:content="$t('test_track.plan_view.relevance_test_case')"
:content="$t('test_track.plan_view.relevance_test_case')" :disabled="planStatus==='Archived'"
@click="$emit('relevanceCase')"/>
</template>
@ -23,7 +23,7 @@ import MsEnvironmentSelect from "../../../../../api/definition/components/case/M
export default {
name: "TestPlanCaseListHeader",
components: {MsEnvironmentSelect, MsTableButton, MsTableHeader},
props: ['condition', 'projectId', 'isReadOnly', 'planId'],
props: ['condition', 'projectId', 'isReadOnly', 'planId', 'planStatus'],
methods: {
setEnvironment(data) {
if (this.planId) {

View File

@ -9,7 +9,7 @@
</template>
<template v-slot:button>
<ms-table-button v-permission="['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']" icon="el-icon-connection"
:content="$t('test_track.plan_view.relevance_test_case')"
:content="$t('test_track.plan_view.relevance_test_case')" :disabled="planStatus==='Archived'"
@click="$emit('relevanceCase')"/>
</template>
@ -26,7 +26,7 @@ export default {
components: {
MsEnvironmentSelect, MsTableButton, MsTableHeader
},
props: ['condition', 'isReadOnly', 'projectId'],
props: ['condition', 'isReadOnly', 'projectId', 'planStatus'],
methods: {}
};
</script>

View File

@ -13,7 +13,7 @@
:content="$t('test_track.plan_view.my_case')" @click="searchMyTestCase"/>
<ms-table-button v-permission="['PROJECT_TRACK_CASE:READ']" v-if="showMyTestCase" icon="el-icon-files"
:content="$t('test_track.plan_view.all_case')" @click="searchMyTestCase"/>
<ms-table-button v-permission="['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']" icon="el-icon-connection"
<ms-table-button v-permission="['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']" icon="el-icon-connection" :disabled="planStatus==='Archived'"
:content="$t('test_track.plan_view.relevance_test_case')"
@click="$emit('openTestCaseRelevanceDialog')"/>
</template>
@ -25,8 +25,8 @@
:data="tableData"
:condition="condition"
:total="total"
:page-size.sync="pageSize"
:operators="operators"
:page-size.sync="pageSize"
:screen-height="screenHeight"
:batch-operators="buttons"
:fields.sync="fields"
@ -359,28 +359,6 @@ export default {
executorFilters: [],
maintainerFilters: [],
showMore: false,
buttons: [
{
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit,
permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT']
},
{
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch,
permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']
}
],
operators: [
{
tip: this.$t('commons.edit'), icon: "el-icon-edit",
exec: this.handleEdit,
permissions: ['PROJECT_TRACK_PLAN:READ+RUN']
},
{
tip: this.$t('test_track.plan_view.cancel_relevance'), icon: "el-icon-unlock", type: "danger",
exec: this.handleDelete,
permissions: ['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']
}
],
typeArr: [
{id: 'status', name: this.$t('test_track.plan_view.execute_result')},
{id: 'executor', name: this.$t('test_track.plan_view.executor')},
@ -411,6 +389,9 @@ export default {
type: Boolean,
default: false
},
planStatus: {
type: String
},
},
computed: {
editTestPlanTestCaseOrder() {
@ -419,6 +400,65 @@ export default {
systemFiledMap() {
return SYSTEM_FIELD_NAME_MAP;
},
operators(){
if (this.planStatus==='Archived') {
return [
{
tip: this.$t('commons.edit'), icon: "el-icon-edit",
exec: this.handleEdit,
isDisable: true,
permissions: ['PROJECT_TRACK_PLAN:READ+RUN']
},
{
tip: this.$t('test_track.plan_view.cancel_relevance'), icon: "el-icon-unlock", type: "danger",
exec: this.handleDelete,
isDisable: true,
permissions: ['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']
}
]
} else {
return [
{
tip: this.$t('commons.edit'), icon: "el-icon-edit",
exec: this.handleEdit,
permissions: ['PROJECT_TRACK_PLAN:READ+RUN']
},
{
tip: this.$t('test_track.plan_view.cancel_relevance'), icon: "el-icon-unlock", type: "danger",
exec: this.handleDelete,
permissions: ['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']
}
]
}
},
buttons(){
if (this.planStatus==='Archived') {
return [
{
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit,
isDisable: true,
permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT']
},
{
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch,
isDisable: true,
permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']
}
]
} else {
return [
{
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit,
permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT']
},
{
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch,
permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']
}
]
}
} ,
},
watch: {
planId() {

View File

@ -25,6 +25,7 @@
@refresh="refresh"
@setCondition="setCondition"
:plan-id="planId"
:plan-status="planStatus "
:clickType="clickType"
:select-node-ids="selectNodeIds"
:version-enable="versionEnable"
@ -96,6 +97,7 @@ export default {
'redirectCharType',
'clickType',
'versionEnable',
'planStatus'
],
mounted() {
this.initData();

View File

@ -12,6 +12,7 @@
class="table-list"
@refresh="refresh"
:plan-id="planId"
:plan-status="planStatus"
:clickType="clickType"
:select-project-id="selectProjectId"
:select-parent-nodes="selectParentNodes"
@ -58,6 +59,7 @@ export default {
'redirectCharType',
'clickType',
'versionEnable',
'planStatus'
],
watch: {
planId() {

View File

@ -5,6 +5,7 @@
<test-plan-load-case-list-header
:condition="condition"
:plan-id="planId"
:plan-status="planStatus"
:isShowVersion="false"
@refresh="initTable"
@relevanceCase="$emit('relevanceCase')"/>
@ -187,8 +188,8 @@ export default {
{
tip: this.$t('api_test.run'), icon: "el-icon-video-play",
exec: this.run,
class: 'run-button',
isDisable: this.isReadOnly,
class: (this.planStatus==='Archived' || this.isReadOnly )?'disable-run':'run-button',
isDisable: this.isReadOnly || this.planStatus==='Archived',
permissions: ['PROJECT_TRACK_PLAN:READ+RUN']
},
{
@ -196,22 +197,22 @@ export default {
icon: "el-icon-setting",
exec: this.changeLoadConfig,
type: 'success',
isDisable: this.isReadOnly,
isDisable: this.isReadOnly || this.planStatus==='Archived',
},
{
tip: this.$t('test_track.plan_view.cancel_relevance'), icon: "el-icon-unlock",
exec: this.handleDelete,
type: 'danger',
isDisable: this.isReadOnly,
isDisable: this.isReadOnly || this.planStatus==='Archived',
permissions: ['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']
},
],
buttons: [
{
name: this.$t('test_track.plan.load_case.unlink_in_bulk'), handleClick: this.handleDeleteBatch, permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']
name: this.$t('test_track.plan.load_case.unlink_in_bulk'), handleClick: this.handleDeleteBatch, isDisable: this.planStatus==='Archived', permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']
},
{
name: this.$t('test_track.plan.load_case.batch_exec_cases'), handleClick: this.handleRunBatch, permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN']
name: this.$t('test_track.plan.load_case.batch_exec_cases'), handleClick: this.handleRunBatch, isDisable: this.planStatus==='Archived', permissions: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN']
}
],
statusFilters: [
@ -235,6 +236,7 @@ export default {
default: false
},
planId: String,
planStatus: String,
reviewId: String,
clickType: String,
versionEnable: Boolean,

View File

@ -11,7 +11,7 @@
</template>
<template v-slot:button>
<ms-table-button v-permission="['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']" icon="el-icon-connection"
:content="$t('test_track.plan_view.relevance_test_case')"
:content="$t('test_track.plan_view.relevance_test_case')" :disabled="planStatus==='Archived'"
@click="$emit('relevanceCase')"/>
</template>
@ -29,7 +29,7 @@ export default {
components: {
MsTableButton, MsTableHeader, 'VersionSelect': VersionSelect.default,
},
props: ['condition', 'isShowVersion'],
props: ['condition', 'isShowVersion', 'planStatus'],
methods: {
changeVersion(currentVersion) {
this.$emit("changeVersion", currentVersion)

View File

@ -297,6 +297,12 @@ textarea {
color: white;
}
.disable-run .el-button {
background-color: #409eff91;
border-color: #409eff00;
color: white;
}
.ms-full-loading .el-loading-spinner {
font-size: 16px;
}