Skip to content

Commit 1ebc71e

Browse files
committed
Remove no longer needed container from security teaser pages.
1 parent a9bb656 commit 1ebc71e

File tree

6 files changed

+94
-137
lines changed

6 files changed

+94
-137
lines changed

graylog2-web-interface/src/components/security/page-layout/Container.tsx

Lines changed: 0 additions & 26 deletions
This file was deleted.

graylog2-web-interface/src/components/security/page-layout/ContentArea.tsx

Lines changed: 0 additions & 36 deletions
This file was deleted.

graylog2-web-interface/src/components/security/page-layout/index.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

graylog2-web-interface/src/components/security/teaser/TeaserPageLayout.tsx

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
1414
* along with this program. If not, see
1515
* <http://www.mongodb.com/licensing/server-side-public-license>.
1616
*/
17-
import * as React from 'react';
18-
import styled, { css } from 'styled-components';
1917
import type { PropsWithChildren } from 'react';
18+
import * as React from 'react';
2019
import { useState } from 'react';
20+
import styled, { css } from 'styled-components';
2121

2222
import { Alert, Button } from 'components/bootstrap';
2323
import { Icon, ConfirmDialog } from 'components/common';
24-
import { ContentArea, Container } from 'components/security/page-layout';
2524

2625
const StyledAlert = styled(Alert)`
2726
padding: ${({ theme }) => theme.spacings.lg};
@@ -103,22 +102,19 @@ const TeaserPageLayout = ({ children }: PropsWithChildren) => {
103102

104103
return (
105104
<>
106-
<Container>
107-
<ContentArea>
108-
<StyledAlert bsStyle="info" noIcon>
109-
<Banner>
110-
<LeftItems>
111-
<BoldText>Security Demo</BoldText>
112-
<span>For more information and booking a full demo of the product visit Graylog website.</span>
113-
</LeftItems>
114-
<Button bsStyle="primary" role="link" target="_blank" href="https://graylog.org/explore-security/">
115-
Graylog Security <Icon name="open_in_new" />
116-
</Button>
117-
</Banner>
118-
</StyledAlert>
119-
{children}
120-
</ContentArea>
121-
</Container>
105+
<StyledAlert bsStyle="info" noIcon>
106+
<Banner>
107+
<LeftItems>
108+
<BoldText>Security Demo</BoldText>
109+
<span>For more information and booking a full demo of the product visit Graylog website.</span>
110+
</LeftItems>
111+
<Button bsStyle="primary" role="link" target="_blank" href="https://graylog.org/explore-security/">
112+
Graylog Security <Icon name="open_in_new" />
113+
</Button>
114+
</Banner>
115+
</StyledAlert>
116+
{children}
117+
122118
{showModal && (
123119
<ConfirmDialog
124120
show

graylog2-web-interface/src/components/security/teaser/TeaserSearch.tsx

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@
1616
*/
1717
import * as React from 'react';
1818
import styled from 'styled-components';
19-
import { useMemo, forwardRef } from 'react';
2019
import 'wicg-inert';
2120

2221
import Hotspot from 'components/security/teaser/Hotspot';
23-
import { SAVE_COPY } from 'views/components/contexts/SearchPageLayoutContext';
24-
import PageContentLayout from 'components/layout/PageContentLayout';
25-
import SearchPageLayoutProvider from 'views/components/contexts/SearchPageLayoutProvider';
22+
import NoSidebarSearchLayout from 'views/components/NoSidebarSearchLayout';
2623
import type { SearchJobResult } from 'views/logic/SearchResult';
2724
import type { SearchJson } from 'views/logic/search/Search';
2825
import StaticSearch from 'views/components/StaticSearch';
@@ -33,10 +30,8 @@ type HotspotMeta = {
3330
description: string;
3431
};
3532

36-
const StyledPageContentLayout = styled(PageContentLayout)`
37-
.page-content-grid {
38-
position: relative;
39-
}
33+
const ReadOnlyContainer = styled.div`
34+
height: 100%;
4035
`;
4136

4237
const DashboardOverlay = styled.div`
@@ -49,43 +44,27 @@ const DashboardOverlay = styled.div`
4944
z-index: 1;
5045
`;
5146

52-
const searchAreaContainer = (hotspots: Array<HotspotMeta>) =>
53-
forwardRef<HTMLDivElement, React.PropsWithChildren>(({ children }, ref) => (
54-
<StyledPageContentLayout ref={ref}>
55-
<DashboardOverlay>
56-
{hotspots.map(({ description, positionX, positionY }, index) => (
57-
// eslint-disable-next-line react/no-array-index-key
58-
<Hotspot positionX={positionX} positionY={positionY} index={index} key={`hotspot-${index}`}>
59-
{description}
60-
</Hotspot>
61-
))}
62-
</DashboardOverlay>
63-
<div inert="">{children}</div>
64-
</StyledPageContentLayout>
65-
));
66-
6747
type Props = {
6848
searchJson: Partial<SearchJson>;
6949
viewJson: any;
7050
searchJobResult: Partial<SearchJobResult>;
7151
hotspots: Array<HotspotMeta>;
7252
};
7353

74-
const TeaserSearch = ({ searchJson, viewJson, searchJobResult, hotspots }: Props) => {
75-
const searchPageLayout = useMemo(
76-
() => ({
77-
sidebar: { isShown: false },
78-
viewActions: SAVE_COPY,
79-
searchAreaContainer: { component: searchAreaContainer(hotspots) },
80-
}),
81-
[hotspots],
82-
);
83-
84-
return (
85-
<SearchPageLayoutProvider value={searchPageLayout}>
54+
const TeaserSearch = ({ searchJson, viewJson, searchJobResult, hotspots }: Props) => (
55+
<NoSidebarSearchLayout>
56+
<DashboardOverlay>
57+
{hotspots.map(({ description, positionX, positionY }, index) => (
58+
// eslint-disable-next-line react/no-array-index-key
59+
<Hotspot positionX={positionX} positionY={positionY} index={index} key={`hotspot-${index}`}>
60+
{description}
61+
</Hotspot>
62+
))}
63+
</DashboardOverlay>
64+
<ReadOnlyContainer inert="">
8665
<StaticSearch searchJson={searchJson} viewJson={viewJson} searchJobResult={searchJobResult} />
87-
</SearchPageLayoutProvider>
88-
);
89-
};
66+
</ReadOnlyContainer>
67+
</NoSidebarSearchLayout>
68+
);
9069

9170
export default TeaserSearch;
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (C) 2020 Graylog, Inc.
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the Server Side Public License, version 1,
6+
* as published by MongoDB, Inc.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* Server Side Public License for more details.
12+
*
13+
* You should have received a copy of the Server Side Public License
14+
* along with this program. If not, see
15+
* <http://www.mongodb.com/licensing/server-side-public-license>.
16+
*/
17+
import * as React from 'react';
18+
import { useMemo } from 'react';
19+
import styled from 'styled-components';
20+
21+
import SearchPageLayoutProvider from 'views/components/contexts/SearchPageLayoutProvider';
22+
import type { LayoutState } from 'views/components/contexts/SearchPageLayoutContext';
23+
import { SAVE_COPY } from 'views/components/contexts/SearchPageLayoutContext';
24+
import { Row } from 'components/bootstrap';
25+
26+
const Container = styled(Row)`
27+
position: relative;
28+
`;
29+
30+
const PageContentLayout = styled.div`
31+
padding: 0 15px;
32+
width: 100%;
33+
height: 100%;
34+
`;
35+
36+
const SearchAreaContainer = React.forwardRef<HTMLDivElement, React.PropsWithChildren>(({ children }, ref) => (
37+
<PageContentLayout ref={ref}>{children}</PageContentLayout>
38+
));
39+
40+
type Props = {
41+
children: React.ReactNode;
42+
viewActions?: LayoutState['viewActions'];
43+
};
44+
45+
const NoSidebarSearchLayout = ({ children, viewActions = SAVE_COPY }: Props) => {
46+
const searchPageLayout = useMemo(
47+
() => ({
48+
sidebar: { isShown: false },
49+
viewActions,
50+
searchAreaContainer: { component: SearchAreaContainer },
51+
}),
52+
[viewActions],
53+
);
54+
55+
return (
56+
<SearchPageLayoutProvider value={searchPageLayout}>
57+
<Container>{children}</Container>
58+
</SearchPageLayoutProvider>
59+
);
60+
};
61+
62+
export default NoSidebarSearchLayout;

0 commit comments

Comments
 (0)