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

Fix major mobile issues with security overview #122770

Merged
merged 3 commits into from
Jan 18, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import React, { useMemo } from 'react';
import styled from 'styled-components';

import { ENABLE_NEWS_FEED_SETTING, NEWS_FEED_URL_SETTING } from '../../../../common/constants';
import { Filters as RecentTimelinesFilters } from '../recent_timelines/filters';
Expand All @@ -20,19 +19,13 @@ import * as i18n from '../../pages/translations';
import { RecentCases } from '../recent_cases';
import { useGetUserCasesPermissions } from '../../../common/lib/kibana';

const SidebarFlexGroup = styled(EuiFlexGroup)`
width: 305px;
`;

const SidebarSpacerComponent = () => (
<EuiFlexItem grow={false}>
<EuiSpacer size="xxl" />
</EuiFlexItem>
);

SidebarSpacerComponent.displayName = 'SidebarSpacerComponent';
const Spacer = React.memo(SidebarSpacerComponent);

export const Sidebar = React.memo<{
recentTimelinesFilterBy: RecentTimelinesFilterMode;
setRecentTimelinesFilterBy: (filterBy: RecentTimelinesFilterMode) => void;
Expand All @@ -51,31 +44,25 @@ export const Sidebar = React.memo<{
const hasCasesReadPermissions = useGetUserCasesPermissions()?.read;

return (
<SidebarFlexGroup direction="column" gutterSize="none">
<EuiFlexGroup direction="column" responsive={false} gutterSize="l">
{hasCasesReadPermissions && (
<>
<EuiFlexItem grow={false}>
<RecentCases />
</EuiFlexItem>

<Spacer />
</>
<EuiFlexItem grow={false}>
<RecentCases />
</EuiFlexItem>
)}

<EuiFlexItem grow={false}>
<SidebarHeader title={i18n.RECENT_TIMELINES}>{recentTimelinesFilters}</SidebarHeader>
<StatefulRecentTimelines filterBy={recentTimelinesFilterBy} />
</EuiFlexItem>

<Spacer />

<EuiFlexItem grow={false}>
<StatefulNewsFeed
enableNewsFeedSetting={ENABLE_NEWS_FEED_SETTING}
newsFeedSetting={NEWS_FEED_URL_SETTING}
/>
</EuiFlexItem>
</SidebarFlexGroup>
</EuiFlexGroup>
);
});

Expand Down
31 changes: 12 additions & 19 deletions x-pack/plugins/security_solution/public/overview/pages/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
* 2.0.
*/

import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiShowFor } from '@elastic/eui';
import React, { useCallback, useState, useMemo } from 'react';
import styled from 'styled-components';

import { AlertsByCategory } from '../components/alerts_by_category';
import { FiltersGlobal } from '../../common/components/filters_global';
Expand Down Expand Up @@ -37,14 +36,6 @@ import { RiskyHostLinks } from '../components/overview_risky_host_links';
import { useAlertsPrivileges } from '../../detections/containers/detection_engine/alerts/use_alerts_privileges';
import { useIsExperimentalFeatureEnabled } from '../../common/hooks/use_experimental_features';

const SidebarFlexItem = styled(EuiFlexItem)`
margin-right: 24px;
`;

const StyledSecuritySolutionPageWrapper = styled(SecuritySolutionPageWrapper)`
overflow-x: auto;
`;

const OverviewComponent = () => {
const getGlobalFiltersQuerySelector = useMemo(
() => inputsSelectors.globalFiltersQuerySelector(),
Expand Down Expand Up @@ -91,20 +82,22 @@ const OverviewComponent = () => {
<SiemSearchBar id="global" indexPattern={indexPattern} />
</FiltersGlobal>

<StyledSecuritySolutionPageWrapper>
<SecuritySolutionPageWrapper>
{!dismissMessage && !metadataIndexExists && canAccessFleet && (
<>
<EndpointNotice onDismiss={dismissEndpointNotice} />
<EuiSpacer size="l" />
</>
)}
<EuiFlexGroup gutterSize="none" justifyContent="spaceBetween">
<SidebarFlexItem grow={false}>
<StatefulSidebar />
</SidebarFlexItem>

<EuiFlexItem grow={true}>
<EuiFlexGroup direction="column" gutterSize="none">
<EuiFlexGroup>
<EuiShowFor sizes={['xl']}>
<EuiFlexItem grow={1}>
<StatefulSidebar />
</EuiFlexItem>
</EuiShowFor>
Comment on lines +93 to +97
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 don't think this column is critical to the page. This removes it from mobile views.


<EuiFlexItem grow={3}>
<EuiFlexGroup direction="column" responsive={false} gutterSize="none">
{hasIndexRead && hasKibanaREAD && (
<>
<EuiFlexItem grow={false}>
Expand Down Expand Up @@ -180,7 +173,7 @@ const OverviewComponent = () => {
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
</StyledSecuritySolutionPageWrapper>
</SecuritySolutionPageWrapper>
</>
) : (
<OverviewEmpty />
Expand Down