-
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 1 commit
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.analytics', { | ||
defaultMessage: 'Elasticsearch', | ||
}), | ||
pageTitle: i18n.translate('sharedUXPackages.noDataConfig.analyticsPageTitle', { | ||
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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,13 +33,13 @@ export const NoDataPage = ({ | |
values: { solution }, | ||
}); | ||
|
||
const link = ( | ||
const link = docsLink ? ( | ||
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. Making |
||
<EuiLink href={docsLink} target="_blank"> | ||
<FormattedMessage id="sharedUXPackages.noDataPage.intro.link" defaultMessage="learn more" /> | ||
</EuiLink> | ||
); | ||
) : null; | ||
|
||
const message = ( | ||
const message = link ? ( | ||
<FormattedMessage | ||
id="sharedUXPackages.noDataPage.intro" | ||
defaultMessage="Add your data to get started, or {link} about {solution}." | ||
|
@@ -48,6 +48,11 @@ export const NoDataPage = ({ | |
link, | ||
}} | ||
/> | ||
) : ( | ||
<FormattedMessage | ||
id="sharedUXPackages.noDataPage.introNoDocLink" | ||
defaultMessage="Add your data to get started." | ||
/> | ||
); | ||
|
||
return ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# No Data Page | ||
|
||
Helps to globally configure the no data page components | ||
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. Need this dummy plugin to create a config for configuring the analytics empty pages "flavor" 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. An alternative could be that all discover, visualize, dashboards expose this config on their own and pass it to the component. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
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')])], | ||
{ defaultValue: 'kibana' as const } | ||
), | ||
}), | ||
}); | ||
export type NoDataPageConfig = TypeOf<typeof configSchema>; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
module.exports = { | ||
preset: '@kbn/test', | ||
rootDir: '../../..', | ||
roots: ['<rootDir>/src/plugins/no_data'], | ||
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/src/plugins/no_data', | ||
coverageReporters: ['text', 'html'], | ||
collectCoverageFrom: ['<rootDir>/src/plugins/no_data/{common,public,server}/**/*.{ts,tsx}'], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"type": "plugin", | ||
"id": "@kbn/no-data-page-plugin", | ||
"owner": "@elastic/appex-sharedux", | ||
"plugin": { | ||
"id": "noDataPage", | ||
"server": true, | ||
"browser": true | ||
} | ||
} |
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.