Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
11956de1
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,发现更多精彩内容 >>
提交
11956de1
编写于
4月 08, 2020
作者:
C
chenjianxing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
子页面激活菜单栏
上级
2364fac5
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
165 addition
and
43 deletion
+165
-43
backend/src/main/java/io/metersphere/controller/TestCaseController.java
...in/java/io/metersphere/controller/TestCaseController.java
+7
-6
backend/src/main/java/io/metersphere/service/TestCaseService.java
...src/main/java/io/metersphere/service/TestCaseService.java
+12
-1
frontend/src/business/components/api/ApiTest.vue
frontend/src/business/components/api/ApiTest.vue
+3
-3
frontend/src/business/components/api/head/ApiHeaderMenus.vue
frontend/src/business/components/api/head/ApiHeaderMenus.vue
+41
-3
frontend/src/business/components/performance/PerformanceTest.vue
...d/src/business/components/performance/PerformanceTest.vue
+3
-3
frontend/src/business/components/performance/head/PerformanceHeaderMenus.vue
...ss/components/performance/head/PerformanceHeaderMenus.vue
+39
-7
frontend/src/business/components/track/TestTrack.vue
frontend/src/business/components/track/TestTrack.vue
+3
-3
frontend/src/business/components/track/case/TestCase.vue
frontend/src/business/components/track/case/TestCase.vue
+22
-8
frontend/src/business/components/track/case/components/TestCaseList.vue
...usiness/components/track/case/components/TestCaseList.vue
+0
-1
frontend/src/business/components/track/head/TrackHeaderMenus.vue
...d/src/business/components/track/head/TrackHeaderMenus.vue
+35
-8
未找到文件。
backend/src/main/java/io/metersphere/controller/TestCaseController.java
浏览文件 @
11956de1
...
...
@@ -2,10 +2,7 @@ package io.metersphere.controller;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
io.metersphere.base.domain.LoadTest
;
import
io.metersphere.base.domain.TestCase
;
import
io.metersphere.base.domain.TestCaseNode
;
import
io.metersphere.base.domain.TestCaseWithBLOBs
;
import
io.metersphere.base.domain.*
;
import
io.metersphere.commons.utils.PageUtils
;
import
io.metersphere.commons.utils.Pager
;
import
io.metersphere.controller.request.testcase.QueryTestCaseRequest
;
...
...
@@ -39,8 +36,7 @@ public class TestCaseController {
String
currentWorkspaceId
=
SessionUtils
.
getCurrentWorkspaceId
();
QueryTestCaseRequest
request
=
new
QueryTestCaseRequest
();
request
.
setWorkspaceId
(
currentWorkspaceId
);
PageHelper
.
startPage
(
1
,
count
,
true
);
return
testCaseService
.
recentTestPlans
(
request
);
return
testCaseService
.
recentTestPlans
(
request
,
count
);
}
@PostMapping
(
"/list"
)
...
...
@@ -58,6 +54,11 @@ public class TestCaseController {
return
testCaseService
.
getTestCase
(
testCaseId
);
}
@GetMapping
(
"/project/{testCaseId}"
)
public
Project
getProjectByTestCaseId
(
@PathVariable
String
testCaseId
){
return
testCaseService
.
getProjectByTestCaseId
(
testCaseId
);
}
@PostMapping
(
"/add"
)
public
void
addTestCase
(
@RequestBody
TestCaseWithBLOBs
testCase
){
testCaseService
.
addTestCase
(
testCase
);
...
...
backend/src/main/java/io/metersphere/service/TestCaseService.java
浏览文件 @
11956de1
package
io.metersphere.service
;
import
com.github.pagehelper.PageHelper
;
import
io.metersphere.base.domain.*
;
import
io.metersphere.base.mapper.ProjectMapper
;
import
io.metersphere.base.mapper.TestCaseMapper
;
...
...
@@ -114,7 +115,7 @@ public class TestCaseService {
}
public
List
<
TestCase
>
recentTestPlans
(
QueryTestCaseRequest
request
)
{
public
List
<
TestCase
>
recentTestPlans
(
QueryTestCaseRequest
request
,
int
count
)
{
if
(
StringUtils
.
isBlank
(
request
.
getWorkspaceId
()))
{
return
null
;
...
...
@@ -126,9 +127,19 @@ public class TestCaseService {
List
<
String
>
projectIds
=
projectMapper
.
selectByExample
(
projectExample
).
stream
()
.
map
(
Project:
:
getId
).
collect
(
Collectors
.
toList
());
PageHelper
.
startPage
(
1
,
count
,
true
);
TestCaseExample
testCaseExample
=
new
TestCaseExample
();
testCaseExample
.
createCriteria
().
andProjectIdIn
(
projectIds
);
testCaseExample
.
setOrderByClause
(
"update_time desc"
);
return
testCaseMapper
.
selectByExample
(
testCaseExample
);
}
public
Project
getProjectByTestCaseId
(
String
testCaseId
)
{
TestCaseWithBLOBs
testCaseWithBLOBs
=
testCaseMapper
.
selectByPrimaryKey
(
testCaseId
);
if
(
testCaseWithBLOBs
==
null
)
{
return
null
;
}
return
projectMapper
.
selectByPrimaryKey
(
testCaseWithBLOBs
.
getProjectId
());
}
}
frontend/src/business/components/api/ApiTest.vue
浏览文件 @
11956de1
<
template
>
<el-col>
<header-menus/>
<
api-
header-menus/>
<div>
<transition>
<keep-alive>
...
...
@@ -12,11 +12,11 @@
</
template
>
<
script
>
import
HeaderMenus
from
"
./head/
HeaderMenus
"
;
import
ApiHeaderMenus
from
"
./head/Api
HeaderMenus
"
;
export
default
{
name
:
"
ApiTest
"
,
components
:
{
HeaderMenus
},
components
:
{
Api
HeaderMenus
},
data
()
{
return
{
beaseUrl
:
"
api
"
...
...
frontend/src/business/components/api/head/HeaderMenus.vue
→
frontend/src/business/components/api/head/
Api
HeaderMenus.vue
浏览文件 @
11956de1
<
template
>
<div
id=
"menu-bar"
>
<div
id=
"menu-bar"
v-if=
"isRouterAlive"
>
<el-menu
class=
"header-menu"
:unique-opened=
"true"
mode=
"horizontal"
router
:default-active=
'$route.path'
>
<el-menu-item
:index=
"'/api/home'"
>
...
...
@@ -24,7 +24,7 @@
<el-submenu
v-if=
"isCurrentWorkspaceUser"
index=
"4"
popper-class=
"submenu"
v-permission=
"['test_manager', 'test_user']"
>
<
template
v-slot:title
>
{{
$t
(
'
commons.test
'
)
}}
</
template
>
<api-recent-test
-plan
/>
<api-recent-test/>
<el-divider/>
<el-menu-item
:index=
"'/api/test/all'"
>
<font-awesome-icon
:icon=
"['fa', 'list-ul']"
/>
...
...
@@ -33,6 +33,8 @@
<el-menu-item
:index=
"'/api/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=
"testEditPath"
class=
"blank_item"
></el-menu-item>
</el-submenu>
<el-submenu
v-if=
"isCurrentWorkspaceUser"
...
...
@@ -44,6 +46,7 @@
<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>
<router-link
v-if=
"isCurrentWorkspaceUser"
...
...
@@ -64,15 +67,45 @@
import
{
checkoutCurrentWorkspace
}
from
"
../../../../common/utils
"
;
export
default
{
name
:
"
Ms
Menus
"
,
name
:
"
ApiHeader
Menus
"
,
components
:
{
ApiRecentTest
,
ApiRecentReport
,
ApiRecentProject
},
data
()
{
return
{
isCurrentWorkspaceUser
:
false
,
testCaseProjectPath
:
''
,
testEditPath
:
''
,
reportViewPath
:
''
,
isRouterAlive
:
true
}
},
watch
:
{
'
$route
'
(
to
,
from
)
{
let
path
=
to
.
path
;
//激活菜单栏
if
(
path
.
indexOf
(
"
/api/test/
"
)
>=
0
){
this
.
testCaseProjectPath
=
'
/api/test/
'
+
this
.
$route
.
params
.
projectId
;
this
.
reload
();
}
if
(
path
.
indexOf
(
"
/api/test/edit/
"
)
>=
0
){
this
.
testEditPath
=
'
/api/test/edit/
'
+
this
.
$route
.
params
.
testId
;
this
.
reload
();
}
if
(
path
.
indexOf
(
"
/api/report/view/
"
)
>=
0
){
this
.
reportViewPath
=
'
/api/report/view/
'
+
this
.
$route
.
params
.
reportId
;
this
.
reload
();
}
}
},
mounted
()
{
this
.
isCurrentWorkspaceUser
=
checkoutCurrentWorkspace
();
},
methods
:
{
reload
()
{
this
.
isRouterAlive
=
false
;
this
.
$nextTick
(
function
()
{
this
.
isRouterAlive
=
true
;
})
}
}
}
...
...
@@ -106,4 +139,9 @@
#menu-bar
{
border-bottom
:
1px
solid
#E6E6E6
;
}
.blank_item
{
display
:
none
;
}
</
style
>
frontend/src/business/components/performance/PerformanceTest.vue
浏览文件 @
11956de1
<
template
>
<el-col>
<header-menus/>
<
performance-
header-menus/>
<div>
<transition>
<keep-alive>
...
...
@@ -13,11 +13,11 @@
<
script
>
import
HeaderMenus
from
"
./head/
HeaderMenus
"
;
import
PerformanceHeaderMenus
from
"
./head/Performance
HeaderMenus
"
;
export
default
{
name
:
"
PerformanceTest
"
,
components
:
{
HeaderMenus
},
components
:
{
Performance
HeaderMenus
},
data
()
{
return
{
beaseUrl
:
"
performance
"
...
...
frontend/src/business/components/performance/head/HeaderMenus.vue
→
frontend/src/business/components/performance/head/
Performance
HeaderMenus.vue
浏览文件 @
11956de1
<
template
>
<div
id=
"menu-bar"
>
<div
id=
"menu-bar"
v-if=
"isRouterAlive"
>
<el-menu
class=
"header-menu"
:unique-opened=
"true"
mode=
"horizontal"
router
:default-active=
'$route.path'
>
<el-menu-item
:index=
"'/performance/home'"
>
...
...
@@ -33,6 +33,8 @@
<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=
"testEditPath"
class=
"blank_item"
></el-menu-item>
</el-submenu>
<el-submenu
v-if=
"isCurrentWorkspaceUser"
...
...
@@ -44,6 +46,7 @@
<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>
<router-link
v-if=
"isCurrentWorkspaceUser"
...
...
@@ -64,20 +67,45 @@
import
{
checkoutCurrentWorkspace
}
from
"
../../../../common/utils
"
;
export
default
{
name
:
"
Ms
Menus
"
,
name
:
"
PerformanceHeader
Menus
"
,
components
:
{
PerformanceRecentReport
,
PerformanceRecentTestPlan
,
PerformanceRecentProject
},
data
()
{
return
{
isCurrentWorkspaceUser
:
false
,
testCaseProjectPath
:
''
,
testEditPath
:
''
,
reportViewPath
:
''
,
isRouterAlive
:
true
}
},
props
:
{
beaseUrl
:
{
type
:
String
}
},
mounted
()
{
this
.
isCurrentWorkspaceUser
=
checkoutCurrentWorkspace
();
},
watch
:
{
'
$route
'
(
to
,
from
)
{
let
path
=
to
.
path
;
//激活菜单栏
if
(
path
.
indexOf
(
"
/performance/test/
"
)
>=
0
){
this
.
testCaseProjectPath
=
'
/performance/test/
'
+
this
.
$route
.
params
.
projectId
;
this
.
reload
();
}
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
){
this
.
reportViewPath
=
'
/performance/report/view/
'
+
this
.
$route
.
params
.
reportId
;
this
.
reload
();
}
}
},
methods
:
{
reload
()
{
this
.
isRouterAlive
=
false
;
this
.
$nextTick
(
function
()
{
this
.
isRouterAlive
=
true
;
})
}
}
}
...
...
@@ -111,4 +139,8 @@
#menu-bar
{
border-bottom
:
1px
solid
#E6E6E6
;
}
.blank_item
{
display
:
none
;
}
</
style
>
frontend/src/business/components/track/TestTrack.vue
浏览文件 @
11956de1
<
template
>
<el-col>
<header-menus/>
<
track-
header-menus/>
<div>
<transition>
<keep-alive>
...
...
@@ -13,11 +13,11 @@
<
script
>
import
HeaderMenus
from
"
./head/
HeaderMenus
"
;
import
TrackHeaderMenus
from
"
./head/Track
HeaderMenus
"
;
export
default
{
name
:
"
TrackHome
"
,
components
:
{
HeaderMenus
},
components
:
{
Track
HeaderMenus
},
data
()
{
return
{
beaseUrl
:
"
track
"
...
...
frontend/src/business/components/track/case/TestCase.vue
浏览文件 @
11956de1
...
...
@@ -72,23 +72,22 @@
treeNodes
:
[]
}
},
created
:
function
()
{
this
.
caseId
=
this
.
$route
.
params
.
caseId
;
created
()
{
this
.
getProjects
();
},
mounted
()
{
if
(
this
.
$route
.
path
.
indexOf
(
"
/track/case/edit
"
)
>=
0
){
this
.
openRecentTestCaseEditDialog
();
}
},
watch
:
{
'
$route
'
(
to
,
from
)
{
let
path
=
to
.
path
;
if
(
path
.
indexOf
(
"
/track/case/all
"
)
>=
0
){
this
.
getProjects
();
this
.
refresh
();
}
if
(
path
.
indexOf
(
"
/track/case/edit
"
)
>=
0
){
let
caseId
=
this
.
$route
.
params
.
caseId
;
this
.
$get
(
'
/test/case/get/
'
+
caseId
,
response
=>
{
console
.
log
(
response
.
data
);
this
.
openTestCaseEditDialog
(
response
.
data
[
0
]);
});
this
.
openRecentTestCaseEditDialog
();
}
}
},
...
...
@@ -164,9 +163,24 @@
this
.
$refs
.
testCaseEditDialog
.
maintainerOptions
=
response
.
data
;
});
},
getProjectByCaseId
(
caseId
)
{
return
this
.
$get
(
'
/test/case/project/
'
+
caseId
,
async
response
=>
{
localStorage
.
setItem
(
CURRENT_PROJECT
,
JSON
.
stringify
(
response
.
data
));
this
.
refresh
();
});
},
refresh
()
{
this
.
$refs
.
testCaseList
.
initTableData
();
this
.
$refs
.
nodeTree
.
getNodeTree
();
this
.
getProjects
();
},
openRecentTestCaseEditDialog
()
{
let
caseId
=
this
.
$route
.
params
.
caseId
;
this
.
getProjectByCaseId
(
caseId
);
this
.
refresh
();
this
.
$get
(
'
/test/case/get/
'
+
caseId
,
response
=>
{
this
.
openTestCaseEditDialog
(
response
.
data
[
0
]);
});
}
}
}
...
...
frontend/src/business/components/track/case/components/TestCaseList.vue
浏览文件 @
11956de1
...
...
@@ -140,7 +140,6 @@
}
},
created
:
function
()
{
this
.
initTableData
();
},
methods
:
{
...
...
frontend/src/business/components/track/head/HeaderMenus.vue
→
frontend/src/business/components/track/head/
Track
HeaderMenus.vue
浏览文件 @
11956de1
<
template
>
<div
id=
"menu-bar"
>
<div
id=
"menu-bar"
v-if=
"isRouterAlive"
>
<el-menu
class=
"header-menu"
:unique-opened=
"true"
mode=
"horizontal"
router
:default-active=
'$route.path'
>
<el-menu-item
:index=
"'/track/home'"
>
...
...
@@ -30,6 +30,7 @@
<font-awesome-icon
:icon=
"['fa', 'list-ul']"
/>
<span
style=
"padding-left: 5px;"
>
{{$t('test_track.case_list')}}
</span>
</el-menu-item>
<el-menu-item
:index=
"testCaseEditPath"
class=
"blank_item"
></el-menu-item>
<!--<el-menu-item :index="'/' + beaseUrl + '/case/create'">-->
<!--<el-button type="text">{{$t('test_track.create_case')}}</el-button>-->
<!--</el-menu-item>-->
...
...
@@ -40,11 +41,12 @@
<
template
v-slot:title
>
{{
$t
(
'
test_track.test_plan
'
)
}}
</
template
>
<recent-test-plan/>
<el-divider/>
<el-menu-item
:index=
"'/track/plan/all'
"
>
<el-menu-item
index=
"/track/plan/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=
"'/track/plan/create'"
>
<el-menu-item
:index=
"testPlanViewPath"
class=
"blank_item"
></el-menu-item>
<el-menu-item
index=
"/track/plan/create"
>
<el-button
type=
"text"
>
{{$t('test_track.create_plan')}}
</el-button>
</el-menu-item>
</el-submenu>
...
...
@@ -53,7 +55,6 @@
</div>
</template>
<
script
>
import
{
checkoutCurrentWorkspace
}
from
"
../../../../common/utils
"
;
...
...
@@ -62,25 +63,45 @@
import
RecentTestPlan
from
"
../plan/components/RecentTestPlan
"
;
export
default
{
name
:
"
Ms
Menus
"
,
name
:
"
TrackHeader
Menus
"
,
components
:
{
RecentTestCase
,
TrackRecentProject
,
RecentTestPlan
},
data
()
{
return
{
isCurrentWorkspaceUser
:
false
,
testPlanViewPath
:
''
,
isRouterAlive
:
true
,
testCaseEditPath
:
''
}
},
props
:
{
beaseUrl
:
{
type
:
String
watch
:
{
'
$route
'
(
to
,
from
)
{
let
path
=
to
.
path
;
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
){
this
.
testCaseEditPath
=
'
/track/case/edit/
'
+
this
.
$route
.
params
.
caseId
;
this
.
reload
();
}
}
},
mounted
()
{
this
.
isCurrentWorkspaceUser
=
checkoutCurrentWorkspace
();
},
methods
:
{
reload
()
{
this
.
isRouterAlive
=
false
;
this
.
$nextTick
(
function
()
{
this
.
isRouterAlive
=
true
;
})
}
}
}
</
script
>
<
style
>
.header-menu.el-menu--horizontal
>
li
{
...
...
@@ -100,6 +121,8 @@
margin-left
:
20%
;
}
</
style
>
<
style
scoped
>
...
...
@@ -109,4 +132,8 @@
#menu-bar
{
border-bottom
:
1px
solid
#E6E6E6
;
}
.blank_item
{
display
:
none
;
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录