[Serverless] Improve observability project empty state in analytics apps (#168598)

## Summary


fix https://github.com/elastic/kibana/issues/166233 (this is a short
term fix that removes "analytics" references from the empty state page
in serverless observability analytics apps)

![Screenshot 2023-10-17 at 12 12
53](6912940e-11ba-440d-a67d-241737f20e5d)
This commit is contained in:
Anton Dosov 2023-10-17 14:58:56 +02:00 committed by GitHub
parent 42742241f7
commit b207f24dab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 79 additions and 18 deletions

View file

@ -16,6 +16,9 @@ xpack.serverless.observability.enabled: true
## Set the home route
uiSettings.overrides.defaultRoute: /app/observability/landing
# Customize empty page state for analytics apps
no_data_page.analyticsNoDataPageFlavor: 'serverless_observability'
## Set the dev project switch current type
xpack.serverless.plugin.developer.projectSwitcher.currentType: 'observability'

View file

@ -147,5 +147,25 @@ describe('AnalyticsNoDataPageComponent', () => {
await screen.findByTestId('kbnOverviewElasticsearchGettingStarted');
});
});
describe('serverless_observability flavor', () => {
it('renders getting started card', async () => {
render(
<I18nProvider>
<AnalyticsNoDataPageProvider {...{ ...services, hasESData: async () => false }}>
<AnalyticsNoDataPage
pageFlavor={'serverless_observability'}
onDataViewCreated={onDataViewCreated}
kibanaGuideDocLink={'http://www.test.com'}
showPlainSpinner={false}
prependBasePath={(path: string) => path}
/>
</AnalyticsNoDataPageProvider>
</I18nProvider>
);
await screen.findByTestId('kbnObservabilityNoData');
});
});
});
});

View file

@ -79,6 +79,31 @@ const flavors: {
},
},
}),
serverless_observability: ({ prependBasePath }) => ({
solution: i18n.translate('sharedUXPackages.noDataConfig.observability', {
defaultMessage: 'Observability',
}),
pageTitle: i18n.translate('sharedUXPackages.noDataConfig.observabilityPageTitle', {
defaultMessage: 'Welcome to Elastic Observability!',
}),
pageDescription: i18n.translate('sharedUXPackages.noDataConfig.observabilityPageDescription', {
defaultMessage:
'Converge metrics, logs, and traces to monitor the health of your applications.',
}),
logo: 'logoObservability',
action: {
observability: {
title: i18n.translate('sharedUXPackages.noDataConfig.observabilityTitle', {
defaultMessage: 'Add data',
}),
description: i18n.translate('sharedUXPackages.noDataConfig.observabilityDescription', {
defaultMessage: 'Get started by collecting data using one of our many integrations.',
}),
'data-test-subj': 'kbnObservabilityNoData',
href: prependBasePath('/app/observabilityOnboarding/'),
},
},
}),
};
/**

View file

@ -26,7 +26,7 @@ export interface Services {
*/
export type AnalyticsNoDataPageServices = Services & KibanaNoDataPageServices;
export type AnalyticsNoDataPageFlavor = 'kibana' | 'serverless_search';
export type AnalyticsNoDataPageFlavor = 'kibana' | 'serverless_search' | 'serverless_observability';
export interface KibanaDependencies {
coreStart: {

View file

@ -24,6 +24,7 @@ export const NoDataPage = ({
action,
docsLink,
pageTitle,
pageDescription,
className,
}: NoDataPageProps) => {
const title =
@ -39,21 +40,23 @@ export const NoDataPage = ({
</EuiLink>
) : null;
const message = link ? (
<FormattedMessage
id="sharedUXPackages.noDataPage.intro"
defaultMessage="Add your data to get started, or {link} about {solution}."
values={{
solution,
link,
}}
/>
) : (
<FormattedMessage
id="sharedUXPackages.noDataPage.introNoDocLink"
defaultMessage="Add your data to get started."
/>
);
const message =
pageDescription ??
(link ? (
<FormattedMessage
id="sharedUXPackages.noDataPage.intro"
defaultMessage="Add your data to get started, or {link} about {solution}."
values={{
solution,
link,
}}
/>
) : (
<FormattedMessage
id="sharedUXPackages.noDataPage.introNoDocLink"
defaultMessage="Add your data to get started."
/>
));
return (
<EuiPageTemplate.Section

View file

@ -42,6 +42,10 @@ export interface NoDataPageProps extends CommonProps, ActionCardProps {
* Optionally replace the auto-generated page title (h1)
*/
pageTitle?: string;
/**
* Optionally replace the auto-generated page description
*/
pageDescription?: string;
}
/**

View file

@ -11,7 +11,13 @@ import { schema, TypeOf, offeringBasedSchema } from '@kbn/config-schema';
export const configSchema = schema.object({
analyticsNoDataPageFlavor: offeringBasedSchema({
serverless: schema.oneOf(
[schema.oneOf([schema.literal('kibana'), schema.literal('serverless_search')])],
[
schema.oneOf([
schema.literal('kibana'),
schema.literal('serverless_search'),
schema.literal('serverless_observability'),
]),
],
{ defaultValue: 'kibana' as const }
),
}),

View file

@ -7,7 +7,7 @@
*/
export interface NoDataPagePluginSetup {
getAnalyticsNoDataPageFlavor: () => 'kibana' | 'serverless_search';
getAnalyticsNoDataPageFlavor: () => 'kibana' | 'serverless_search' | 'serverless_observability';
}
export type NoDataPagePluginStart = NoDataPagePluginSetup;