Skip to content

Commit

Permalink
[O11y Overview] Add code to display/hide UX section when appropriate (e…
Browse files Browse the repository at this point in the history
…lastic#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.
  • Loading branch information
justinkambic committed Oct 21, 2020
1 parent 68dc471 commit 3e79ba8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
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
4 changes: 3 additions & 1 deletion x-pack/plugins/observability/public/pages/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'>;
Expand Down Expand Up @@ -87,6 +87,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];
});
Expand Down

0 comments on commit 3e79ba8

Please sign in to comment.