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

[fleet] Adjust unified integration view to have better UI controls #114692

Merged
merged 9 commits into from
Oct 14, 2021
Merged
6 changes: 6 additions & 0 deletions src/core/public/rendering/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
#app-fixed-viewport {
top: $headerHeight;
}

.kbnStickyMenu {
position: sticky;
max-height: calc(100vh - #{$headerHeight + $euiSize});
top: $headerHeight + $euiSize;
}
}

.kbnBody {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@
* 2.0.
*/
import React, { memo } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiImage, EuiSpacer, EuiText, EuiLink } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText, EuiLink } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { i18n } from '@kbn/i18n';

import styled, { useTheme } from 'styled-components';

import type { EuiTheme } from 'src/plugins/kibana_react/common';

import { useLink } from '../../../hooks';
import type { Section } from '../sections';

import { useLinks, useStartServices } from '../hooks';
import { useStartServices } from '../hooks';

import { WithHeaderLayout } from './';

Expand All @@ -26,45 +22,12 @@ interface Props {
children?: React.ReactNode;
}

const Illustration = styled(EuiImage)`
margin-bottom: -77px;
position: relative;
top: -16px;
width: 395px;
`;

const Hero = styled.div`
text-align: right;
`;

const HeroImage = memo(() => {
const { toSharedAssets } = useLinks();
const theme = useTheme() as EuiTheme;
const IS_DARK_THEME = theme.darkMode;

return (
<Hero>
<Illustration
alt={i18n.translate('xpack.fleet.epm.illustrationAltText', {
defaultMessage: 'Illustration of an integration',
})}
url={
IS_DARK_THEME
? toSharedAssets('illustration_integrations_darkmode.svg')
: toSharedAssets('illustration_integrations_lightmode.svg')
}
/>
</Hero>
);
});

export const DefaultLayout: React.FunctionComponent<Props> = memo(({ section, children }) => {
const { getHref } = useLink();
const { docLinks } = useStartServices();

return (
<WithHeaderLayout
rightColumn={<HeroImage />}
leftColumn={
<EuiFlexGroup direction="column" gutterSize="none" justifyContent="center">
<EuiText>
Expand All @@ -79,20 +42,11 @@ export const DefaultLayout: React.FunctionComponent<Props> = memo(({ section, ch
<EuiSpacer size="s" />

<EuiFlexItem grow={false}>
<EuiText size="m" color="subdued">
<EuiText size="s" color="subdued">
<p>
<FormattedMessage
id="xpack.fleet.epm.pageSubtitle"
defaultMessage="Collect data from popular applications and services. To learn more about Integrations, view {link}"
values={{
link: (
<EuiLink target="_blank" href={docLinks.links.elasticStackGetStarted}>
{i18n.translate('xpack.fleet.epm.pageSubtitleLinkText', {
defaultMessage: 'Getting started with Elastic Stack',
})}
</EuiLink>
),
}}
defaultMessage="Choose an integration to start collecting and analyzing your data"
/>
</p>
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
type Args = Omit<PackageCardProps, 'status'> & { width: number };

const args: Args = {
width: 250,
width: 280,
title: 'Title',
description: 'Description',
name: 'beats',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React from 'react';
import styled from 'styled-components';
import { EuiCard } from '@elastic/eui';
import { EuiCard, EuiFlexItem, EuiBadge, EuiToolTip, EuiSpacer } from '@elastic/eui';

import { CardIcon } from '../../../../../components/package_icon';
import type { IntegrationCardItem } from '../../../../../../common/types/models/epm';
Expand All @@ -16,10 +16,10 @@ import { RELEASE_BADGE_DESCRIPTION, RELEASE_BADGE_LABEL } from './release_badge'

export type PackageCardProps = IntegrationCardItem;

// adding the `href` causes EuiCard to use a `a` instead of a `button`
// `a` tags use `euiLinkColor` which results in blueish Badge text
// Min-height is roughly 3 lines of content.
// This keeps the cards from looking overly unbalanced because of content differences.
const Card = styled(EuiCard)`
color: inherit;
min-height: 127px;
`;

export function PackageCard({
Expand All @@ -32,14 +32,28 @@ export function PackageCard({
url,
release,
}: PackageCardProps) {
const betaBadgeLabel = release && release !== 'ga' ? RELEASE_BADGE_LABEL[release] : undefined;
const betaBadgeLabelTooltipContent =
release && release !== 'ga' ? RELEASE_BADGE_DESCRIPTION[release] : undefined;
let releaseBadge: React.ReactNode | null = null;

if (release && release !== 'ga') {
snide marked this conversation as resolved.
Show resolved Hide resolved
releaseBadge = (
<EuiFlexItem grow={false}>
<EuiSpacer size="xs" />
<span>
<EuiToolTip display="inlineBlock" content={RELEASE_BADGE_DESCRIPTION[release]}>
<EuiBadge color="hollow">{RELEASE_BADGE_LABEL[release]}</EuiBadge>
</EuiToolTip>
</span>
</EuiFlexItem>
);
}

return (
<Card
layout="horizontal"
title={title || ''}
titleSize="xs"
description={description}
hasBorder
icon={
<CardIcon
icons={icons}
Expand All @@ -50,9 +64,9 @@ export function PackageCard({
/>
}
href={url}
betaBadgeLabel={betaBadgeLabel}
betaBadgeTooltipContent={betaBadgeLabelTooltipContent}
target={url.startsWith('http') || url.startsWith('https') ? '_blank' : undefined}
/>
>
{releaseBadge}
</Card>
);
}
Loading