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
66faedfb
Commit
66faedfb
authored
Aug 07, 2019
by
Ryan McKinley
Committed by
Torkel Ödegaard
Aug 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DataFrame: remove dateFormat (#18424)
parent
e1b2d61c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 additions
and
36 deletions
+1
-36
packages/grafana-data/src/types/data.ts
+0
-1
packages/grafana-data/src/utils/csv.ts
+0
-1
packages/grafana-ui/src/utils/displayValue.ts
+1
-32
packages/grafana-ui/src/utils/fieldDisplay.test.ts
+0
-2
No files found.
packages/grafana-data/src/types/data.ts
View file @
66faedfb
...
...
@@ -48,7 +48,6 @@ export interface Field {
type
?:
FieldType
;
filterable
?:
boolean
;
unit
?:
string
;
dateFormat
?:
string
;
// Source data format
decimals
?:
number
|
null
;
// Significant digits (for display)
min
?:
number
|
null
;
max
?:
number
|
null
;
...
...
packages/grafana-data/src/utils/csv.ts
View file @
66faedfb
...
...
@@ -98,7 +98,6 @@ export class CSVReader {
name
:
'#'
,
type
:
FieldType
.
number
,
unit
:
'#'
,
dateFormat
:
'#'
,
};
// Check if it is a known/supported column
...
...
packages/grafana-ui/src/utils/displayValue.ts
View file @
66faedfb
// Libraries
import
_
from
'lodash'
;
import
{
DateTime
,
dateTime
,
Threshold
,
getMappedValue
,
Field
,
DecimalInfo
,
DisplayValue
,
DecimalCount
,
}
from
'@grafana/data'
;
import
{
Threshold
,
getMappedValue
,
Field
,
DecimalInfo
,
DisplayValue
,
DecimalCount
}
from
'@grafana/data'
;
// Utils
import
{
getValueFormat
}
from
'./valueFormats/valueFormats'
;
...
...
@@ -60,14 +51,6 @@ export function getDisplayProcessor(options?: DisplayValueOptions): DisplayProce
}
}
if
(
field
.
dateFormat
)
{
const
date
=
toMoment
(
value
,
numeric
,
field
.
dateFormat
);
if
(
date
.
isValid
())
{
text
=
date
.
format
(
field
.
dateFormat
);
shouldFormat
=
false
;
}
}
if
(
!
isNaN
(
numeric
))
{
if
(
shouldFormat
&&
!
_
.
isBoolean
(
value
))
{
const
{
decimals
,
scaledDecimals
}
=
getDecimalsForValue
(
value
,
field
.
decimals
);
...
...
@@ -88,20 +71,6 @@ export function getDisplayProcessor(options?: DisplayValueOptions): DisplayProce
return
toStringProcessor
;
}
function
toMoment
(
value
:
any
,
numeric
:
number
,
format
:
string
):
DateTime
{
if
(
!
isNaN
(
numeric
))
{
const
v
=
dateTime
(
numeric
);
if
(
v
.
isValid
())
{
return
v
;
}
}
const
v
=
dateTime
(
value
,
format
);
if
(
v
.
isValid
)
{
return
v
;
}
return
dateTime
(
value
);
// moment will try to parse the format
}
/** Will return any value as a number or NaN */
function
toNumber
(
value
:
any
):
number
{
if
(
typeof
value
===
'number'
)
{
...
...
packages/grafana-ui/src/utils/fieldDisplay.test.ts
View file @
66faedfb
...
...
@@ -8,7 +8,6 @@ describe('FieldDisplay', () => {
const
f0
=
{
min
:
0
,
max
:
100
,
dateFormat
:
'YYYY'
,
};
const
f1
=
{
unit
:
'ms'
,
...
...
@@ -20,7 +19,6 @@ describe('FieldDisplay', () => {
expect
(
field
.
min
).
toEqual
(
0
);
expect
(
field
.
max
).
toEqual
(
100
);
expect
(
field
.
unit
).
toEqual
(
'ms'
);
expect
(
field
.
dateFormat
).
toEqual
(
'YYYY'
);
// last one overrieds
const
f2
=
{
...
...
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