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
d36efddc
Unverified
Commit
d36efddc
authored
Apr 24, 2018
by
Marcus Efraimsson
Committed by
GitHub
Apr 24, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11699 from grafana/11466-edit-row
fixed so user who can edit dashboard can edit row
parents
00555663
38a4a2dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
public/app/features/dashboard/dashgrid/DashboardRow.tsx
+1
-2
public/app/features/dashboard/specs/DashboardRow.jest.tsx
+6
-8
No files found.
public/app/features/dashboard/dashgrid/DashboardRow.tsx
View file @
d36efddc
...
...
@@ -4,7 +4,6 @@ import { PanelModel } from '../panel_model';
import
{
PanelContainer
}
from
'./PanelContainer'
;
import
templateSrv
from
'app/features/templating/template_srv'
;
import
appEvents
from
'app/core/app_events'
;
import
config
from
'app/core/config'
;
export
interface
DashboardRowProps
{
panel
:
PanelModel
;
...
...
@@ -95,7 +94,7 @@ export class DashboardRow extends React.Component<DashboardRowProps, any> {
{
title
}
<
span
className=
"dashboard-row__panel_count"
>
(
{
hiddenPanels
}
hidden panels)
</
span
>
</
a
>
{
config
.
bootData
.
user
.
orgRole
!==
'Viewer'
&&
(
{
this
.
dashboard
.
meta
.
canEdit
===
true
&&
(
<
div
className=
"dashboard-row__actions"
>
<
a
className=
"pointer"
onClick=
{
this
.
openSettings
}
>
<
i
className=
"fa fa-cog"
/>
...
...
public/app/features/dashboard/specs/DashboardRow.jest.tsx
View file @
d36efddc
...
...
@@ -2,17 +2,15 @@ import React from 'react';
import
{
shallow
}
from
'enzyme'
;
import
{
DashboardRow
}
from
'../dashgrid/DashboardRow'
;
import
{
PanelModel
}
from
'../panel_model'
;
import
config
from
'../../../core/config'
;
describe
(
'DashboardRow'
,
()
=>
{
let
wrapper
,
panel
,
getPanelContainer
,
dashboardMock
;
beforeEach
(()
=>
{
dashboardMock
=
{
toggleRow
:
jest
.
fn
()
};
config
.
bootData
=
{
user
:
{
orgRole
:
'Admin'
,
dashboardMock
=
{
toggleRow
:
jest
.
fn
(),
meta
:
{
canEdit
:
true
,
},
};
...
...
@@ -41,8 +39,8 @@ describe('DashboardRow', () => {
expect
(
wrapper
.
find
(
'.dashboard-row__actions .pointer'
)).
toHaveLength
(
2
);
});
it
(
'should have zero actions
as viewer
'
,
()
=>
{
config
.
bootData
.
user
.
orgRole
=
'Viewer'
;
it
(
'should have zero actions
when cannot edit
'
,
()
=>
{
dashboardMock
.
meta
.
canEdit
=
false
;
panel
=
new
PanelModel
({
collapsed
:
false
});
wrapper
=
shallow
(<
DashboardRow
panel=
{
panel
}
getPanelContainer=
{
getPanelContainer
}
/>);
expect
(
wrapper
.
find
(
'.dashboard-row__actions .pointer'
)).
toHaveLength
(
0
);
...
...
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