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

[EPM] update compatibility section #50975

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 1 addition & 6 deletions x-pack/legacy/plugins/epm/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ export type ServiceName = 'kibana' | 'elasticsearch';
export type RequirementVersion = string;

export interface ServiceRequirements {
version: RequirementVersionRange;
}

export interface RequirementVersionRange {
min: RequirementVersion;
max: RequirementVersion;
versions: string;
}

// from /categories
Expand Down
38 changes: 19 additions & 19 deletions x-pack/legacy/plugins/epm/public/components/content_collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
*/
import React, { useState, useRef, useLayoutEffect, Fragment, useCallback } from 'react';
import { EuiButtonEmpty, EuiSpacer, EuiButton, EuiHorizontalRule } from '@elastic/eui';
import euiStyled from '../../../../common/eui_styled_components';
import styled from 'styled-components';

const BottomFade = euiStyled.div`
width: 100%;
background: ${props =>
`linear-gradient(${props.theme.eui.euiColorEmptyShade}00 0%, ${props.theme.eui.euiColorEmptyShade} 100%)`};
margin-top: -${props => parseInt(props.theme.eui.spacerSizes.xl, 10) * 2}px;
height: ${props => parseInt(props.theme.eui.spacerSizes.xl, 10) * 2}px;
position: absolute;
const BottomFade = styled.div`
width: 100%;
background: ${props =>
`linear-gradient(${props.theme.eui.euiColorEmptyShade}00 0%, ${props.theme.eui.euiColorEmptyShade} 100%)`};
margin-top: -${props => parseInt(props.theme.eui.spacerSizes.xl, 10) * 2}px;
height: ${props => parseInt(props.theme.eui.spacerSizes.xl, 10) * 2}px;
position: absolute;
`;
const ContentCollapseContainer = euiStyled.div`
position: relative;
const ContentCollapseContainer = styled.div`
position: relative;
`;
const CollapseButtonContainer = euiStyled.div`
display: inline-block;
background-color: ${props => props.theme.eui.euiColorGhost};
position: absolute;
left: 50%;
transform: translateX(-50%);
top: ${props => parseInt(props.theme.eui.euiButtonHeight, 10) / 2}px;
const CollapseButtonContainer = styled.div`
display: inline-block;
background-color: ${props => props.theme.eui.euiColorGhost};
position: absolute;
left: 50%;
transform: translateX(-50%);
top: ${props => parseInt(props.theme.eui.euiButtonHeight, 10) / 2}px;
`;
const CollapseButtonTop = euiStyled(EuiButtonEmpty)`
float: right;
const CollapseButtonTop = styled(EuiButtonEmpty)`
float: right;
`;

const CollapseButton = ({
Expand Down
34 changes: 21 additions & 13 deletions x-pack/legacy/plugins/epm/public/components/requirements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
*/

import React, { Fragment } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiTextColor, EuiTitle } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiTextColor, EuiTitle, EuiIcon, EuiText } from '@elastic/eui';
import styled from 'styled-components';
import { entries } from '../../common/type_utils';
import { RequirementsByServiceName } from '../../common/types';
import { ServiceTitleMap } from '../constants';
import { useCore } from '../hooks/use_core';
import { VersionBadge } from './version_badge';
import { Version } from './version';

export interface RequirementsProps {
requirements: RequirementsByServiceName;
Expand All @@ -21,15 +21,27 @@ export function Requirements(props: RequirementsProps) {
const { requirements } = props;
const { theme } = useCore();

const Text = styled.span`
padding-bottom: ${theme.eui.paddingSizes.m};
const FlexGroup = styled(EuiFlexGroup)`
padding: 0 0 ${theme.eui.paddingSizes.m} 0;
margin: 0;
`;
const StyledVersion = styled(Version)`
font-size: ${theme.eui.euiFontSizeXS};
`;

return (
<Fragment>
<EuiTitle size="xs">
<Text>Compatibility</Text>
</EuiTitle>
<FlexGroup gutterSize="s" alignItems="center">
<EuiFlexItem grow={false}>
<EuiIcon type={'logoElasticStack'} />
</EuiFlexItem>
<EuiFlexItem>
<EuiTitle>
<EuiText>
<h4>Elastic Stack Compatibility</h4>
</EuiText>
</EuiTitle>
</EuiFlexItem>
</FlexGroup>
{entries(requirements).map(([service, requirement]) => (
<EuiFlexGroup key={service}>
<EuiFlexItem grow={true}>
Expand All @@ -38,11 +50,7 @@ export function Requirements(props: RequirementsProps) {
</EuiTextColor>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<div>
<VersionBadge version={requirement.version.min} />
<span>{' - '}</span>
<VersionBadge version={requirement.version.max} />
</div>
<StyledVersion version={requirement.versions} />
</EuiFlexItem>
</EuiFlexGroup>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@
*/

import React from 'react';
import { EuiBadge } from '@elastic/eui';
import styled from 'styled-components';
import { RequirementVersion } from '../../common/types';

export function VersionBadge({ version }: { version: RequirementVersion }) {
return <EuiBadge color="hollow">v{version}</EuiBadge>;
const CodeText = styled.span`
font-family: ${props => props.theme.eui.euiCodeFontFamily};
`;
export function Version({
className,
version,
}: {
className?: string;
version: RequirementVersion;
}) {
return <CodeText className={className}>{version}</CodeText>;
}
11 changes: 8 additions & 3 deletions x-pack/legacy/plugins/epm/public/screens/detail/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { useTrackedPromise } from '../../../../infra/public/utils/use_tracked_pr
import { installPackage } from '../../data';
import { PLUGIN } from '../../../common/constants';
import { PackageInfo } from '../../../common/types';
import { VersionBadge } from '../../components/version_badge';
import { Version } from '../../components/version';
import { IconPanel } from '../../components/icon_panel';
import { useBreadcrumbs, useCore, useLinks } from '../../hooks';
import { CenterColumn, LeftColumn, RightColumn } from './layout';
Expand All @@ -42,7 +42,12 @@ export function Header(props: HeaderProps) {
`;

const Text = styled.span`
margin-right: ${theme.eui.spacerSizes.xl};
margin-right: ${theme.eui.euiSizeM};
`;

const StyledVersion = styled(Version)`
font-size: ${theme.eui.euiFontSizeS};
color: ${theme.eui.euiColorDarkShade};
`;

return (
Expand All @@ -60,7 +65,7 @@ export function Header(props: HeaderProps) {
<EuiTitle size="l">
<h1>
<Text>{title}</Text>
<VersionBadge version={version} />
<StyledVersion version={version} />
</h1>
</EuiTitle>
</CenterColumn>
Expand Down