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
bc673fd9
Commit
bc673fd9
authored
Feb 03, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Worked on loading a home dashboard through backend
parent
a127f2d5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
31 deletions
+11
-31
src/app/controllers/sidemenuCtrl.js
+1
-1
src/app/features/grafanaDatasource/datasource.js
+4
-4
src/app/routes/backend/dashboard.js
+6
-26
No files found.
src/app/controllers/sidemenuCtrl.js
View file @
bc673fd9
...
...
@@ -20,7 +20,7 @@ function (angular, _, $, config) {
text
:
"Dashbords"
,
icon
:
"fa fa-th-large"
,
href
:
$scope
.
getUrl
(
"/"
),
startsWith
:
config
.
appSubUrl
+
'/dashboard/'
,
//
startsWith: config.appSubUrl + '/dashboard/',
});
$scope
.
menu
.
push
({
...
...
src/app/features/grafanaDatasource/datasource.js
View file @
bc673fd9
...
...
@@ -19,13 +19,13 @@ function (angular, _, kbn) {
}
GrafanaDatasource
.
prototype
.
getDashboard
=
function
(
slug
,
isTemp
)
{
var
url
=
'/dashboard/'
+
slug
;
var
url
=
'/dashboard
s
/'
+
slug
;
if
(
isTemp
)
{
url
=
'/temp/'
+
slug
;
}
return
backendSrv
.
get
(
'/api/dashboard/'
+
slug
);
return
backendSrv
.
get
(
'/api/dashboard
s/db
/'
+
slug
);
};
GrafanaDatasource
.
prototype
.
query
=
function
(
options
)
{
...
...
@@ -50,7 +50,7 @@ function (angular, _, kbn) {
dashboard
.
id
=
null
;
}
return
backendSrv
.
post
(
'/api/dashboard/'
,
{
dashboard
:
dashboard
})
return
backendSrv
.
post
(
'/api/dashboard
s/db
/'
,
{
dashboard
:
dashboard
})
.
then
(
function
(
data
)
{
return
{
title
:
dashboard
.
title
,
url
:
'/dashboard/db/'
+
data
.
slug
};
},
function
(
err
)
{
...
...
@@ -61,7 +61,7 @@ function (angular, _, kbn) {
};
GrafanaDatasource
.
prototype
.
deleteDashboard
=
function
(
id
)
{
return
backendSrv
.
delete
(
'/api/dashboard/'
+
id
);
return
backendSrv
.
delete
(
'/api/dashboard
s/db
/'
+
id
);
};
GrafanaDatasource
.
prototype
.
searchDashboards
=
function
(
query
)
{
...
...
src/app/routes/backend/dashboard.js
View file @
bc673fd9
...
...
@@ -2,47 +2,27 @@ define([
'angular'
,
'store'
,
],
function
(
angular
,
store
)
{
function
(
angular
)
{
"use strict"
;
var
module
=
angular
.
module
(
'grafana.routes'
);
// remember previous dashboard
var
prevDashPath
=
null
;
module
.
controller
(
'DashFromDBProvider'
,
function
(
$scope
,
$rootScope
,
datasourceSrv
,
$routeParams
,
alertSrv
,
$http
,
$location
)
{
module
.
controller
(
'DashFromDBProvider'
,
function
(
$scope
,
datasourceSrv
,
$routeParams
,
backendSrv
)
{
var
db
=
datasourceSrv
.
getGrafanaDB
();
var
isTemp
=
window
.
location
.
href
.
indexOf
(
'dashboard/temp'
)
!==
-
1
;
if
(
!
$routeParams
.
id
)
{
// do we have a previous dash
if
(
prevDashPath
)
{
$location
.
path
(
prevDashPath
);
return
;
}
var
savedRoute
=
store
.
get
(
'grafanaDashboardDefault'
);
if
(
!
savedRoute
)
{
$http
.
get
(
"app/dashboards/default.json?"
+
new
Date
().
getTime
()).
then
(
function
(
result
)
{
var
dashboard
=
angular
.
fromJson
(
result
.
data
);
$scope
.
initDashboard
({
model
:
dashboard
,
meta
:
{}},
$scope
);
backendSrv
.
get
(
'api/dashboards/home'
).
then
(
function
(
result
)
{
$scope
.
initDashboard
(
result
,
$scope
);
},
function
()
{
$scope
.
initDashboard
({},
$scope
);
$scope
.
appEvent
(
'alert-error'
,
[
'Load dashboard failed'
,
''
]);
});
return
;
}
else
{
$location
.
path
(
savedRoute
);
return
;
}
}
db
.
getDashboard
(
$routeParams
.
id
,
isTemp
).
then
(
function
(
result
)
{
prevDashPath
=
$location
.
path
();
db
.
getDashboard
(
$routeParams
.
id
,
false
).
then
(
function
(
result
)
{
$scope
.
initDashboard
(
result
,
$scope
);
}).
then
(
null
,
function
()
{
$scope
.
initDashboard
({
...
...
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