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
295bc425
Unverified
Commit
295bc425
authored
Feb 10, 2019
by
Torkel Ödegaard
Committed by
GitHub
Feb 10, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15337 from grafana/time-range-to-angular-query-controllers
provide time range to angular query controllers
parents
89c153d4
a0729b9b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletions
+13
-1
public/app/features/dashboard/panel_editor/QueryEditorRow.tsx
+13
-1
No files found.
public/app/features/dashboard/panel_editor/QueryEditorRow.tsx
View file @
295bc425
...
...
@@ -7,10 +7,11 @@ import _ from 'lodash';
import
{
getDatasourceSrv
}
from
'app/features/plugins/datasource_srv'
;
import
{
AngularComponent
,
getAngularLoader
}
from
'app/core/services/AngularLoader'
;
import
{
Emitter
}
from
'app/core/utils/emitter'
;
import
{
getTimeSrv
}
from
'app/features/dashboard/services/TimeSrv'
;
// Types
import
{
PanelModel
}
from
'../state/PanelModel'
;
import
{
DataQuery
,
DataSourceApi
}
from
'@grafana/ui'
;
import
{
DataQuery
,
DataSourceApi
,
TimeRange
}
from
'@grafana/ui'
;
interface
Props
{
panel
:
PanelModel
;
...
...
@@ -43,8 +44,15 @@ export class QueryEditorRow extends PureComponent<Props, State> {
componentDidMount
()
{
this
.
loadDatasource
();
this
.
props
.
panel
.
events
.
on
(
'refresh'
,
this
.
onPanelRefresh
);
}
onPanelRefresh
=
()
=>
{
if
(
this
.
state
.
angularScope
)
{
this
.
state
.
angularScope
.
range
=
getTimeSrv
().
timeRange
();
}
};
getAngularQueryComponentScope
():
AngularQueryComponentScope
{
const
{
panel
,
query
}
=
this
.
props
;
const
{
datasource
}
=
this
.
state
;
...
...
@@ -56,6 +64,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
refresh
:
()
=>
panel
.
refresh
(),
render
:
()
=>
panel
.
render
(),
events
:
panel
.
events
,
range
:
getTimeSrv
().
timeRange
(),
};
}
...
...
@@ -97,6 +106,8 @@ export class QueryEditorRow extends PureComponent<Props, State> {
}
componentWillUnmount
()
{
this
.
props
.
panel
.
events
.
off
(
'refresh'
,
this
.
onPanelRefresh
);
if
(
this
.
angularQueryEditor
)
{
this
.
angularQueryEditor
.
destroy
();
}
...
...
@@ -250,4 +261,5 @@ export interface AngularQueryComponentScope {
datasource
:
DataSourceApi
;
toggleEditorMode
?:
()
=>
void
;
getCollapsedText
?:
()
=>
string
;
range
:
TimeRange
;
}
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