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
dba64a4e
Commit
dba64a4e
authored
Mar 22, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved DisplayValueOptions type back, #16134
parent
5a5aed10
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
25 deletions
+22
-25
packages/grafana-ui/src/types/displayValue.ts
+1
-24
packages/grafana-ui/src/utils/displayValue.ts
+21
-1
No files found.
packages/grafana-ui/src/types/displayValue.ts
View file @
dba64a4e
import
{
DecimalCount
}
from
'../utils'
;
import
{
ValueMapping
}
from
'./panel'
;
import
{
Threshold
}
from
'./threshold'
;
import
{
GrafanaTheme
}
from
'./theme'
;
export
interface
DisplayValue
{
text
:
string
;
// Show in the UI
numeric
:
number
;
// Use isNaN to check if it is a real number
color
?:
string
;
// color based on configs or Threshold
}
export
interface
DisplayValueOptions
{
unit
?:
string
;
decimals
?:
DecimalCount
;
dateFormat
?:
string
;
// If set try to convert numbers to date
color
?:
string
;
mappings
?:
ValueMapping
[];
thresholds
?:
Threshold
[];
prefix
?:
string
;
suffix
?:
string
;
// Alternative to empty string
noValue
?:
string
;
// Context
isUtc
?:
boolean
;
theme
?:
GrafanaTheme
;
// Will pick 'dark' if not defined
title
?:
string
;
}
export
interface
DecimalInfo
{
...
...
packages/grafana-ui/src/utils/displayValue.ts
View file @
dba64a4e
...
...
@@ -8,10 +8,30 @@ import { getMappedValue } from './valueMappings';
import
{
getColorFromHexRgbOrName
}
from
'./namedColorsPalette'
;
// Types
import
{
DecimalInfo
,
DisplayValue
,
DisplayValueOptions
,
GrafanaTheme
,
GrafanaThemeType
,
Threshold
}
from
'../types'
;
import
{
Threshold
,
ValueMapping
,
DecimalInfo
,
DisplayValue
,
GrafanaTheme
,
GrafanaThemeType
}
from
'../types'
;
import
{
DecimalCount
}
from
'./valueFormats/valueFormats'
;
export
type
DisplayProcessor
=
(
value
:
any
)
=>
DisplayValue
;
export
interface
DisplayValueOptions
{
unit
?:
string
;
decimals
?:
DecimalCount
;
dateFormat
?:
string
;
// If set try to convert numbers to date
color
?:
string
;
mappings
?:
ValueMapping
[];
thresholds
?:
Threshold
[];
prefix
?:
string
;
suffix
?:
string
;
// Alternative to empty string
noValue
?:
string
;
// Context
isUtc
?:
boolean
;
theme
?:
GrafanaTheme
;
// Will pick 'dark' if not defined
}
export
function
getDisplayProcessor
(
options
?:
DisplayValueOptions
):
DisplayProcessor
{
if
(
options
&&
!
_
.
isEmpty
(
options
))
{
const
formatFunc
=
getValueFormat
(
options
.
unit
||
'none'
);
...
...
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