修改 url 和组件

This commit is contained in:
Captain.B 2020-04-09 16:04:15 +08:00
parent 6485f7f533
commit 37f41a85fb
10 changed files with 60 additions and 170 deletions

View File

@ -23,8 +23,8 @@ import javax.annotation.Resource;
import java.util.List; import java.util.List;
@RestController @RestController
@RequestMapping(value = "report") @RequestMapping(value = "performance/report")
public class ReportController { public class PerformanceReportController {
@Resource @Resource
private ReportService reportService; private ReportService reportService;

View File

@ -3,8 +3,7 @@
<div id="menu-bar" v-if="isRouterAlive"> <div id="menu-bar" v-if="isRouterAlive">
<el-row type="flex"> <el-row type="flex">
<el-col :span="8"> <el-col :span="8">
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router <el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'>
:default-active='$route.path'>
<el-menu-item :index="'/performance/home'"> <el-menu-item :index="'/performance/home'">
{{ $t("i18n.home") }} {{ $t("i18n.home") }}
</el-menu-item> </el-menu-item>
@ -12,29 +11,19 @@
<el-submenu v-if="isCurrentWorkspaceUser" <el-submenu v-if="isCurrentWorkspaceUser"
index="3" popper-class="submenu" v-permission="['test_manager']"> index="3" popper-class="submenu" v-permission="['test_manager']">
<template v-slot:title>{{$t('commons.project')}}</template> <template v-slot:title>{{$t('commons.project')}}</template>
<performance-recent-project/> <ms-recent-list :options="projectRecent"/>
<el-divider/> <el-divider/>
<el-menu-item :index="'/performance/project/all'"> <ms-show-all :index="'/performance/project/all'"/>
<font-awesome-icon :icon="['fa', 'list-ul']"/> <ms-create-button :index="'/performance/project/create'" :title="$t('project.create')"/>
<span style="padding-left: 5px;">{{$t('commons.show_all')}}</span>
</el-menu-item>
<el-menu-item :index="'/performance/project/create'">
<el-button type="text">{{$t('project.create')}}</el-button>
</el-menu-item>
</el-submenu> </el-submenu>
<el-submenu v-if="isCurrentWorkspaceUser" <el-submenu v-if="isCurrentWorkspaceUser"
index="4" popper-class="submenu" v-permission="['test_manager', 'test_user']"> index="4" popper-class="submenu" v-permission="['test_manager', 'test_user']">
<template v-slot:title>{{$t('commons.test')}}</template> <template v-slot:title>{{$t('commons.test')}}</template>
<performance-recent-test-plan/> <ms-recent-list :options="testRecent"/>
<el-divider/> <el-divider/>
<el-menu-item :index="'/performance/test/all'"> <ms-show-all :index="'/performance/test/all'"/>
<font-awesome-icon :icon="['fa', 'list-ul']"/> <ms-create-button :index="'/performance/test/create'" :title="$t('load_test.create')"/>
<span style="padding-left: 5px;">{{$t('commons.show_all')}}</span>
</el-menu-item>
<el-menu-item :index="'/performance/test/create'">
<el-button type="text">{{$t('load_test.create')}}</el-button>
</el-menu-item>
<el-menu-item :index="testCaseProjectPath" class="blank_item"></el-menu-item> <el-menu-item :index="testCaseProjectPath" class="blank_item"></el-menu-item>
<el-menu-item :index="testEditPath" class="blank_item"></el-menu-item> <el-menu-item :index="testEditPath" class="blank_item"></el-menu-item>
</el-submenu> </el-submenu>
@ -42,13 +31,9 @@
<el-submenu v-if="isCurrentWorkspaceUser" <el-submenu v-if="isCurrentWorkspaceUser"
index="5" popper-class="submenu" v-permission="['test_manager', 'test_user', 'test_viewer']"> index="5" popper-class="submenu" v-permission="['test_manager', 'test_user', 'test_viewer']">
<template v-slot:title>{{$t('commons.report')}}</template> <template v-slot:title>{{$t('commons.report')}}</template>
<performance-recent-report/> <ms-recent-list :options="reportRecent"/>
<el-divider/> <el-divider/>
<el-menu-item :index="'/performance/report/all'"> <ms-show-all :index="'/performance/report/all'"/>
<font-awesome-icon :icon="['fa', 'list-ul']"/>
<span style="padding-left: 5px;">{{$t('commons.show_all')}}</span>
</el-menu-item>
<el-menu-item :index="reportViewPath" class="blank_item"></el-menu-item>
</el-submenu> </el-submenu>
</el-menu> </el-menu>
</el-col> </el-col>
@ -65,22 +50,55 @@
<script> <script>
import PerformanceRecentTestPlan from "../../performance/test/PerformanceRecentTestPlan";
import PerformanceRecentProject from "../../performance/project/PerformanceRecentProject";
import PerformanceRecentReport from "../../performance/report/PerformanceRecentReport";
import {checkoutCurrentWorkspace} from "../../../../common/js/utils"; import {checkoutCurrentWorkspace} from "../../../../common/js/utils";
import MsCreateTest from "../../common/head/CreateTest"; import MsCreateTest from "../../common/head/CreateTest";
import MsRecentList from "../../common/head/RecentList";
import MsCreateButton from "../../common/head/CreateButton";
import MsShowAll from "../../common/head/ShowAll";
export default { export default {
name: "PerformanceHeaderMenus", name: "PerformanceHeaderMenus",
components: {PerformanceRecentReport, PerformanceRecentTestPlan, PerformanceRecentProject, MsCreateTest}, components: {
MsCreateButton,
MsShowAll,
MsRecentList,
MsCreateTest
},
data() { data() {
return { return {
isCurrentWorkspaceUser: false, isCurrentWorkspaceUser: false,
testCaseProjectPath: '', testCaseProjectPath: '',
testEditPath: '', testEditPath: '',
reportViewPath: '', reportViewPath: '',
isRouterAlive: true isRouterAlive: true,
projectRecent: {
title: this.$t('project.recent'),
url: "/project/recent/5",
index(item) {
return '/performance/test/' + item.id;
},
router(item) {
return {name: 'perPlan', params: {projectId: item.id, projectName: item.name}}
}
},
testRecent: {
title: this.$t('load_test.recent'),
url: "/performance/recent/5",
index(item) {
return '/performance/test/edit/' + item.id;
},
router(item) {
}
},
reportRecent: {
title: this.$t('report.recent'),
url: "/performance/report/recent/5",
index(item) {
return '/performance/report/view/' + item.id;
},
router(item) {
}
}
} }
}, },
mounted() { mounted() {

View File

@ -1,44 +0,0 @@
<template>
<el-menu router menu-trigger="click" :default-active="$route.path">
<div class="recent-text">
<i class="el-icon-time"/>
{{$t('project.recent')}}
</div>
<el-menu-item :key="p.id" v-for="p in recentProjects"
:index="'/performance/test/' + p.id" :route="{name:'perPlan', params:{projectId:p.id, projectName:p.name}}">
{{ p.name }}
</el-menu-item>
</el-menu>
</template>
<script>
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../common/js/constants";
import {hasRoles} from "../../../../common/js/utils";
export default {
name: "PerformanceRecentProject",
mounted() {
if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.$get('/project/recent/5', (response) => {
this.recentProjects = response.data;
});
}
},
methods: {},
data() {
return {
recentProjects: [],
}
}
}
</script>
<style scoped>
.recent-text {
padding-left: 10%;
color: #777777;
}
</style>

View File

@ -1,42 +0,0 @@
<template>
<el-menu router menu-trigger="click" :default-active="$route.path">
<div class="recent-text">
<i class="el-icon-time"/>
{{$t('load_test.recent')}}
</div>
<el-menu-item :key="p.id" v-for="p in recentReports"
:index="'/performance/report/view/' + p.id" :route="{path: '/performance/report/view/' + p.id}">
{{ p.name }}
</el-menu-item>
</el-menu>
</template>
<script>
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../common/js/constants";
import {hasRoles} from "../../../../common/js/utils";
export default {
name: "PerformanceRecentReport",
mounted() {
if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.$get('/report/recent/5', (response) => {
this.recentReports = response.data;
});
}
},
methods: {},
data() {
return {
recentReports: [],
}
}
}
</script>
<style scoped>
.recent-text {
padding-left: 10%;
color: #777777;
}
</style>

View File

@ -81,7 +81,7 @@
methods: { methods: {
initBreadcrumb() { initBreadcrumb() {
if(this.reportId){ if(this.reportId){
this.result = this.$get("report/test/pro/info/" + this.reportId, res => { this.result = this.$get("/performance/report/test/pro/info/" + this.reportId, res => {
let data = res.data; let data = res.data;
if(data){ if(data){
this.reportName = data.name; this.reportName = data.name;
@ -94,7 +94,7 @@
}, },
mounted() { mounted() {
this.reportId = this.$route.path.split('/')[4]; this.reportId = this.$route.path.split('/')[4];
this.$get("report/" + this.reportId, res => { this.$get("/performance/report/" + this.reportId, res => {
let data = res.data; let data = res.data;
this.status = data.status; this.status = data.status;
if (data.status === "Error") { if (data.status === "Error") {
@ -115,7 +115,7 @@
'$route'(to) { '$route'(to) {
let reportId = to.path.split('/')[4]; let reportId = to.path.split('/')[4];
if(reportId){ if(reportId){
this.$get("report/test/pro/info/" + reportId, response => { this.$get("/performance/report/test/pro/info/" + reportId, response => {
let data = response.data; let data = response.data;
if(data){ if(data){
this.reportName = data.name; this.reportName = data.name;

View File

@ -107,8 +107,8 @@
data() { data() {
return { return {
result: {}, result: {},
queryPath: "/report/list/all", queryPath: "/performance/report/list/all",
deletePath: "/report/delete/", deletePath: "/performance/report/delete/",
condition: "", condition: "",
projectId: null, projectId: null,
tableData: [], tableData: [],

View File

@ -149,10 +149,10 @@
}, },
methods: { methods: {
initTableData() { initTableData() {
this.$get("/report/content/errors/" + this.id, res => { this.$get("/performance/report/content/errors/" + this.id, res => {
this.tableData = res.data; this.tableData = res.data;
}) })
this.$get("/report/content/errors_top5/" + this.id, res => { this.$get("/performance/report/content/errors_top5/" + this.id, res => {
this.errorTotal = res.data this.errorTotal = res.data
this.errorTop5 = res.data.errorsTop5List; this.errorTop5 = res.data.errorsTop5List;
}) })

View File

@ -97,7 +97,7 @@
}, },
methods: { methods: {
initTableData() { initTableData() {
this.$get("/report/content/" + this.id, res => { this.$get("/performance/report/content/" + this.id, res => {
this.tableData = res.data.requestStatisticsList; this.tableData = res.data.requestStatisticsList;
this.totalInfo = res.data; this.totalInfo = res.data;
}) })

View File

@ -85,7 +85,7 @@
}, },
methods: { methods: {
initTableData() { initTableData() {
this.$get("/report/content/testoverview/" + this.id, res => { this.$get("/performance/report/content/testoverview/" + this.id, res => {
let data = res.data; let data = res.data;
this.maxUsers = data.maxUsers; this.maxUsers = data.maxUsers;
this.avgThroughput = data.avgThroughput; this.avgThroughput = data.avgThroughput;
@ -94,7 +94,7 @@
this.responseTime90 = data.responseTime90; this.responseTime90 = data.responseTime90;
this.avgBandwidth = data.avgBandwidth; this.avgBandwidth = data.avgBandwidth;
}) })
this.$get("/report/content/load_chart/" + this.id, res => { this.$get("/performance/report/content/load_chart/" + this.id, res => {
let data = res.data; let data = res.data;
let loadOption = { let loadOption = {
title: { title: {
@ -127,7 +127,7 @@
} }
this.loadOption = this.generateOption(loadOption, data); this.loadOption = this.generateOption(loadOption, data);
}) })
this.$get("/report/content/res_chart/" + this.id, res => { this.$get("/performance/report/content/res_chart/" + this.id, res => {
let data = res.data; let data = res.data;
let resOption = { let resOption = {
title: { title: {

View File

@ -1,42 +0,0 @@
<template>
<el-menu router menu-trigger="click" :default-active="$route.path">
<div class="recent-text">
<i class="el-icon-time"/>
{{$t('load_test.recent')}}
</div>
<el-menu-item :key="t.id" v-for="t in recentTestPlans" :index="'/performance/test/edit/' + t.id">
{{ t.name }}
</el-menu-item>
</el-menu>
</template>
<script>
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../common/js/constants";
export default {
name: "PerformanceRecentTestPlan",
mounted() {
const rolesString = localStorage.getItem("roles");
const roles = rolesString.split(',');
if (roles.indexOf(ROLE_TEST_MANAGER) > -1 || roles.indexOf(ROLE_TEST_USER) > -1 || roles.indexOf(ROLE_TEST_VIEWER) > -1) {
this.$get('/performance/recent/5', (response) => {
this.recentTestPlans = response.data;
});
}
},
data() {
return {
recentTestPlans: []
}
}
}
</script>
<style scoped>
.recent-text {
padding-left: 10%;
color: #777777;
}
</style>