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
97758380
Commit
97758380
authored
Feb 02, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Worked on stars in search results
parent
ad3d15e2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
1 deletions
+28
-1
grafana
+1
-1
pkg/api/api.go
+1
-0
pkg/api/dtos/models.go
+4
-0
pkg/api/stars.go
+20
-0
pkg/models/search.go
+1
-0
pkg/services/sqlstore/dashboard.go
+1
-0
No files found.
grafana
@
b67f4dc3
Subproject commit
1e3970c6e56af810047ab815acd7fd5e681b5139
Subproject commit
b67f4dc390b5241339b8f2799110faf3d454e4c5
pkg/api/api.go
View file @
97758380
...
...
@@ -45,6 +45,7 @@ func Register(r *macaron.Macaron) {
r
.
Put
(
"/"
,
bind
(
m
.
UpdateUserCommand
{}),
UpdateUser
)
r
.
Post
(
"/using/:id"
,
SetUsingAccount
)
r
.
Get
(
"/accounts"
,
GetUserAccounts
)
r
.
Get
(
"/stars/"
,
GetUserStars
)
r
.
Post
(
"/stars/dashboard/:id"
,
StarDashboard
)
r
.
Delete
(
"/stars/dashboard/:id"
,
UnstarDashboard
)
})
...
...
pkg/api/dtos/models.go
View file @
97758380
...
...
@@ -57,6 +57,10 @@ type MetricQueryResultDataDto struct {
DataPoints
[][
2
]
float64
`json:"datapoints"`
}
type
UserStars
struct
{
DashboardIds
map
[
string
]
bool
`json:"dashboardIds"`
}
func
GetGravatarUrl
(
text
string
)
string
{
if
text
==
""
{
return
""
...
...
pkg/api/stars.go
View file @
97758380
package
api
import
(
"strconv"
"github.com/torkelo/grafana-pro/pkg/api/dtos"
"github.com/torkelo/grafana-pro/pkg/bus"
"github.com/torkelo/grafana-pro/pkg/middleware"
m
"github.com/torkelo/grafana-pro/pkg/models"
...
...
@@ -43,3 +46,20 @@ func UnstarDashboard(c *middleware.Context) {
c
.
JsonOK
(
"Dashboard unstarred"
)
}
func
GetUserStars
(
c
*
middleware
.
Context
)
{
query
:=
m
.
GetUserStarsQuery
{
UserId
:
c
.
UserId
}
if
err
:=
bus
.
Dispatch
(
&
query
);
err
!=
nil
{
c
.
JsonApiErr
(
500
,
"Failed to get user stars"
,
err
)
return
}
var
result
dtos
.
UserStars
result
.
DashboardIds
=
make
(
map
[
string
]
bool
)
for
_
,
star
:=
range
query
.
Result
{
result
.
DashboardIds
[
strconv
.
FormatInt
(
star
.
DashboardId
,
10
)]
=
true
}
c
.
JSON
(
200
,
&
result
)
}
pkg/models/search.go
View file @
97758380
...
...
@@ -7,6 +7,7 @@ type SearchResult struct {
}
type
DashboardSearchHit
struct
{
Id
int64
`json:"id"`
Title
string
`json:"title"`
Slug
string
`json:"slug"`
Tags
[]
string
`json:"tags"`
...
...
pkg/services/sqlstore/dashboard.go
View file @
97758380
...
...
@@ -105,6 +105,7 @@ func SearchDashboards(query *m.SearchDashboardsQuery) error {
hit
,
exists
:=
hits
[
item
.
Id
]
if
!
exists
{
hit
=
&
m
.
DashboardSearchHit
{
Id
:
item
.
Id
,
Title
:
item
.
Title
,
Slug
:
item
.
Slug
,
Tags
:
[]
string
{},
...
...
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