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
49b18e17
Commit
49b18e17
authored
Jan 06, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test query feature to grafana datasource to generate a test graph on first login
parent
34427f34
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
6 deletions
+36
-6
src/app/features/all.js
+1
-0
src/app/features/grafanaDatasource/datasource.js
+13
-1
src/app/features/grafanaDatasource/partials/query.editor.html
+17
-0
src/app/services/all.js
+0
-1
src/app/services/backendSrv.js
+5
-4
No files found.
src/app/features/all.js
View file @
49b18e17
...
...
@@ -9,4 +9,5 @@ define([
'./dashboard/all'
,
'./admin/accountCtrl'
,
'./admin/datasourcesCtrl'
,
'./grafanaDatasource/datasource'
,
],
function
()
{});
src/app/
services/grafanaD
atasource.js
→
src/app/
features/grafanaDatasource/d
atasource.js
View file @
49b18e17
define
([
'angular'
,
'lodash'
,
'kbn'
,
],
function
(
angular
,
_
)
{
function
(
angular
,
_
,
kbn
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.services'
);
...
...
@@ -12,6 +13,9 @@ function (angular, _) {
function
GrafanaDatasource
()
{
this
.
type
=
'grafana'
;
this
.
grafanaDB
=
true
;
this
.
name
=
"grafana"
;
this
.
supportMetrics
=
true
;
this
.
editorSrc
=
'app/features/grafanaDatasource/partials/query.editor.html'
;
}
GrafanaDatasource
.
prototype
.
getDashboard
=
function
(
id
,
isTemp
)
{
...
...
@@ -31,6 +35,14 @@ function (angular, _) {
});
};
GrafanaDatasource
.
prototype
.
query
=
function
(
options
)
{
// get from & to in seconds
var
from
=
kbn
.
parseDate
(
options
.
range
.
from
).
getTime
();
var
to
=
kbn
.
parseDate
(
options
.
range
.
to
).
getTime
();
return
backendSrv
.
get
(
'/api/metrics/test'
,
{
from
:
from
,
to
:
to
,
maxDataPoints
:
options
.
maxDataPoints
});
};
GrafanaDatasource
.
prototype
.
saveDashboard
=
function
(
dashboard
)
{
// remove id if title has changed
if
(
dashboard
.
title
!==
dashboard
.
originalTitle
)
{
...
...
src/app/features/grafanaDatasource/partials/query.editor.html
0 → 100644
View file @
49b18e17
<div
class=
"fluid-row"
style=
"margin-top: 20px"
>
<div
class=
"span2"
></div>
<div
class=
"grafana-info-box span8"
>
<h5>
Test graph
</h5>
<p>
This is just a test data source that generates random walk series. If this is your only data source
open the left side menu and goto data sources admin screen and add your data sources. You can change
data source using the button to the left of the
<strong>
Add query
</strong>
button.
</p>
</div>
<div
class=
"span2"
></div>
<div
class=
"clearfix"
></div>
</div>
src/app/services/all.js
View file @
49b18e17
...
...
@@ -6,6 +6,5 @@ define([
'./keyboardManager'
,
'./popoverSrv'
,
'./backendSrv'
,
'./grafanaDatasource'
,
],
function
()
{});
src/app/services/backendSrv.js
View file @
49b18e17
...
...
@@ -10,8 +10,8 @@ function (angular, _, config) {
module
.
service
(
'backendSrv'
,
function
(
$http
,
alertSrv
)
{
this
.
get
=
function
(
url
)
{
return
this
.
request
({
method
:
'GET'
,
url
:
url
});
this
.
get
=
function
(
url
,
params
)
{
return
this
.
request
({
method
:
'GET'
,
url
:
url
,
params
:
params
});
};
this
.
delete
=
function
(
url
)
{
...
...
@@ -30,7 +30,8 @@ function (angular, _, config) {
var
httpOptions
=
{
url
:
config
.
appSubUrl
+
options
.
url
,
method
:
options
.
method
,
data
:
options
.
data
data
:
options
.
data
,
params
:
options
.
params
,
};
return
$http
(
httpOptions
).
then
(
function
(
results
)
{
...
...
@@ -54,7 +55,7 @@ function (angular, _, config) {
}
if
(
data
.
message
)
{
alertSrv
.
set
(
"
Error
"
,
data
.
message
,
data
.
severity
,
10000
);
alertSrv
.
set
(
"
Problem!
"
,
data
.
message
,
data
.
severity
,
10000
);
}
throw
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