[v9.2.x] SearchV2: Fix star query when no stars exist (#61818)

SearchV2: Fix star query when no stars exist (#61726)

(cherry picked from commit c315946a91)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2023-01-19 21:53:29 +00:00
committed by GitHub
co-authored by Ryan McKinley
parent 0a415bfbbd
commit 0f40e95b54
+16 -4
View File
@@ -42,11 +42,23 @@ export class BlugeSearcher implements GrafanaSearcher {
}
// get the starred dashboards
const starsUIDS = await getBackendSrv().get('api/user/stars');
const starredQuery = {
uid: starsUIDS,
query: query.query ?? '*',
if (starsUIDS?.length) {
return this.doSearchQuery({
uid: starsUIDS,
query: query.query ?? '*',
});
}
// Nothing is starred
return {
view: new DataFrameView({ length: 0, fields: [] }),
totalRows: 0,
loadMoreItems: async (startIndex: number, stopIndex: number): Promise<void> => {
return;
},
isItemLoaded: (index: number): boolean => {
return true;
},
};
return this.doSearchQuery(starredQuery);
}
async tags(query: SearchQuery): Promise<TermCount[]> {