Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
78c82517
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,发现更多精彩内容 >>
提交
78c82517
编写于
4月 09, 2020
作者:
C
chenjianxing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改测试用例head
上级
d60dc5ec
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
122 addition
and
213 deletion
+122
-213
backend/src/main/java/io/metersphere/controller/ProjectController.java
...ain/java/io/metersphere/controller/ProjectController.java
+5
-0
backend/src/main/java/io/metersphere/controller/TestCaseController.java
...in/java/io/metersphere/controller/TestCaseController.java
+1
-1
backend/src/main/java/io/metersphere/service/ProjectService.java
.../src/main/java/io/metersphere/service/ProjectService.java
+4
-0
backend/src/main/java/io/metersphere/service/TestCaseService.java
...src/main/java/io/metersphere/service/TestCaseService.java
+2
-4
frontend/src/business/components/track/case/TestCase.vue
frontend/src/business/components/track/case/TestCase.vue
+35
-18
frontend/src/business/components/track/case/components/RecentTestCase.vue
...iness/components/track/case/components/RecentTestCase.vue
+0
-42
frontend/src/business/components/track/head/TrackHeaderMenus.vue
...d/src/business/components/track/head/TrackHeaderMenus.vue
+75
-53
frontend/src/business/components/track/plan/components/RecentTestPlan.vue
...iness/components/track/plan/components/RecentTestPlan.vue
+0
-42
frontend/src/business/components/track/project/TrackRecentProject.vue
.../business/components/track/project/TrackRecentProject.vue
+0
-53
未找到文件。
backend/src/main/java/io/metersphere/controller/ProjectController.java
浏览文件 @
78c82517
...
...
@@ -42,6 +42,11 @@ public class ProjectController {
return
projectService
.
getRecentProjectList
(
request
);
}
@GetMapping
(
"/get/{id}"
)
public
Project
getProject
(
@PathVariable
String
id
)
{
return
projectService
.
getProjectById
(
id
);
}
@PostMapping
(
"/add"
)
@RequiresRoles
(
RoleConstants
.
TEST_MANAGER
)
public
Project
addProject
(
@RequestBody
Project
project
)
{
...
...
backend/src/main/java/io/metersphere/controller/TestCaseController.java
浏览文件 @
78c82517
...
...
@@ -50,7 +50,7 @@ public class TestCaseController {
}
@GetMapping
(
"/get/{testCaseId}"
)
public
List
<
TestCaseWithBLOBs
>
getTestCase
(
@PathVariable
String
testCaseId
){
public
TestCaseWithBLOBs
getTestCase
(
@PathVariable
String
testCaseId
){
return
testCaseService
.
getTestCase
(
testCaseId
);
}
...
...
backend/src/main/java/io/metersphere/service/ProjectService.java
浏览文件 @
78c82517
...
...
@@ -74,4 +74,8 @@ public class ProjectService {
example
.
setOrderByClause
(
"update_time desc"
);
return
projectMapper
.
selectByExample
(
example
);
}
public
Project
getProjectById
(
String
id
)
{
return
projectMapper
.
selectByPrimaryKey
(
id
);
}
}
backend/src/main/java/io/metersphere/service/TestCaseService.java
浏览文件 @
78c82517
...
...
@@ -54,10 +54,8 @@ public class TestCaseService {
return
testCaseMapper
.
selectByExample
(
testCaseExample
);
}
public
List
<
TestCaseWithBLOBs
>
getTestCase
(
String
testCaseId
)
{
TestCaseExample
testCaseExample
=
new
TestCaseExample
();
testCaseExample
.
createCriteria
().
andIdEqualTo
(
testCaseId
);
return
testCaseMapper
.
selectByExampleWithBLOBs
(
testCaseExample
);
public
TestCaseWithBLOBs
getTestCase
(
String
testCaseId
)
{
return
testCaseMapper
.
selectByPrimaryKey
(
testCaseId
);
}
public
int
editTestCase
(
TestCaseWithBLOBs
testCase
)
{
...
...
frontend/src/business/components/track/case/TestCase.vue
浏览文件 @
78c82517
...
...
@@ -52,7 +52,6 @@
data
()
{
return
{
result
:
{},
projectId
:
null
,
tableData
:
[],
multipleSelection
:
[],
currentPage
:
1
,
...
...
@@ -67,15 +66,19 @@
this
.
getProjects
();
},
mounted
()
{
if
(
this
.
$route
.
params
.
projectId
){
this
.
getProjectById
(
this
.
$route
.
params
.
projectId
)
}
if
(
this
.
$route
.
path
.
indexOf
(
"
/track/case/edit
"
)
>=
0
){
this
.
openRecentTestCaseEditDialog
();
this
.
$router
.
push
(
'
/track/case/all
'
);
}
},
watch
:
{
'
$route
'
(
to
,
from
)
{
let
path
=
to
.
path
;
if
(
path
.
indexOf
(
"
/track/case/all
"
)
>=
0
){
this
.
refresh
();
if
(
to
.
params
.
projectId
){
this
.
getProjectById
(
to
.
params
.
projectId
)
}
if
(
path
.
indexOf
(
"
/track/case/edit
"
)
>=
0
){
this
.
openRecentTestCaseEditDialog
();
...
...
@@ -87,9 +90,9 @@
getProjects
()
{
this
.
$get
(
"
/project/listAll
"
,
(
response
)
=>
{
this
.
projects
=
response
.
data
;
if
(
localStorage
.
getItem
(
CURRENT_PROJECT
))
{
let
lastProject
=
JSON
.
parse
(
localStorage
.
getItem
(
CURRENT_PROJECT
));
let
hasCurrentProject
=
false
;
let
lastProject
=
JSON
.
parse
(
localStorage
.
getItem
(
CURRENT_PROJECT
));
if
(
lastProject
)
{
let
hasCurrentProject
=
false
;
for
(
let
i
=
0
;
i
<
this
.
projects
.
length
;
i
++
)
{
if
(
this
.
projects
[
i
].
id
==
lastProject
.
id
)
{
this
.
currentProject
=
lastProject
;
...
...
@@ -100,14 +103,9 @@
if
(
!
hasCurrentProject
)
{
this
.
currentProject
=
null
;
}
if
(
this
.
projects
.
length
>
0
){
this
.
currentProject
=
this
.
projects
[
0
];
localStorage
.
setItem
(
CURRENT_PROJECT
,
JSON
.
stringify
(
this
.
projects
[
0
]));
}
}
else
{
if
(
this
.
projects
.
length
>
0
){
this
.
currentProject
=
this
.
projects
[
0
];
localStorage
.
setItem
(
CURRENT_PROJECT
,
JSON
.
stringify
(
this
.
projects
[
0
]));
this
.
setCurrentProject
(
this
.
projects
[
0
]);
}
}
// this.checkProject();
...
...
@@ -124,8 +122,7 @@
}
},
changeProject
(
project
)
{
this
.
currentProject
=
project
;
localStorage
.
setItem
(
CURRENT_PROJECT
,
JSON
.
stringify
(
project
));
this
.
setCurrentProject
(
project
);
},
refreshTable
(
data
)
{
this
.
$refs
.
testCaseList
.
initTableData
(
data
);
...
...
@@ -161,8 +158,7 @@
},
getProjectByCaseId
(
caseId
)
{
return
this
.
$get
(
'
/test/case/project/
'
+
caseId
,
async
response
=>
{
localStorage
.
setItem
(
CURRENT_PROJECT
,
JSON
.
stringify
(
response
.
data
));
this
.
refresh
();
this
.
setCurrentProject
(
response
.
data
);
});
},
refresh
()
{
...
...
@@ -173,11 +169,32 @@
openRecentTestCaseEditDialog
()
{
let
caseId
=
this
.
$route
.
params
.
caseId
;
this
.
getProjectByCaseId
(
caseId
);
this
.
refresh
();
//
this.refresh();
this
.
$get
(
'
/test/case/get/
'
+
caseId
,
response
=>
{
this
.
openTestCaseEditDialog
(
response
.
data
[
0
]);
if
(
response
.
data
)
{
this
.
openTestCaseEditDialog
(
response
.
data
);
}
});
},
getProjectById
(
id
)
{
if
(
id
&&
id
!=
'
all
'
){
this
.
$get
(
'
/project/get/
'
+
id
,
response
=>
{
let
project
=
response
.
data
;
this
.
setCurrentProject
(
project
);
});
}
if
(
id
===
'
all
'
)
{
this
.
refresh
();
}
},
setCurrentProject
(
project
)
{
if
(
project
)
{
this
.
currentProject
=
project
;
localStorage
.
setItem
(
CURRENT_PROJECT
,
JSON
.
stringify
(
project
));
}
this
.
refresh
();
}
}
}
</
script
>
...
...
frontend/src/business/components/track/case/components/RecentTestCase.vue
已删除
100644 → 0
浏览文件 @
d60dc5ec
<
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 recentTestCases"
:index=
"'/track/case/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
:
"
RecentTestCase
"
,
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
(
'
/test/case/recent/5
'
,
(
response
)
=>
{
this
.
recentTestCases
=
response
.
data
;
});
}
},
data
()
{
return
{
recentTestCases
:
[]
}
}
}
</
script
>
<
style
scoped
>
.recent-text
{
padding-left
:
10%
;
color
:
#777777
;
}
</
style
>
frontend/src/business/components/track/head/TrackHeaderMenus.vue
浏览文件 @
78c82517
<
template
>
<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'"
>
{{
$t
(
"
i18n.home
"
)
}}
</el-menu-item>
<el-submenu
v-if=
"isCurrentWorkspaceUser"
index=
"3"
popper-class=
"submenu"
v-permission=
"['test_manager']"
>
<template
v-slot:title
>
{{
$t
(
'
commons.project
'
)
}}
</
template
>
<track-recent-project/>
<el-divider/>
<el-menu-item
:index=
"'/track/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=
"'/track/project/create'"
>
<el-button
type=
"text"
>
{{$t('project.create')}}
</el-button>
</el-menu-item>
</el-submenu>
<el-submenu
v-if=
"isCurrentWorkspaceUser"
index=
"6"
popper-class=
"submenu"
v-permission=
"['test_manager', 'test_user']"
>
<
template
v-slot:title
>
{{
$t
(
'
test_track.test_case
'
)
}}
</
template
>
<recent-test-case/>
<el-divider/>
<el-menu-item
:index=
"'/track/case/all'"
>
<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-submenu>
<el-submenu
v-if=
"isCurrentWorkspaceUser"
index=
"7"
popper-class=
"submenu"
v-permission=
"['test_manager', 'test_user', 'test_viewer']"
>
<
template
v-slot:title
>
{{
$t
(
'
test_track.test_plan
'
)
}}
</
template
>
<recent-test-plan/>
<el-divider/>
<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=
"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>
</el-menu>
<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=
"'/track/home'"
>
{{
$t
(
"
i18n.home
"
)
}}
</el-menu-item>
<el-submenu
v-if=
"isCurrentWorkspaceUser"
index=
"3"
popper-class=
"submenu"
v-permission=
"['test_manager']"
>
<template
v-slot:title
>
{{
$t
(
'
commons.project
'
)
}}
</
template
>
<ms-recent-list
:options=
"projectRecent"
/>
<el-divider/>
<ms-show-all
:index=
"'/track/project/all'"
/>
<ms-create-button
:index=
"'/track/project/create'"
:title=
"$t('project.create')"
/>
</el-submenu>
<el-submenu
v-if=
"isCurrentWorkspaceUser"
index=
"6"
popper-class=
"submenu"
v-permission=
"['test_manager', 'test_user']"
>
<
template
v-slot:title
>
{{
$t
(
'
test_track.test_case
'
)
}}
</
template
>
<ms-recent-list
:options=
"testRecent"
/>
<el-divider/>
<ms-show-all
:index=
"'/track/case/all'"
/>
<el-menu-item
:index=
"testCaseEditPath"
class=
"blank_item"
></el-menu-item>
</el-submenu>
<el-submenu
v-if=
"isCurrentWorkspaceUser"
index=
"7"
popper-class=
"submenu"
v-permission=
"['test_manager', 'test_user', 'test_viewer']"
>
<
template
v-slot:title
>
{{
$t
(
'
test_track.test_plan
'
)
}}
</
template
>
<ms-recent-list
:options=
"planRecent"
/>
<el-divider/>
<ms-show-all
:index=
"'/track/plan/all'"
/>
<el-menu-item
:index=
"testPlanViewPath"
class=
"blank_item"
></el-menu-item>
<ms-create-button
:index=
"'/track/plan/create'"
:title=
"$t('project.create')"
/>
</el-submenu>
</el-menu>
</el-col>
</el-row>
</div>
</template>
<
script
>
import
{
checkoutCurrentWorkspace
}
from
"
../../../../common/utils
"
;
import
TrackRecentProject
from
"
../../track/project/TrackRecentProject
"
;
import
RecentTestCase
from
"
../case/components/RecentTestCase
"
;
import
RecentTestPlan
from
"
../plan/components/RecentTestPlan
"
;
import
MsShowAll
from
"
../../common/head/ShowAll
"
;
import
MsRecentList
from
"
../../common/head/RecentList
"
;
import
MsCreateButton
from
"
../../common/head/CreateButton
"
;
export
default
{
name
:
"
TrackHeaderMenus
"
,
components
:
{
RecentTestCase
,
TrackRecentProject
,
RecentTestPla
n
},
components
:
{
MsShowAll
,
MsRecentList
,
MsCreateButto
n
},
data
()
{
return
{
isCurrentWorkspaceUser
:
false
,
testPlanViewPath
:
''
,
isRouterAlive
:
true
,
testCaseEditPath
:
''
testCaseEditPath
:
''
,
projectRecent
:
{
title
:
this
.
$t
(
'
project.recent
'
),
url
:
"
/project/recent/5
"
,
index
:
function
(
item
)
{
return
'
/track/case/
'
+
item
.
id
;
},
router
:
function
(
item
)
{
return
{
name
:
'
testCase
'
,
params
:
{
projectId
:
item
.
id
,
projectName
:
item
.
name
}}
}
},
testRecent
:
{
title
:
this
.
$t
(
'
load_test.recent
'
),
url
:
"
/test/case/recent/5
"
,
index
:
function
(
item
)
{
return
'
/track/case/edit/
'
+
item
.
id
;
},
router
:
function
(
item
)
{}
},
planRecent
:
{
title
:
this
.
$t
(
'
report.recent
'
),
url
:
"
/test/plan/recent/5
"
,
index
:
function
(
item
)
{
return
'
/track/plan/view/
'
+
item
.
id
;
},
router
:
function
(
item
)
{}
}
}
},
watch
:
{
...
...
@@ -133,4 +151,8 @@
.blank_item
{
display
:
none
;
}
.el-divider--horizontal
{
margin
:
0
;
}
</
style
>
frontend/src/business/components/track/plan/components/RecentTestPlan.vue
已删除
100644 → 0
浏览文件 @
d60dc5ec
<
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=
"'/track/plan/view/' + 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
:
"
RecentTestPlan
"
,
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
(
'
/test/plan/recent/5
'
,
(
response
)
=>
{
this
.
recentTestPlans
=
response
.
data
;
});
}
},
data
()
{
return
{
recentTestPlans
:
[]
}
}
}
</
script
>
<
style
scoped
>
.recent-text
{
padding-left
:
10%
;
color
:
#777777
;
}
</
style
>
frontend/src/business/components/track/project/TrackRecentProject.vue
已删除
100644 → 0
浏览文件 @
d60dc5ec
<
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"
@
click=
"routeToTestCase(p)"
>
{{
p
.
name
}}
</el-menu-item>
</el-menu>
</
template
>
<
script
>
import
{
ROLE_TEST_MANAGER
,
ROLE_TEST_USER
,
ROLE_TEST_VIEWER
,
CURRENT_PROJECT
}
from
"
../../../../common/constants
"
;
import
{
hasRoles
}
from
"
../../../../common/utils
"
;
export
default
{
name
:
"
TrackRecentProject
"
,
mounted
()
{
if
(
hasRoles
(
ROLE_TEST_VIEWER
,
ROLE_TEST_USER
,
ROLE_TEST_MANAGER
))
{
this
.
$get
(
'
/project/recent/5
'
,
(
response
)
=>
{
this
.
recentProjects
=
response
.
data
;
});
}
},
data
()
{
return
{
recentProjects
:
[],
}
},
methods
:
{
routeToTestCase
(
project
)
{
localStorage
.
setItem
(
CURRENT_PROJECT
,
JSON
.
stringify
(
project
));
if
(
this
.
$router
.
currentRoute
.
path
===
'
/track/case/all
'
){
this
.
$router
.
go
(
0
);
}
else
{
this
.
$router
.
push
(
"
/track/case/all
"
);
}
}
}
}
</
script
>
<
style
scoped
>
.recent-text
{
padding-left
:
10%
;
color
:
#777777
;
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录