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

[ENDPOINT] Initial version of new page layout. #71687

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 15 additions & 7 deletions x-pack/plugins/security_solution/public/app/home/index.tsx
Expand Up @@ -7,6 +7,7 @@
import React, { useMemo } from 'react';
import styled from 'styled-components';

import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { useThrottledResizeObserver } from '../../common/components/utils';
import { DragDropContextWrapper } from '../../common/components/drag_and_drop/drag_drop_context_wrapper';
import { Flyout } from '../../timelines/components/flyout';
Expand All @@ -20,7 +21,7 @@ import { navTabs } from './home_navigations';
import { useSignalIndex } from '../../detections/containers/detection_engine/alerts/use_signal_index';

const WrappedByAutoSizer = styled.div`
height: 100%;
min-height: calc(100vh - 48px);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This whole styling might end up being removed if we decide to go with EuiFlexGroup and EuiFlexItem.

`;
WrappedByAutoSizer.displayName = 'WrappedByAutoSizer';

Expand Down Expand Up @@ -69,10 +70,17 @@ export const HomePage: React.FC<HomePageProps> = ({ children }) => {
const { browserFields, indexPattern, indicesExist } = useWithSource('default', indexToAdd);

return (
<WrappedByAutoSizer data-test-subj="wrapped-by-auto-sizer" ref={measureRef}>
<HeaderGlobal />

<Main data-test-subj="pageContainer">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is one part where I was not sure - do we strive for semantic markup? I removed the main tag because I used EUI layout components (EuiFlexGroup and EuiFlexItem), but instead I can just use EUI classes on HTML elements.

<EuiFlexGroup
direction="column"
gutterSize="none"
data-test-subj="wrapped-by-auto-sizer"
style={{ minHeight: 'calc(100vh - 48px)' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Never mind that it's inline style, it was result of a lot of experimenting, will fix it when we agree on this solution.

>
<EuiFlexItem grow={false}>
<HeaderGlobal className="euiFlexItem" />
</EuiFlexItem>

<EuiFlexItem data-test-subj="pageContainer">
<DragDropContextWrapper browserFields={browserFields}>
<UseUrlState indexPattern={indexPattern} navTabs={navTabs} />
{indicesExist && showTimeline && (
Expand All @@ -88,10 +96,10 @@ export const HomePage: React.FC<HomePageProps> = ({ children }) => {

{children}
</DragDropContextWrapper>
</Main>
</EuiFlexItem>

<HelpMenu />
</WrappedByAutoSizer>
</EuiFlexGroup>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So this changes the file shared between all the apps (it's a bit confusing that it's named HomePage). I did a very shallow test but would need to be tested a bit more thoroughly. I guess I should align this change with other teams (maybe Rob?).

);
};

Expand Down
Expand Up @@ -25,15 +25,17 @@ import { EuiTabProps } from '@elastic/eui/src/components/tabs/tab';

const StyledEuiPage = styled(EuiPage)`
&.endpoint--isListView {
padding: 0 ${(props) => props.theme.eui.euiSizeL};
padding: 0;
flex: 1 1 100%;
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'm not sure if I want to use flex directly, I'd rather find a way to use EUI classes but not sure it's as easy.


.endpoint-header {
padding: ${(props) => props.theme.eui.euiSizeL};
margin-bottom: 0;
}
.endpoint-page-content {
border-left: none;
border-right: none;
border: none;
box-shadow: none;
border-radius: 0;
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 discussed with Kevin that it feels like we use EuiPage component but then we actually overwrite a lot of it's styling so it's not clear if that component is helping much. I think it would be nice to have this type of layout supported by EUI.

}
}
&.endpoint--isDetailsView {
Expand All @@ -44,7 +46,7 @@ const StyledEuiPage = styled(EuiPage)`
}
}
.endpoint-navTabs {
margin-left: ${(props) => props.theme.eui.euiSizeM};
padding-left: ${(props) => props.theme.eui.euiSizeM};
}
.endpoint-header-leftSection {
overflow: hidden;
Expand Down