-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution] Fix positioning of Kibana banners list inside Sec… #80124
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,13 +24,13 @@ import { APP_ID, ADD_DATA_PATH, APP_DETECTIONS_PATH } from '../../../../common/c | |
import { useGlobalHeaderPortal } from '../../hooks/use_global_header_portal'; | ||
import { LinkAnchor } from '../links'; | ||
|
||
const Wrapper = styled.header` | ||
${({ theme }) => ` | ||
const Wrapper = styled.header<{ $isFixed: boolean }>` | ||
${({ theme, $isFixed }) => ` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like any of the React components could calculate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because we need that information also to determine proper |
||
background: ${theme.eui.euiColorEmptyShade}; | ||
border-bottom: ${theme.eui.euiBorderThin}; | ||
width: 100%; | ||
z-index: ${theme.eui.euiZNavigation}; | ||
position: fixed; | ||
position: ${$isFixed ? 'fixed' : 'relative'}; | ||
`} | ||
`; | ||
Wrapper.displayName = 'Wrapper'; | ||
|
@@ -62,75 +62,78 @@ FlexGroup.displayName = 'FlexGroup'; | |
|
||
interface HeaderGlobalProps { | ||
hideDetectionEngine?: boolean; | ||
isFixed?: boolean; | ||
} | ||
export const HeaderGlobal = React.memo( | ||
forwardRef<HTMLDivElement, HeaderGlobalProps>(({ hideDetectionEngine = false }, ref) => { | ||
const { globalHeaderPortalNode } = useGlobalHeaderPortal(); | ||
const { globalFullScreen } = useFullScreen(); | ||
const search = useGetUrlSearch(navTabs.overview); | ||
const { application, http } = useKibana().services; | ||
const { navigateToApp } = application; | ||
const basePath = http.basePath.get(); | ||
const goToOverview = useCallback( | ||
(ev) => { | ||
ev.preventDefault(); | ||
navigateToApp(`${APP_ID}:${SecurityPageName.overview}`, { path: search }); | ||
}, | ||
[navigateToApp, search] | ||
); | ||
return ( | ||
<Wrapper ref={ref} className="siemHeaderGlobal"> | ||
<WrapperContent $globalFullScreen={globalFullScreen}> | ||
<FlexGroup | ||
alignItems="center" | ||
$hasSibling={globalHeaderPortalNode.hasChildNodes()} | ||
justifyContent="spaceBetween" | ||
wrap | ||
> | ||
<FlexItem> | ||
<EuiFlexGroup alignItems="center" responsive={false}> | ||
<FlexItem grow={false}> | ||
<LinkAnchor onClick={goToOverview} href={getAppOverviewUrl(search)}> | ||
<EuiIcon aria-label={i18n.SECURITY_SOLUTION} type="logoSecurity" size="l" /> | ||
</LinkAnchor> | ||
</FlexItem> | ||
|
||
<FlexItem component="nav"> | ||
<SiemNavigation | ||
display="condensed" | ||
navTabs={ | ||
hideDetectionEngine | ||
? pickBy((_, key) => key !== SecurityPageName.detections, navTabs) | ||
: navTabs | ||
} | ||
/> | ||
</FlexItem> | ||
</EuiFlexGroup> | ||
</FlexItem> | ||
<FlexItem grow={false}> | ||
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false} wrap> | ||
{window.location.pathname.includes(APP_DETECTIONS_PATH) && ( | ||
forwardRef<HTMLDivElement, HeaderGlobalProps>( | ||
({ hideDetectionEngine = false, isFixed = true }, ref) => { | ||
const { globalHeaderPortalNode } = useGlobalHeaderPortal(); | ||
const { globalFullScreen } = useFullScreen(); | ||
const search = useGetUrlSearch(navTabs.overview); | ||
const { application, http } = useKibana().services; | ||
const { navigateToApp } = application; | ||
const basePath = http.basePath.get(); | ||
const goToOverview = useCallback( | ||
(ev) => { | ||
ev.preventDefault(); | ||
navigateToApp(`${APP_ID}:${SecurityPageName.overview}`, { path: search }); | ||
}, | ||
[navigateToApp, search] | ||
); | ||
return ( | ||
<Wrapper ref={ref} $isFixed={isFixed}> | ||
<WrapperContent $globalFullScreen={globalFullScreen}> | ||
<FlexGroup | ||
alignItems="center" | ||
$hasSibling={globalHeaderPortalNode.hasChildNodes()} | ||
justifyContent="spaceBetween" | ||
wrap | ||
> | ||
<FlexItem> | ||
<EuiFlexGroup alignItems="center" responsive={false}> | ||
<FlexItem grow={false}> | ||
<MlPopover /> | ||
<LinkAnchor onClick={goToOverview} href={getAppOverviewUrl(search)}> | ||
<EuiIcon aria-label={i18n.SECURITY_SOLUTION} type="logoSecurity" size="l" /> | ||
</LinkAnchor> | ||
</FlexItem> | ||
|
||
<FlexItem component="nav"> | ||
<SiemNavigation | ||
display="condensed" | ||
navTabs={ | ||
hideDetectionEngine | ||
? pickBy((_, key) => key !== SecurityPageName.detections, navTabs) | ||
: navTabs | ||
} | ||
/> | ||
</FlexItem> | ||
)} | ||
</EuiFlexGroup> | ||
</FlexItem> | ||
<FlexItem grow={false}> | ||
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false} wrap> | ||
{window.location.pathname.includes(APP_DETECTIONS_PATH) && ( | ||
<FlexItem grow={false}> | ||
<MlPopover /> | ||
</FlexItem> | ||
)} | ||
|
||
<FlexItem grow={false}> | ||
<EuiButtonEmpty | ||
data-test-subj="add-data" | ||
href={`${basePath}${ADD_DATA_PATH}`} | ||
iconType="plusInCircle" | ||
> | ||
{i18n.BUTTON_ADD_DATA} | ||
</EuiButtonEmpty> | ||
</FlexItem> | ||
</EuiFlexGroup> | ||
</FlexItem> | ||
</FlexGroup> | ||
<OutPortal node={globalHeaderPortalNode} /> | ||
</WrapperContent> | ||
</Wrapper> | ||
); | ||
}) | ||
<FlexItem grow={false}> | ||
<EuiButtonEmpty | ||
data-test-subj="add-data" | ||
href={`${basePath}${ADD_DATA_PATH}`} | ||
iconType="plusInCircle" | ||
> | ||
{i18n.BUTTON_ADD_DATA} | ||
</EuiButtonEmpty> | ||
</FlexItem> | ||
</EuiFlexGroup> | ||
</FlexItem> | ||
</FlexGroup> | ||
<OutPortal node={globalHeaderPortalNode} /> | ||
</WrapperContent> | ||
</Wrapper> | ||
); | ||
} | ||
) | ||
); | ||
HeaderGlobal.displayName = 'HeaderGlobal'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the logic is "the header is fixed when there are no banners?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that what we decide in the zoom meeting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little bit more details here, only the banners coming from kibana.