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
9dd6aefc
Commit
9dd6aefc
authored
Mar 16, 2016
by
utkarshcmu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor corrections
parent
749fd618
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
21 deletions
+21
-21
pkg/api/api.go
+6
-6
pkg/api/preferences.go
+6
-6
pkg/models/preferences.go
+3
-3
pkg/services/sqlstore/preferences.go
+5
-5
public/app/features/dashboard/dashnav/dashnav.ts
+1
-1
No files found.
pkg/api/api.go
View file @
9dd6aefc
...
...
@@ -160,12 +160,12 @@ func Register(r *macaron.Macaron) {
r
.
Delete
(
"/:id"
,
wrap
(
DeleteApiKey
))
},
reqOrgAdmin
)
// Preferences
r
.
Group
(
"/preferences"
,
func
()
{
r
.
Get
(
"/"
,
wrap
(
GetPreferences
))
r
.
Put
(
"/"
,
bind
(
m
.
SavePreferencesCommand
{}),
wrap
(
SavePreferences
))
r
.
Post
(
"/set-home-dash"
,
bind
(
m
.
SavePreferencesCommand
{}),
wrap
(
SetHomeDashboard
))
})
// Preferences
r
.
Group
(
"/preferences"
,
func
()
{
r
.
Get
(
"/"
,
wrap
(
GetPreferences
))
r
.
Put
(
"/"
,
bind
(
m
.
SavePreferencesCommand
{}),
wrap
(
SavePreferences
))
r
.
Post
(
"/set-home-dash"
,
bind
(
m
.
SavePreferencesCommand
{}),
wrap
(
SetHomeDashboard
))
})
// Data sources
r
.
Group
(
"/datasources"
,
func
()
{
...
...
pkg/api/preferences.go
View file @
9dd6aefc
...
...
@@ -42,13 +42,13 @@ func GetPreferences(c *middleware.Context) {
// POST /api/preferences/set-home-dash
func
SetHomeDashboard
(
c
*
middleware
.
Context
,
cmd
m
.
SavePreferencesCommand
)
Response
{
cmd
.
UserId
=
c
.
UserId
cmd
.
OrgId
=
c
.
OrgId
cmd
.
UserId
=
c
.
UserId
cmd
.
OrgId
=
c
.
OrgId
if
err
:=
bus
.
Dispatch
(
&
cmd
);
err
!=
nil
{
return
ApiError
(
500
,
"Failed to set home dashboard"
,
err
)
}
if
err
:=
bus
.
Dispatch
(
&
cmd
);
err
!=
nil
{
return
ApiError
(
500
,
"Failed to set home dashboard"
,
err
)
}
return
ApiSuccess
(
"Home dashboard set"
)
return
ApiSuccess
(
"Home dashboard set"
)
}
pkg/models/preferences.go
View file @
9dd6aefc
...
...
@@ -39,7 +39,7 @@ type SavePreferencesCommand struct {
UserId
int64
OrgId
int64
HomeDashboardId
int64
`json:"d
ashboardId"`
Timezone
string
`json:"timezone"`
Theme
string
`json:"theme"`
HomeDashboardId
int64
`json:"homeD
ashboardId"`
Timezone
string
`json:"timezone"`
Theme
string
`json:"theme"`
}
pkg/services/sqlstore/preferences.go
View file @
9dd6aefc
package
sqlstore
import
(
"time"
"github.com/grafana/grafana/pkg/bus"
m
"github.com/grafana/grafana/pkg/models"
"time"
)
func
init
()
{
...
...
@@ -42,8 +42,8 @@ func SavePreferences(cmd *m.SavePreferencesCommand) error {
HomeDashboardId
:
cmd
.
HomeDashboardId
,
Timezone
:
cmd
.
Timezone
,
Theme
:
cmd
.
Theme
,
Created
:
time
.
Now
(),
Updated
:
time
.
Now
(),
Created
:
time
.
Now
(),
Updated
:
time
.
Now
(),
}
_
,
err
=
sess
.
Insert
(
&
prefs
)
return
err
...
...
@@ -51,8 +51,8 @@ func SavePreferences(cmd *m.SavePreferencesCommand) error {
prefs
.
HomeDashboardId
=
cmd
.
HomeDashboardId
prefs
.
Timezone
=
cmd
.
Timezone
prefs
.
Theme
=
cmd
.
Theme
prefs
.
Updated
=
time
.
Now
()
prefs
.
Version
+=
1
prefs
.
Updated
=
time
.
Now
()
prefs
.
Version
+=
1
_
,
err
=
sess
.
Id
(
prefs
.
Id
)
.
Update
(
&
prefs
)
return
err
}
...
...
public/app/features/dashboard/dashnav/dashnav.ts
View file @
9dd6aefc
...
...
@@ -106,7 +106,7 @@ export class DashNavCtrl {
$scope
.
saveDashboardAsHome
=
function
()
{
// TODO: this backend method needs to be implemented
backendSrv
.
post
(
'/api/preferences/set-home-dash'
,
{
d
ashboardId
:
$scope
.
dashboard
.
id
homeD
ashboardId
:
$scope
.
dashboard
.
id
});
};
...
...
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