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
7023dedc
Commit
7023dedc
authored
Mar 20, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(preferences): refactoring PR #4399
parent
9e98c86a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
20 deletions
+21
-20
pkg/api/dashboard.go
+2
-3
pkg/api/dtos/models.go
+2
-2
pkg/services/sqlstore/dashboard.go
+10
-4
public/app/core/routes/dashboard_loaders.js
+7
-11
No files found.
pkg/api/dashboard.go
View file @
7023dedc
...
...
@@ -175,9 +175,8 @@ func GetHomeDashboard(c *middleware.Context) {
return
}
slug
:=
dtos
.
DashboardSlug
{
Slug
:
query
.
Result
}
c
.
JSON
(
200
,
&
slug
)
dashRedirect
:=
dtos
.
DashboardRedirect
{
RedirectUri
:
"db/"
+
query
.
Result
}
c
.
JSON
(
200
,
&
dashRedirect
)
return
}
...
...
pkg/api/dtos/models.go
View file @
7023dedc
...
...
@@ -57,8 +57,8 @@ type DashboardFullWithMeta struct {
Dashboard
*
simplejson
.
Json
`json:"dashboard"`
}
type
Dashboard
Slug
struct
{
Slug
string
`json:"slug
"`
type
Dashboard
Redirect
struct
{
RedirectUri
string
`json:"redirectUri
"`
}
type
DataSource
struct
{
...
...
pkg/services/sqlstore/dashboard.go
View file @
7023dedc
...
...
@@ -257,16 +257,22 @@ func GetDashboards(query *m.GetDashboardsQuery) error {
return
nil
}
type
DashboardSlugDTO
struct
{
Slug
string
}
func
GetDashboardSlugById
(
query
*
m
.
GetDashboardSlugByIdQuery
)
error
{
dashboard
:=
m
.
Dashboard
{
Id
:
query
.
Id
}
has
,
err
:=
x
.
Get
(
&
dashboard
)
query
.
Result
=
dashboard
.
Slug
var
rawSql
=
`SELECT slug from dashboard WHERE Id=?`
var
slug
=
DashboardSlugDTO
{}
exists
,
err
:=
x
.
Sql
(
rawSql
,
query
.
Id
)
.
Get
(
&
slug
)
if
err
!=
nil
{
return
err
}
else
if
ha
s
==
false
{
}
else
if
exist
s
==
false
{
return
m
.
ErrDashboardNotFound
}
query
.
Result
=
slug
.
Slug
return
nil
}
public/app/core/routes/dashboard_loaders.js
View file @
7023dedc
...
...
@@ -4,20 +4,16 @@ define([
function
(
coreModule
)
{
"use strict"
;
coreModule
.
default
.
controller
(
'LoadDashboardCtrl'
,
function
(
$scope
,
$routeParams
,
dashboardLoaderSrv
,
backendSrv
)
{
coreModule
.
default
.
controller
(
'LoadDashboardCtrl'
,
function
(
$scope
,
$routeParams
,
dashboardLoaderSrv
,
backendSrv
,
$location
)
{
if
(
!
$routeParams
.
slug
)
{
backendSrv
.
get
(
'/api/dashboards/home'
).
then
(
function
(
result
)
{
if
(
result
.
slug
==
null
)
{
var
meta
=
result
.
meta
;
meta
.
canSave
=
meta
.
canShare
=
meta
.
canStar
=
false
;
$scope
.
initDashboard
(
result
,
$scope
);
backendSrv
.
get
(
'/api/dashboards/home'
).
then
(
function
(
homeDash
)
{
if
(
homeDash
.
redirectUri
)
{
$location
.
path
(
'dashboard/'
+
homeDash
.
redirectUri
);
}
else
{
$routeParams
.
type
=
'db'
;
$routeParams
.
slug
=
result
.
slug
;
dashboardLoaderSrv
.
loadDashboard
(
$routeParams
.
type
,
$routeParams
.
slug
).
then
(
function
(
result
)
{
$scope
.
initDashboard
(
result
,
$scope
);
});
var
meta
=
homeDash
.
meta
;
meta
.
canSave
=
meta
.
canShare
=
meta
.
canStar
=
false
;
$scope
.
initDashboard
(
homeDash
,
$scope
);
}
});
return
;
...
...
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