模版名称校验
This commit is contained in:
parent
0b0e8f69d8
commit
d031adf090
|
@ -3,6 +3,8 @@ package io.metersphere.track.service;
|
|||
import io.metersphere.base.domain.TestCaseReportTemplate;
|
||||
import io.metersphere.base.domain.TestCaseReportTemplateExample;
|
||||
import io.metersphere.base.mapper.TestCaseReportTemplateMapper;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.track.request.testCaseReport.QueryTemplateRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -43,13 +45,26 @@ public class TestCaseReportTemplateService {
|
|||
|
||||
public void addTestCaseReportTemplate(TestCaseReportTemplate testCaseReportTemplate) {
|
||||
testCaseReportTemplate.setId(UUID.randomUUID().toString());
|
||||
checkCaseReportTemplateExist(testCaseReportTemplate);
|
||||
testCaseReportTemplateMapper.insert(testCaseReportTemplate);
|
||||
}
|
||||
|
||||
public void editTestCaseReportTemplate(TestCaseReportTemplate testCaseReportTemplate) {
|
||||
checkCaseReportTemplateExist(testCaseReportTemplate);
|
||||
testCaseReportTemplateMapper.updateByPrimaryKeyWithBLOBs(testCaseReportTemplate);
|
||||
}
|
||||
|
||||
private void checkCaseReportTemplateExist (TestCaseReportTemplate testCaseReportTemplate) {
|
||||
TestCaseReportTemplateExample example = new TestCaseReportTemplateExample();
|
||||
example.createCriteria()
|
||||
.andNameEqualTo(testCaseReportTemplate.getName())
|
||||
.andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
|
||||
.andIdNotEqualTo(testCaseReportTemplate.getId());
|
||||
if (testCaseReportTemplateMapper.selectByExample(example).size() > 0) {
|
||||
MSException.throwException("同一工作空间下不能存在同名模版");
|
||||
}
|
||||
}
|
||||
|
||||
public int deleteTestCaseReportTemplate(String id) {
|
||||
return testCaseReportTemplateMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
padding: 20px;
|
||||
}
|
||||
|
||||
ms-main-container {
|
||||
.ms-main-container {
|
||||
height: calc(100vh - 40px);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,13 +10,15 @@
|
|||
|
||||
<el-table-column
|
||||
prop="name"
|
||||
fixed
|
||||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="priority"
|
||||
:label="$t('test_track.case.priority')">
|
||||
:label="$t('test_track.case.priority')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority" ref="priority"/>
|
||||
</template>
|
||||
|
@ -33,7 +35,8 @@
|
|||
|
||||
<el-table-column
|
||||
prop="status"
|
||||
:label="$t('test_track.plan_view.execute_result')">
|
||||
:label="$t('test_track.plan_view.execute_result')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<status-table-item :value="scope.row.status"/>
|
||||
</template>
|
||||
|
@ -41,7 +44,8 @@
|
|||
|
||||
<el-table-column
|
||||
prop="planName"
|
||||
:label="$t('test_track.plan.test_plan')">
|
||||
:label="$t('test_track.plan.test_plan')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
|
|
@ -206,9 +206,12 @@
|
|||
});
|
||||
},
|
||||
handleSave() {
|
||||
if (this.template.name == '') {
|
||||
if (this.template.name == null || this.template.name == '') {
|
||||
this.$warning(this.$t('test_track.plan_view.input_template_name'));
|
||||
return;
|
||||
} else if (this.template.name.length > 64) {
|
||||
this.$warning(this.$t('commons.name') + this.$t('test_track.length_less_than') + '64');
|
||||
return;
|
||||
}
|
||||
let param = {};
|
||||
this.buildParam(param);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<div class="name-edit">
|
||||
<el-button plain size="mini" icon="el-icon-back" @click="handleClose">{{$t('test_track.return')}}</el-button>
|
||||
|
||||
<span>{{report.name}}</span>
|
||||
<span class="title">{{report.name}}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12" class="head-right">
|
||||
|
|
|
@ -333,7 +333,7 @@ export default {
|
|||
test_name: "Test"
|
||||
},
|
||||
test_track: {
|
||||
test_track: "Test Track",
|
||||
test_track: "Track",
|
||||
confirm: "Confirm",
|
||||
cancel: "Cancel",
|
||||
project: "Project",
|
||||
|
@ -344,7 +344,7 @@ export default {
|
|||
recent_case: "Recent case",
|
||||
pass_rate: "Pass rate",
|
||||
case: {
|
||||
test_case: "Test case",
|
||||
test_case: "Case",
|
||||
move: "Move case",
|
||||
case_list: "Test case list",
|
||||
create_case: "Create case",
|
||||
|
@ -353,13 +353,13 @@ export default {
|
|||
no_project: "There is no project in this workspace, please create the project first",
|
||||
priority: "Priority",
|
||||
type: "Type",
|
||||
method: "The test way",
|
||||
method: "Method",
|
||||
auto: "Auto",
|
||||
manual: "Manual",
|
||||
create: "Create test case",
|
||||
case_type: "Case Type",
|
||||
name: "Test case name",
|
||||
module: "Subordinate to the module",
|
||||
module: "Module",
|
||||
maintainer: "Maintainer",
|
||||
steps: "Steps",
|
||||
number: "Number",
|
||||
|
@ -393,12 +393,12 @@ export default {
|
|||
}
|
||||
},
|
||||
plan: {
|
||||
test_plan: "Test Plan",
|
||||
test_plan: "Plan",
|
||||
create_plan: "Create test plan",
|
||||
edit_plan: "Edit test plan",
|
||||
plan_name: "Test plan name",
|
||||
plan_project: "Related project",
|
||||
plan_stage: "Testing phase",
|
||||
plan_project: "Project",
|
||||
plan_stage: "Stage",
|
||||
plan_status: "Status",
|
||||
smoke_test: "Smoke test",
|
||||
functional_test: "Functional test",
|
||||
|
@ -434,9 +434,9 @@ export default {
|
|||
},
|
||||
plan_view: {
|
||||
plan: "Plan",
|
||||
relevance_test_case: "Relevance test case",
|
||||
relevance_test_case: "Relevance case",
|
||||
executor: "Executor",
|
||||
execute_result: "Execute result",
|
||||
execute_result: "Result",
|
||||
pass: "Pass",
|
||||
failure: "Failure",
|
||||
blocking: "Blocking",
|
||||
|
@ -447,7 +447,7 @@ export default {
|
|||
all_case: "All case",
|
||||
pre_case: "The last case",
|
||||
next_case: "The next case",
|
||||
change_execution_results: "Change execution results",
|
||||
change_execution_results: "Change results",
|
||||
change_executor: "Change executor",
|
||||
select_executor: "Select executor",
|
||||
select_execute_result: "Select execute result",
|
||||
|
@ -462,7 +462,7 @@ export default {
|
|||
base_info: "Base info",
|
||||
test_result: "Test result",
|
||||
result_distribution: "Result distribution",
|
||||
custom_component: "Custom component",
|
||||
custom_component: "Custom",
|
||||
create_report: "Create report",
|
||||
view_report: "View report",
|
||||
component_library: "Component library",
|
||||
|
|
Loading…
Reference in New Issue