Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
d9ee8e40
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,发现更多精彩内容 >>
提交
d9ee8e40
编写于
3月 06, 2020
作者:
C
Captain.B
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hasRoles
上级
0fd99a4d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
37 addition
and
55 deletion
+37
-55
frontend/src/common/utils.js
frontend/src/common/utils.js
+18
-0
frontend/src/performance/components/HeaderSetting.vue
frontend/src/performance/components/HeaderSetting.vue
+0
-33
frontend/src/performance/components/HeaderUser.vue
frontend/src/performance/components/HeaderUser.vue
+13
-13
frontend/src/performance/components/project/RecentProject.vue
...tend/src/performance/components/project/RecentProject.vue
+2
-3
frontend/src/performance/components/report/RecentReport.vue
frontend/src/performance/components/report/RecentReport.vue
+2
-3
frontend/src/performance/components/testPlan/RecentTestPlan.vue
...nd/src/performance/components/testPlan/RecentTestPlan.vue
+2
-3
未找到文件。
frontend/src/common/utils.js
0 → 100644
浏览文件 @
d9ee8e40
import
{
TokenKey
}
from
"
./constants
"
;
export
function
hasRole
(
role
)
{
let
user
=
JSON
.
parse
(
localStorage
.
getItem
(
TokenKey
));
let
roles
=
user
.
roles
.
map
(
r
=>
r
.
id
);
return
roles
.
indexOf
(
role
)
>
-
1
;
}
export
function
hasRoles
(...
roles
)
{
let
user
=
JSON
.
parse
(
localStorage
.
getItem
(
TokenKey
));
let
rs
=
user
.
roles
.
map
(
r
=>
r
.
id
);
for
(
let
item
of
roles
)
{
if
(
rs
.
indexOf
(
item
)
>
-
1
)
{
return
true
;
}
}
return
false
;
}
frontend/src/performance/components/HeaderSetting.vue
已删除
100644 → 0
浏览文件 @
0fd99a4d
<
template
>
<el-row
class=
"settings"
type=
"flex"
justify=
"end"
align=
"middle"
>
<router-link
to=
"/content"
>
<font-awesome-icon
:icon=
"['fas', 'user-plus']"
size=
"lg"
/>
</router-link>
<router-link
to=
"/setting"
>
<font-awesome-icon
:icon=
"['fas', 'cog']"
size=
"lg"
/>
</router-link>
</el-row>
</
template
>
<
script
>
export
default
{
name
:
"
MsSetting
"
}
</
script
>
<
style
scoped
>
.settings
>
*
{
padding-left
:
15px
;
cursor
:
pointer
;
line-height
:
40px
;
color
:
inherit
;
}
.settings
>
*
:hover
{
opacity
:
0.7
;
}
.settings
>
*
:active
{
opacity
:
0.8
;
}
</
style
>
frontend/src/performance/components/HeaderUser.vue
浏览文件 @
d9ee8e40
...
...
@@ -42,7 +42,8 @@
</template>
<
script
>
import
{
ROLE_TEST_MANAGER
,
ROLE_TEST_USER
,
ROLE_TEST_VIEWER
,
TokenKey
}
from
'
../../common/constants
'
;
import
{
ROLE_ORG_ADMIN
,
ROLE_TEST_MANAGER
,
ROLE_TEST_USER
,
ROLE_TEST_VIEWER
,
TokenKey
}
from
'
../../common/constants
'
;
import
{
hasRoles
}
from
"
../../common/utils
"
;
export
default
{
name
:
"
MsUser
"
,
...
...
@@ -89,18 +90,17 @@
}
},
initMenuData
()
{
let
roles
=
this
.
currentUser
.
roles
.
map
(
r
=>
r
.
id
);
// if (roles.indexOf(ROLE_ORG_ADMIN) > -1) {
this
.
$get
(
"
/organization/list/userorg/
"
+
this
.
currentUserId
,
response
=>
{
let
data
=
response
.
data
;
this
.
organizationList
=
data
;
let
org
=
data
.
filter
(
r
=>
r
.
id
===
this
.
currentUser
.
lastOrganizationId
);
if
(
org
.
length
>
0
)
{
this
.
currentOrganizationName
=
org
[
0
].
name
;
}
});
// }
if
(
roles
.
indexOf
(
ROLE_TEST_MANAGER
)
>
-
1
||
roles
.
indexOf
(
ROLE_TEST_USER
)
>
-
1
||
roles
.
indexOf
(
ROLE_TEST_VIEWER
)
>
-
1
)
{
if
(
hasRoles
(
ROLE_ORG_ADMIN
,
ROLE_TEST_VIEWER
,
ROLE_TEST_USER
,
ROLE_TEST_MANAGER
))
{
this
.
$get
(
"
/organization/list/userorg/
"
+
this
.
currentUserId
,
response
=>
{
let
data
=
response
.
data
;
this
.
organizationList
=
data
;
let
org
=
data
.
filter
(
r
=>
r
.
id
===
this
.
currentUser
.
lastOrganizationId
);
if
(
org
.
length
>
0
)
{
this
.
currentOrganizationName
=
org
[
0
].
name
;
}
});
}
if
(
hasRoles
(
ROLE_TEST_VIEWER
,
ROLE_TEST_USER
,
ROLE_TEST_MANAGER
))
{
if
(
!
this
.
currentUser
.
lastOrganizationId
)
{
return
false
;
}
...
...
frontend/src/performance/components/project/RecentProject.vue
浏览文件 @
d9ee8e40
...
...
@@ -15,14 +15,13 @@
<
script
>
import
{
ROLE_TEST_MANAGER
,
ROLE_TEST_USER
,
ROLE_TEST_VIEWER
}
from
"
../../../common/constants
"
;
import
{
hasRoles
}
from
"
../../../common/utils
"
;
export
default
{
name
:
"
MsRecentProject
"
,
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
)
{
if
(
hasRoles
(
ROLE_TEST_VIEWER
,
ROLE_TEST_USER
,
ROLE_TEST_MANAGER
)
)
{
this
.
$get
(
'
/project/recent/5
'
,
(
response
)
=>
{
this
.
recentProjects
=
response
.
data
;
});
...
...
frontend/src/performance/components/report/RecentReport.vue
浏览文件 @
d9ee8e40
...
...
@@ -13,14 +13,13 @@
<
script
>
import
{
ROLE_TEST_MANAGER
,
ROLE_TEST_USER
,
ROLE_TEST_VIEWER
}
from
"
../../../common/constants
"
;
import
{
hasRoles
}
from
"
../../../common/utils
"
;
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
)
{
if
(
hasRoles
(
ROLE_TEST_VIEWER
,
ROLE_TEST_USER
,
ROLE_TEST_MANAGER
)
)
{
this
.
$get
(
'
/report/recent/5
'
,
(
response
)
=>
{
this
.
recentReports
=
response
.
data
;
});
...
...
frontend/src/performance/components/testPlan/RecentTestPlan.vue
浏览文件 @
d9ee8e40
...
...
@@ -12,14 +12,13 @@
<
script
>
import
{
ROLE_TEST_MANAGER
,
ROLE_TEST_USER
,
ROLE_TEST_VIEWER
}
from
"
../../../common/constants
"
;
import
{
hasRoles
}
from
"
../../../common/utils
"
;
export
default
{
name
:
"
MsRecentTestPlan
"
,
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
)
{
if
(
hasRoles
(
ROLE_TEST_VIEWER
,
ROLE_TEST_USER
,
ROLE_TEST_MANAGER
)
)
{
this
.
$get
(
'
/testplan/recent/5
'
,
(
response
)
=>
{
this
.
recentTestPlans
=
response
.
data
;
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录