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
3ea441d1
Commit
3ea441d1
authored
Mar 21, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(live): tricky
parent
e63ff1c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
public/app/plugins/datasource/grafana-live/datasource.ts
+18
-18
No files found.
public/app/plugins/datasource/grafana-live/datasource.ts
View file @
3ea441d1
...
@@ -4,6 +4,21 @@ import {liveSrv} from 'app/core/core';
...
@@ -4,6 +4,21 @@ import {liveSrv} from 'app/core/core';
import
{
Observable
}
from
'vendor/npm/rxjs/Observable'
;
import
{
Observable
}
from
'vendor/npm/rxjs/Observable'
;
class
DataObservable
{
target
:
any
;
constructor
(
target
)
{
this
.
target
=
target
;
}
subscribe
(
options
)
{
var
observable
=
liveSrv
.
subscribe
(
this
.
target
.
stream
);
return
observable
.
subscribe
(
data
=>
{
console
.
log
(
"grafana stream ds data!"
,
data
);
});
}
}
export
class
GrafanaStreamDS
{
export
class
GrafanaStreamDS
{
subscription
:
any
;
subscription
:
any
;
...
@@ -12,30 +27,15 @@ export class GrafanaStreamDS {
...
@@ -12,30 +27,15 @@ export class GrafanaStreamDS {
}
}
query
(
options
)
{
query
(
options
)
:
any
{
if
(
options
.
targets
.
length
===
0
)
{
if
(
options
.
targets
.
length
===
0
)
{
return
Promise
.
resolve
({
data
:
[]});
return
Promise
.
resolve
({
data
:
[]});
}
}
var
target
=
options
.
targets
[
0
];
var
target
=
options
.
targets
[
0
];
var
observable
=
new
DataObservable
(
target
);
if
(
this
.
subscription
)
{
return
Promise
.
resolve
(
observable
);
if
(
this
.
subscription
.
stream
!==
target
.
stream
)
{
this
.
subscription
.
unsubscribe
();
}
else
{
return
Promise
.
resolve
({
data
:
[]});
}
}
var
observable
=
liveSrv
.
subscribe
(
target
.
stream
);
this
.
subscription
=
observable
.
subscribe
(
data
=>
{
console
.
log
(
"grafana stream ds data!"
,
data
);
});
this
.
subscription
.
stream
=
target
.
stream
;
return
Promise
.
resolve
({
data
:
[]});
}
}
}
}
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