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
1ccde201
Commit
1ccde201
authored
Mar 18, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(live datasouces): moved from Observable to Subject
parent
9ddf22ea
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
10 deletions
+23
-10
public/app/features/panel/metrics_panel_ctrl.ts
+22
-7
public/app/plugins/panel/graph/module.ts
+1
-3
No files found.
public/app/features/panel/metrics_panel_ctrl.ts
View file @
1ccde201
...
...
@@ -26,8 +26,7 @@ class MetricsPanelCtrl extends PanelCtrl {
timeInfo
:
any
;
skipDataOnInit
:
boolean
;
datasources
:
any
[];
dataSubscription
:
any
;
dataHandler
:
any
;
dataSubject
:
any
;
constructor
(
$scope
,
$injector
)
{
super
(
$scope
,
$injector
);
...
...
@@ -168,7 +167,12 @@ class MetricsPanelCtrl extends PanelCtrl {
return
this
.
$q
.
when
([]);
}
if
(
this
.
dataSubject
)
{
return
this
.
$q
.
when
([]);
}
var
metricsQuery
=
{
panelId
:
this
.
panel
.
id
,
range
:
this
.
range
,
rangeRaw
:
this
.
rangeRaw
,
interval
:
this
.
interval
,
...
...
@@ -184,9 +188,9 @@ class MetricsPanelCtrl extends PanelCtrl {
return
datasource
.
query
(
metricsQuery
).
then
(
results
=>
{
this
.
setTimeQueryEnd
();
// check for if data source returns
observable
// check for if data source returns
subject
if
(
results
&&
results
.
subscribe
)
{
this
.
handle
Observable
(
results
);
this
.
handle
DataSubject
(
results
);
return
{
data
:
[]};
}
...
...
@@ -194,16 +198,27 @@ class MetricsPanelCtrl extends PanelCtrl {
this
.
panel
.
snapshotData
=
results
;
}
return
results
;
return
this
.
dataHandler
(
results
)
;
});
}
catch
(
err
)
{
return
this
.
$q
.
reject
(
err
);
}
}
handleObservable
(
observable
)
{
this
.
dataSubscription
=
observable
.
subscribe
({
dataHandler
(
data
)
{
return
data
;
}
handleDataSubject
(
subject
)
{
// if we already have a connection
if
(
this
.
dataSubject
)
{
return
;
}
this
.
dataSubject
=
subject
;
this
.
dataSubject
.
subscribe
({
next
:
(
data
)
=>
{
console
.
log
(
'dataSubject next!'
);
if
(
data
.
range
)
{
this
.
range
=
data
.
range
;
}
...
...
public/app/plugins/panel/graph/module.ts
View file @
1ccde201
...
...
@@ -140,9 +140,7 @@ class GraphCtrl extends MetricsPanelCtrl {
refreshData
(
datasource
)
{
this
.
annotationsPromise
=
this
.
annotationsSrv
.
getAnnotations
(
this
.
dashboard
);
return
this
.
issueQueries
(
datasource
)
.
then
(
res
=>
this
.
dataHandler
(
res
))
.
catch
(
err
=>
{
return
this
.
issueQueries
(
datasource
).
catch
(
err
=>
{
this
.
seriesList
=
[];
this
.
render
([]);
throw
err
;
...
...
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