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
ca55d1f3
Commit
ca55d1f3
authored
Jan 19, 2016
by
utkarshcmu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor bug fixes
parent
41fd0ed4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
42 deletions
+42
-42
pkg/api/api.go
+8
-8
pkg/api/dashboard_snapshot.go
+15
-15
pkg/api/index.go
+5
-5
pkg/models/dashboard_snapshot.go
+4
-4
pkg/services/sqlstore/dashboard_snapshot.go
+10
-10
No files found.
pkg/api/api.go
View file @
ca55d1f3
...
...
@@ -68,11 +68,11 @@ func Register(r *macaron.Macaron) {
r
.
Post
(
"/api/user/password/reset"
,
bind
(
dtos
.
ResetUserPasswordForm
{}),
wrap
(
ResetPassword
))
// dashboard snapshots
r
.
Get
(
"/dashboard/snapshot/*"
,
Index
)
r
.
Get
(
"/dashboard/snapshots/"
,
reqSignedIn
,
Index
)
r
.
Get
(
"/dashboard/snapshot/*"
,
Index
)
r
.
Get
(
"/dashboard/snapshots/"
,
reqSignedIn
,
Index
)
// api for dashboard snapshots
r
.
Post
(
"/api/snapshots/"
,
bind
(
m
.
CreateDashboardSnapshotCommand
{}),
CreateDashboardSnapshot
)
// api for dashboard snapshots
r
.
Post
(
"/api/snapshots/"
,
bind
(
m
.
CreateDashboardSnapshotCommand
{}),
CreateDashboardSnapshot
)
r
.
Get
(
"/api/snapshot/shared-options/"
,
GetSharingOptions
)
r
.
Get
(
"/api/snapshots/:key"
,
GetDashboardSnapshot
)
r
.
Get
(
"/api/snapshots-delete/:key"
,
DeleteDashboardSnapshot
)
...
...
@@ -184,10 +184,10 @@ func Register(r *macaron.Macaron) {
r
.
Get
(
"/tags"
,
GetDashboardTags
)
})
// Dashboard snapshots
r
.
Group
(
"/dashboard/snapshots"
,
func
()
{
r
.
Get
(
"/"
,
wrap
(
SearchDashboardSnapshots
))
})
// Dashboard snapshots
r
.
Group
(
"/dashboard/snapshots"
,
func
()
{
r
.
Get
(
"/"
,
wrap
(
SearchDashboardSnapshots
))
})
// Playlist
r
.
Group
(
"/playlists"
,
func
()
{
...
...
pkg/api/dashboard_snapshot.go
View file @
ca55d1f3
...
...
@@ -101,23 +101,23 @@ func DeleteDashboardSnapshot(c *middleware.Context) {
}
func
SearchDashboardSnapshots
(
c
*
middleware
.
Context
)
Response
{
query
:=
c
.
Query
(
"query"
)
limit
:=
c
.
QueryInt
(
"limit"
)
query
:=
c
.
Query
(
"query"
)
limit
:=
c
.
QueryInt
(
"limit"
)
if
limit
==
0
{
limit
=
1000
}
if
limit
==
0
{
limit
=
1000
}
searchQuery
:=
m
.
GetDashboardSnapshotsQuery
{
Name
:
query
,
Limit
:
limit
,
OrgId
:
c
.
OrgId
,
}
searchQuery
:=
m
.
GetDashboardSnapshotsQuery
{
Name
:
query
,
Limit
:
limit
,
OrgId
:
c
.
OrgId
,
}
err
:=
bus
.
Dispatch
(
&
searchQuery
)
if
err
!=
nil
{
return
ApiError
(
500
,
"Search failed"
,
err
)
}
err
:=
bus
.
Dispatch
(
&
searchQuery
)
if
err
!=
nil
{
return
ApiError
(
500
,
"Search failed"
,
err
)
}
return
Json
(
200
,
searchQuery
.
Result
)
return
Json
(
200
,
searchQuery
.
Result
)
}
pkg/api/index.go
View file @
ca55d1f3
...
...
@@ -60,11 +60,11 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
Url
:
"/playlists"
,
})
data
.
MainNavLinks
=
append
(
data
.
MainNavLinks
,
&
dtos
.
NavLink
{
Text
:
"Snapshots"
,
Icon
:
"fa fa-fw fa-camera-retro"
,
Url
:
"/dashboard/snapshots"
,
})
data
.
MainNavLinks
=
append
(
data
.
MainNavLinks
,
&
dtos
.
NavLink
{
Text
:
"Snapshots"
,
Icon
:
"fa fa-fw fa-camera-retro"
,
Url
:
"/dashboard/snapshots"
,
})
if
c
.
OrgRole
==
m
.
ROLE_ADMIN
{
data
.
MainNavLinks
=
append
(
data
.
MainNavLinks
,
&
dtos
.
NavLink
{
...
...
pkg/models/dashboard_snapshot.go
View file @
ca55d1f3
...
...
@@ -52,9 +52,9 @@ type GetDashboardSnapshotQuery struct {
type
DashboardSnapshots
[]
*
DashboardSnapshot
type
GetDashboardSnapshotsQuery
struct
{
Name
string
Limit
int
OrgId
int64
Name
string
Limit
int
OrgId
int64
Result
DashboardSnapshots
Result
DashboardSnapshots
}
pkg/services/sqlstore/dashboard_snapshot.go
View file @
ca55d1f3
...
...
@@ -12,7 +12,7 @@ func init() {
bus
.
AddHandler
(
"sql"
,
CreateDashboardSnapshot
)
bus
.
AddHandler
(
"sql"
,
GetDashboardSnapshot
)
bus
.
AddHandler
(
"sql"
,
DeleteDashboardSnapshot
)
bus
.
AddHandler
(
"sql"
,
SearchDashboardSnapshots
)
bus
.
AddHandler
(
"sql"
,
SearchDashboardSnapshots
)
}
func
CreateDashboardSnapshot
(
cmd
*
m
.
CreateDashboardSnapshotCommand
)
error
{
...
...
@@ -67,16 +67,16 @@ func GetDashboardSnapshot(query *m.GetDashboardSnapshotQuery) error {
}
func
SearchDashboardSnapshots
(
query
*
m
.
GetDashboardSnapshotsQuery
)
error
{
var
snapshots
=
make
(
m
.
DashboardSnapshots
,
0
)
var
snapshots
=
make
(
m
.
DashboardSnapshots
,
0
)
sess
:=
x
.
Limit
(
query
.
Limit
)
sess
:=
x
.
Limit
(
query
.
Limit
)
if
query
.
Name
!=
""
{
sess
.
Where
(
"name LIKE ?"
,
query
.
Name
)
}
if
query
.
Name
!=
""
{
sess
.
Where
(
"name LIKE ?"
,
query
.
Name
)
}
sess
.
Where
(
"org_id = ?"
,
query
.
OrgId
)
err
:=
sess
.
Find
(
&
snapshots
)
query
.
Result
=
snapshots
return
err
sess
.
Where
(
"org_id = ?"
,
query
.
OrgId
)
err
:=
sess
.
Find
(
&
snapshots
)
query
.
Result
=
snapshots
return
err
}
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