mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
Dashboard: Fix loading custom home dashboard (#25447)
* Dashboard: Fix loading custom home dashboard * Updated and added test
This commit is contained in:
parent
c53435f7a7
commit
8474794aaa
@ -201,7 +201,6 @@ describeInitScenario('Initializing home dashboard', ctx => {
|
||||
ctx.setup(() => {
|
||||
ctx.args.routeInfo = DashboardRouteInfo.Home;
|
||||
ctx.backendSrv.get.mockResolvedValue({
|
||||
meta: {},
|
||||
redirectUri: '/u/123/my-home',
|
||||
});
|
||||
});
|
||||
@ -212,6 +211,17 @@ describeInitScenario('Initializing home dashboard', ctx => {
|
||||
});
|
||||
});
|
||||
|
||||
describeInitScenario('Initializing home dashboard cancelled', ctx => {
|
||||
ctx.setup(() => {
|
||||
ctx.args.routeInfo = DashboardRouteInfo.Home;
|
||||
ctx.backendSrv.get.mockResolvedValue([]);
|
||||
});
|
||||
|
||||
it('Should abort init process', () => {
|
||||
expect(ctx.actions.length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describeInitScenario('Initializing existing dashboard', ctx => {
|
||||
const mockQueries = [
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ async function fetchDashboard(
|
||||
const dashDTO: DashboardDTO = await backendSrv.get('/api/dashboards/home');
|
||||
|
||||
// if above all is cancelled it will return an array
|
||||
if (!dashDTO.meta) {
|
||||
if (Array.isArray(dashDTO)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user