mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
This reverts commit 007cd144a9
from #44175.
This commit is contained in:
parent
cb09162cde
commit
62b69a0b90
@ -305,7 +305,7 @@ func (ss *SQLStore) findDashboards(ctx context.Context, query *search.FindPersis
|
||||
}
|
||||
|
||||
if len(query.FolderIds) > 0 {
|
||||
filters = append(filters, searchstore.FolderFilter{Dialect: dialect, IDs: query.FolderIds})
|
||||
filters = append(filters, searchstore.FolderFilter{IDs: query.FolderIds})
|
||||
}
|
||||
|
||||
var res []DashboardSearchProjection
|
||||
|
@ -384,24 +384,6 @@ func TestDashboardDataAccess(t *testing.T) {
|
||||
require.Equal(t, hit.FolderURL, fmt.Sprintf("/dashboards/f/%s/%s", savedFolder.Uid, savedFolder.Slug))
|
||||
})
|
||||
|
||||
t.Run("Should be able to search for general folder's children", func(t *testing.T) {
|
||||
setup()
|
||||
query := search.FindPersistedDashboardsQuery{
|
||||
OrgId: 1,
|
||||
FolderIds: []int64{0},
|
||||
SignedInUser: &models.SignedInUser{OrgId: 1, OrgRole: models.ROLE_EDITOR},
|
||||
}
|
||||
|
||||
err := sqlStore.SearchDashboards(context.Background(), &query)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, len(query.Result), 1)
|
||||
hit := query.Result[0]
|
||||
require.Equal(t, savedDash2.Id, hit.ID)
|
||||
require.Equal(t, fmt.Sprintf("/d/%s/%s", savedDash2.Uid, savedDash2.Slug), hit.URL)
|
||||
require.Equal(t, int64(0), hit.FolderID)
|
||||
})
|
||||
|
||||
t.Run("Should be able to search for dashboard by dashboard ids", func(t *testing.T) {
|
||||
setup()
|
||||
query := search.FindPersistedDashboardsQuery{
|
||||
|
@ -87,16 +87,10 @@ func (f TitleFilter) Where() (string, []interface{}) {
|
||||
}
|
||||
|
||||
type FolderFilter struct {
|
||||
Dialect migrator.Dialect
|
||||
IDs []int64
|
||||
IDs []int64
|
||||
}
|
||||
|
||||
func (f FolderFilter) Where() (string, []interface{}) {
|
||||
if len(f.IDs) == 1 && f.IDs[0] == 0 {
|
||||
sql := fmt.Sprintf("dashboard.folder_id = 0 AND dashboard.is_folder = %s", f.Dialect.BooleanStr(false))
|
||||
return sql, []interface{}{}
|
||||
}
|
||||
|
||||
return sqlIDin("dashboard.folder_id", f.IDs)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user