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
01208ccd
Commit
01208ccd
authored
Feb 12, 2019
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: Rename renderHelper > renderDataPanel and move logic to smaller functions
parent
b5dbf26d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
17 deletions
+28
-17
public/app/features/dashboard/dashgrid/PanelChrome.tsx
+28
-17
No files found.
public/app/features/dashboard/dashgrid/PanelChrome.tsx
View file @
01208ccd
...
@@ -94,6 +94,25 @@ export class PanelChrome extends PureComponent<Props, State> {
...
@@ -94,6 +94,25 @@ export class PanelChrome extends PureComponent<Props, State> {
return
!
this
.
props
.
dashboard
.
otherPanelInFullscreen
(
this
.
props
.
panel
);
return
!
this
.
props
.
dashboard
.
otherPanelInFullscreen
(
this
.
props
.
panel
);
}
}
get
hasPanelSnapshot
()
{
const
{
panel
}
=
this
.
props
;
return
panel
.
snapshotData
&&
panel
.
snapshotData
.
length
;
}
get
hasDataPanel
()
{
return
!
this
.
props
.
plugin
.
noQueries
&&
!
this
.
hasPanelSnapshot
;
}
get
getDataForPanel
()
{
const
{
panel
,
plugin
}
=
this
.
props
;
if
(
plugin
.
noQueries
)
{
return
null
;
}
return
this
.
hasPanelSnapshot
?
snapshotDataToPanelData
(
panel
)
:
null
;
}
renderPanelPlugin
(
loading
:
LoadingState
,
panelData
:
PanelData
,
width
:
number
,
height
:
number
):
JSX
.
Element
{
renderPanelPlugin
(
loading
:
LoadingState
,
panelData
:
PanelData
,
width
:
number
,
height
:
number
):
JSX
.
Element
{
const
{
panel
,
plugin
}
=
this
.
props
;
const
{
panel
,
plugin
}
=
this
.
props
;
const
{
timeRange
,
renderCounter
}
=
this
.
state
;
const
{
timeRange
,
renderCounter
}
=
this
.
state
;
...
@@ -121,20 +140,14 @@ export class PanelChrome extends PureComponent<Props, State> {
...
@@ -121,20 +140,14 @@ export class PanelChrome extends PureComponent<Props, State> {
);
);
}
}
render
Helper
=
(
width
:
number
,
height
:
number
):
JSX
.
Element
=>
{
render
DataPanel
=
(
width
:
number
,
height
:
number
):
JSX
.
Element
=>
{
const
{
panel
,
plugin
}
=
this
.
props
;
const
{
panel
}
=
this
.
props
;
const
{
refreshCounter
,
timeRange
}
=
this
.
state
;
const
{
refreshCounter
,
timeRange
}
=
this
.
state
;
const
{
datasource
,
targets
}
=
panel
;
const
{
datasource
,
targets
}
=
panel
;
return
(
return
(
<>
<>
{
panel
.
snapshotData
&&
panel
.
snapshotData
.
length
>
0
?
(
{
this
.
hasDataPanel
?
(
this
.
renderPanelPlugin
(
LoadingState
.
Done
,
snapshotDataToPanelData
(
panel
),
width
,
height
)
<
DataPanel
)
:
(
<>
{
plugin
.
noQueries
?
this
.
renderPanelPlugin
(
LoadingState
.
Done
,
null
,
width
,
height
)
:
(
<
DataPanel
panelId=
{
panel
.
id
}
panelId=
{
panel
.
id
}
datasource=
{
datasource
}
datasource=
{
datasource
}
queries=
{
targets
}
queries=
{
targets
}
...
@@ -142,20 +155,18 @@ export class PanelChrome extends PureComponent<Props, State> {
...
@@ -142,20 +155,18 @@ export class PanelChrome extends PureComponent<Props, State> {
isVisible=
{
this
.
isVisible
}
isVisible=
{
this
.
isVisible
}
widthPixels=
{
width
}
widthPixels=
{
width
}
refreshCounter=
{
refreshCounter
}
refreshCounter=
{
refreshCounter
}
onDataResponse=
{
this
.
onDataResponse
}
onDataResponse=
{
this
.
onDataResponse
}
>
>
{
({
loading
,
panelData
})
=>
{
{
({
loading
,
panelData
})
=>
{
return
this
.
renderPanelPlugin
(
loading
,
panelData
,
width
,
height
);
return
this
.
renderPanelPlugin
(
loading
,
panelData
,
width
,
height
);
}
}
}
}
</
DataPanel
>
</
DataPanel
>
)
}
)
:
(
</>
this
.
renderPanelPlugin
(
LoadingState
.
Done
,
this
.
getDataForPanel
,
width
,
height
)
)
}
)
}
</>
</>
);
);
}
}
render
()
{
render
()
{
const
{
dashboard
,
panel
}
=
this
.
props
;
const
{
dashboard
,
panel
}
=
this
.
props
;
const
{
timeInfo
}
=
this
.
state
;
const
{
timeInfo
}
=
this
.
state
;
...
@@ -180,7 +191,7 @@ export class PanelChrome extends PureComponent<Props, State> {
...
@@ -180,7 +191,7 @@ export class PanelChrome extends PureComponent<Props, State> {
scopedVars=
{
panel
.
scopedVars
}
scopedVars=
{
panel
.
scopedVars
}
links=
{
panel
.
links
}
links=
{
panel
.
links
}
/>
/>
{
this
.
render
Helper
(
width
,
height
)
}
{
this
.
render
DataPanel
(
width
,
height
)
}
</
div
>
</
div
>
);
);
}
}
}
}
...
...
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