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
Show 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
...
@@ -42,6 +42,7 @@ export const NumberValueEditor: React.FC<FieldConfigEditorProps<number, NumberFi
max=
{
settings
.
max
}
max=
{
settings
.
max
}
type=
"number"
type=
"number"
step=
{
settings
.
step
}
step=
{
settings
.
step
}
placeholder=
{
settings
.
placeholder
}
onChange=
{
e
=>
{
onChange=
{
e
=>
{
onChange
(
onChange
(
settings
.
integer
?
toIntegerOrUndefined
(
e
.
currentTarget
.
value
)
:
toFloatOrUndefined
(
e
.
currentTarget
.
value
)
settings
.
integer
?
toIntegerOrUndefined
(
e
.
currentTarget
.
value
)
:
toFloatOrUndefined
(
e
.
currentTarget
.
value
)
...
@@ -64,6 +65,7 @@ export const NumberOverrideEditor: React.FC<FieldOverrideEditorProps<number, Num
...
@@ -64,6 +65,7 @@ export const NumberOverrideEditor: React.FC<FieldOverrideEditorProps<number, Num
max=
{
settings
.
max
}
max=
{
settings
.
max
}
type=
"number"
type=
"number"
step=
{
settings
.
step
}
step=
{
settings
.
step
}
placeholder=
{
settings
.
placeholder
}
onChange=
{
e
=>
{
onChange=
{
e
=>
{
onChange
(
onChange
(
settings
.
integer
?
toIntegerOrUndefined
(
e
.
currentTarget
.
value
)
:
toFloatOrUndefined
(
e
.
currentTarget
.
value
)
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
React
from
'react'
;
import
cloneDeep
from
'lodash/cloneDeep'
;
import
cloneDeep
from
'lodash/cloneDeep'
;
import
{
import
{
FieldConfigEditorRegistry
,
FieldConfigSource
,
FieldConfigSource
,
DataFrame
,
DataFrame
,
FieldPropertyEditorItem
,
FieldPropertyEditorItem
,
VariableSuggestionsScope
,
VariableSuggestionsScope
,
standardFieldConfigEditorRegistry
,
standardFieldConfigEditorRegistry
,
PanelPlugin
,
SelectableValue
,
SelectableValue
,
}
from
'@grafana/data'
;
}
from
'@grafana/data'
;
import
{
Forms
,
fieldMatchersUI
,
ValuePicker
}
from
'@grafana/ui'
;
import
{
Forms
,
fieldMatchersUI
,
ValuePicker
}
from
'@grafana/ui'
;
...
@@ -15,8 +15,8 @@ import { OptionsGroup } from './OptionsGroup';
...
@@ -15,8 +15,8 @@ import { OptionsGroup } from './OptionsGroup';
import
{
OverrideEditor
}
from
'./OverrideEditor'
;
import
{
OverrideEditor
}
from
'./OverrideEditor'
;
interface
Props
{
interface
Props
{
plugin
:
PanelPlugin
;
config
:
FieldConfigSource
;
config
:
FieldConfigSource
;
custom
?:
FieldConfigEditorRegistry
;
// custom fields
include
?:
string
[];
// Ordered list of which fields should be shown/included
include
?:
string
[];
// Ordered list of which fields should be shown/included
onChange
:
(
config
:
FieldConfigSource
)
=>
void
;
onChange
:
(
config
:
FieldConfigSource
)
=>
void
;
/* Helpful for IntelliSense */
/* Helpful for IntelliSense */
...
@@ -113,15 +113,19 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
...
@@ -113,15 +113,19 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
}
}
renderCustomConfigs
()
{
renderCustomConfigs
()
{
const
{
custom
}
=
this
.
props
;
const
{
plugin
}
=
this
.
props
;
if
(
!
custom
)
{
if
(
!
plugin
.
customFieldConfigs
)
{
return
null
;
return
null
;
}
}
return
custom
.
list
().
map
(
f
=>
this
.
renderEditor
(
f
,
true
));
return
plugin
.
customFieldConfigs
.
list
().
map
(
f
=>
this
.
renderEditor
(
f
,
true
));
}
}
renderOverrides
()
{
renderOverrides
()
{
const
{
config
,
data
,
custom
}
=
this
.
props
;
const
{
config
,
data
,
plugin
}
=
this
.
props
;
const
{
customFieldConfigs
}
=
plugin
;
if
(
config
.
overrides
.
length
===
0
)
{
if
(
config
.
overrides
.
length
===
0
)
{
return
null
;
return
null
;
}
}
...
@@ -133,9 +137,9 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
...
@@ -133,9 +137,9 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
custom
:
false
,
custom
:
false
,
}));
}));
if
(
custom
)
{
if
(
custom
FieldConfigs
)
{
configPropertiesOptions
=
configPropertiesOptions
.
concat
(
configPropertiesOptions
=
configPropertiesOptions
.
concat
(
custom
.
list
().
map
(
i
=>
({
custom
FieldConfigs
.
list
().
map
(
i
=>
({
label
:
i
.
name
,
label
:
i
.
name
,
value
:
i
.
id
,
value
:
i
.
id
,
description
:
i
.
description
,
description
:
i
.
description
,
...
@@ -156,7 +160,7 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
...
@@ -156,7 +160,7 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
onChange=
{
value
=>
this
.
onOverrideChange
(
i
,
value
)
}
onChange=
{
value
=>
this
.
onOverrideChange
(
i
,
value
)
}
onRemove=
{
()
=>
this
.
onOverrideRemove
(
i
)
}
onRemove=
{
()
=>
this
.
onOverrideRemove
(
i
)
}
configPropertiesOptions=
{
configPropertiesOptions
}
configPropertiesOptions=
{
configPropertiesOptions
}
customPropertiesRegistry=
{
custom
}
customPropertiesRegistry=
{
custom
FieldConfigs
}
/>
/>
);
);
})
}
})
}
...
@@ -178,13 +182,17 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
...
@@ -178,13 +182,17 @@ export class FieldConfigEditor extends React.PureComponent<Props> {
};
};
render
()
{
render
()
{
const
{
plugin
}
=
this
.
props
;
return
(
return
(
<
div
>
<
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
.
renderOverrides
()
}
{
this
.
renderAddOverride
()
}
{
this
.
renderAddOverride
()
}
</
OptionsGroup
>
</
OptionsGroup
>
...
...
public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx
View file @
5396c9ef
...
@@ -110,7 +110,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
...
@@ -110,7 +110,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
return
(
return
(
<
FieldConfigEditor
<
FieldConfigEditor
config=
{
fieldOptions
}
config=
{
fieldOptions
}
custom=
{
plugin
.
customFieldConfigs
}
plugin=
{
plugin
}
onChange=
{
this
.
onFieldConfigsChange
}
onChange=
{
this
.
onFieldConfigsChange
}
data=
{
data
.
series
}
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