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
a738945a
Commit
a738945a
authored
Mar 16, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(data source observerable): started work on handling data source observerable
parent
b273cd13
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
public/app/features/panel/metrics_panel_ctrl.ts
+21
-0
No files found.
public/app/features/panel/metrics_panel_ctrl.ts
View file @
a738945a
...
@@ -26,6 +26,7 @@ class MetricsPanelCtrl extends PanelCtrl {
...
@@ -26,6 +26,7 @@ class MetricsPanelCtrl extends PanelCtrl {
timeInfo
:
any
;
timeInfo
:
any
;
skipDataOnInit
:
boolean
;
skipDataOnInit
:
boolean
;
datasources
:
any
[];
datasources
:
any
[];
dataSubscription
:
any
;
constructor
(
$scope
,
$injector
)
{
constructor
(
$scope
,
$injector
)
{
super
(
$scope
,
$injector
);
super
(
$scope
,
$injector
);
...
@@ -182,6 +183,12 @@ class MetricsPanelCtrl extends PanelCtrl {
...
@@ -182,6 +183,12 @@ class MetricsPanelCtrl extends PanelCtrl {
return
datasource
.
query
(
metricsQuery
).
then
(
results
=>
{
return
datasource
.
query
(
metricsQuery
).
then
(
results
=>
{
this
.
setTimeQueryEnd
();
this
.
setTimeQueryEnd
();
// check for if data source returns observable
if
(
results
&&
results
.
subscribe
)
{
this
.
handleObservable
(
results
);
return
{
data
:
[]};
}
if
(
this
.
dashboard
.
snapshot
)
{
if
(
this
.
dashboard
.
snapshot
)
{
this
.
panel
.
snapshotData
=
results
;
this
.
panel
.
snapshotData
=
results
;
}
}
...
@@ -193,6 +200,20 @@ class MetricsPanelCtrl extends PanelCtrl {
...
@@ -193,6 +200,20 @@ class MetricsPanelCtrl extends PanelCtrl {
}
}
}
}
handleObservable
(
observable
)
{
this
.
dataSubscription
=
observable
.
subscribe
({
next
:
(
data
)
=>
{
console
.
log
(
'panel: observer got data'
);
},
error
:
(
error
)
=>
{
console
.
log
(
'panel: observer got error'
);
},
complete
:
()
=>
{
console
.
log
(
'panel: observer got complete'
);
}
});
}
setDatasource
(
datasource
)
{
setDatasource
(
datasource
)
{
// switching to mixed
// switching to mixed
if
(
datasource
.
meta
.
mixed
)
{
if
(
datasource
.
meta
.
mixed
)
{
...
...
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