Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
q4speed 2020-04-24 16:03:04 +08:00
commit 874f3c627e
16 changed files with 147 additions and 94 deletions

View File

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

View File

@ -1,5 +1,5 @@
package io.metersphere.commons.constants;
public enum TestPlanTestCaseStatus {
Prepare, Pass, Failure, Blocking, Skip
Prepare, Pass, Failure, Blocking, Skip, Underway
}

View File

@ -98,13 +98,19 @@ public class TestPlanService {
testPlanTestCase.setCreateTime(System.currentTimeMillis());
testPlanTestCase.setUpdateTime(System.currentTimeMillis());
testPlanTestCase.setPlanId(request.getPlanId());
testPlanTestCase.setStatus(TestPlanTestCaseStatus.Prepare.name());
testPlanTestCase.setStatus(TestPlanStatus.Prepare.name());
testPlanTestCase.setResults(testCase.getSteps());
batchMapper.insert(testPlanTestCase);
});
}
sqlSession.flushStatements();
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
if (StringUtils.equals(testPlan.getStatus(), TestPlanStatus.Prepare.name())) {
testPlan.setStatus(TestPlanStatus.Underway.name());
testPlanMapper.updateByPrimaryKey(testPlan);
}
}
public List<TestPlan> recentTestPlans(String currentWorkspaceId) {

View File

@ -4,11 +4,13 @@ import io.metersphere.base.domain.TestPlanTestCase;
import io.metersphere.base.domain.TestPlanTestCaseExample;
import io.metersphere.base.mapper.TestPlanTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.controller.request.testcase.QueryTestCaseRequest;
import io.metersphere.controller.request.testcase.TestCaseBatchRequest;
import io.metersphere.controller.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.dto.TestPlanCaseDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -31,6 +33,9 @@ public class TestPlanTestCaseService {
}
public void editTestCase(TestPlanTestCase testPlanTestCase) {
if (StringUtils.equals(TestPlanTestCaseStatus.Prepare.name(), testPlanTestCase.getStatus())) {
testPlanTestCase.setStatus(TestPlanTestCaseStatus.Underway.name());
}
testPlanTestCase.setUpdateTime(System.currentTimeMillis());
testPlanTestCaseMapper.updateByPrimaryKeySelective(testPlanTestCase);
}

View File

@ -0,0 +1,26 @@
<template>
<el-tag :type="type" :effect="effect" size="mini">{{content}}</el-tag>
</template>
<script>
export default {
name: "MsTag",
props: {
type: {
type: String,
default: 'primary',
},
content: {
type: String
},
effect: {
type: String,
default: 'dark',
}
}
}
</script>
<style scoped>
</style>

View File

@ -98,9 +98,9 @@
import MsTablePagination from '../../../../components/common/pagination/TablePagination';
import NodeBreadcrumb from '../../common/NodeBreadcrumb';
import MsTableHeader from '../../../../components/common/components/MsTableHeader';
import PriorityTableItem from "../../common/TableItems/PriorityTableItem";
import TypeTableItem from "../../common/TableItems/TypeTableItem";
import MethodTableItem from "../../common/TableItems/MethodTableItem";
import PriorityTableItem from "../../common/tableItems/planview/PriorityTableItem";
import TypeTableItem from "../../common/tableItems/planview/TypeTableItem";
import MethodTableItem from "../../common/tableItems/planview/MethodTableItem";
import MsTableOperator from "../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";

View File

@ -1,36 +0,0 @@
<template>
<div>
<el-tag v-if="value == 'P0'"
type="danger"
effect="dark"
size="mini">{{value}}</el-tag>
<el-tag v-if="value == 'P1'"
type="danger"
effect="light"
size="mini">{{value}}</el-tag>
<el-tag v-if="value == 'P2'"
type="warning"
effect="dark"
size="mini">{{value}}</el-tag>
<el-tag v-if="value == 'P3'"
type="warning"
effect="light"
size="mini">{{value}}</el-tag>
</div>
</template>
<script>
export default {
name: "PriorityTableItem",
props: {
value: {
type: String
}
}
}
</script>
<style scoped>
</style>

View File

@ -1,39 +0,0 @@
<template>
<div>
<el-tag v-if="value == 'Prepare'"
type="info"
effect="dark"
size="mini">{{$t('test_track.plan.plan_status_prepare')}}</el-tag>
<el-tag v-if="value == 'Pass'"
type="success"
effect="dark"
size="mini">{{$t('test_track.plan_view.pass')}}</el-tag>
<el-tag v-if="value == 'Failure'"
type="danger"
effect="dark"
size="mini">{{$t('test_track.plan_view.failure')}}</el-tag>
<el-tag v-if="value == 'Blocking'"
type="warning"
effect="dark"
size="mini">{{$t('test_track.plan_view.blocking')}}</el-tag>
<el-tag v-if="value == 'Skip'"
type="info"
effect="dark"
size="mini">{{$t('test_track.plan_view.skip')}}</el-tag>
</div>
</template>
<script>
export default {
name: "StatusTableItem",
props: {
value: {
type: String
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,24 @@
<template>
<div>
<ms-tag v-if="value == 'Prepare'" type="info" :content="$t('test_track.plan.plan_status_prepare')"/>
<ms-tag v-if="value == 'Underway'" type="primary" :content="$t('test_track.plan.plan_status_running')"/>
<ms-tag v-if="value == 'Completed'" type="success" :content="$t('test_track.plan_view.plan_status_completed')"/>
</div>
</template>
<script>
import MsTag from "../../../../common/components/MsTag";
export default {
name: "PlanStatusTableItem",
components: {MsTag},
props: {
value: {
type: String
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,26 @@
<template>
<div>
<ms-tag v-if="value == 'P0'" type="danger" :content="value"/>
<ms-tag v-if="value == 'P1'" effect="light" type="danger" :content="value"/>
<ms-tag v-if="value == 'P2'" type="warning" :content="value"/>
<ms-tag v-if="value == 'P3'" effect="light" type="warning" :content="value"/>
</div>
</template>
<script>
import MsTag from "../../../../common/components/MsTag";
export default {
name: "PriorityTableItem",
components: {MsTag},
props: {
value: {
type: String
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,27 @@
<template>
<div>
<ms-tag v-if="value == 'Prepare'" type="info" :content="$t('test_track.plan.plan_status_prepare')"/>
<ms-tag v-if="value == 'Underway'" type="primary" :content="$t('test_track.plan.plan_status_running')"/>
<ms-tag v-if="value == 'Pass'" type="success" :content="$t('test_track.plan_view.pass')"/>
<ms-tag v-if="value == 'Failure'" type="danger" :content="$t('test_track.plan_view.failure')"/>
<ms-tag v-if="value == 'Blocking'" type="warning" :content="$t('test_track.plan_view.blocking')"/>
<ms-tag v-if="value == 'Skip'" type="info" :content="$t('test_track.plan.plan_view.skip')"/>
</div>
</template>
<script>
import MsTag from "../../../../common/components/MsTag";
export default {
name: "StatusTableItem",
components: {MsTag},
props: {
value: {
type: String
}
}
}
</script>
<style scoped>
</style>

View File

@ -26,9 +26,7 @@
:label="$t('test_track.plan.plan_status')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span v-if="scope.row.status == 'Prepare'">{{$t('test_track.plan.plan_status_prepare')}}</span>
<span v-if="scope.row.status == 'Running'">{{$t('test_track.plan.plan_status_running')}}</span>
<span v-if="scope.row.status == 'Completed'">{{$t('test_track.plan.plan_status_completed')}}</span>
<plan-status-table-item :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column
@ -70,7 +68,6 @@
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-card>
</el-main>
</div>
@ -83,10 +80,13 @@
import MsDialogFooter from "../../../common/components/MsDialogFooter";
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
import MsTableOperator from "../../../common/components/MsTableOperator";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
export default {
name: "TestPlanList",
components: {MsTableOperator, MsTableOperatorButton, MsDialogFooter, MsTableHeader, MsCreateBox, MsTablePagination},
components: {
PlanStatusTableItem,
MsTableOperator, MsTableOperatorButton, MsDialogFooter, MsTableHeader, MsCreateBox, MsTablePagination},
data() {
return {
result: {},

View File

@ -41,7 +41,7 @@
@click="handleNext()"/>
<el-divider direction="vertical"></el-divider>
<el-button type="primary" size="mini" @click="saveCase">{{$t('test_track.save')}}</el-button>
<el-button type="primary" size="mini" @click="saveCase(false)">{{$t('test_track.save')}}</el-button>
</el-col>
</el-row>
@ -193,11 +193,12 @@
},
cancel() {
this.showDialog = false;
this.$emit('refreshTable');
},
statusChange(status) {
this.testCase.status = status;
},
saveCase() {
saveCase(isContinuous) {
let param = {};
param.id = this.testCase.id;
param.status = this.testCase.status;
@ -210,16 +211,22 @@
});
param.results = JSON.stringify(param.results);
this.$post('/test/plan/case/edit', param, () => {
if (isContinuous) {
this.updateTestCases(param);
return;
}
this.$refs.drawer.closeDrawer();
this.$message.success(this.$t('commons.save_success'));
this.$emit('refresh');
});
},
handleNext() {
this.saveCase(true);
this.index++;
this.getTestCase(this.index);
},
handlePre() {
this.saveCase(true);
this.index--;
this.getTestCase(this.index);
},
@ -242,7 +249,13 @@
openTestCaseEdit(testCase) {
this.showDialog = true;
this.initData(testCase);
},
updateTestCases(testCase) {
this.testCases.forEach(item => {
if (testCase.id === item.id) {
Object.assign(item, testCase);
}
});
},
initData(testCase) {
this.result = this.$post('/test/plan/case/list/all', this.searchParam, response => {

View File

@ -100,7 +100,8 @@
<test-plan-test-case-edit
ref="testPlanTestCaseEdit"
:search-param="condition"
@refresh="refresh"/>
@refresh="refresh"
@refreshTable="search"/>
</el-card>
</template>
@ -117,10 +118,10 @@
import {TokenKey} from '../../../../../../common/js/constants';
import {tableFilter} from '../../../../../../common/js/utils';
import PriorityTableItem from "../../../common/TableItems/PriorityTableItem";
import StatusTableItem from "../../../common/TableItems/StatusTableItem";
import TypeTableItem from "../../../common/TableItems/TypeTableItem";
import MethodTableItem from "../../../common/TableItems/MethodTableItem";
import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem";
import StatusTableItem from "../../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem";
import MethodTableItem from "../../../common/tableItems/planview/MethodTableItem";
import MsTableOperator from "../../../../common/components/MsTableOperator";
export default {