Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
bb7d818a
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 3 年多
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bb7d818a
编写于
5月 18, 2020
作者:
Q
q4speed
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复测试关联报告查询错误的bug
首页增加测试日历功能
上级
d80976f5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
71 addition
and
6 deletion
+71
-6
backend/src/main/java/io/metersphere/api/controller/APIReportController.java
...va/io/metersphere/api/controller/APIReportController.java
+13
-0
backend/src/main/java/io/metersphere/api/service/APIReportService.java
...ain/java/io/metersphere/api/service/APIReportService.java
+10
-0
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.java
...o/metersphere/base/mapper/ext/ExtApiTestReportMapper.java
+3
-0
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.xml
...io/metersphere/base/mapper/ext/ExtApiTestReportMapper.xml
+13
-1
frontend/src/business/components/api/home/ApiTestHome.vue
frontend/src/business/components/api/home/ApiTestHome.vue
+26
-2
frontend/src/business/components/api/test/ApiReportDialog.vue
...tend/src/business/components/api/test/ApiReportDialog.vue
+5
-2
frontend/src/business/components/api/test/ApiTestConfig.vue
frontend/src/business/components/api/test/ApiTestConfig.vue
+1
-1
未找到文件。
backend/src/main/java/io/metersphere/api/controller/APIReportController.java
浏览文件 @
bb7d818a
...
...
@@ -10,11 +10,13 @@ import io.metersphere.commons.constants.RoleConstants;
import
io.metersphere.commons.utils.PageUtils
;
import
io.metersphere.commons.utils.Pager
;
import
io.metersphere.commons.utils.SessionUtils
;
import
io.metersphere.dto.DashboardTestDTO
;
import
org.apache.shiro.authz.annotation.Logical
;
import
org.apache.shiro.authz.annotation.RequiresRoles
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
...
...
@@ -34,6 +36,11 @@ public class APIReportController {
return
apiReportService
.
recentTest
(
request
);
}
@GetMapping
(
"/list/{testId}"
)
public
List
<
APIReportResult
>
listByTestId
(
@PathVariable
String
testId
)
{
return
apiReportService
.
listByTestId
(
testId
);
}
@PostMapping
(
"/list/{goPage}/{pageSize}"
)
public
Pager
<
List
<
APIReportResult
>>
list
(
@PathVariable
int
goPage
,
@PathVariable
int
pageSize
,
@RequestBody
QueryAPIReportRequest
request
)
{
Page
<
Object
>
page
=
PageHelper
.
startPage
(
goPage
,
pageSize
,
true
);
...
...
@@ -51,4 +58,10 @@ public class APIReportController {
apiReportService
.
delete
(
request
);
}
@GetMapping
(
"dashboard/tests"
)
public
List
<
DashboardTestDTO
>
dashboardTests
()
{
return
apiReportService
.
dashboardTests
(
SessionUtils
.
getCurrentWorkspaceId
());
}
}
backend/src/main/java/io/metersphere/api/service/APIReportService.java
浏览文件 @
bb7d818a
...
...
@@ -10,9 +10,12 @@ import io.metersphere.base.domain.ApiTestWithBLOBs;
import
io.metersphere.base.mapper.ApiTestReportMapper
;
import
io.metersphere.base.mapper.ext.ExtApiTestReportMapper
;
import
io.metersphere.commons.constants.APITestStatus
;
import
io.metersphere.dto.DashboardTestDTO
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.time.Instant
;
import
java.time.temporal.ChronoUnit
;
import
java.util.List
;
import
java.util.UUID
;
...
...
@@ -62,4 +65,11 @@ public class APIReportService {
report
.
setStatus
(
APITestStatus
.
Completed
.
name
());
apiTestReportMapper
.
insert
(
report
);
}
public
List
<
DashboardTestDTO
>
dashboardTests
(
String
workspaceId
)
{
Instant
oneYearAgo
=
Instant
.
now
().
plus
(-
365
,
ChronoUnit
.
DAYS
);
long
startTimestamp
=
oneYearAgo
.
toEpochMilli
();
return
extApiTestReportMapper
.
selectDashboardTests
(
workspaceId
,
startTimestamp
);
}
}
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.java
浏览文件 @
bb7d818a
...
...
@@ -3,6 +3,7 @@ package io.metersphere.base.mapper.ext;
import
io.metersphere.api.dto.APIReportResult
;
import
io.metersphere.api.dto.QueryAPIReportRequest
;
import
io.metersphere.dto.ApiReportDTO
;
import
io.metersphere.dto.DashboardTestDTO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -15,4 +16,6 @@ public interface ExtApiTestReportMapper {
APIReportResult
get
(
@Param
(
"id"
)
String
id
);
List
<
DashboardTestDTO
>
selectDashboardTests
(
@Param
(
"workspaceId"
)
String
workspaceId
,
@Param
(
"startTimestamp"
)
long
startTimestamp
);
}
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.xml
浏览文件 @
bb7d818a
...
...
@@ -29,7 +29,7 @@
</select>
<select
id=
"listByTestId"
resultMap=
"BaseResultMap"
>
SELECT
c
,
SELECT
t.name AS test_name
,
r.name, r.description, r.id, r.test_id, r.create_time, r.update_time, r.status,
project.name AS project_name
FROM api_test_report r JOIN api_test t ON r.test_id = t.id
...
...
@@ -50,4 +50,16 @@
ORDER BY r.update_time DESC
</select>
<select
id=
"selectDashboardTests"
resultType=
"io.metersphere.dto.DashboardTestDTO"
>
SELECT create_time AS date, count(api_test_report.id) AS count,
date_format(from_unixtime(create_time / 1000), '%Y-%m-%d') AS x
FROM api_test_report
WHERE test_id IN (SELECT api_test.id
FROM api_test
JOIN project ON api_test.project_id = project.id
WHERE workspace_id = #{workspaceId,jdbcType=VARCHAR})
AND create_time > #{startTimestamp}
GROUP BY x
</select>
</mapper>
\ No newline at end of file
frontend/src/business/components/api/home/ApiTestHome.vue
浏览文件 @
bb7d818a
<
template
>
<ms-container>
<ms-main-container>
<ms-main-container
v-loading=
"result.loading"
>
<el-row
:gutter=
"20"
>
<el-col
:span=
"12"
>
<ms-api-test-recent-list/>
...
...
@@ -9,6 +9,9 @@
<ms-api-report-recent-list/>
</el-col>
</el-row>
<el-row>
<ms-test-heatmap
:values=
"values"
></ms-test-heatmap>
</el-row>
</ms-main-container>
</ms-container>
...
...
@@ -19,13 +22,34 @@
import
MsMainContainer
from
"
../../common/components/MsMainContainer
"
;
import
MsApiTestRecentList
from
"
./ApiTestRecentList
"
;
import
MsApiReportRecentList
from
"
./ApiReportRecentList
"
;
import
MsTestHeatmap
from
"
../../common/components/MsTestHeatmap
"
;
export
default
{
name
:
"
ApiTestHome
"
,
components
:
{
MsApiReportRecentList
,
MsApiTestRecentList
,
MsMainContainer
,
MsContainer
}
components
:
{
MsTestHeatmap
,
MsApiReportRecentList
,
MsApiTestRecentList
,
MsMainContainer
,
MsContainer
},
data
()
{
return
{
values
:
[],
result
:
{},
}
},
mounted
()
{
this
.
result
=
this
.
$get
(
'
/api/report/dashboard/tests
'
,
response
=>
{
this
.
values
=
response
.
data
;
});
},
}
</
script
>
<
style
scoped
>
.el-row
{
margin-bottom
:
20px
;
}
.el-row
:last-child
{
margin-bottom
:
0
;
}
</
style
>
frontend/src/business/components/api/test/ApiReportDialog.vue
浏览文件 @
bb7d818a
...
...
@@ -3,7 +3,7 @@
<el-button
type=
"success"
plain
@
click=
"search"
>
{{
$t
(
'
api_report.title
'
)
}}
</el-button>
<el-dialog
:title=
"$t('api_report.title')"
:visible.sync=
"reportVisible"
>
<el-table
:data=
"tableData"
>
<el-table
:data=
"tableData"
v-loading=
"result.loading"
>
<el-table-column
:label=
"$t('commons.name')"
width=
"150"
show-overflow-tooltip
>
<template
v-slot:default=
"scope"
>
<el-link
type=
"info"
@
click=
"link(scope.row)"
>
{{
scope
.
row
.
name
}}
</el-link>
...
...
@@ -37,6 +37,8 @@
components
:
{
MsApiReportStatus
},
props
:
[
"
testId
"
],
data
()
{
return
{
reportVisible
:
false
,
...
...
@@ -50,7 +52,8 @@
search
()
{
this
.
reportVisible
=
true
;
this
.
result
=
this
.
$get
(
"
/api/report/recent/99
"
,
response
=>
{
let
url
=
"
/api/report/list/
"
+
this
.
testId
;
this
.
result
=
this
.
$get
(
url
,
response
=>
{
this
.
tableData
=
response
.
data
;
});
},
...
...
frontend/src/business/components/api/test/ApiTestConfig.vue
浏览文件 @
bb7d818a
...
...
@@ -26,7 +26,7 @@
<el-button
type=
"warning"
plain
@
click=
"cancel"
>
{{
$t
(
'
commons.cancel
'
)
}}
</el-button>
<ms-api-report-dialog/>
<ms-api-report-dialog
:test-id=
"id"
v-if=
"id"
/>
</el-row>
</el-header>
<ms-api-scenario-config
:scenarios=
"test.scenarioDefinition"
ref=
"config"
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录