-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Serverless Elasticsearch] Fix user is blocked from moving forward when opening Discover, Dashboard, or Visualize Library #164709
Changes from all commits
9c61c00
743e754
33f17e2
64c26af
f6e4023
a558c40
6335295
e4afe7c
40e320b
ba23feb
d634767
2e211b5
9086b61
e1b7cd3
9df4624
0f26a4d
a276b6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { KibanaNoDataPage } from '@kbn/shared-ux-page-kibana-no-data'; | ||
import { KibanaNoDataPageProps } from '@kbn/shared-ux-page-kibana-no-data-types'; | ||
import { AnalyticsNoDataPageFlavor } from '@kbn/shared-ux-page-analytics-no-data-types'; | ||
|
||
/** | ||
* Props for the pure component. | ||
|
@@ -21,26 +23,63 @@ export interface Props { | |
allowAdHocDataView?: boolean; | ||
/** if the kibana instance is customly branded */ | ||
showPlainSpinner: boolean; | ||
/** The flavor of the empty page to use. */ | ||
pageFlavor?: AnalyticsNoDataPageFlavor; | ||
prependBasePath: (path: string) => string; | ||
} | ||
|
||
const solution = i18n.translate('sharedUXPackages.noDataConfig.analytics', { | ||
defaultMessage: 'Analytics', | ||
}); | ||
|
||
const pageTitle = i18n.translate('sharedUXPackages.noDataConfig.analyticsPageTitle', { | ||
defaultMessage: 'Welcome to Analytics!', | ||
}); | ||
|
||
const addIntegrationsTitle = i18n.translate('sharedUXPackages.noDataConfig.addIntegrationsTitle', { | ||
defaultMessage: 'Add integrations', | ||
}); | ||
|
||
const addIntegrationsDescription = i18n.translate( | ||
'sharedUXPackages.noDataConfig.addIntegrationsDescription', | ||
{ | ||
defaultMessage: 'Use Elastic Agent to collect data and build out Analytics solutions.', | ||
} | ||
); | ||
const flavors: { | ||
[K in AnalyticsNoDataPageFlavor]: (deps: { | ||
kibanaGuideDocLink: string; | ||
prependBasePath: (path: string) => string; | ||
}) => KibanaNoDataPageProps['noDataConfig']; | ||
} = { | ||
kibana: ({ kibanaGuideDocLink }) => ({ | ||
solution: i18n.translate('sharedUXPackages.noDataConfig.analytics', { | ||
defaultMessage: 'Analytics', | ||
}), | ||
pageTitle: i18n.translate('sharedUXPackages.noDataConfig.analyticsPageTitle', { | ||
defaultMessage: 'Welcome to Analytics!', | ||
}), | ||
logo: 'logoKibana', | ||
action: { | ||
elasticAgent: { | ||
title: i18n.translate('sharedUXPackages.noDataConfig.addIntegrationsTitle', { | ||
defaultMessage: 'Add integrations', | ||
}), | ||
description: i18n.translate('sharedUXPackages.noDataConfig.addIntegrationsDescription', { | ||
defaultMessage: 'Use Elastic Agent to collect data and build out Analytics solutions.', | ||
}), | ||
'data-test-subj': 'kbnOverviewAddIntegrations', | ||
}, | ||
}, | ||
docsLink: kibanaGuideDocLink, | ||
}), | ||
serverless_search: ({ prependBasePath }) => ({ | ||
solution: i18n.translate('sharedUXPackages.noDataConfig.elasticsearch', { | ||
defaultMessage: 'Elasticsearch', | ||
}), | ||
pageTitle: i18n.translate('sharedUXPackages.noDataConfig.elasticsearchPageTitle', { | ||
defaultMessage: 'Welcome to Elasticsearch!', | ||
}), | ||
logo: 'logoElasticsearch', | ||
action: { | ||
elasticsearch: { | ||
title: i18n.translate('sharedUXPackages.noDataConfig.elasticsearchTitle', { | ||
defaultMessage: 'Get started', | ||
}), | ||
description: i18n.translate('sharedUXPackages.noDataConfig.elasticsearchDescription', { | ||
defaultMessage: | ||
'Set up your programming language client, ingest some data, and start searching.', | ||
}), | ||
'data-test-subj': 'kbnOverviewElasticsearchGettingStarted', | ||
href: prependBasePath('/app/elasticsearch/'), | ||
/** force the no data card to be shown **/ | ||
canAccessFleet: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Passing/faking this explicitly so that Currently, it is ugly: even though the |
||
}, | ||
}, | ||
}), | ||
}; | ||
|
||
/** | ||
* A pure component of an entire page that can be displayed when Kibana "has no data", specifically for Analytics. | ||
|
@@ -50,20 +89,13 @@ export const AnalyticsNoDataPage = ({ | |
onDataViewCreated, | ||
allowAdHocDataView, | ||
showPlainSpinner, | ||
prependBasePath, | ||
pageFlavor = 'kibana', | ||
}: Props) => { | ||
const noDataConfig = { | ||
solution, | ||
pageTitle, | ||
logo: 'logoKibana', | ||
action: { | ||
elasticAgent: { | ||
title: addIntegrationsTitle, | ||
description: addIntegrationsDescription, | ||
'data-test-subj': 'kbnOverviewAddIntegrations', | ||
}, | ||
}, | ||
docsLink: kibanaGuideDocLink, | ||
}; | ||
const noDataConfig: KibanaNoDataPageProps['noDataConfig'] = flavors[pageFlavor]({ | ||
kibanaGuideDocLink, | ||
prependBasePath, | ||
}); | ||
|
||
return ( | ||
<KibanaNoDataPage | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
href on this level is added only for "serverless_search" flavor, but not for "kibana" flavor because the integrations page is already hardcoded inside the component. The
NoDataCard
must be refactored to be fully configurable and don't hardcode fleet stuff.