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
68b9342d
Commit
68b9342d
authored
May 24, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: dashboard search by type (folder or dash)
parent
b4576edc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
0 deletions
+13
-0
pkg/api/search.go
+2
-0
pkg/services/search/handlers.go
+1
-0
pkg/services/search/models.go
+2
-0
pkg/services/sqlstore/dashboard.go
+8
-0
No files found.
pkg/api/search.go
View file @
68b9342d
...
...
@@ -14,6 +14,7 @@ func Search(c *middleware.Context) {
tags
:=
c
.
QueryStrings
(
"tag"
)
starred
:=
c
.
Query
(
"starred"
)
limit
:=
c
.
QueryInt
(
"limit"
)
dashboardType
:=
c
.
Query
(
"type"
)
if
limit
==
0
{
limit
=
1000
...
...
@@ -35,6 +36,7 @@ func Search(c *middleware.Context) {
IsStarred
:
starred
==
"true"
,
OrgId
:
c
.
OrgId
,
DashboardIds
:
dbids
,
Type
:
dashboardType
,
}
err
:=
bus
.
Dispatch
(
&
searchQuery
)
...
...
pkg/services/search/handlers.go
View file @
68b9342d
...
...
@@ -45,6 +45,7 @@ func searchHandler(query *Query) error {
IsStarred
:
query
.
IsStarred
,
OrgId
:
query
.
OrgId
,
DashboardIds
:
query
.
DashboardIds
,
Type
:
query
.
Type
,
}
if
err
:=
bus
.
Dispatch
(
&
dashQuery
);
err
!=
nil
{
...
...
pkg/services/search/models.go
View file @
68b9342d
...
...
@@ -46,6 +46,7 @@ type Query struct {
UserId
int64
Limit
int
IsStarred
bool
Type
string
DashboardIds
[]
int
Result
HitList
...
...
@@ -57,6 +58,7 @@ type FindPersistedDashboardsQuery struct {
UserId
int64
IsStarred
bool
DashboardIds
[]
int
Type
string
Result
HitList
}
pkg/services/sqlstore/dashboard.go
View file @
68b9342d
...
...
@@ -201,6 +201,14 @@ func findDashboards(query *search.FindPersistedDashboardsQuery) ([]DashboardSear
params
=
append
(
params
,
"%"
+
query
.
Title
+
"%"
)
}
if
len
(
query
.
Type
)
>
0
&&
query
.
Type
==
"dash-folder"
{
sql
.
WriteString
(
" AND dashboard.is_folder = 1"
)
}
if
len
(
query
.
Type
)
>
0
&&
query
.
Type
==
"dash-db"
{
sql
.
WriteString
(
" AND dashboard.is_folder = 0"
)
}
sql
.
WriteString
(
fmt
.
Sprintf
(
" ORDER BY dashboard.title ASC LIMIT 1000"
))
var
res
[]
DashboardSearchProjection
...
...
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