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
8f92e23e
Commit
8f92e23e
authored
Dec 18, 2018
by
Peter Holmberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy props to state to make it visible in the view
parent
a4091813
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
3 deletions
+35
-3
public/app/features/dashboard/dashgrid/QueryOptions.tsx
+35
-3
No files found.
public/app/features/dashboard/dashgrid/QueryOptions.tsx
View file @
8f92e23e
...
@@ -38,7 +38,33 @@ interface Props {
...
@@ -38,7 +38,33 @@ interface Props {
datasource
:
DataSourceSelectItem
;
datasource
:
DataSourceSelectItem
;
}
}
export
class
QueryOptions
extends
PureComponent
<
Props
>
{
interface
State
{
relativeTime
:
string
;
timeShift
:
string
;
}
export
class
QueryOptions
extends
PureComponent
<
Props
,
State
>
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
relativeTime
:
props
.
panel
.
timeFrom
||
''
,
timeShift
:
props
.
panel
.
timeShift
||
''
,
};
}
onRelativeTimeChange
=
event
=>
{
this
.
setState
({
relativeTime
:
event
.
target
.
value
,
});
};
onTimeShiftChange
=
event
=>
{
this
.
setState
({
timeShift
:
event
.
target
.
value
,
});
};
onOverrideTime
=
(
evt
,
status
:
InputStatus
)
=>
{
onOverrideTime
=
(
evt
,
status
:
InputStatus
)
=>
{
const
{
value
}
=
evt
.
target
;
const
{
value
}
=
evt
.
target
;
const
{
panel
}
=
this
.
props
;
const
{
panel
}
=
this
.
props
;
...
@@ -128,8 +154,10 @@ export class QueryOptions extends PureComponent<Props> {
...
@@ -128,8 +154,10 @@ export class QueryOptions extends PureComponent<Props> {
});
});
}
}
render
=
()
=>
{
render
()
{
const
hideTimeOverride
=
this
.
props
.
panel
.
hideTimeOverride
;
const
hideTimeOverride
=
this
.
props
.
panel
.
hideTimeOverride
;
const
{
relativeTime
,
timeShift
}
=
this
.
state
;
return
(
return
(
<
div
className=
"gf-form-inline"
>
<
div
className=
"gf-form-inline"
>
{
this
.
renderOptions
()
}
{
this
.
renderOptions
()
}
...
@@ -140,9 +168,11 @@ export class QueryOptions extends PureComponent<Props> {
...
@@ -140,9 +168,11 @@ export class QueryOptions extends PureComponent<Props> {
type=
"text"
type=
"text"
className=
"width-6"
className=
"width-6"
placeholder=
"1h"
placeholder=
"1h"
onChange=
{
this
.
onRelativeTimeChange
}
onBlur=
{
this
.
onOverrideTime
}
onBlur=
{
this
.
onOverrideTime
}
validationEvents=
{
timeRangeValidationEvents
}
validationEvents=
{
timeRangeValidationEvents
}
hideErrorMessage=
{
true
}
hideErrorMessage=
{
true
}
value=
{
relativeTime
}
/>
/>
</
div
>
</
div
>
...
@@ -152,9 +182,11 @@ export class QueryOptions extends PureComponent<Props> {
...
@@ -152,9 +182,11 @@ export class QueryOptions extends PureComponent<Props> {
type=
"text"
type=
"text"
className=
"width-6"
className=
"width-6"
placeholder=
"1h"
placeholder=
"1h"
onChange=
{
this
.
onTimeShiftChange
}
onBlur=
{
this
.
onTimeShift
}
onBlur=
{
this
.
onTimeShift
}
validationEvents=
{
timeRangeValidationEvents
}
validationEvents=
{
timeRangeValidationEvents
}
hideErrorMessage=
{
true
}
hideErrorMessage=
{
true
}
value=
{
timeShift
}
/>
/>
</
div
>
</
div
>
...
@@ -163,5 +195,5 @@ export class QueryOptions extends PureComponent<Props> {
...
@@ -163,5 +195,5 @@ export class QueryOptions extends PureComponent<Props> {
</
div
>
</
div
>
</
div
>
</
div
>
);
);
}
;
}
}
}
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