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

Features integrations + mobile, copy, design tweaks #115495

Merged
merged 13 commits into from
Oct 20, 2021
Merged
10 changes: 6 additions & 4 deletions src/core/public/rendering/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
top: $headerHeight;
}

.kbnStickyMenu {
position: sticky;
max-height: calc(100vh - #{$headerHeight + $euiSize});
top: $headerHeight + $euiSize;
@include euiBreakpoint('xl', 'l') {
.kbnStickyMenu {
position: sticky;
max-height: calc(100vh - #{$headerHeight + $euiSize});
Copy link
Contributor

Choose a reason for hiding this comment

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

Any thoughts on applying this max-height style regardless if the sticky condition is true? Doing so would avoid the visual "jumpiness" of the menu when transitioning between the non-sticky and sticky modes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made a follow up item to track this. I think I have some better ways to do this, but given the FF timing / difficulty around getting stuff merged with tests I'm gonna punt this to a follow PR.

#115696

top: $headerHeight + $euiSize;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const EmptyIndexListPrompt = ({
<EuiCard
className="inpEmptyState__card"
onClick={() => {
navigateToApp('home', { path: '/app/integrations/browse' });
navigateToApp('integrations', { path: '/browse' });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bug from #114911

This fixes the link from the index pattern redirect.

closeFlyout();
}}
icon={<EuiIcon size="xl" type="database" color="subdued" />}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const ElasticAgentCard: FunctionComponent<ElasticAgentCardProps> = ({
<EuiCard
paddingSize="l"
image={image}
textAlign="left"
snide marked this conversation as resolved.
Show resolved Hide resolved
title={
<EuiTextColor color="default">
{i18n.translate('kibana-react.noDataPage.elasticAgentCard.noPermission.title', {
Expand Down Expand Up @@ -78,6 +79,7 @@ export const ElasticAgentCard: FunctionComponent<ElasticAgentCardProps> = ({
return (
<EuiCard
paddingSize="l"
textAlign="left"
image={image}
href={href ?? addBasePath(`/app/integrations/browse${hasCategory}`)}
// Bad hack to fix the need for an a11y title even though the button exists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const NoDataCard: FunctionComponent<NoDataPageActions> = ({
return (
<EuiCard
paddingSize="l"
textAlign="left"
snide marked this conversation as resolved.
Show resolved Hide resolved
// TODO: we should require both title and description to be passed in by consumers since defaults are not adequate.
// see comment: https://github.com/elastic/kibana/pull/111261/files#r708399140
title={title!}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const link = (
const title = (
<FormattedMessage
id="xpack.fleet.epm.integrationPreference.title"
defaultMessage="When an integration is available for {link}, show:"
defaultMessage="If an integration is available for {link}, show:"
values={{ link }}
/>
);
Expand Down Expand Up @@ -115,6 +115,7 @@ export const IntegrationPreference = ({ initialType, onChange }: Props) => {
name="preference"
/>
</EuiForm>
<EuiSpacer size="m" />
</EuiPanel>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
EuiText,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';

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

import { Loading } from '../../../components';
Expand All @@ -32,6 +33,7 @@ export interface Props {
controls?: ReactNode | ReactNode[];
title?: string;
list: IntegrationCardItem[];
featuredList?: JSX.Element | null;
initialSearch?: string;
setSelectedCategory: (category: string) => void;
onSearchChange: (search: string) => void;
Expand All @@ -48,6 +50,7 @@ export const PackageListGrid: FunctionComponent<Props> = ({
onSearchChange,
setSelectedCategory,
showMissingIntegrationMessage = false,
featuredList = null,
callout,
}) => {
const [searchTerm, setSearchTerm] = useState(initialSearch || '');
Expand Down Expand Up @@ -106,42 +109,45 @@ export const PackageListGrid: FunctionComponent<Props> = ({
}

return (
<div ref={menuRef}>
<EuiFlexGroup alignItems="flexStart" gutterSize="xl">
<EuiFlexItem grow={1} className={isSticky ? 'kbnStickyMenu' : ''}>
{controlsContent}
</EuiFlexItem>
<EuiFlexItem grow={5}>
<EuiSearchBar
query={searchTerm || undefined}
box={{
placeholder: i18n.translate('xpack.fleet.epmList.searchPackagesPlaceholder', {
defaultMessage: 'Search for integrations',
}),
incremental: true,
}}
onChange={onQueryChange}
/>
{callout ? (
<>
<EuiSpacer />
{callout}
</>
) : null}
<EuiSpacer />
{gridContent}
{showMissingIntegrationMessage && (
<>
<EuiSpacer />
<MissingIntegrationContent
resetQuery={resetQuery}
setSelectedCategory={setSelectedCategory}
/>
</>
)}
</EuiFlexItem>
</EuiFlexGroup>
</div>
<>
{featuredList}
<div ref={menuRef}>
<EuiFlexGroup alignItems="flexStart" gutterSize="xl">
<EuiFlexItem grow={1} className={isSticky ? 'kbnStickyMenu' : ''}>
{controlsContent}
</EuiFlexItem>
<EuiFlexItem grow={5}>
<EuiSearchBar
query={searchTerm || undefined}
box={{
placeholder: i18n.translate('xpack.fleet.epmList.searchPackagesPlaceholder', {
defaultMessage: 'Search for integrations',
}),
incremental: true,
}}
onChange={onQueryChange}
/>
{callout ? (
<>
<EuiSpacer />
{callout}
</>
) : null}
<EuiSpacer />
{gridContent}
{showMissingIntegrationMessage && (
<>
<EuiSpacer />
<MissingIntegrationContent
resetQuery={resetQuery}
setSelectedCategory={setSelectedCategory}
/>
</>
)}
</EuiFlexItem>
</EuiFlexGroup>
</div>
</>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@
import React, { memo, useMemo, useState } from 'react';
import { useLocation, useHistory, useParams } from 'react-router-dom';
import _ from 'lodash';
import { EuiHorizontalRule, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import {
EuiHorizontalRule,
EuiFlexItem,
EuiFlexGrid,
EuiSpacer,
EuiCard,
EuiIcon,
} from '@elastic/eui';

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

import { pagePathGetters } from '../../../../constants';
import {
Expand Down Expand Up @@ -98,6 +108,9 @@ export const AvailablePackages: React.FC = memo(() => {
const [preference, setPreference] = useState<IntegrationPreferenceType>('recommended');
useBreadcrumbs('integrations_all');

const { http } = useStartServices();
const addBasePath = http.basePath.prepend;

const { selectedCategory, searchParam } = getParams(
useParams<CategoryParams>(),
useLocation().search
Expand Down Expand Up @@ -210,8 +223,56 @@ export const AvailablePackages: React.FC = memo(() => {
return c.categories.includes(selectedCategory);
});

// TODO: Remove this hard coded list of integrations with a suggestion service
const featuredList = (
<>
<EuiFlexGrid columns={3}>
snide marked this conversation as resolved.
Show resolved Hide resolved
<EuiFlexItem>
<EuiCard
icon={<EuiIcon type="logoSecurity" size="xxl" />}
href={addBasePath('/app/integrations/detail/endpoint/')}
title={i18n.translate('xpack.fleet.featuredSecurityTitle', {
defaultMessage: 'Endpoint Security',
})}
description={i18n.translate('xpack.fleet.featuredSecurityDesc', {
defaultMessage:
'Protect your hosts with threat prevention, detection, and deep security data visibility.',
})}
/>
snide marked this conversation as resolved.
Show resolved Hide resolved
</EuiFlexItem>
<EuiFlexItem>
<EuiCard
title={i18n.translate('xpack.fleet.featuredObsTitle', {
defaultMessage: 'Elastic APM',
})}
description={i18n.translate('xpack.fleet.featuredObsDesc', {
defaultMessage:
'Monitor, detect and diagnose complex performance issues from your application.',
})}
href={addBasePath('/app/integrations/detail/apm')}
icon={<EuiIcon type="logoObservability" size="xxl" />}
/>
</EuiFlexItem>
<EuiFlexItem>
<EuiCard
icon={<EuiIcon type="logoAppSearch" size="xxl" />}
href={addBasePath('/app/enterprise_search/app_search')}
title={i18n.translate('xpack.fleet.featuredSearchTitle', {
defaultMessage: 'Web site crawler',
})}
description={i18n.translate('xpack.fleet.featuredSearchDesc', {
defaultMessage: 'Add search to your website with the App Search web crawler.',
})}
/>
</EuiFlexItem>
</EuiFlexGrid>
<EuiSpacer size="xl" />
</>
);

return (
<PackageListGrid
featuredList={featuredList}
isLoading={isLoadingAllPackages}
controls={controls}
initialSearch={searchParam}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export const ALL_CATEGORY = {
}),
};

export const INSTALLED_CATEGORY = {
id: '',
title: i18n.translate('xpack.fleet.epmList.allPackagesInstalledFilterLinkText', {
defaultMessage: 'All installed',
}),
};

export interface Props {
isLoading?: boolean;
categories: CategoryFacet[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { CategoryFacets } from './category_facets';

import type { CategoryParams } from '.';
import { getParams, categoryExists, mapToCard } from '.';
import { ALL_CATEGORY } from './category_facets';
import { INSTALLED_CATEGORY } from './category_facets';

const AnnouncementLink = () => {
const { docLinks } = useStartServices();
Expand Down Expand Up @@ -56,10 +56,6 @@ const Callout = () => (
</EuiCallOut>
);

const title = i18n.translate('xpack.fleet.epmList.installedTitle', {
defaultMessage: 'Installed integrations',
});

// TODO: clintandrewhall - this component is hard to test due to the hooks, particularly those that use `http`
// or `location` to load data. Ideally, we'll split this into "connected" and "pure" components.
export const InstalledPackages: React.FC = memo(() => {
Expand Down Expand Up @@ -115,7 +111,7 @@ export const InstalledPackages: React.FC = memo(() => {
const categories: CategoryFacet[] = useMemo(
() => [
{
...ALL_CATEGORY,
...INSTALLED_CATEGORY,
count: allInstalledPackages.length,
},
{
Expand Down Expand Up @@ -153,7 +149,7 @@ export const InstalledPackages: React.FC = memo(() => {

return (
<PackageListGrid
{...{ isLoading, title, controls, setSelectedCategory, callout }}
{...{ isLoading, controls, setSelectedCategory, callout }}
onSearchChange={setSearchTerm}
initialSearch={searchParam}
list={cards}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ export function ObservabilityHeaderMenu(): React.ReactElement | null {
}

const addDataLinkText = i18n.translate('xpack.observability.home.addData', {
defaultMessage: 'Add data',
defaultMessage: 'Add integrations',
});
Loading