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
5396c9ef
Unverified
Commit
5396c9ef
authored
Feb 17, 2020
by
Torkel Ödegaard
Committed by
GitHub
Feb 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NewPanelEdit: Minor changes (#22239)
parent
4ca39670
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
13 deletions
+23
-13
packages/grafana-ui/src/components/FieldConfigs/number.tsx
+2
-0
public/app/features/dashboard/components/PanelEditor/FieldConfigEditor.tsx
+20
-12
public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx
+1
-1
No files found.
packages/grafana-ui/src/components/FieldConfigs/number.tsx
View file @
5396c9ef
...
...
@@ -42,6 +42,7 @@ export const NumberValueEditor: React.FC<FieldConfigEditorProps<number, NumberFi
max=
{
settings
.
max
}
type=
"number"
step=
{
settings
.
step
}
placeholder=
{
settings
.
placeholder
}
onChange=
{
e
=>
{
onChange
(
settings
.
integer
?
toIntegerOrUndefined
(
e
.
currentTarget
.
value
)
:
toFloatOrUndefined
(
e
.
currentTarget
.
value
)
...
...
@@ -64,6 +65,7 @@ export const NumberOverrideEditor: React.FC<FieldOverrideEditorProps<number, Num
max=
{
settings
.
max
}
type=
"number"
step=
{
settings
.
step
}
placeholder=
{
settings
.
placeholder
}
onChange=
{
e
=>
{
onChange
(
settings
.
integer
?
toIntegerOrUndefined
(
e
.
currentTarget
.
value
)
:
toFloatOrUndefined
(
e
.
currentTarget
.
value
)
...
...
public/app/features/dashboard/components/PanelEditor/FieldConfigEditor.tsx
View file @
5396c9ef
import
React
from
'react'
;
import
cloneDeep
from
'lodash/cloneDeep'
;
import
{
FieldConfigEditorRegistry
,
FieldConfigSource
,
DataFrame
,
FieldPropertyEditorItem
,
VariableSuggestionsScope
,
standardFieldConfigEditorRegistry
,
PanelPlugin
,
SelectableValue
,
}
from
'@grafana/data'
;
import
{
Forms
,
fieldMatchersUI
,
ValuePicker
}
from
'@grafana/ui'
;
...
...
@@ -15,8 +15,8 @@ import { OptionsGroup } from './OptionsGroup';
import
{
OverrideEditor
}
from
'./OverrideEditor'
;
interface
Props
{
plugin
:
PanelPlugin
;
config
:
FieldConfigSource
;
custom
?:
FieldConfigEditorRegistry
;
// custom fields
include
?:
string
[];
// Ordered list of which fields should be shown/included
onChange
:
(
config
:
FieldConfigSource
)
=>
void
;
/* Helpful for IntelliSense */
...
...
@@ -113,15 +113,19 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
}
renderCustomConfigs
()
{
const
{
custom
}
=
this
.
props
;
if
(
!
custom
)
{
const
{
plugin
}
=
this
.
props
;
if
(
!
plugin
.
customFieldConfigs
)
{
return
null
;
}
return
custom
.
list
().
map
(
f
=>
this
.
renderEditor
(
f
,
true
));
return
plugin
.
customFieldConfigs
.
list
().
map
(
f
=>
this
.
renderEditor
(
f
,
true
));
}
renderOverrides
()
{
const
{
config
,
data
,
custom
}
=
this
.
props
;
const
{
config
,
data
,
plugin
}
=
this
.
props
;
const
{
customFieldConfigs
}
=
plugin
;
if
(
config
.
overrides
.
length
===
0
)
{
return
null
;
}
...
...
@@ -133,9 +137,9 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
custom
:
false
,
}));
if
(
custom
)
{
if
(
custom
FieldConfigs
)
{
configPropertiesOptions
=
configPropertiesOptions
.
concat
(
custom
.
list
().
map
(
i
=>
({
custom
FieldConfigs
.
list
().
map
(
i
=>
({
label
:
i
.
name
,
value
:
i
.
id
,
description
:
i
.
description
,
...
...
@@ -156,7 +160,7 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
onChange=
{
value
=>
this
.
onOverrideChange
(
i
,
value
)
}
onRemove=
{
()
=>
this
.
onOverrideRemove
(
i
)
}
configPropertiesOptions=
{
configPropertiesOptions
}
customPropertiesRegistry=
{
custom
}
customPropertiesRegistry=
{
custom
FieldConfigs
}
/>
);
})
}
...
...
@@ -178,13 +182,17 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
};
render
()
{
const
{
plugin
}
=
this
.
props
;
return
(
<
div
>
<
OptionsGroup
title=
"Field configuration"
>
{
this
.
renderStandardConfigs
()
}
</
OptionsGroup
>
{
plugin
.
customFieldConfigs
&&
(
<
OptionsGroup
title=
{
`${plugin.meta.name} options`
}
>
{
this
.
renderCustomConfigs
()
}
</
OptionsGroup
>
)
}
{
this
.
props
.
custom
&&
<
OptionsGroup
title=
"Visualization options"
>
{
this
.
renderCustomConfigs
()
}
</
OptionsGroup
>
}
<
OptionsGroup
title=
"Field defaults"
>
{
this
.
renderStandardConfigs
()
}
</
OptionsGroup
>
<
OptionsGroup
title=
"Field
O
verrides"
>
<
OptionsGroup
title=
"Field
o
verrides"
>
{
this
.
renderOverrides
()
}
{
this
.
renderAddOverride
()
}
</
OptionsGroup
>
...
...
public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx
View file @
5396c9ef
...
...
@@ -110,7 +110,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
return
(
<
FieldConfigEditor
config=
{
fieldOptions
}
custom=
{
plugin
.
customFieldConfigs
}
plugin=
{
plugin
}
onChange=
{
this
.
onFieldConfigsChange
}
data=
{
data
.
series
}
/>
...
...
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