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
01251927
Commit
01251927
authored
Jan 16, 2019
by
Peter Holmberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redoing input props
parent
0d955279
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
48 deletions
+24
-48
packages/grafana-ui/src/components/FormField/FormField.test.tsx
+2
-4
packages/grafana-ui/src/components/FormField/FormField.tsx
+2
-4
packages/grafana-ui/src/components/ValueMappingsEditor/MappingRow.tsx
+9
-15
public/app/plugins/panel/gauge/GaugeOptionsEditor.tsx
+2
-10
public/app/plugins/panel/gauge/ValueOptions.tsx
+9
-15
No files found.
packages/grafana-ui/src/components/FormField/FormField.test.tsx
View file @
01251927
...
...
@@ -6,10 +6,8 @@ const setup = (propOverrides?: object) => {
const
props
:
Props
=
{
label
:
'Test'
,
labelWidth
:
11
,
inputProps
:
{
value
:
10
,
onChange
:
jest
.
fn
(),
},
value
:
10
,
onChange
:
jest
.
fn
(),
};
Object
.
assign
(
props
,
propOverrides
);
...
...
packages/grafana-ui/src/components/FormField/FormField.tsx
View file @
01251927
import
React
,
{
InputHTMLAttributes
,
FunctionComponent
}
from
'react'
;
import
{
Label
}
from
'..'
;
export
interface
Props
{
export
interface
Props
extends
InputHTMLAttributes
<
HTMLInputElement
>
{
label
:
string
;
inputProps
:
InputHTMLAttributes
<
HTMLInputElement
>
;
labelWidth
?:
number
;
inputWidth
?:
number
;
}
const
defaultProps
=
{
labelWidth
:
6
,
inputProps
:
{},
inputWidth
:
12
,
};
const
FormField
:
FunctionComponent
<
Props
>
=
({
label
,
labelWidth
,
input
Props
,
inputWidth
})
=>
{
const
FormField
:
FunctionComponent
<
Props
>
=
({
label
,
labelWidth
,
input
Width
,
...
inputProps
})
=>
{
return
(
<
div
className=
"form-field"
>
<
Label
width=
{
labelWidth
}
>
{
label
}
</
Label
>
...
...
packages/grafana-ui/src/components/ValueMappingsEditor/MappingRow.tsx
View file @
01251927
...
...
@@ -64,22 +64,18 @@ export default class MappingRow extends PureComponent<Props, State> {
<
FormField
label=
"From"
labelWidth=
{
4
}
inputProps=
{
{
onChange
:
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
this
.
onMappingFromChange
(
event
),
onBlur
:
()
=>
this
.
updateMapping
(),
value
:
from
,
}
}
inputWidth=
{
8
}
onChange=
{
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
this
.
onMappingFromChange
(
event
)
}
onBlur=
{
()
=>
this
.
updateMapping
()
}
value=
{
from
}
/>
<
FormField
label=
"To"
labelWidth=
{
4
}
inputProps=
{
{
onBlur
:
()
=>
this
.
updateMapping
,
onChange
:
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
this
.
onMappingToChange
(
event
),
value
:
to
,
}
}
inputWidth=
{
8
}
onBlur=
{
()
=>
this
.
updateMapping
}
onChange=
{
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
this
.
onMappingToChange
(
event
)
}
value=
{
to
}
/>
<
div
className=
"gf-form gf-form--grow"
>
<
Label
width=
{
4
}
>
Text
</
Label
>
...
...
@@ -99,11 +95,9 @@ export default class MappingRow extends PureComponent<Props, State> {
<
FormField
label=
"Value"
labelWidth=
{
4
}
inputProps=
{
{
onBlur
:
()
=>
this
.
updateMapping
,
onChange
:
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
this
.
onMappingValueChange
(
event
),
value
:
value
,
}
}
onBlur=
{
()
=>
this
.
updateMapping
}
onChange=
{
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
this
.
onMappingValueChange
(
event
)
}
value=
{
value
}
inputWidth=
{
8
}
/>
<
div
className=
"gf-form gf-form--grow"
>
...
...
public/app/plugins/panel/gauge/GaugeOptionsEditor.tsx
View file @
01251927
...
...
@@ -21,16 +21,8 @@ export default class GaugeOptionsEditor extends PureComponent<PanelOptionsProps<
return
(
<
PanelOptionsGroup
title=
"Gauge"
>
<
FormField
label=
"Min value"
labelWidth=
{
8
}
inputProps=
{
{
onChange
:
event
=>
this
.
onMinValueChange
(
event
),
value
:
minValue
}
}
/>
<
FormField
label=
"Max value"
labelWidth=
{
8
}
inputProps=
{
{
onChange
:
event
=>
this
.
onMaxValueChange
(
event
),
value
:
maxValue
}
}
/>
<
FormField
label=
"Min value"
labelWidth=
{
8
}
onChange=
{
event
=>
this
.
onMinValueChange
(
event
)
}
value=
{
minValue
}
/>
<
FormField
label=
"Max value"
labelWidth=
{
8
}
onChange=
{
event
=>
this
.
onMaxValueChange
(
event
)
}
value=
{
maxValue
}
/>
<
Switch
label=
"Show labels"
labelClass=
"width-8"
...
...
public/app/plugins/panel/gauge/ValueOptions.tsx
View file @
01251927
import
React
,
{
PureComponent
}
from
'react'
;
import
{
FormField
,
Label
,
PanelOptionsProps
,
PanelOptionsGroup
,
Select
}
from
'@grafana/ui'
;
import
{
FormField
,
Label
,
PanelOptionsProps
,
PanelOptionsGroup
,
Select
}
from
'@grafana/ui'
;
import
UnitPicker
from
'app/core/components/Select/UnitPicker'
;
import
{
GaugeOptions
}
from
'./types'
;
...
...
@@ -55,28 +55,22 @@ export default class ValueOptions extends PureComponent<PanelOptionsProps<GaugeO
<
FormField
label=
"Decimals"
labelWidth=
{
labelWidth
}
inputProps=
{
{
placeholder
:
'auto'
,
onChange
:
event
=>
this
.
onDecimalChange
(
event
),
value
:
decimals
||
''
,
type
:
'number'
,
}
}
placeholder=
"auto"
onChange=
{
event
=>
this
.
onDecimalChange
(
event
)
}
value=
{
decimals
||
''
}
type=
"number"
/>
<
FormField
label=
"Prefix"
labelWidth=
{
labelWidth
}
inputProps=
{
{
onChange
:
event
=>
this
.
onPrefixChange
(
event
),
value
:
prefix
||
''
,
}
}
onChange=
{
event
=>
this
.
onPrefixChange
(
event
)
}
value=
{
prefix
||
''
}
/>
<
FormField
label=
"Suffix"
labelWidth=
{
labelWidth
}
inputProps=
{
{
onChange
:
event
=>
this
.
onSuffixChange
(
event
),
value
:
suffix
||
''
,
}
}
onChange=
{
event
=>
this
.
onSuffixChange
(
event
)
}
value=
{
suffix
||
''
}
/>
</
PanelOptionsGroup
>
);
...
...
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