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
66a4d1a5
Unverified
Commit
66a4d1a5
authored
Jul 08, 2019
by
Ryan McKinley
Committed by
GitHub
Jul 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor: fix range util imports (#17988)
parent
ccc3d88c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
9 deletions
+24
-9
packages/grafana-ui/src/components/TimePicker/time.ts
+13
-5
public/app/features/dashboard/panel_editor/QueryOptions.tsx
+11
-4
No files found.
packages/grafana-ui/src/components/TimePicker/time.ts
View file @
66a4d1a5
import
{
TimeRange
,
TIME_FORMAT
,
RawTimeRange
,
TimeZone
}
from
'@grafana/data'
;
import
{
describeTimeRange
}
from
'@grafana/data/src/utils/rangeutil'
;
import
{
dateMath
}
from
'@grafana/data'
;
import
{
isDateTime
,
dateTime
,
DateTime
,
toUtc
}
from
'@grafana/data'
;
import
{
TimeRange
,
TIME_FORMAT
,
RawTimeRange
,
TimeZone
,
rangeUtil
,
dateMath
,
isDateTime
,
dateTime
,
DateTime
,
toUtc
,
}
from
'@grafana/data'
;
export
const
rawToTimeRange
=
(
raw
:
RawTimeRange
,
timeZone
?:
TimeZone
):
TimeRange
=>
{
const
from
=
stringToDateTimeType
(
raw
.
from
,
false
,
timeZone
);
...
...
@@ -32,7 +40,7 @@ export const stringToDateTimeType = (value: string | DateTime, roundUp?: boolean
};
export
const
mapTimeRangeToRangeString
=
(
timeRange
:
RawTimeRange
):
string
=>
{
return
describeTimeRange
(
timeRange
);
return
rangeUtil
.
describeTimeRange
(
timeRange
);
};
export
const
isValidTimeString
=
(
text
:
string
)
=>
dateMath
.
isValid
(
text
);
public/app/features/dashboard/panel_editor/QueryOptions.tsx
View file @
66a4d1a5
...
...
@@ -2,12 +2,19 @@
import
React
,
{
PureComponent
,
ChangeEvent
,
FocusEvent
}
from
'react'
;
// Utils
import
{
isValidTimeSpan
}
from
'@grafana/data/src/utils/rangeutil
'
;
import
{
rangeUtil
}
from
'@grafana/data
'
;
// Components
import
{
DataSourceSelectItem
,
EventsWithValidation
,
Input
,
InputStatus
,
Switch
,
ValidationEvents
}
from
'@grafana/ui'
;
import
{
DataSourceSelectItem
,
EventsWithValidation
,
Input
,
InputStatus
,
Switch
,
ValidationEvents
,
FormLabel
,
}
from
'@grafana/ui'
;
import
{
DataSourceOption
}
from
'./DataSourceOption'
;
import
{
FormLabel
}
from
'@grafana/ui'
;
// Types
import
{
PanelModel
}
from
'../state'
;
...
...
@@ -19,7 +26,7 @@ const timeRangeValidationEvents: ValidationEvents = {
if
(
!
value
)
{
return
true
;
}
return
isValidTimeSpan
(
value
);
return
rangeUtil
.
isValidTimeSpan
(
value
);
},
errorMessage
:
'Not a valid timespan'
,
},
...
...
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