Skip to content
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

[O11y Overview] Add code to display/hide UX section when appropriate #80873

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export function DataSections({ bucketSize, hasData, absoluteTime, relativeTime }
/>
</EuiFlexItem>
)}
{hasData?.ux && (
{/* @ts-ignore see https://github.com/elastic/kibana/issues/81081 */}
{hasData?.ux?.hasData && (
Copy link
Contributor

@shahzad31 shahzad31 Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of changing the api or suppressing the type , i feel like we can improve the types here. if you notice two lines below it's also (hasData.ux as UXHasDataResponse).serviceName as string used like that.
there is actually already a type declared to handle this specific api use case https://github.com/elastic/kibana/blob/master/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts#L40

need to check why it's not working.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion!

<EuiFlexItem grow={false}>
<UXSection
serviceName={(hasData.ux as UXHasDataResponse).serviceName as string}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const getEmptySections = ({ core }: { core: AppMountContext['core'] }): I
'Performance is a distribution. Measure the experiences of all visitors to your web application and understand how to improve the experience for everyone.',
}),
linkTitle: i18n.translate('xpack.observability.emptySection.apps.ux.link', {
defaultMessage: 'Install Rum Agent',
defaultMessage: 'Install RUM Agent',
}),
href: core.http.basePath.prepend('/app/home#/tutorial/apm'),
},
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/observability/public/pages/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export function OverviewPage({ routeParams }: Props) {
const appEmptySections = getEmptySections({ core }).filter(({ id }) => {
if (id === 'alert') {
return alertStatus !== FETCH_STATUS.FAILURE && !alerts.length;
} else if (id === 'ux') {
// @ts-ignore see https://github.com/elastic/kibana/issues/81081
return !hasData[id]?.hasData;
}
return !hasData[id];
});
Expand Down