Search API: Search by folder UID (#65040)
* Search: Attempt to support folderUID filter * Search: Use folder UID instead of ID for searching folders * Update swagger * Fix JSON property casing * Add integration test * Remove redundant query condition * Fix frontend test * Fix listing dashboards in General/root * Add support for fetching top level folders using `folderUIDs=` (empty string) query parameter * Add deprecation notice * Send uid of general in sql.ts * Use 'general' for query folderUIDs query param for fetching folder * Add tests * Fix FolderUIDFilter --------- Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
co-authored by
Sofia Papagiannaki
parent
64ed77ddce
commit
7bc6d32eb9
+17
-1
@@ -60,7 +60,12 @@ func (hs *HTTPServer) Search(c *contextmodel.ReqContext) response.Response {
|
||||
}
|
||||
}
|
||||
|
||||
if len(dbIDs) > 0 && len(dbUIDs) > 0 {
|
||||
folderUIDs := c.QueryStrings("folderUIDs")
|
||||
|
||||
bothDashboardIds := len(dbIDs) > 0 && len(dbUIDs) > 0
|
||||
bothFolderIds := len(folderIDs) > 0 && len(folderUIDs) > 0
|
||||
|
||||
if bothDashboardIds || bothFolderIds {
|
||||
return response.Error(400, "search supports UIDs or IDs, not both", nil)
|
||||
}
|
||||
|
||||
@@ -76,6 +81,7 @@ func (hs *HTTPServer) Search(c *contextmodel.ReqContext) response.Response {
|
||||
DashboardUIDs: dbUIDs,
|
||||
Type: dashboardType,
|
||||
FolderIds: folderIDs,
|
||||
FolderUIDs: folderUIDs,
|
||||
Permission: permission,
|
||||
Sort: sort,
|
||||
}
|
||||
@@ -136,17 +142,27 @@ type SearchParams struct {
|
||||
// Enum: dash-folder,dash-db
|
||||
Type string `json:"type"`
|
||||
// List of dashboard id’s to search for
|
||||
// This is deprecated: users should use the `dashboardUIDs` query parameter instead
|
||||
// in:query
|
||||
// required: false
|
||||
// deprecated: true
|
||||
DashboardIds []int64 `json:"dashboardIds"`
|
||||
// List of dashboard uid’s to search for
|
||||
// in:query
|
||||
// required: false
|
||||
DashboardUIDs []string `json:"dashboardUIDs"`
|
||||
// List of folder id’s to search in for dashboards
|
||||
// If it's `0` then it will query for the top level folders
|
||||
// This is deprecated: users should use the `folderUIDs` query parameter instead
|
||||
// in:query
|
||||
// required: false
|
||||
// deprecated: true
|
||||
FolderIds []int64 `json:"folderIds"`
|
||||
// List of folder UID’s to search in for dashboards
|
||||
// If it's an empty string then it will query for the top level folders
|
||||
// in:query
|
||||
// required: false
|
||||
FolderUIDs []string `json:"folderUIDs"`
|
||||
// Flag indicating if only starred Dashboards should be returned
|
||||
// in:query
|
||||
// required: false
|
||||
|
||||
Reference in New Issue
Block a user