mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Scopes: Name relationship objects *binding (#84955)
Signed-off-by: bergquist <carl.bergquist@gmail.com> Co-authored-by: Bogdan Matei <bogdan.matei@grafana.com>
This commit is contained in:
@@ -58,13 +58,10 @@ export class ScopesDashboardsScene extends SceneObjectBase<ScopesDashboardsScene
|
||||
private async fetchDashboardsUids(scope: string): Promise<string[]> {
|
||||
try {
|
||||
const response = await getBackendSrv().get<{
|
||||
items: Array<{ spec: { dashboardUids: null | string[]; scopeUid: string } }>;
|
||||
items: Array<{ spec: { dashboards: null | string[]; scope: string } }>;
|
||||
}>(this._url, { scope });
|
||||
|
||||
return (
|
||||
response.items.find((item) => !!item.spec.dashboardUids && item.spec.scopeUid === scope)?.spec.dashboardUids ??
|
||||
[]
|
||||
);
|
||||
return response.items.find((item) => !!item.spec.dashboards && item.spec.scope === scope)?.spec.dashboards ?? [];
|
||||
} catch (err) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ jest.mock('@grafana/runtime', () => ({
|
||||
return {
|
||||
items: Object.values(scopesMocks).map((scope) => ({
|
||||
spec: {
|
||||
dashboardUids: scope.dashboards.map((dashboard) => dashboard.uid),
|
||||
scopeUid: scope.uid,
|
||||
dashboards: scope.dashboards.map((dashboard) => dashboard.uid),
|
||||
scope: scope.uid,
|
||||
},
|
||||
})),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user