mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Preferences: Use search endpoint to get missing dashboard (#53540)
This commit is contained in:
parent
72367f99cf
commit
6423485061
@ -3003,8 +3003,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/core/components/SharedPreferences/SharedPreferences.tsx:5381": [
|
"public/app/core/components/SharedPreferences/SharedPreferences.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
|
||||||
],
|
],
|
||||||
"public/app/core/components/TagFilter/TagBadge.tsx:5381": [
|
"public/app/core/components/TagFilter/TagBadge.tsx:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
|
@ -111,27 +111,13 @@ export class SharedPreferences extends PureComponent<Props, State> {
|
|||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
const prefs = await this.service.load();
|
const prefs = await this.service.load();
|
||||||
const dashboards = (await backendSrv.search({ starred: true })) as DashboardSearchItem[];
|
const dashboards = await backendSrv.search({ starred: true });
|
||||||
|
|
||||||
if (prefs.homeDashboardUID && !dashboards.find((d) => d.uid === prefs.homeDashboardUID)) {
|
if (prefs.homeDashboardUID && !dashboards.find((d) => d.uid === prefs.homeDashboardUID)) {
|
||||||
const missingDash = await backendSrv.getDashboardByUid(prefs.homeDashboardUID);
|
const missingDash = await backendSrv.search({ dashboardUIDs: prefs.homeDashboardUID });
|
||||||
|
|
||||||
if (missingDash?.dashboard) {
|
if (missingDash.length > 0) {
|
||||||
dashboards.push({
|
dashboards.push(missingDash[0]);
|
||||||
title: missingDash.dashboard.title,
|
|
||||||
tags: [],
|
|
||||||
type: DashboardSearchItemType.DashDB,
|
|
||||||
uid: missingDash.dashboard.uid,
|
|
||||||
uri: '', // uri is not part of dashboard metadata
|
|
||||||
url: missingDash.meta.url || '',
|
|
||||||
folderId: missingDash.meta.folderId,
|
|
||||||
folderTitle: missingDash.meta.folderTitle,
|
|
||||||
folderUid: missingDash.meta.folderUid,
|
|
||||||
folderUrl: missingDash.meta.folderUrl,
|
|
||||||
isStarred: missingDash.meta.isStarred || false,
|
|
||||||
slug: missingDash.meta.slug,
|
|
||||||
items: [],
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user