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
66191f94
Commit
66191f94
authored
Feb 09, 2020
by
Ryan McKinley
Committed by
GitHub
Feb 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New Editor: use unit picker (#22033)
* use unit picker * export correct file name * override is the same
parent
a58d2b87
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
packages/grafana-data/src/types/fieldOverrides.ts
+2
-2
packages/grafana-ui/src/components/FieldConfigs/standardFieldConfigEditorRegistry.tsx
+3
-2
packages/grafana-ui/src/components/FieldConfigs/units.tsx
+22
-0
No files found.
packages/grafana-data/src/types/fieldOverrides.ts
View file @
66191f94
...
...
@@ -25,7 +25,7 @@ export interface FieldConfigSource {
export
interface
FieldConfigEditorProps
<
TValue
,
TSettings
>
{
item
:
FieldPropertyEditorItem
<
TValue
,
TSettings
>
;
// The property info
value
:
TValue
;
onChange
:
(
value
:
TValue
)
=>
void
;
onChange
:
(
value
?
:
TValue
)
=>
void
;
}
export
interface
FieldOverrideContext
{
...
...
@@ -38,7 +38,7 @@ export interface FieldOverrideEditorProps<TValue, TSettings> {
item
:
FieldPropertyEditorItem
<
TValue
,
TSettings
>
;
value
:
any
;
context
:
FieldOverrideContext
;
onChange
:
(
value
:
any
)
=>
void
;
onChange
:
(
value
?
:
any
)
=>
void
;
}
export
interface
FieldPropertyEditorItem
<
TValue
=
any
,
TSettings
=
any
>
extends
RegistryItem
{
...
...
packages/grafana-ui/src/components/FieldConfigs/standardFieldConfigEditorRegistry.tsx
View file @
66191f94
import
{
FieldConfigEditorRegistry
,
Registry
,
FieldPropertyEditorItem
,
ThresholdsConfig
}
from
'@grafana/data'
;
import
{
StringValueEditor
,
StringOverrideEditor
,
stringOverrideProcessor
,
StringFieldConfigSettings
}
from
'./string'
;
import
{
NumberValueEditor
,
NumberOverrideEditor
,
numberOverrideProcessor
,
NumberFieldConfigSettings
}
from
'./number'
;
import
{
UnitValueEditor
,
UnitOverrideEditor
}
from
'./units'
;
import
{
ThresholdsValueEditor
,
ThresholdsOverrideEditor
,
...
...
@@ -27,8 +28,8 @@ const unit: FieldPropertyEditorItem<string, StringFieldConfigSettings> = {
name
:
'Unit'
,
description
:
'value units'
,
editor
:
String
ValueEditor
,
override
:
String
OverrideEditor
,
editor
:
Unit
ValueEditor
,
override
:
Unit
OverrideEditor
,
process
:
stringOverrideProcessor
,
settings
:
{
...
...
packages/grafana-ui/src/components/FieldConfigs/units.tsx
0 → 100644
View file @
66191f94
import
React
from
'react'
;
import
{
FieldOverrideEditorProps
,
FieldConfigEditorProps
}
from
'@grafana/data'
;
import
{
UnitPicker
}
from
'../UnitPicker/UnitPicker'
;
export
interface
UnitFieldConfigSettings
{
// ??
}
export
const
UnitValueEditor
:
React
.
FC
<
FieldConfigEditorProps
<
string
,
UnitFieldConfigSettings
>>
=
({
value
,
onChange
,
})
=>
{
return
<
UnitPicker
value=
{
value
}
onChange=
{
onChange
}
/>;
};
export
const
UnitOverrideEditor
:
React
.
FC
<
FieldOverrideEditorProps
<
string
,
UnitFieldConfigSettings
>>
=
({
value
,
onChange
,
})
=>
{
return
<
UnitPicker
value=
{
value
}
onChange=
{
onChange
}
/>;
};
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