Dashboard search now supports filtering by multiple dashboard tags, Closes #2095
This commit is contained in:
@@ -150,13 +150,8 @@ func SearchDashboards(query *search.FindPersistedDashboardsQuery) error {
|
||||
params = append(params, "%"+query.Title+"%")
|
||||
}
|
||||
|
||||
if len(query.Tag) > 0 {
|
||||
sql.WriteString(" AND dashboard_tag.term=?")
|
||||
params = append(params, query.Tag)
|
||||
}
|
||||
|
||||
if query.Limit == 0 || query.Limit > 10000 {
|
||||
query.Limit = 300
|
||||
query.Limit = 1000
|
||||
}
|
||||
|
||||
sql.WriteString(fmt.Sprintf(" ORDER BY dashboard.title ASC LIMIT %d", query.Limit))
|
||||
|
||||
@@ -99,18 +99,6 @@ func TestDashboardDataAccess(t *testing.T) {
|
||||
So(len(hit.Tags), ShouldEqual, 2)
|
||||
})
|
||||
|
||||
Convey("Should be able to search for dashboards using tags", func() {
|
||||
query1 := search.FindPersistedDashboardsQuery{Tag: "webapp", OrgId: 1}
|
||||
query2 := search.FindPersistedDashboardsQuery{Tag: "tagdoesnotexist", OrgId: 1}
|
||||
|
||||
err := SearchDashboards(&query1)
|
||||
err = SearchDashboards(&query2)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(len(query1.Result), ShouldEqual, 1)
|
||||
So(len(query2.Result), ShouldEqual, 0)
|
||||
})
|
||||
|
||||
Convey("Should not be able to save dashboard with same name", func() {
|
||||
cmd := m.SaveDashboardCommand{
|
||||
OrgId: 1,
|
||||
|
||||
Reference in New Issue
Block a user