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

* Add code to display/hide UX section when appropriate.

* Suppress errors with link to dedicated issue.

* Fix typo in call to action.

* Remove type error suppression.
This commit is contained in:
Justin Kambic 2020-10-21 07:26:08 -04:00 committed by GitHub
parent 3a969f4e8f
commit c11163d004
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View file

@ -64,7 +64,7 @@ export function DataSections({ bucketSize, hasData, absoluteTime, relativeTime }
/>
</EuiFlexItem>
)}
{hasData?.ux && (
{(hasData.ux as UXHasDataResponse).hasData && (
<EuiFlexItem grow={false}>
<UXSection
serviceName={(hasData.ux as UXHasDataResponse).serviceName as string}

View file

@ -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'),
},

View file

@ -24,7 +24,7 @@ import { getEmptySections } from './empty_section';
import { LoadingObservability } from './loading_observability';
import { getNewsFeed } from '../../services/get_news_feed';
import { DataSections } from './data_sections';
import { useTrackPageview } from '../..';
import { useTrackPageview, UXHasDataResponse } from '../..';
interface Props {
routeParams: RouteParams<'/overview'>;
@ -88,6 +88,8 @@ 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') {
return !(hasData[id] as UXHasDataResponse).hasData;
}
return !hasData[id];
});