Worked on search filter flag IsStarred, and updated frontend with new dashboard list panel
This commit is contained in:
@@ -7,10 +7,13 @@ import (
|
||||
"github.com/torkelo/grafana-pro/pkg/bus"
|
||||
"github.com/torkelo/grafana-pro/pkg/middleware"
|
||||
m "github.com/torkelo/grafana-pro/pkg/models"
|
||||
"github.com/torkelo/grafana-pro/pkg/setting"
|
||||
)
|
||||
|
||||
func Search(c *middleware.Context) {
|
||||
queryText := c.Query("q")
|
||||
starred := c.Query("starred")
|
||||
|
||||
result := m.SearchResult{
|
||||
Dashboards: []*m.DashboardSearchHit{},
|
||||
Tags: []*m.DashboardTagCloudItem{},
|
||||
@@ -31,6 +34,8 @@ func Search(c *middleware.Context) {
|
||||
query := m.SearchDashboardsQuery{
|
||||
Title: matches[3],
|
||||
Tag: matches[2],
|
||||
UserId: c.UserId,
|
||||
IsStarred: starred == "1",
|
||||
AccountId: c.AccountId,
|
||||
}
|
||||
err := bus.Dispatch(&query)
|
||||
@@ -38,7 +43,11 @@ func Search(c *middleware.Context) {
|
||||
c.JsonApiErr(500, "Search failed", err)
|
||||
return
|
||||
}
|
||||
|
||||
result.Dashboards = query.Result
|
||||
for _, dash := range result.Dashboards {
|
||||
dash.Url = setting.AbsUrlTo("dashboard/db/" + dash.Slug)
|
||||
}
|
||||
}
|
||||
|
||||
c.JSON(200, result)
|
||||
|
||||
Reference in New Issue
Block a user