feat: 测试报告列表支持修改报告名称

This commit is contained in:
zhangdahai112 2022-02-10 14:57:42 +08:00 committed by zhangdahai112
parent 8e07a9a1d5
commit fdf20abe42
12 changed files with 169 additions and 17 deletions

View File

@ -60,4 +60,8 @@ public class APIScenarioReportController {
apiReportService.deleteAPIReportBatch(request);
}
@PostMapping("/reName")
public void reName(@RequestBody QueryAPIReportRequest reportRequest) {
apiReportService.reName(reportRequest);
}
}

View File

@ -752,4 +752,12 @@ public class ApiScenarioReportService {
}
}
}
public void reName(QueryAPIReportRequest reportRequest) {
ApiScenarioReport apiTestReport = apiScenarioReportMapper.selectByPrimaryKey(reportRequest.getId());
if (apiTestReport != null) {
apiTestReport.setName(reportRequest.getName());
apiScenarioReportMapper.updateByPrimaryKey(apiTestReport);
}
}
}

View File

@ -98,4 +98,9 @@ public class TestPlanReportController {
testPlanReportService.countReportByTestPlanReportId(report.getTestPlanReport().getId(), null, triggerMode);
return "success";
}
@PostMapping("/reName")
public void reName(@RequestBody TestPlanReport request) {
testPlanReportService.reName(request.getId(), request.getName());
}
}

View File

@ -919,4 +919,12 @@ public class TestPlanReportService {
}
}
}
public void reName(String planId, String planName) {
TestPlanReport testPlanReport = testPlanReportMapper.selectByPrimaryKey(planId);
if (testPlanReport != null) {
testPlanReport.setName(planName);
testPlanReportMapper.updateByPrimaryKey(testPlanReport);
}
}
}

View File

@ -31,8 +31,17 @@
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<el-table-column :label="$t('commons.name')" width="200" show-overflow-tooltip prop="name">
</el-table-column>
<ms-table-column
prop="name"
sortable
:label="$t('commons.name')"
:show-overflow-tooltip="false"
:editable="true"
:edit-content="$t('report.rename_report')"
@editColumn="openReNameDialog"
min-width="200px">
</ms-table-column>
<el-table-column prop="scenarioName" :label="$t('api_test.automation.scenario_name')" width="150"
show-overflow-tooltip/>
@ -75,6 +84,8 @@
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-card>
<ms-rename-report-dialog ref="renameDialog" @submit="rename($event)"></ms-rename-report-dialog>
</ms-main-container>
</ms-container>
</template>
@ -83,7 +94,8 @@
import {getCurrentProjectID} from "@/common/js/utils";
import {REPORT_CONFIGS} from "../../../common/components/search/search-components";
import {_filter, _sort} from "@/common/js/tableUtils";
import MsRenameReportDialog from "@/business/components/common/components/report/MsRenameReportDialog";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
export default {
components: {
ReportTriggerModeItem: () => import("../../../common/tableItem/ReportTriggerModeItem"),
@ -93,7 +105,9 @@ export default {
MsContainer: () => import("../../../common/components/MsContainer"),
MsTableHeader: () => import("../../../common/components/MsTableHeader"),
MsTablePagination: () => import("../../../common/pagination/TablePagination"),
ShowMoreBtn: () => import("../../../track/case/components/ShowMoreBtn")
ShowMoreBtn: () => import("../../../track/case/components/ShowMoreBtn"),
MsRenameReportDialog,
MsTableColumn,
},
data() {
return {
@ -271,6 +285,16 @@ export default {
let rowArray = Array.from(rowSets)
let ids = rowArray.map(s => s.id);
return ids;
},
openReNameDialog($event) {
this.$refs.renameDialog.open($event);
},
rename(data) {
this.$post("/api/scenario/report/reName/", data, () => {
this.$success(this.$t("organization.integration.successful_operation"));
this.init();
this.$refs.renameDialog.close();
});
}
},

View File

@ -0,0 +1,47 @@
<template>
<el-dialog
:title="$t('report.rename_report')"
:visible.sync="dialogVisible"
width="40%"
:modal-append-to-body="false"
:before-close="close">
<el-form>
<el-form-item :label="$t('commons.name')">
<el-input v-model="data.name"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="close">{{ $t('commons.cancel') }}</el-button>
<el-button type="primary" @click="submit">{{ $t('commons.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name: "MsRenameReportDialog",
data() {
return {
dialogVisible: false,
data: {}
};
},
methods: {
open(data) {
this.dialogVisible = true;
this.data = JSON.parse(JSON.stringify(data));
},
submit() {
this.$emit('submit', this.data);
},
close() {
this.dialogVisible = false;
}
}
}
</script>
<style scoped>
</style>

View File

@ -12,8 +12,17 @@
:filter-method="filterMethod"
:show-overflow-tooltip="showOverflowTooltip">
<template v-slot:default="scope">
<slot :row="scope.row" :$index="scope.$index">
{{scope.row[prop]}}
<slot :row="scope.row" :$index="scope.$index" v-if="!editable">
<span @click="$emit('click', scope.row)">{{ scope.row[prop] }}</span>
</slot>
<slot :row="scope.row" :$index="scope.$index" v-if="editable">
<span style="cursor: pointer;" @click="$emit('click', scope.row)">{{ scope.row[prop] }}</span>
<el-tooltip :content="editContent ? editContent : $t('commons.edit')"
@click.native.stop="$emit('editColumn', scope.row)">
<a style="cursor: pointer">
<i style="cursor:pointer" class="el-input__icon el-icon-edit pointer"></i>
</a>
</el-tooltip>
</slot>
</template>
</el-table-column>
@ -63,7 +72,15 @@ export default {
default() {
return null;
}
}
},
editable: {
type: Boolean,
default: false
},
editContent: {
type: String,
default: null
},
},
mounted() {
this.active = true;

View File

@ -27,14 +27,18 @@
:label="$t('report.test_name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
<ms-table-column
prop="name"
sortable
:label="$t('commons.name')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span @click="handleView(scope.row)" style="cursor: pointer;">{{ scope.row.name }}</span>
</template>
</el-table-column>
:show-overflow-tooltip="false"
:editable="true"
:edit-content="$t('report.rename_report')"
@editColumn="openReNameDialog"
@click="handleView($event)"
min-width="200px">
</ms-table-column>
<el-table-column
v-if="versionEnable"
:label="$t('project.version.name')"
@ -132,6 +136,8 @@
</el-card>
</ms-main-container>
<same-test-reports ref="compareReports"/>
<ms-rename-report-dialog ref="renameDialog" @submit="rename"></ms-rename-report-dialog>
</ms-container>
</template>
@ -149,6 +155,8 @@ import ShowMoreBtn from "../../track/case/components/ShowMoreBtn";
import {_filter, _sort, getLastTableSortField, saveLastTableSortField} from "@/common/js/tableUtils";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import SameTestReports from "@/business/components/performance/report/components/SameTestReports";
import MsRenameReportDialog from "@/business/components/common/components/report/MsRenameReportDialog";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
export default {
name: "PerformanceTestReportList",
@ -163,6 +171,8 @@ export default {
MsContainer,
MsMainContainer,
ShowMoreBtn,
MsRenameReportDialog,
MsTableColumn,
},
created: function () {
this.testId = this.$route.path.split('/')[3];
@ -421,6 +431,16 @@ export default {
});
}
},
openReNameDialog($event) {
this.$refs.renameDialog.open($event);
},
rename(data) {
this.$post("/performance/report/rename", data, () => {
this.$success(this.$t("organization.integration.successful_operation"));
this.initTableData();
this.$refs.renameDialog.close();
});
}
}
};
</script>

View File

@ -31,6 +31,10 @@
:fields-width="fieldsWidth"
sortable
:label="$t('test_track.report.list.name')"
:show-overflow-tooltip="false"
:editable="true"
:edit-content="$t('report.rename_report')"
@editColumn="openReNameDialog"
min-width="200px">
</ms-table-column>
@ -114,6 +118,7 @@
:total="total"/>
<test-plan-report-view @refresh="initTableData" ref="testPlanReportView"/>
<test-plan-db-report ref="dbReport"/>
<ms-rename-report-dialog ref="renameDialog" @submit="rename"></ms-rename-report-dialog>
</el-card>
</template>
@ -147,7 +152,7 @@ import {getCurrentProjectID} from "@/common/js/utils";
import TestPlanDbReport from "@/business/components/track/report/components/TestPlanDbReport";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
import MsRenameReportDialog from "@/business/components/common/components/report/MsRenameReportDialog";
export default {
name: "TestPlanReportList",
components: {
@ -159,6 +164,7 @@ export default {
ShowMoreBtn, MsTableSelectAll,
MsTableColumn,
MsTable,
MsRenameReportDialog
},
data() {
return {
@ -355,6 +361,16 @@ export default {
saveSortField(key, orders) {
saveLastTableSortField(key, JSON.stringify(orders));
},
openReNameDialog($event) {
this.$refs.renameDialog.open($event);
},
rename(data) {
this.$post("/test/plan/report/reName/", data, () => {
this.$success(this.$t("organization.integration.successful_operation"));
this.initTableData();
this.$refs.renameDialog.close();
});
}
}
};
</script>

View File

@ -939,7 +939,8 @@ export default {
file_id: 'Report File ID',
avg_response_time: 'Average Response Time',
tps: 'Transactions Per Second',
plan_share_url: 'Whether the link jump is logged in'
plan_share_url: 'Whether the link jump is logged in',
rename_report: 'Rename report'
},
load_test: {
id: 'Load Test ID',

View File

@ -943,7 +943,8 @@ export default {
file_id: '文件ID',
avg_response_time: '平均响应时间',
tps: '每秒传输的事物处理个数',
plan_share_url: '链接跳转是否登陆'
plan_share_url: '链接跳转是否登陆',
rename_report: '重命名报告'
},
load_test: {
id: '测试ID',

View File

@ -943,7 +943,8 @@ export default {
file_id: '文件ID',
avg_response_time: '平均響應時間',
tps: '每秒傳輸的事物處理個數',
plan_share_url: '鏈接跳轉是否登陸'
plan_share_url: '鏈接跳轉是否登陸',
rename_report: '重命名報告'
},
load_test: {
id: '測試ID',