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
1df4f711
Unverified
Commit
1df4f711
authored
Jul 24, 2020
by
Torkel Ödegaard
Committed by
GitHub
Jul 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dashboard: Restore panel edit permission check, fixes 26555' (#26556)
parent
a94745af
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
public/app/features/dashboard/containers/DashboardPage.test.tsx
+14
-0
public/app/features/dashboard/containers/DashboardPage.tsx
+6
-0
No files found.
public/app/features/dashboard/containers/DashboardPage.test.tsx
View file @
1df4f711
...
...
@@ -139,6 +139,20 @@ describe('DashboardPage', () => {
});
});
dashboardPageScenario
(
'When user goes into panel edit but has no edit permissions'
,
ctx
=>
{
ctx
.
setup
(()
=>
{
ctx
.
mount
();
ctx
.
setDashboardProp
({},
{
canEdit
:
false
});
ctx
.
wrapper
?.
setProps
({
urlEditPanelId
:
'1'
,
});
});
it
(
'Should update component state to fullscreen and edit'
,
()
=>
{
const
state
=
ctx
.
wrapper
?.
state
();
expect
(
state
?.
editPanel
).
toBe
(
null
);
});
});
dashboardPageScenario
(
'When user goes back to dashboard from view panel'
,
ctx
=>
{
ctx
.
setup
(()
=>
{
ctx
.
mount
();
...
...
public/app/features/dashboard/containers/DashboardPage.tsx
View file @
1df4f711
...
...
@@ -117,6 +117,12 @@ export class DashboardPage extends PureComponent<Props, State> {
// entering edit mode
if
(
!
editPanel
&&
urlEditPanelId
)
{
this
.
getPanelByIdFromUrlParam
(
urlEditPanelId
,
panel
=>
{
// if no edit permission show error
if
(
!
dashboard
.
canEditPanel
(
panel
))
{
this
.
props
.
notifyApp
(
createErrorNotification
(
'Permission to edit panel denied'
));
return
;
}
this
.
setState
({
editPanel
:
panel
});
});
}
...
...
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