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
36d67f22
Commit
36d67f22
authored
Mar 13, 2019
by
ryan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generic repeater
parent
4bbd6ab7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
packages/grafana-ui/src/components/VizRepeater/VizRepeater.tsx
+9
-9
public/app/plugins/panel/bargauge/BarGaugePanel.tsx
+1
-1
public/app/plugins/panel/gauge/GaugePanel.tsx
+1
-1
No files found.
packages/grafana-ui/src/components/VizRepeater/VizRepeater.tsx
View file @
36d67f22
import
React
,
{
PureComponent
}
from
'react'
;
import
{
SingleStatValueInfo
,
VizOrientation
}
from
'../../types'
;
import
{
VizOrientation
}
from
'../../types'
;
interface
RenderProps
{
interface
RenderProps
<
T
>
{
vizWidth
:
number
;
vizHeight
:
number
;
value
Info
:
SingleStatValueInfo
;
value
:
T
;
}
interface
Props
{
children
:
(
renderProps
:
RenderProps
)
=>
JSX
.
Element
|
JSX
.
Element
[];
interface
Props
<
T
>
{
children
:
(
renderProps
:
RenderProps
<
T
>
)
=>
JSX
.
Element
|
JSX
.
Element
[];
height
:
number
;
width
:
number
;
values
:
SingleStatValueInfo
[];
values
:
T
[];
orientation
:
VizOrientation
;
}
const
SPACE_BETWEEN
=
10
;
export
class
VizRepeater
extends
PureComponent
<
Props
>
{
export
class
VizRepeater
<
T
>
extends
PureComponent
<
Props
<
T
>
>
{
getOrientation
():
VizOrientation
{
const
{
orientation
,
width
,
height
}
=
this
.
props
;
...
...
@@ -64,10 +64,10 @@ export class VizRepeater extends PureComponent<Props> {
return
(
<
div
style=
{
repeaterStyle
}
>
{
values
.
map
((
value
Info
,
index
)
=>
{
{
values
.
map
((
value
,
index
)
=>
{
return
(
<
div
key=
{
index
}
style=
{
itemStyles
}
>
{
children
({
vizHeight
,
vizWidth
,
value
Info
})
}
{
children
({
vizHeight
,
vizWidth
,
value
})
}
</
div
>
);
})
}
...
...
public/app/plugins/panel/bargauge/BarGaugePanel.tsx
View file @
36d67f22
...
...
@@ -49,7 +49,7 @@ export class BarGaugePanel extends PureComponent<Props> {
return
(
<
VizRepeater
height=
{
height
}
width=
{
width
}
values=
{
values
}
orientation=
{
options
.
orientation
}
>
{
({
vizHeight
,
vizWidth
,
value
Info
})
=>
this
.
renderBarGauge
(
valueInfo
.
value
,
vizWidth
,
vizHeight
)
}
{
({
vizHeight
,
vizWidth
,
value
})
=>
this
.
renderBarGauge
(
value
,
vizWidth
,
vizHeight
)
}
</
VizRepeater
>
);
}
...
...
public/app/plugins/panel/gauge/GaugePanel.tsx
View file @
36d67f22
...
...
@@ -52,7 +52,7 @@ export class GaugePanel extends PureComponent<Props> {
return
(
<
VizRepeater
height=
{
height
}
width=
{
width
}
values=
{
values
}
orientation=
{
VizOrientation
.
Auto
}
>
{
({
vizHeight
,
vizWidth
,
value
Info
})
=>
this
.
renderGauge
(
valueInfo
.
value
,
vizWidth
,
vizHeight
)
}
{
({
vizHeight
,
vizWidth
,
value
})
=>
this
.
renderGauge
(
value
,
vizWidth
,
vizHeight
)
}
</
VizRepeater
>
);
}
...
...
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