Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
0714200b
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,发现更多精彩内容 >>
提交
0714200b
编写于
3月 02, 2020
作者:
C
Captain.B
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
报告菜单 0.1
上级
761dea73
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
121 addition
and
4 deletion
+121
-4
backend/src/main/java/io/metersphere/controller/ReportController.java
...main/java/io/metersphere/controller/ReportController.java
+36
-0
backend/src/main/java/io/metersphere/controller/request/ReportRequest.java
...java/io/metersphere/controller/request/ReportRequest.java
+13
-0
backend/src/main/java/io/metersphere/service/ReportService.java
...d/src/main/java/io/metersphere/service/ReportService.java
+28
-0
frontend/src/performance/components/HeaderMenus.vue
frontend/src/performance/components/HeaderMenus.vue
+8
-4
frontend/src/performance/components/report/RecentReport.vue
frontend/src/performance/components/report/RecentReport.vue
+36
-0
未找到文件。
backend/src/main/java/io/metersphere/controller/ReportController.java
0 → 100644
浏览文件 @
0714200b
package
io.metersphere.controller
;
import
com.github.pagehelper.PageHelper
;
import
io.metersphere.base.domain.LoadTestReport
;
import
io.metersphere.commons.constants.RoleConstants
;
import
io.metersphere.controller.request.ReportRequest
;
import
io.metersphere.service.ReportService
;
import
io.metersphere.user.SessionUtils
;
import
org.apache.shiro.authz.annotation.Logical
;
import
org.apache.shiro.authz.annotation.RequiresRoles
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
@RequestMapping
(
value
=
"report"
)
public
class
ReportController
{
@Resource
private
ReportService
reportService
;
@GetMapping
(
"/recent/{count}"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
TEST_MANAGER
,
RoleConstants
.
TEST_USER
,
RoleConstants
.
TEST_VIEWER
},
logical
=
Logical
.
OR
)
public
List
<
LoadTestReport
>
recentProjects
(
@PathVariable
int
count
)
{
String
currentWorkspaceId
=
SessionUtils
.
getCurrentWorkspaceId
();
ReportRequest
request
=
new
ReportRequest
();
request
.
setWorkspaceId
(
currentWorkspaceId
);
// 最近 `count` 个项目
PageHelper
.
startPage
(
1
,
count
);
return
reportService
.
getRecentReportList
(
request
);
}
}
backend/src/main/java/io/metersphere/controller/request/ReportRequest.java
0 → 100644
浏览文件 @
0714200b
package
io.metersphere.controller.request
;
public
class
ReportRequest
{
private
String
workspaceId
;
public
String
getWorkspaceId
()
{
return
workspaceId
;
}
public
void
setWorkspaceId
(
String
workspaceId
)
{
this
.
workspaceId
=
workspaceId
;
}
}
backend/src/main/java/io/metersphere/service/ReportService.java
0 → 100644
浏览文件 @
0714200b
package
io.metersphere.service
;
import
io.metersphere.base.domain.LoadTestReport
;
import
io.metersphere.base.domain.LoadTestReportExample
;
import
io.metersphere.base.mapper.LoadTestReportMapper
;
import
io.metersphere.controller.request.ReportRequest
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.List
;
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
ReportService
{
@Resource
private
LoadTestReportMapper
loadTestReportMapper
;
public
List
<
LoadTestReport
>
getRecentReportList
(
ReportRequest
request
)
{
LoadTestReportExample
example
=
new
LoadTestReportExample
();
LoadTestReportExample
.
Criteria
criteria
=
example
.
createCriteria
();
//
example
.
setOrderByClause
(
"update_time desc"
);
return
loadTestReportMapper
.
selectByExample
(
example
);
}
}
frontend/src/performance/components/HeaderMenus.vue
浏览文件 @
0714200b
...
...
@@ -30,9 +30,12 @@
</el-submenu>
<el-submenu
index=
"5"
popper-class=
"submenu"
v-permission=
"['test_manager', 'test_user', 'test_viewer']"
>
<
template
slot=
"title"
>
报告
</
template
>
<el-menu-item
index=
"5-1"
>
报告1
</el-menu-item>
<el-menu-item
index=
"5-2"
>
报告2
</el-menu-item>
<el-menu-item
index=
"5-3"
>
显示全部
</el-menu-item>
<ms-recent-report/>
<el-divider/>
<el-menu-item
index=
"/report/all"
>
<font-awesome-icon
:icon=
"['fa', 'list-ul']"
/>
<span
style=
"padding-left: 5px;"
>
显示全部
</span>
</el-menu-item>
</el-submenu>
</el-menu>
</template>
...
...
@@ -40,10 +43,11 @@
<
script
>
import
MsRecentTestPlan
from
"
./testPlan/RecentTestPlan
"
;
import
MsRecentProject
from
"
./project/RecentProject
"
;
import
MsRecentReport
from
"
./report/RecentReport
"
;
export
default
{
name
:
"
MsMenus
"
,
components
:
{
MsRecentTestPlan
,
MsRecentProject
}
components
:
{
MsRecent
Report
,
MsRecent
TestPlan
,
MsRecentProject
}
}
</
script
>
...
...
frontend/src/performance/components/report/RecentReport.vue
0 → 100644
浏览文件 @
0714200b
<
template
>
<el-menu
router
menu-trigger=
"click"
:default-active=
"$route.path"
>
<el-menu-item
:key=
"p.id"
v-for=
"p in recentReports"
:index=
"'/report/' + p.id"
:route=
"
{name:'report', 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
"
;
export
default
{
name
:
"
MsRecentReport
"
,
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
(
'
/report/recent/5
'
,
(
response
)
=>
{
this
.
recentReports
=
response
.
data
;
});
}
},
methods
:
{},
data
()
{
return
{
recentReports
:
[],
}
}
}
</
script
>
<
style
scoped
>
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录