mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[APM] Add logic to setup default landing page for serverless (#158916)
Closes https://github.com/elastic/kibana/issues/158457 ## Summary This PR add default landing page for serverless based on comments provided here - https://github.com/elastic/kibana/issues/158457#issuecomment-1570760274
This commit is contained in:
parent
87dc7ae928
commit
ec7ba022e1
3 changed files with 35 additions and 2 deletions
|
@ -12,7 +12,7 @@ xpack.serverless.observability.enabled: true
|
||||||
xpack.infra.logs.app_target: discover
|
xpack.infra.logs.app_target: discover
|
||||||
|
|
||||||
## Set the home route
|
## Set the home route
|
||||||
uiSettings.overrides.defaultRoute: /app/observabilityOnboarding
|
uiSettings.overrides.defaultRoute: /app/observability/landing
|
||||||
|
|
||||||
## Set the dev project switch current type
|
## Set the dev project switch current type
|
||||||
xpack.serverless.plugin.developer.projectSwitcher.currentType: 'observability'
|
xpack.serverless.plugin.developer.projectSwitcher.currentType: 'observability'
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||||
|
* or more contributor license agreements. Licensed under the Elastic License
|
||||||
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||||
|
* 2.0.
|
||||||
|
*/
|
||||||
|
import React from 'react';
|
||||||
|
import { useHasData } from '../../hooks/use_has_data';
|
||||||
|
import { useKibana } from '../../utils/kibana_react';
|
||||||
|
|
||||||
|
export function LandingPage() {
|
||||||
|
const { hasDataMap, isAllRequestsComplete } = useHasData();
|
||||||
|
const {
|
||||||
|
application: { navigateToUrl },
|
||||||
|
http: { basePath },
|
||||||
|
} = useKibana().services;
|
||||||
|
|
||||||
|
if (isAllRequestsComplete) {
|
||||||
|
const { apm, infra_logs: logs } = hasDataMap;
|
||||||
|
const hasApmData = apm?.hasData;
|
||||||
|
const hasLogsData = logs?.hasData;
|
||||||
|
|
||||||
|
if (hasLogsData) {
|
||||||
|
navigateToUrl(basePath.prepend('/app/discover'));
|
||||||
|
} else if (hasApmData) {
|
||||||
|
navigateToUrl(basePath.prepend('/app/apm/services'));
|
||||||
|
} else {
|
||||||
|
navigateToUrl(basePath.prepend('/app/observabilityOnboarding'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return <></>;
|
||||||
|
}
|
|
@ -21,6 +21,7 @@ import { SlosWelcomePage } from '../pages/slos_welcome/slos_welcome';
|
||||||
import { SloDetailsPage } from '../pages/slo_details/slo_details';
|
import { SloDetailsPage } from '../pages/slo_details/slo_details';
|
||||||
import { SloEditPage } from '../pages/slo_edit/slo_edit';
|
import { SloEditPage } from '../pages/slo_edit/slo_edit';
|
||||||
import { casesPath } from '../../common';
|
import { casesPath } from '../../common';
|
||||||
|
import { LandingPage } from '../pages/landing/landing';
|
||||||
|
|
||||||
export type RouteParams<T extends keyof typeof routes> = DecodeParams<typeof routes[T]['params']>;
|
export type RouteParams<T extends keyof typeof routes> = DecodeParams<typeof routes[T]['params']>;
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ export const routes = {
|
||||||
},
|
},
|
||||||
'/landing': {
|
'/landing': {
|
||||||
handler: () => {
|
handler: () => {
|
||||||
return <SimpleRedirect to="/overview" />;
|
return <LandingPage />;
|
||||||
},
|
},
|
||||||
params: {},
|
params: {},
|
||||||
exact: true,
|
exact: true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue