This commit is contained in:
chenjianxing 2020-04-09 17:57:49 +08:00
commit 7ba029b96d
53 changed files with 317 additions and 597 deletions

View File

@ -10,6 +10,7 @@ import io.metersphere.controller.request.ReportRequest;
import io.metersphere.dto.ReportDTO;
import io.metersphere.report.base.ChartsData;
import io.metersphere.report.base.Errors;
import io.metersphere.report.base.ReportTimeInfo;
import io.metersphere.report.base.TestOverview;
import io.metersphere.report.dto.ErrorsTop5DTO;
import io.metersphere.report.dto.RequestStatisticsDTO;
@ -23,8 +24,8 @@ import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping(value = "report")
public class ReportController {
@RequestMapping(value = "performance/report")
public class PerformanceReportController {
@Resource
private ReportService reportService;
@ -77,6 +78,11 @@ public class ReportController {
return reportService.getTestOverview(reportId);
}
@GetMapping("/content/report_time/{reportId}")
public ReportTimeInfo getReportTimeInfo(@PathVariable String reportId) {
return reportService.getReportTimeInfo(reportId);
}
@GetMapping("/content/load_chart/{reportId}")
public List<ChartsData> getLoadChartData(@PathVariable String reportId) {
return reportService.getLoadChartData(reportId);

View File

@ -406,6 +406,28 @@ public class JtlResolver {
return chartsDataList;
}
public static ReportTimeInfo getReportTimeInfo(String jtlString) {
ReportTimeInfo reportTimeInfo = new ReportTimeInfo();
List<Metric> totalLineList = JtlResolver.resolver(jtlString);
totalLineList.sort(Comparator.comparing(t0 -> Long.valueOf(t0.getTimestamp())));
String startTimeStamp = totalLineList.get(0).getTimestamp();
String endTimeStamp = totalLineList.get(totalLineList.size()-1).getTimestamp();
String startTime = stampToDate(startTimeStamp);
String endTime = stampToDate(endTimeStamp);
reportTimeInfo.setStartTime(startTime);
reportTimeInfo.setEndTime(endTime);
Date startDate = new Date(Long.parseLong(startTimeStamp));
Date endDate = new Date(Long.parseLong(endTimeStamp));
long timestamp = endDate.getTime() - startDate.getTime();
reportTimeInfo.setDuration(String.valueOf(timestamp*1.0 / 1000 / 60));
return reportTimeInfo;
}
private static String stampToDate(String timeStamp) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long lt = Long.parseLong(timeStamp);

View File

@ -0,0 +1,32 @@
package io.metersphere.report.base;
public class ReportTimeInfo {
private String duration;
private String startTime;
private String endTime;
public String getDuration() {
return duration;
}
public void setDuration(String duration) {
this.duration = duration;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}

View File

@ -3,9 +3,9 @@ package io.metersphere.report.base;
public class TestOverview {
private String maxUsers;
private String avgThroughput; // Hits/s
private String avgThroughput;
private String errors;
private String avgResponseTime; // s
private String avgResponseTime;
private String responseTime90;
private String avgBandwidth;

View File

@ -12,6 +12,7 @@ import io.metersphere.dto.ReportDTO;
import io.metersphere.report.JtlResolver;
import io.metersphere.report.base.ChartsData;
import io.metersphere.report.base.Errors;
import io.metersphere.report.base.ReportTimeInfo;
import io.metersphere.report.base.TestOverview;
import io.metersphere.report.dto.ErrorsTop5DTO;
import io.metersphere.report.dto.RequestStatisticsDTO;
@ -84,6 +85,14 @@ public class ReportService {
return testOverview;
}
public ReportTimeInfo getReportTimeInfo(String id) {
checkReportStatus(id);
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(id);
String content = loadTestReport.getContent();
ReportTimeInfo reportTimeInfo = JtlResolver.getReportTimeInfo(content);
return reportTimeInfo;
}
public List<ChartsData> getLoadChartData(String id) {
checkReportStatus(id);
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(id);

View File

@ -48,14 +48,6 @@
}
</script>
<style>
body {
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
font-size: 14px;
margin: 0;
}
</style>
<style scoped>
#header-top {
width: 100%;

View File

@ -51,7 +51,7 @@
<script>
import {checkoutCurrentWorkspace} from "../../../../common/utils";
import {checkoutCurrentWorkspace} from "../../../../common/js/utils";
import MsRecentList from "../../common/head/RecentList";
import MsShowAll from "../../common/head/ShowAll";
import MsCreateButton from "../../common/head/CreateButton";
@ -126,22 +126,6 @@
</script>
<style>
.header-menu.el-menu--horizontal > li {
height: 39px;
line-height: 40px;
color: dimgray;
}
.header-menu.el-menu--horizontal > li.el-submenu > * {
height: 39px;
line-height: 40px;
color: dimgray;
}
</style>
<style scoped>
.el-divider--horizontal {
margin: 0;

View File

@ -1,53 +0,0 @@
<template>
<div>
<div class="recent-text">
<i class="el-icon-time"/>
<span>{{$t('project.recent')}}</span>
</div>
<el-menu-item :key="p.id" v-for="p in recentProjects"
:index="'/api/' + p.id" :route="{name:'fucPlan', params:{projectId:p.id, projectName:p.name}}">
<span class="title">{{ p.name }}</span>
</el-menu-item>
</div>
</template>
<script>
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../common/constants";
import {hasRoles} from "../../../../common/utils";
export default {
name: "ApiRecentProject",
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: 0 10px;
margin-top: -5px;
line-height: 36px;
color: #777777;
background-color: #F5F5F5;
}
.recent-text span {
padding-left: 6px;
}
.title {
padding-left: 20px;
}
</style>

View File

@ -1,54 +0,0 @@
<template>
<div>
<div class="recent-text">
<i class="el-icon-time"/>
<span>{{$t('load_test.recent')}}</span>
</div>
<el-menu-item :key="p.id" v-for="p in recentReports"
:index="'/api/report/view/' + p.id" :route="{path: '/api/report/view/' + p.id}">
<span class="title">{{ p.name }}</span>
</el-menu-item>
</div>
</template>
<script>
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../common/constants";
export default {
name: "ApiRecentReport",
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('/api/report/recent/5', (response) => {
this.recentReports = response.data;
});
}
},
methods: {},
data() {
return {
recentReports: [],
}
}
}
</script>
<style scoped>
.recent-text {
padding: 0 10px;
margin-top: -5px;
line-height: 36px;
color: #777777;
background-color: #F5F5F5;
}
.recent-text span {
padding-left: 6px;
}
.title {
padding-left: 20px;
}
</style>

View File

@ -1,6 +1,5 @@
<template>
<div class="testreport-container" v-loading="result.loading">
<div class="container" v-loading="result.loading">
<div class="main-content">
<el-card>
<template v-slot:header>
@ -75,7 +74,6 @@
</div>
</el-card>
</div>
</div>
</template>
@ -145,7 +143,7 @@
});
},
_handleDelete(report) {
this.result = this.$post(this.deletePath + report.id, {},() => {
this.result = this.$post(this.deletePath + report.id, {}, () => {
this.$message({
message: this.$t('commons.delete_success'),
type: 'success'
@ -158,20 +156,6 @@
</script>
<style scoped>
.testreport-container {
padding: 15px;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.main-content {
margin: 0 auto;
width: 100%;
max-width: 1200px;
}
.test-content {
width: 100%;
}

View File

@ -1,41 +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="'/api/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/constants";
import {hasRoles} from "../../../../common/utils";
export default {
name: "ApiRecentTest",
mounted() {
if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.$get('/api/recent/5', (response) => {
this.recentTestPlans = response.data;
});
}
},
data() {
return {
recentTestPlans: []
}
}
}
</script>
<style scoped>
.recent-text {
padding-left: 10%;
color: #777777;
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<div class="testplan-container" v-loading="result.loading">
<div class="container" v-loading="result.loading">
<div class="main-content">
<el-card>
<template v-slot:header>
@ -172,19 +172,6 @@
</script>
<style scoped>
.testplan-container {
padding: 15px;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.main-content {
margin: 0 auto;
width: 100%;
max-width: 1200px;
}
.test-content {
width: 100%;
}

View File

@ -49,23 +49,6 @@
}
}
</script>
<style>
.header-top-menus.el-menu--horizontal > li {
height: 40px;
line-height: 40px;
color: inherit;
}
.header-top-menus.el-menu--horizontal > li.el-submenu > * {
height: 39px;
line-height: 40px;
color: inherit;
}
.header-top-menus.el-menu--horizontal > li.is-active {
background: #595591 !important;
}
</style>
<style scoped>
</style>

View File

@ -43,8 +43,15 @@
</template>
<script>
import {ROLE_ORG_ADMIN, ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER, TokenKey, WORKSPACE_ID} from '../../../../common/constants';
import {hasRoles} from "../../../../common/utils";
import {
ROLE_ORG_ADMIN,
ROLE_TEST_MANAGER,
ROLE_TEST_USER,
ROLE_TEST_VIEWER,
TokenKey,
WORKSPACE_ID
} from '../../../../common/js/constants';
import {hasRoles} from "../../../../common/js/utils";
export default {
name: "MsUser",
@ -149,13 +156,7 @@
}
}
</script>
<style>
.header-user-menu.el-menu--horizontal > li.el-submenu > * {
height: 40px;
line-height: 40px;
color: inherit;
}
</style>
<style scoped>
.dropdown-link {
cursor: pointer;

View File

@ -12,8 +12,8 @@
</template>
<script>
import {hasRoles} from "../../../../common/utils";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../common/constants";
import {hasRoles} from "../../../../common/js/utils";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../common/js/constants";
export default {
name: "MsRecentList",

View File

@ -1,38 +1,29 @@
<template>
<div id="menu-bar" v-if="isRouterAlive">
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router
:default-active='$route.path'>
<el-row type="flex">
<el-col :span="8">
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'>
<el-menu-item :index="'/performance/home'">
{{ $t("i18n.home") }}
</el-menu-item>
<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>
<performance-recent-project/>
<ms-recent-list :options="projectRecent"/>
<el-divider/>
<el-menu-item :index="'/performance/project/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="'/performance/project/create'">
<el-button type="text">{{$t('project.create')}}</el-button>
</el-menu-item>
<ms-show-all :index="'/performance/project/all'"/>
<ms-create-button :index="'/performance/project/create'" :title="$t('project.create')"/>
</el-submenu>
<el-submenu v-if="isCurrentWorkspaceUser"
index="4" popper-class="submenu" v-permission="['test_manager', 'test_user']">
<template v-slot:title>{{$t('commons.test')}}</template>
<performance-recent-test-plan/>
<ms-recent-list :options="testRecent"/>
<el-divider/>
<el-menu-item :index="'/performance/test/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="'/performance/test/create'">
<el-button type="text">{{$t('load_test.create')}}</el-button>
</el-menu-item>
<ms-show-all :index="'/performance/test/all'"/>
<ms-create-button :index="'/performance/test/create'" :title="$t('load_test.create')"/>
<el-menu-item :index="testCaseProjectPath" class="blank_item"></el-menu-item>
<el-menu-item :index="testEditPath" class="blank_item"></el-menu-item>
</el-submenu>
@ -40,42 +31,74 @@
<el-submenu v-if="isCurrentWorkspaceUser"
index="5" popper-class="submenu" v-permission="['test_manager', 'test_user', 'test_viewer']">
<template v-slot:title>{{$t('commons.report')}}</template>
<performance-recent-report/>
<ms-recent-list :options="reportRecent"/>
<el-divider/>
<el-menu-item :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>
<ms-show-all :index="'/performance/report/all'"/>
</el-submenu>
<router-link v-if="isCurrentWorkspaceUser"
class="header-bottom" :to="'/performance/test/create'" v-permission="['test_user','test_manager']">
<el-button type="primary" size="small">{{$t('load_test.create')}}</el-button>
</router-link>
</el-menu>
</el-col>
<el-col :span="8">
<el-row type="flex" justify="center">
<ms-create-test :show="isCurrentWorkspaceUser" :to="'/performance/test/create'"/>
</el-row>
</el-col>
<el-col :span="8"/>
</el-row>
</div>
</template>
<script>
import PerformanceRecentTestPlan from "../../performance/test/PerformanceRecentTestPlan";
import PerformanceRecentProject from "../../performance/project/PerformanceRecentProject";
import PerformanceRecentReport from "../../performance/report/PerformanceRecentReport";
import {checkoutCurrentWorkspace} from "../../../../common/utils";
import {checkoutCurrentWorkspace} from "../../../../common/js/utils";
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 {
name: "PerformanceHeaderMenus",
components: {PerformanceRecentReport, PerformanceRecentTestPlan, PerformanceRecentProject},
components: {
MsCreateButton,
MsShowAll,
MsRecentList,
MsCreateTest
},
data() {
return {
isCurrentWorkspaceUser: false,
testCaseProjectPath: '',
testEditPath: '',
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() {
@ -85,22 +108,22 @@
'$route'(to, from) {
let path = to.path;
//
if (path.indexOf("/performance/test/") >= 0){
if (path.indexOf("/performance/test/") >= 0) {
this.testCaseProjectPath = '/performance/test/' + this.$route.params.projectId;
this.reload();
}
if (path.indexOf("/performance/test/edit/") >= 0){
if (path.indexOf("/performance/test/edit/") >= 0) {
this.testEditPath = '/performance/test/edit/' + this.$route.params.testId;
this.reload();
}
if (path.indexOf("/performance/report/view/") >= 0){
if (path.indexOf("/performance/report/view/") >= 0) {
this.reportViewPath = '/performance/report/view/' + this.$route.params.reportId;
this.reload();
}
}
},
methods: {
reload () {
reload() {
this.isRouterAlive = false;
this.$nextTick(function () {
this.isRouterAlive = true;
@ -111,33 +134,18 @@
</script>
<style>
.header-menu.el-menu--horizontal > li {
height: 39px;
line-height: 40px;
color: dimgray;
}
.header-menu.el-menu--horizontal > li.el-submenu > * {
height: 39px;
line-height: 40px;
color: dimgray;
}
.header-bottom {
line-height: 40px;
margin-left: 20%;
}
</style>
<style scoped>
.el-divider--horizontal {
margin: 0;
}
.el-menu.el-menu--horizontal {
border-bottom: none;
}
#menu-bar {
border-bottom: 1px solid #E6E6E6;
background-color: #FFF;
}
.blank_item {

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/constants";
import {hasRoles} from "../../../../common/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/constants";
import {hasRoles} from "../../../../common/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

@ -1,5 +1,5 @@
<template>
<div v-loading="result.loading" class="report-view-container">
<div v-loading="result.loading" class="container">
<div class="main-content">
<el-card>
<el-row>
@ -20,13 +20,13 @@
</el-col>
<el-col :span="8">
<span class="ms-report-time-desc">
持续时间 30 分钟
持续时间 {{duration}} 分钟
</span>
<span class="ms-report-time-desc">
开始时间 2020-3-10 12:00:00
开始时间 {{startTime}}
</span>
<span class="ms-report-time-desc">
结束时间 2020-3-10 12:30:00
结束时间 {{endTime}}
</span>
</el-col>
</el-row>
@ -75,13 +75,16 @@
status: '',
reportName: '',
testName: '',
projectName: ''
projectName: '',
startTime: '0',
endTime: '0',
duration: '0'
}
},
methods: {
initBreadcrumb() {
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;
if(data){
this.reportName = data.name;
@ -90,11 +93,23 @@
}
})
}
},
initReportTimeInfo() {
if(this.reportId){
this.result = this.$get("/performance/report/content/report_time/" + this.reportId, res => {
let data = res.data;
if(data){
this.startTime = data.startTime;
this.endTime = data.endTime;
this.duration = data.duration;
}
})
}
}
},
mounted() {
this.reportId = this.$route.path.split('/')[4];
this.$get("report/" + this.reportId, res => {
this.$get("/performance/report/" + this.reportId, res => {
let data = res.data;
this.status = data.status;
if (data.status === "Error") {
@ -110,12 +125,13 @@
}
})
this.initBreadcrumb();
this.initReportTimeInfo();
},
watch: {
'$route'(to) {
let reportId = to.path.split('/')[4];
if(reportId){
this.$get("report/test/pro/info/" + reportId, response => {
this.$get("/performance/report/test/pro/info/" + reportId, response => {
let data = response.data;
if(data){
this.reportName = data.name;
@ -123,6 +139,14 @@
this.projectName = data.projectName;
}
});
this.result = this.$get("/performance/report/content/report_time/" + this.reportId, res => {
let data = res.data;
if(data){
this.startTime = data.startTime;
this.endTime = data.endTime;
this.duration = data.duration;
}
})
window.location.reload();
}
}
@ -131,20 +155,6 @@
</script>
<style scoped>
.report-view-container {
float: none;
text-align: center;
padding: 15px;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.report-view-container .main-content {
margin: 0 auto;
width: 100%;
max-width: 1200px;
}
.ms-report-view-btns {
margin-top: 15px;

View File

@ -1,5 +1,5 @@
<template>
<div class="testreport-container" v-loading="result.loading">
<div class="container" v-loading="result.loading">
<div class="main-content">
<el-card>
@ -107,8 +107,8 @@
data() {
return {
result: {},
queryPath: "/report/list/all",
deletePath: "/report/delete/",
queryPath: "/performance/report/list/all",
deletePath: "/performance/report/delete/",
condition: "",
projectId: null,
tableData: [],
@ -191,19 +191,6 @@
<style scoped>
.testreport-container {
padding: 15px;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.main-content {
margin: 0 auto;
width: 100%;
max-width: 1200px;
}
.test-content {
width: 100%;
}

View File

@ -149,10 +149,10 @@
},
methods: {
initTableData() {
this.$get("/report/content/errors/" + this.id, res => {
this.$get("/performance/report/content/errors/" + this.id, res => {
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.errorTop5 = res.data.errorsTop5List;
})

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<template>
<div class="edit-testplan-container" v-loading="result.loading">
<div class="container" v-loading="result.loading">
<div class="main-content">
<el-card>
<el-row>
@ -17,9 +17,11 @@
</template>
</el-input>
</el-col>
<el-col :span="12" :offset="2">
<el-button type="primary" plain @click="save">{{$t('commons.save')}}</el-button>
<el-button type="primary" plain @click="saveAndRun">{{$t('load_test.save_and_run')}}</el-button>
<el-button type="warning" plain @click="cancel">{{$t('commons.cancel')}}</el-button>
</el-col>
</el-row>
@ -232,23 +234,10 @@
</script>
<style scoped>
.edit-testplan-container {
float: none;
text-align: center;
padding: 15px;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.edit-testplan-container .main-content {
margin: 0 auto;
width: 100%;
max-width: 1200px;
}
.edit-testplan-container .testplan-config {
.testplan-config {
margin-top: 15px;
text-align: center;
}
.el-select {

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/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>

View File

@ -1,5 +1,5 @@
<template>
<div class="testplan-container" v-loading="result.loading">
<div class="container" v-loading="result.loading">
<div class="main-content">
<el-card>
<template v-slot:header>
@ -190,18 +190,6 @@
</script>
<style scoped>
.testplan-container {
padding: 15px;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.main-content {
margin: 0 auto;
width: 100%;
max-width: 1200px;
}
.test-content {
width: 100%;

View File

@ -1,5 +1,5 @@
<template>
<div class="project-container">
<div class="container">
<div class="main-content">
<el-card v-loading="result.loading">
<template v-slot:header>
@ -67,7 +67,7 @@
<script>
import MsCreateBox from "../settings/CreateBox";
import {Message} from "element-ui";
import {TokenKey} from "../../../common/constants";
import {TokenKey} from "../../../common/js/constants";
export default {
name: "MsProject",
@ -193,18 +193,6 @@
</script>
<style scoped>
.project-container {
padding: 15px;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.main-content {
margin: 0 auto;
width: 100%;
max-width: 1200px;
}
.table-page {
padding-top: 20px;

View File

@ -6,7 +6,7 @@
</template>
<script>
import {TokenKey} from "../../../common/constants";
import {TokenKey} from "../../../common/js/constants";
export default {
name: "MsCurrentUser",

View File

@ -51,14 +51,3 @@
}
</style>
<style>
.main-content span.title {
font-size: 16px;
font-weight: 500;
margin-top: 0;
text-overflow: ellipsis;
overflow: hidden;
word-wrap: break-word;
white-space: nowrap;
}
</style>

View File

@ -42,7 +42,7 @@
</template>
<script>
import {checkoutCurrentOrganization, checkoutCurrentWorkspace} from "../../../common/utils";
import {checkoutCurrentOrganization, checkoutCurrentWorkspace} from "../../../common/js/utils";
export default {
name: "MsSettingMenu",

View File

@ -120,7 +120,7 @@
<script>
import MsCreateBox from "../CreateBox";
import {TokenKey} from "../../../../common/constants";
import {TokenKey} from "../../../../common/js/constants";
export default {
name: "MsOrganizationMember",

View File

@ -188,7 +188,7 @@
<script>
import MsCreateBox from "../CreateBox";
import {Message} from "element-ui";
import {TokenKey} from "../../../../common/constants";
import {TokenKey} from "../../../../common/js/constants";
export default {
name: "MsOrganizationWorkspace",

View File

@ -54,7 +54,7 @@
</template>
<script>
import {TokenKey} from "../../../../common/constants";
import {TokenKey} from "../../../../common/js/constants";
export default {
data() {

View File

@ -460,7 +460,6 @@
data() {
return {
result: {},
loading: false,
createVisible: false,
updateVisible: false,
memberVisible: false,

View File

@ -120,7 +120,7 @@
<script>
import MsCreateBox from "../CreateBox";
import {TokenKey} from "../../../../common/constants";
import {TokenKey} from "../../../../common/js/constants";
export default {
name: "MsMember",

View File

@ -41,7 +41,7 @@
import NodeTree from './components/NodeTree';
import TestCaseEdit from './components/TestCaseEdit';
import {WORKSPACE_ID,CURRENT_PROJECT} from '../../../../common/constants';
import {CURRENT_PROJECT, WORKSPACE_ID} from '../../../../common/js/constants';
import TestCaseList from "./components/TestCaseList";
import SelectMenu from "../common/SelectMenu";

View File

@ -68,7 +68,7 @@
<script>
import {CURRENT_PROJECT} from '../../../../../common/constants';
import {CURRENT_PROJECT} from '../../../../../common/js/constants';
export default {
name: "NodeTree",

View File

@ -188,7 +188,7 @@
<script>
import {CURRENT_PROJECT} from '../../../../../common/constants';
import {CURRENT_PROJECT} from '../../../../../common/js/constants';
export default {
name: "TestCaseEdit",

View File

@ -115,7 +115,6 @@
</template>
<script>
import {CURRENT_PROJECT} from '../../../../../common/constants';
export default {
name: "TestCaseList",

View File

@ -38,19 +38,17 @@
</el-submenu>
</el-menu>
</el-col>
</el-row>
</div>
</template>
<script>
import {checkoutCurrentWorkspace} from "../../../../common/utils";
import {checkoutCurrentWorkspace} from "../../../../common/js/utils";
import MsShowAll from "../../common/head/ShowAll";
import MsRecentList from "../../common/head/RecentList";
import MsCreateButton from "../../common/head/CreateButton";
export default {
name: "TrackHeaderMenus",
components: {MsShowAll, MsRecentList, MsCreateButton},
@ -91,11 +89,11 @@
watch: {
'$route'(to, from) {
let path = to.path;
if (path.indexOf("/track/plan/view") >= 0){
if (path.indexOf("/track/plan/view") >= 0) {
this.testPlanViewPath = '/track/plan/view/' + this.$route.params.planId;
this.reload();
}
if (path.indexOf("/track/case/edit") >= 0){
if (path.indexOf("/track/case/edit") >= 0) {
this.testCaseEditPath = '/track/case/edit/' + this.$route.params.caseId;
this.reload();
}
@ -105,7 +103,7 @@
this.isCurrentWorkspaceUser = checkoutCurrentWorkspace();
},
methods: {
reload () {
reload() {
this.isRouterAlive = false;
this.$nextTick(function () {
this.isRouterAlive = true;
@ -116,34 +114,11 @@
</script>
<style>
.header-menu.el-menu--horizontal > li {
height: 39px;
line-height: 40px;
color: dimgray;
}
.header-menu.el-menu--horizontal > li.el-submenu > * {
height: 39px;
line-height: 40px;
color: dimgray;
}
.header-bottom {
line-height: 40px;
margin-left: 20%;
}
</style>
<style scoped>
.el-divider--horizontal {
margin: 0;
}
#menu-bar {
border-bottom: 1px solid #E6E6E6;
}

View File

@ -99,7 +99,7 @@
<script>
import {WORKSPACE_ID} from '../../../../../common/constants';
import {WORKSPACE_ID} from '../../../../../common/js/constants';
export default {
name: "TestPlanEdit",

View File

@ -1,16 +1,18 @@
import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import icon from "../common/icon";
import filters from "../common/filter";
import ajax from "../common/ajax";
import icon from "../common/js/icon";
import filters from "../common/js/filter";
import ajax from "../common/js/ajax";
import App from './App.vue';
import router from "./components/common/router/router";
import './permission' // permission control
import i18n from "../i18n/i18n";
import store from "./store";
import {permission} from './permission'
import chart from "../common/chart";
import chart from "../common/js/chart";
import '../common/css/menu-header.css';
import '../common/css/main.css';
Vue.config.productionTip = false;
Vue.use(icon);

View File

@ -1,5 +1,5 @@
import router from './components/common/router/router'
import {TokenKey} from '../common/constants';
import {TokenKey} from '../common/js/constants';
const whiteList = ['/login']; // no redirect whitelist

View File

@ -0,0 +1,11 @@
.container {
padding: 15px;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.main-content {
margin: 0 auto;
width: 100%;
}

View File

@ -0,0 +1,47 @@
.header-menu.el-menu--horizontal > li {
height: 39px;
line-height: 40px;
color: dimgray;
}
.header-menu.el-menu--horizontal > li.el-submenu > * {
height: 39px;
line-height: 40px;
color: dimgray;
}
.header-user-menu.el-menu--horizontal > li.el-submenu > * {
height: 40px;
line-height: 40px;
color: inherit;
}
body {
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
font-size: 14px;
margin: 0;
}
.main-content span.title {
font-size: 16px;
font-weight: 500;
margin-top: 0;
text-overflow: ellipsis;
overflow: hidden;
word-wrap: break-word;
white-space: nowrap;
}
.header-top-menus.el-menu--horizontal > li {
height: 40px;
line-height: 40px;
color: inherit;
}
.header-top-menus.el-menu--horizontal > li.el-submenu > * {
height: 39px;
line-height: 40px;
color: inherit;
}
.header-top-menus.el-menu--horizontal > li.is-active {
background: #595591 !important;
}

View File

@ -46,6 +46,10 @@ export default {
}
function exception(error, result) {
if (error.response && error.response.status === 401) {
login();
return;
}
result.loading = false;
window.console.error(error.response || error.message);
if (error.response.data) {

View File

@ -41,7 +41,7 @@
</template>
<script>
import {TokenKey} from '../common/constants';
import {TokenKey} from '../common/js/constants';
export default {

View File

@ -2,7 +2,7 @@ import Vue from 'vue';
import ElementUI, {Button, Col, Form, FormItem, Input, Row} from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import Login from "./Login.vue";
import Ajax from "../common/ajax";
import Ajax from "../common/js/ajax";
import i18n from "../i18n/i18n";
Vue.config.productionTip = false;