Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
17d627af
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,发现更多精彩内容 >>
提交
17d627af
编写于
5月 18, 2020
作者:
C
Captain.B
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/dev' into dev
上级
ba3fe5a1
2c729923
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
85 addition
and
18 deletion
+85
-18
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/head/ApiHeaderMenus.vue
frontend/src/business/components/api/head/ApiHeaderMenus.vue
+1
-1
frontend/src/business/components/api/home/ApiTestHome.vue
frontend/src/business/components/api/home/ApiTestHome.vue
+26
-2
frontend/src/business/components/api/report/ApiReportList.vue
...tend/src/business/components/api/report/ApiReportList.vue
+5
-5
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
frontend/src/business/components/api/test/ApiTestList.vue
frontend/src/business/components/api/test/ApiTestList.vue
+5
-5
frontend/src/business/components/common/head/HeaderTopMenus.vue
...nd/src/business/components/common/head/HeaderTopMenus.vue
+3
-1
未找到文件。
backend/src/main/java/io/metersphere/api/controller/APIReportController.java
浏览文件 @
17d627af
...
@@ -10,11 +10,13 @@ import io.metersphere.commons.constants.RoleConstants;
...
@@ -10,11 +10,13 @@ import io.metersphere.commons.constants.RoleConstants;
import
io.metersphere.commons.utils.PageUtils
;
import
io.metersphere.commons.utils.PageUtils
;
import
io.metersphere.commons.utils.Pager
;
import
io.metersphere.commons.utils.Pager
;
import
io.metersphere.commons.utils.SessionUtils
;
import
io.metersphere.commons.utils.SessionUtils
;
import
io.metersphere.dto.DashboardTestDTO
;
import
org.apache.shiro.authz.annotation.Logical
;
import
org.apache.shiro.authz.annotation.Logical
;
import
org.apache.shiro.authz.annotation.RequiresRoles
;
import
org.apache.shiro.authz.annotation.RequiresRoles
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
@RestController
@RestController
...
@@ -34,6 +36,11 @@ public class APIReportController {
...
@@ -34,6 +36,11 @@ public class APIReportController {
return
apiReportService
.
recentTest
(
request
);
return
apiReportService
.
recentTest
(
request
);
}
}
@GetMapping
(
"/list/{testId}"
)
public
List
<
APIReportResult
>
listByTestId
(
@PathVariable
String
testId
)
{
return
apiReportService
.
listByTestId
(
testId
);
}
@PostMapping
(
"/list/{goPage}/{pageSize}"
)
@PostMapping
(
"/list/{goPage}/{pageSize}"
)
public
Pager
<
List
<
APIReportResult
>>
list
(
@PathVariable
int
goPage
,
@PathVariable
int
pageSize
,
@RequestBody
QueryAPIReportRequest
request
)
{
public
Pager
<
List
<
APIReportResult
>>
list
(
@PathVariable
int
goPage
,
@PathVariable
int
pageSize
,
@RequestBody
QueryAPIReportRequest
request
)
{
Page
<
Object
>
page
=
PageHelper
.
startPage
(
goPage
,
pageSize
,
true
);
Page
<
Object
>
page
=
PageHelper
.
startPage
(
goPage
,
pageSize
,
true
);
...
@@ -51,4 +58,10 @@ public class APIReportController {
...
@@ -51,4 +58,10 @@ public class APIReportController {
apiReportService
.
delete
(
request
);
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
浏览文件 @
17d627af
...
@@ -10,9 +10,12 @@ import io.metersphere.base.domain.ApiTestWithBLOBs;
...
@@ -10,9 +10,12 @@ import io.metersphere.base.domain.ApiTestWithBLOBs;
import
io.metersphere.base.mapper.ApiTestReportMapper
;
import
io.metersphere.base.mapper.ApiTestReportMapper
;
import
io.metersphere.base.mapper.ext.ExtApiTestReportMapper
;
import
io.metersphere.base.mapper.ext.ExtApiTestReportMapper
;
import
io.metersphere.commons.constants.APITestStatus
;
import
io.metersphere.commons.constants.APITestStatus
;
import
io.metersphere.dto.DashboardTestDTO
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.time.Instant
;
import
java.time.temporal.ChronoUnit
;
import
java.util.List
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.UUID
;
...
@@ -62,4 +65,11 @@ public class APIReportService {
...
@@ -62,4 +65,11 @@ public class APIReportService {
report
.
setStatus
(
APITestStatus
.
Completed
.
name
());
report
.
setStatus
(
APITestStatus
.
Completed
.
name
());
apiTestReportMapper
.
insert
(
report
);
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
浏览文件 @
17d627af
...
@@ -3,6 +3,7 @@ package io.metersphere.base.mapper.ext;
...
@@ -3,6 +3,7 @@ package io.metersphere.base.mapper.ext;
import
io.metersphere.api.dto.APIReportResult
;
import
io.metersphere.api.dto.APIReportResult
;
import
io.metersphere.api.dto.QueryAPIReportRequest
;
import
io.metersphere.api.dto.QueryAPIReportRequest
;
import
io.metersphere.dto.ApiReportDTO
;
import
io.metersphere.dto.ApiReportDTO
;
import
io.metersphere.dto.DashboardTestDTO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
@@ -15,4 +16,6 @@ public interface ExtApiTestReportMapper {
...
@@ -15,4 +16,6 @@ public interface ExtApiTestReportMapper {
APIReportResult
get
(
@Param
(
"id"
)
String
id
);
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
浏览文件 @
17d627af
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
</select>
</select>
<select
id=
"listByTestId"
resultMap=
"BaseResultMap"
>
<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,
r.name, r.description, r.id, r.test_id, r.create_time, r.update_time, r.status,
project.name AS project_name
project.name AS project_name
FROM api_test_report r JOIN api_test t ON r.test_id = t.id
FROM api_test_report r JOIN api_test t ON r.test_id = t.id
...
@@ -50,4 +50,16 @@
...
@@ -50,4 +50,16 @@
ORDER BY r.update_time DESC
ORDER BY r.update_time DESC
</select>
</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>
</mapper>
\ No newline at end of file
frontend/src/business/components/api/head/ApiHeaderMenus.vue
浏览文件 @
17d627af
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
return
'
/api/
'
+
item
.
id
;
return
'
/api/
'
+
item
.
id
;
},
},
router
:
function
(
item
)
{
router
:
function
(
item
)
{
return
{
name
:
'
fucPlan
'
,
params
:
{
projectId
:
item
.
id
,
projectName
:
item
.
name
}}
return
{
name
:
'
ApiTestList
'
,
params
:
{
projectId
:
item
.
id
,
projectName
:
item
.
name
}}
}
}
},
},
testRecent
:
{
testRecent
:
{
...
...
frontend/src/business/components/api/home/ApiTestHome.vue
浏览文件 @
17d627af
<
template
>
<
template
>
<ms-container>
<ms-container>
<ms-main-container>
<ms-main-container
v-loading=
"result.loading"
>
<el-row
:gutter=
"20"
>
<el-row
:gutter=
"20"
>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<ms-api-test-recent-list/>
<ms-api-test-recent-list/>
...
@@ -9,6 +9,9 @@
...
@@ -9,6 +9,9 @@
<ms-api-report-recent-list/>
<ms-api-report-recent-list/>
</el-col>
</el-col>
</el-row>
</el-row>
<el-row>
<ms-test-heatmap
:values=
"values"
></ms-test-heatmap>
</el-row>
</ms-main-container>
</ms-main-container>
</ms-container>
</ms-container>
...
@@ -19,13 +22,34 @@
...
@@ -19,13 +22,34 @@
import
MsMainContainer
from
"
../../common/components/MsMainContainer
"
;
import
MsMainContainer
from
"
../../common/components/MsMainContainer
"
;
import
MsApiTestRecentList
from
"
./ApiTestRecentList
"
;
import
MsApiTestRecentList
from
"
./ApiTestRecentList
"
;
import
MsApiReportRecentList
from
"
./ApiReportRecentList
"
;
import
MsApiReportRecentList
from
"
./ApiReportRecentList
"
;
import
MsTestHeatmap
from
"
../../common/components/MsTestHeatmap
"
;
export
default
{
export
default
{
name
:
"
ApiTestHome
"
,
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
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.el-row
{
margin-bottom
:
20px
;
}
.el-row
:last-child
{
margin-bottom
:
0
;
}
</
style
>
</
style
>
frontend/src/business/components/api/report/ApiReportList.vue
浏览文件 @
17d627af
...
@@ -59,11 +59,11 @@
...
@@ -59,11 +59,11 @@
}
}
},
},
beforeRouteEnter
(
to
,
from
,
next
)
{
watch
:
{
next
(
self
=>
{
'
$route
'
(
to
)
{
self
.
testId
=
to
.
params
.
testId
;
this
.
testId
=
to
.
params
.
testId
;
self
.
search
();
this
.
search
();
}
);
}
},
},
methods
:
{
methods
:
{
...
...
frontend/src/business/components/api/test/ApiReportDialog.vue
浏览文件 @
17d627af
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<el-button
type=
"success"
plain
@
click=
"search"
>
{{
$t
(
'
api_report.title
'
)
}}
</el-button>
<el-button
type=
"success"
plain
@
click=
"search"
>
{{
$t
(
'
api_report.title
'
)
}}
</el-button>
<el-dialog
:title=
"$t('api_report.title')"
:visible.sync=
"reportVisible"
>
<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
>
<el-table-column
:label=
"$t('commons.name')"
width=
"150"
show-overflow-tooltip
>
<template
v-slot:default=
"scope"
>
<template
v-slot:default=
"scope"
>
<el-link
type=
"info"
@
click=
"link(scope.row)"
>
{{
scope
.
row
.
name
}}
</el-link>
<el-link
type=
"info"
@
click=
"link(scope.row)"
>
{{
scope
.
row
.
name
}}
</el-link>
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
components
:
{
MsApiReportStatus
},
components
:
{
MsApiReportStatus
},
props
:
[
"
testId
"
],
data
()
{
data
()
{
return
{
return
{
reportVisible
:
false
,
reportVisible
:
false
,
...
@@ -50,7 +52,8 @@
...
@@ -50,7 +52,8 @@
search
()
{
search
()
{
this
.
reportVisible
=
true
;
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
;
this
.
tableData
=
response
.
data
;
});
});
},
},
...
...
frontend/src/business/components/api/test/ApiTestConfig.vue
浏览文件 @
17d627af
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
<el-button
type=
"warning"
plain
@
click=
"cancel"
>
{{
$t
(
'
commons.cancel
'
)
}}
</el-button>
<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-row>
</el-header>
</el-header>
<ms-api-scenario-config
:scenarios=
"test.scenarioDefinition"
ref=
"config"
/>
<ms-api-scenario-config
:scenarios=
"test.scenarioDefinition"
ref=
"config"
/>
...
...
frontend/src/business/components/api/test/ApiTestList.vue
浏览文件 @
17d627af
...
@@ -63,11 +63,11 @@
...
@@ -63,11 +63,11 @@
}
}
},
},
beforeRouteEnter
(
to
,
from
,
next
)
{
watch
:
{
next
(
self
=>
{
'
$route
'
(
to
)
{
self
.
projectId
=
to
.
params
.
projectId
;
this
.
projectId
=
to
.
params
.
projectId
;
self
.
search
();
this
.
search
();
}
);
}
},
},
methods
:
{
methods
:
{
...
...
frontend/src/business/components/common/head/HeaderTopMenus.vue
浏览文件 @
17d627af
...
@@ -34,7 +34,9 @@
...
@@ -34,7 +34,9 @@
},
},
watch
:
{
watch
:
{
'
$route
'
(
to
)
{
'
$route
'
(
to
)
{
this
.
activeIndex
=
to
.
matched
[
0
].
path
;
if
(
to
.
matched
.
length
>
0
)
{
this
.
activeIndex
=
to
.
matched
[
0
].
path
;
}
this
.
handleSelect
(
this
.
activeIndex
);
this
.
handleSelect
(
this
.
activeIndex
);
}
}
},
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录