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
e4e41474
Commit
e4e41474
authored
Nov 14, 2018
by
Peter Holmberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first stuff
parent
f50dc4e9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
26 deletions
+85
-26
public/app/core/components/Picker/UnitPicker.tsx
+68
-0
public/app/features/dashboard/dashgrid/DataPanel.tsx
+1
-5
public/app/features/dashboard/dashgrid/PanelChrome.tsx
+0
-3
public/app/plugins/panel/gauge/module.tsx
+16
-2
public/app/viz/GaugeOptions.tsx
+0
-16
No files found.
public/app/core/components/Picker/UnitPicker.tsx
0 → 100644
View file @
e4e41474
import
React
,
{
PureComponent
}
from
'react'
;
import
Select
from
'react-select'
;
import
ResetStyles
from
'app/core/components/Picker/ResetStyles'
;
import
DescriptionOption
from
'./DescriptionOption'
;
import
kbn
from
'../../utils/kbn'
;
interface
Props
{
width
:
number
;
className
?:
string
;
onSelected
:
(
item
:
any
)
=>
{}
|
void
;
placeholder
?:
string
;
}
export
class
UnitPicker
extends
PureComponent
<
Props
>
{
formatGroupLabel
=
data
=>
{
console
.
log
(
'format'
,
data
);
const
groupStyles
=
{
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'space-between'
,
};
const
groupBadgeStyles
=
{
backgroundColor
:
'#EBECF0'
,
borderRadius
:
'2em'
,
color
:
'#172B4D'
,
display
:
'inline-block'
,
fontSize
:
12
,
fontWeight
:
400
,
lineHeight
:
'1'
,
minWidth
:
1
,
padding
:
'0.16666666666667em 0.5em'
,
textAlign
:
'center'
,
}
as
React
.
CSSProperties
;
return
(
<
div
style=
{
groupStyles
}
>
<
span
>
{
data
.
label
}
</
span
>
<
span
style=
{
groupBadgeStyles
}
>
{
data
.
submenu
.
length
}
</
span
>
</
div
>
);
};
render
()
{
const
{
className
,
onSelected
,
placeholder
,
width
}
=
this
.
props
;
const
options
=
kbn
.
getUnitFormats
();
return
(
<
Select
classNamePrefix=
"gf-form-select-box"
className=
{
`width-${width} gf-form-input gf-form-input--form-dropdown ${className || ''}`
}
components=
{
{
Option
:
DescriptionOption
,
}
}
getOptionLabel=
{
i
=>
i
.
text
}
getOptionValue=
{
i
=>
i
.
value
}
isSearchable=
{
false
}
onChange=
{
onSelected
}
options=
{
options
}
placeholder=
{
placeholder
||
'Choose'
}
styles=
{
ResetStyles
}
formatGroupLabel=
{
this
.
formatGroupLabel
}
/>
);
}
}
public/app/features/dashboard/dashgrid/DataPanel.tsx
View file @
e4e41474
...
...
@@ -48,10 +48,6 @@ export class DataPanel extends Component<Props, State> {
};
}
componentDidMount
()
{
console
.
log
(
'DataPanel mount'
);
}
async
componentDidUpdate
(
prevProps
:
Props
)
{
if
(
!
this
.
hasPropsChanged
(
prevProps
))
{
return
;
...
...
@@ -113,7 +109,7 @@ export class DataPanel extends Component<Props, State> {
render
()
{
const
{
response
,
loading
,
isFirstLoad
}
=
this
.
state
;
console
.
log
(
'data panel render'
);
const
timeSeries
=
response
.
data
;
if
(
isFirstLoad
&&
(
loading
===
LoadingState
.
Loading
||
loading
===
LoadingState
.
NotStarted
))
{
...
...
public/app/features/dashboard/dashgrid/PanelChrome.tsx
View file @
e4e41474
...
...
@@ -57,7 +57,6 @@ export class PanelChrome extends PureComponent<Props, State> {
};
onRender
=
()
=>
{
console
.
log
(
'onRender'
);
this
.
setState
(
prevState
=>
({
...
prevState
,
renderCounter
:
this
.
state
.
renderCounter
+
1
,
...
...
@@ -75,7 +74,6 @@ export class PanelChrome extends PureComponent<Props, State> {
const
{
datasource
,
targets
}
=
panel
;
const
PanelComponent
=
this
.
props
.
component
;
console
.
log
(
'panelChrome render'
);
return
(
<
div
className=
"panel-container"
>
<
PanelHeader
panel=
{
panel
}
dashboard=
{
dashboard
}
/>
...
...
@@ -88,7 +86,6 @@ export class PanelChrome extends PureComponent<Props, State> {
refreshCounter=
{
refreshCounter
}
>
{
({
loading
,
timeSeries
})
=>
{
console
.
log
(
'panelcrome inner render'
);
return
(
<
PanelComponent
loading=
{
loading
}
...
...
public/app/plugins/panel/gauge/module.tsx
View file @
e4e41474
import
React
,
{
PureComponent
}
from
'react'
;
import
Gauge
from
'app/viz/Gauge'
;
import
{
NullValueMode
,
PanelProps
}
from
'app/types'
;
import
{
NullValueMode
,
Panel
OptionsProps
,
Panel
Props
}
from
'app/types'
;
import
{
getTimeSeriesVMs
}
from
'app/viz/state/timeSeries'
;
import
{
UnitPicker
}
from
'../../../core/components/Picker/UnitPicker'
;
export
interface
Options
{}
...
...
@@ -20,4 +21,17 @@ export class GaugePanel extends PureComponent<Props> {
}
}
export
{
GaugePanel
as
PanelComponent
};
export
class
GaugeOptions
extends
PureComponent
<
PanelOptionsProps
<
Options
>>
{
render
()
{
return
(
<
div
>
<
div
className=
"section gf-form-group"
>
<
h5
className=
"page-heading"
>
Units
</
h5
>
<
UnitPicker
width=
{
20
}
onSelected=
{
()
=>
{}
}
/>
</
div
>
</
div
>
);
}
}
export
{
GaugePanel
as
PanelComponent
,
GaugeOptions
as
PanelOptionsComponent
};
public/app/viz/GaugeOptions.tsx
deleted
100644 → 0
View file @
f50dc4e9
import
React
,
{
PureComponent
}
from
'react'
;
import
{
PanelOptionsProps
}
from
'../types'
;
interface
Props
{}
export
class
GaugeOptions
extends
PureComponent
<
PanelOptionsProps
<
Props
>>
{
render
()
{
return
(
<
div
>
<
div
className=
"section gf-form-group"
>
<
h5
className=
"page-heading"
>
Draw Modes
</
h5
>
</
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