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
fbd94fc6
Commit
fbd94fc6
authored
Mar 14, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(websockets): inital work on websockets, #4355
parent
5b6754ce
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
88 additions
and
13 deletions
+88
-13
pkg/api/api.go
+1
-1
pkg/api/live/conn.go
+0
-0
pkg/api/live/hub.go
+0
-0
pkg/api/search.go
+2
-4
public/app/core/core.ts
+2
-0
public/app/core/live/live_srv.ts
+31
-0
public/app/features/admin/admin.ts
+0
-8
public/app/plugins/datasource/stream/datasource.ts
+21
-0
public/app/plugins/datasource/stream/module.ts
+15
-0
public/app/plugins/datasource/stream/partials/query.editor.html
+8
-0
public/app/plugins/datasource/stream/plugin.json
+8
-0
No files found.
pkg/api/api.go
View file @
fbd94fc6
...
...
@@ -4,7 +4,7 @@ import (
"github.com/go-macaron/binding"
"github.com/grafana/grafana/pkg/api/avatar"
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/live"
"github.com/grafana/grafana/pkg/
api/
live"
"github.com/grafana/grafana/pkg/middleware"
m
"github.com/grafana/grafana/pkg/models"
"gopkg.in/macaron.v1"
...
...
pkg/live/conn.go
→
pkg/
api/
live/conn.go
View file @
fbd94fc6
File moved
pkg/live/hub.go
→
pkg/
api/
live/hub.go
View file @
fbd94fc6
File moved
pkg/api/search.go
View file @
fbd94fc6
package
api
import
(
"strconv"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/live"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/services/search"
"strconv"
)
func
Search
(
c
*
middleware
.
Context
)
{
...
...
@@ -43,6 +43,4 @@ func Search(c *middleware.Context) {
}
c
.
JSON
(
200
,
searchQuery
.
Result
)
live
.
SendMessage
(
query
)
}
public/app/core/core.ts
View file @
fbd94fc6
...
...
@@ -28,6 +28,7 @@ import {infoPopover} from './components/info_popover';
import
{
colorPicker
}
from
'./components/colorpicker'
;
import
{
navbarDirective
}
from
'./components/navbar/navbar'
;
import
{
arrayJoin
}
from
'./directives/array_join'
;
import
{
liveSrv
}
from
'./live/live_srv'
;
import
'app/core/controllers/all'
;
import
'app/core/services/all'
;
import
'app/core/routes/routes'
;
...
...
@@ -42,5 +43,6 @@ export {
navbarDirective
,
searchDirective
,
colorPicker
,
liveSrv
,
infoPopover
};
public/app/core/live/live_srv.ts
0 → 100644
View file @
fbd94fc6
///<reference path="../../headers/common.d.ts" />
import
config
from
'app/core/config'
;
import
coreModule
from
'app/core/core_module'
;
export
class
LiveSrv
{
conn
:
any
;
init
()
{
this
.
conn
=
new
WebSocket
(
"ws://localhost:3000/ws"
);
this
.
conn
.
onclose
=
function
(
evt
)
{
console
.
log
(
"WebSocket closed"
);
};
this
.
conn
.
onmessage
=
function
(
evt
)
{
console
.
log
(
"WebSocket message"
,
evt
.
data
);
};
this
.
conn
.
onopen
=
function
(
evt
)
{
console
.
log
(
"Connection opened"
);
};
}
subscribe
(
name
)
{
if
(
!
this
.
conn
)
{
this
.
init
();
}
}
}
var
instance
=
new
LiveSrv
();
export
{
instance
as
liveSrv
};
public/app/features/admin/admin.ts
View file @
fbd94fc6
...
...
@@ -20,14 +20,6 @@ class AdminSettingsCtrl {
class
AdminHomeCtrl
{
/** @ngInject **/
constructor
()
{
var
conn
=
new
WebSocket
(
"ws://localhost:3000/ws"
);
conn
.
onclose
=
function
(
evt
)
{
console
.
log
(
"Connection closed"
);
};
conn
.
onmessage
=
function
(
evt
)
{
console
.
log
(
"message"
,
evt
.
data
);
};
}
}
...
...
public/app/plugins/datasource/stream/datasource.ts
0 → 100644
View file @
fbd94fc6
///<reference path="../../../headers/common.d.ts" />
import
{
liveSrv
}
from
'app/core/core'
;
export
class
GrafanaStreamDS
{
/** @ngInject */
constructor
(
private
$q
)
{
}
query
(
options
)
{
if
(
options
.
targets
.
length
===
0
)
{
return
Promise
.
resolve
({
data
:
[]});
}
var
target
=
options
.
targets
[
0
];
liveSrv
.
subscribe
(
target
);
}
}
public/app/plugins/datasource/stream/module.ts
0 → 100644
View file @
fbd94fc6
///<reference path="../../../headers/common.d.ts" />
import
angular
from
'angular'
;
import
{
GrafanaStreamDS
}
from
'./datasource'
;
import
{
QueryCtrl
}
from
'app/plugins/sdk'
;
class
GrafanaQueryCtrl
extends
QueryCtrl
{
static
templateUrl
=
'partials/query.editor.html'
;
}
export
{
GrafanaStreamDS
as
Datasource
,
GrafanaQueryCtrl
as
QueryCtrl
,
};
public/app/plugins/datasource/stream/partials/query.editor.html
0 → 100644
View file @
fbd94fc6
<query-editor-row
ctrl=
"ctrl"
>
<li
class=
"tight-form-item"
>
Stream Expression
</li>
<li>
<input
type=
"text"
class=
"tight-form-input input-large"
ng-model=
"ctrl.target.channel"
>
</li>
</query-editor-row>
public/app/plugins/datasource/stream/plugin.json
0 → 100644
View file @
fbd94fc6
{
"type"
:
"datasource"
,
"name"
:
"Grafana Stream DS"
,
"id"
:
"grafana-stream-ds"
,
"builtIn"
:
true
,
"metrics"
:
true
}
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