Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
331be7d4
Commit
331be7d4
authored
Sep 14, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add permission fixes
parent
776d8118
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
11 deletions
+41
-11
public/app/core/components/PermissionList/AddPermission.tsx
+16
-10
public/app/features/dashboard/state/reducers.test.ts
+24
-0
public/app/types/acl.ts
+1
-1
No files found.
public/app/core/components/PermissionList/AddPermission.tsx
View file @
331be7d4
...
...
@@ -26,28 +26,34 @@ class AddPermissions extends Component<Props, NewDashboardAclItem> {
return
{
userId
:
0
,
teamId
:
0
,
role
:
OrgRole
.
Viewer
,
type
:
AclTarget
.
Team
,
permission
:
PermissionLevel
.
View
,
};
}
onTypeChanged
=
evt
=>
{
this
.
setState
({
type
:
evt
.
target
.
value
as
AclTarget
});
const
type
=
evt
.
target
.
value
as
AclTarget
;
switch
(
type
)
{
case
AclTarget
.
User
:
case
AclTarget
.
Team
:
this
.
setState
({
type
:
type
,
userId
:
0
,
teamId
:
0
,
role
:
undefined
});
break
;
case
AclTarget
.
Editor
:
this
.
setState
({
type
:
type
,
userId
:
0
,
teamId
:
0
,
role
:
OrgRole
.
Editor
});
break
;
case
AclTarget
.
Viewer
:
this
.
setState
({
type
:
type
,
userId
:
0
,
teamId
:
0
,
role
:
OrgRole
.
Viewer
});
break
;
}
};
onUserSelected
=
(
user
:
User
)
=>
{
this
.
setState
({
userId
:
user
?
user
.
id
:
0
,
teamId
:
0
,
});
this
.
setState
({
userId
:
user
?
user
.
id
:
0
});
};
onTeamSelected
=
(
team
:
Team
)
=>
{
this
.
setState
({
userId
:
0
,
teamId
:
team
?
team
.
id
:
0
,
});
this
.
setState
({
teamId
:
team
?
team
.
id
:
0
});
};
onPermissionChanged
=
(
permission
:
OptionWithDescription
)
=>
{
...
...
public/app/features/dashboard/state/reducers.test.ts
0 → 100644
View file @
331be7d4
import
{
Action
,
ActionTypes
}
from
'./actions'
;
import
{
OrgRole
,
PermissionLevel
,
DashboardState
}
from
'app/types'
;
import
{
inititalState
,
dashboardReducer
}
from
'./reducers'
;
describe
(
'dashboard reducer'
,
()
=>
{
describe
(
'loadDashboardPermissions'
,
()
=>
{
let
state
:
DashboardState
;
beforeEach
(()
=>
{
const
action
:
Action
=
{
type
:
ActionTypes
.
LoadDashboardPermissions
,
payload
:
[
{
id
:
2
,
dashboardId
:
1
,
role
:
OrgRole
.
Viewer
,
permission
:
PermissionLevel
.
View
},
{
id
:
3
,
dashboardId
:
1
,
role
:
OrgRole
.
Editor
,
permission
:
PermissionLevel
.
Edit
},
],
};
state
=
dashboardReducer
(
inititalState
,
action
);
});
it
(
'should add permissions to state'
,
async
()
=>
{
expect
(
state
.
permissions
.
length
).
toBe
(
2
);
});
});
});
public/app/types/acl.ts
View file @
331be7d4
...
...
@@ -50,7 +50,7 @@ export interface DashboardPermissionInfo {
export
interface
NewDashboardAclItem
{
teamId
:
number
;
userId
:
number
;
role
:
OrgRole
;
role
?
:
OrgRole
;
permission
:
PermissionLevel
;
type
:
AclTarget
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment