Skip to content

Commit

Permalink
Merge branch 'master' into stream-delete-modal-dwh
Browse files Browse the repository at this point in the history
  • Loading branch information
ousmaneo committed Aug 22, 2024
2 parents 46383bf + 4b32888 commit e810a64
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 82 deletions.
2 changes: 1 addition & 1 deletion graylog2-web-interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@reduxjs/toolkit": "^2.2.0",
"@tanstack/query-sync-storage-persister": "^4.33.0",
"@tanstack/react-query-persist-client": "^4.33.0",
"ace-builds": "1.35.4",
"ace-builds": "1.35.5",
"bootstrap": "3.4.1",
"bson-objectid": "^2.0.3",
"chroma-js": "^2.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@tanstack/react-query": "4.36.1",
"@types/create-react-class": "15.6.8",
"@types/jquery": "3.5.30",
"@types/react": "18.3.3",
"@types/react": "18.3.4",
"babel-preset-graylog": "file:../babel-preset-graylog",
"create-react-class": "15.7.0",
"eslint-config-graylog": "file:../eslint-config-graylog",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ interface PluginDataWarehouse {
}
}>,
StreamDataWarehouse: React.ComponentType<{}>,
DataWarehouseJobs: React.ComponentType<{}>,
StreamIlluminateProcessingSection: React.ComponentType<{
stream: Stream,
}>,
StreamIndexSetDataWarehouseWarning: React.ComponentType<{streamId: string, isArchivingEnabled: boolean}>,
fetchStreamDataWarehouseStatus: (streamId: string) => Promise<{
id: string,
Expand All @@ -204,7 +206,6 @@ interface PluginDataWarehouse {
restore_history: Array<{id:string}>,

}>;
DataWarehouseStreamDeleteWarning: React.ComponentType<{}>,
getStreamDataWarehouseTableElements: (permission: Immutable.List<string>) => {
attributeName: string,
attributes: Array<{ id: string, title: string }>,
Expand Down
6 changes: 4 additions & 2 deletions graylog2-web-interface/src/components/common/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import PropTypes from 'prop-types';
import styled, { css } from 'styled-components';

import Icon from 'components/common/Icon';
import type { IconName, RotateProp, IconType } from 'components/common/Icon';
import type { IconName, RotateProp, IconType, SizeProp } from 'components/common/Icon';

const Wrapper = styled.button<{ disabled: boolean }>(({ theme, disabled }) => css`
display: inline-flex;
Expand Down Expand Up @@ -51,7 +51,8 @@ type Props = {
iconType?: IconType,
disabled?: boolean,
rotation?: RotateProp,
'data-testid'?: string
'data-testid'?: string,
size?: SizeProp,
};

const handleClick = (onClick: () => void | undefined) => {
Expand Down Expand Up @@ -98,6 +99,7 @@ IconButton.defaultProps = {
rotation: undefined,
iconType: undefined,
'data-testid': undefined,
size: undefined,
};

export default IconButton;
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,39 @@
* <http://www.mongodb.com/licensing/server-side-public-license>.
*/
import * as React from 'react';
import { useParams } from 'react-router-dom';
import styled, { css } from 'styled-components';
import { PluginStore } from 'graylog-web-plugin/plugin';

import { defaultCompare as naturalSort } from 'logic/DefaultCompare';
import usePipelinesConnectedStream, { type StreamConnectedPipelines } from 'hooks/usePipelinesConnectedStream';
import { Table, Button, Alert } from 'components/bootstrap';
import { Table, Button } from 'components/bootstrap';
import Routes from 'routing/Routes';
import { IfPermitted, Section, Icon } from 'components/common';
import usePipelines from 'hooks/usePipelines';
import { LinkContainer } from 'components/common/router';
import StreamPipelinesConnectionForm from 'components/streams/StreamDetails/StreamPipelinesConnectionForm';
import type { Stream } from 'logic/streams/types';

type Props = {
stream: Stream,
};

const ActionButtonsWrap = styled.span(({ theme }) => css`
margin-right: ${theme.spacings.xxs};
float: right;
`);

const StreamDataRoutingProcessing = () => {
const { streamId } = useParams<{streamId: string}>();
const StreamDataRoutingProcessing = ({ stream }: Props) => {
const { id: streamId } = stream;
const { data: connectedPipelines, isInitialLoading: isLoadingConnectPipelines } = usePipelinesConnectedStream(streamId);
const hasConnectedPipelines = !isLoadingConnectPipelines && connectedPipelines?.length > 0;
const { data: pipelines } = usePipelines();
const sortPipelines = (pipelinesList: StreamConnectedPipelines) => pipelinesList.sort((s1, s2) => naturalSort(s1.title, s2.title));
const StreamIlluminateProcessingSection = PluginStore.exports('dataWarehouse')?.[0]?.StreamIlluminateProcessingSection;

return (
<>
<Alert bsStyle="default">
The <b>Illuminate Processing</b> step is an immutable Pipeline that occurs before user Pipelines in the default processing order.<br />
It collects messages that meet supported formats from the All Messages stream, parses that data into the Graylog GIM schema fields and routes them to this Stream.
</Alert>
<Section title="Illuminate Processing">
<p>Illuminate Processing step</p>
</Section>
{StreamIlluminateProcessingSection && (<StreamIlluminateProcessingSection stream={stream} />)}
<Section title="Pipelines"
actions={(
<IfPermitted permissions="streams:create">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const StreamDetails = ({ stream }: Props) => {
<SegmentContainer className="content">
<FullHeightCol xs={12}>
{currentSegment === INTAKE_SEGMENT && <StreamDataRoutingIntake stream={stream} />}
{currentSegment === PROCESSING_SEGMENT && <StreamDataRoutingProcessing />}
{currentSegment === PROCESSING_SEGMENT && <StreamDataRoutingProcessing stream={stream} />}
{currentSegment === DESTINATIONS_SEGMENT && <StreamDataRoutingDestinations stream={stream} />}
</FullHeightCol>
</SegmentContainer>
Expand Down
39 changes: 2 additions & 37 deletions graylog2-web-interface/src/theme/GraylogThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import { ThemeProvider } from 'styled-components';
import type { ColorScheme } from '@graylog/sawmill';
import SawmillSC from '@graylog/sawmill/styled-components';
import type { MantineTheme } from '@graylog/sawmill/mantine';
import SawmillMantine from '@graylog/sawmill/mantine';
import { useMemo } from 'react';
import { MantineProvider } from '@mantine/core';

import usePluginEntities from 'hooks/usePluginEntities';
import type { CustomThemesColors } from 'theme/theme-types';
import useThemes from 'theme/hooks/useThemes';

import ColorSchemeContext from './ColorSchemeContext';
import { COLOR_SCHEMES } from './constants';
import usePreferredColorScheme from './hooks/usePreferredColorScheme';

import 'material-symbols/rounded.css';

Expand All @@ -39,37 +33,8 @@ type Props = {
userIsLoggedIn: boolean,
}

const useSCTheme = (
changeColorScheme: (newColorScheme: ColorScheme) => void,
mantineTheme: MantineTheme,
) => useMemo(() => {
const theme = SawmillSC(mantineTheme);

return ({
...theme,
changeMode: changeColorScheme,
mantine: mantineTheme,
});
}, [changeColorScheme, mantineTheme]);

const useMantineTheme = (
colorScheme: ColorScheme,
useCustomThemeColors: () => ({ data: CustomThemesColors }),
) => {
const { data: customThemeColors } = useCustomThemeColors?.() ?? {};

return useMemo(() => SawmillMantine({
colorScheme,
customColors: customThemeColors?.[colorScheme],
}), [colorScheme, customThemeColors]);
};

const GraylogThemeProvider = ({ children, initialThemeModeOverride, userIsLoggedIn }: Props) => {
const [colorScheme, changeColorScheme] = usePreferredColorScheme(initialThemeModeOverride, userIsLoggedIn);
const themeCustomizer = usePluginEntities('customization.theme.customizer');
const useCustomThemeColors = themeCustomizer?.[0]?.hooks.useCustomThemeColors;
const mantineTheme = useMantineTheme(colorScheme, useCustomThemeColors);
const scTheme = useSCTheme(changeColorScheme, mantineTheme);
const { scTheme, mantineTheme, colorScheme } = useThemes(initialThemeModeOverride, userIsLoggedIn);

return (
<ColorSchemeContext.Provider value={colorScheme}>
Expand Down
63 changes: 63 additions & 0 deletions graylog2-web-interface/src/theme/hooks/useThemes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2020 Graylog, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*/

import { useMemo } from 'react';
import type { ColorScheme } from '@graylog/sawmill';
import SawmillMantine from '@graylog/sawmill/mantine';
import type { MantineTheme } from '@graylog/sawmill/mantine';
import SawmillSC from '@graylog/sawmill/styled-components';

import type { CustomThemesColors } from 'theme/theme-types';
import usePreferredColorScheme from 'theme/hooks/usePreferredColorScheme';
import usePluginEntities from 'hooks/usePluginEntities';

const useMantineTheme = (
colorScheme: ColorScheme,
useCustomThemeColors: () => ({ data: CustomThemesColors }),
) => {
const { data: customThemeColors } = useCustomThemeColors?.() ?? {};

return useMemo(() => SawmillMantine({
colorScheme,
customColors: customThemeColors?.[colorScheme],
}), [colorScheme, customThemeColors]);
};

const useStyledComponentsTheme = (
changeColorScheme: (newColorScheme: ColorScheme) => void,
mantineTheme: MantineTheme,
) => useMemo(() => {
const theme = SawmillSC(mantineTheme);

return ({
...theme,
changeMode: changeColorScheme,
mantine: mantineTheme,
});
}, [changeColorScheme, mantineTheme]);

const useThemes = (initialThemeModeOverride: ColorScheme, userIsLoggedIn: boolean) => {
const [colorScheme, changeColorScheme] = usePreferredColorScheme(initialThemeModeOverride, userIsLoggedIn);
const themeCustomizer = usePluginEntities('customization.theme.customizer');
const useCustomThemeColors = themeCustomizer?.[0]?.hooks.useCustomThemeColors;
const mantineTheme = useMantineTheme(colorScheme, useCustomThemeColors);
const scTheme = useStyledComponentsTheme(changeColorScheme, mantineTheme);

return { scTheme, mantineTheme, colorScheme };
};

export default useThemes;
44 changes: 22 additions & 22 deletions graylog2-web-interface/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3620,7 +3620,7 @@
dependencies:
"@types/react" "*"

"@types/react@*", "@types/[email protected]", "@types/[email protected].3", "@types/react@^16", "@types/react@^16.9.11", "@types/react@^16.9.9":
"@types/react@*", "@types/[email protected]", "@types/[email protected].4", "@types/react@^16", "@types/react@^16.9.11", "@types/react@^16.9.9":
version "18.0.28"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.28.tgz#accaeb8b86f4908057ad629a26635fe641480065"
integrity sha512-RD0ivG1kEztNBdoAK7lekI9M+azSnitIn85h4iOiaLjaTrMjzslhaqCGaI4IyCJ1RljWiLCEu4jyrLLgqxBTew==
Expand Down Expand Up @@ -4112,10 +4112,10 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8:
mime-types "~2.1.34"
negotiator "0.6.3"

[email protected].4, ace-builds@^1.32.8:
version "1.35.4"
resolved "https://registry.yarnpkg.com/ace-builds/-/ace-builds-1.35.4.tgz#f41d7ef57c3a7d424cd7e3300bef0cbef905c84f"
integrity sha512-r0KQclhZ/uk5a4zOqRYQkJuQuu4vFMiA6VTj54Tk4nI1TUR3iEMMppZkWbNoWEgWwv4ciDloObb9Rf4V55Qgjw==
[email protected].5, ace-builds@^1.32.8:
version "1.35.5"
resolved "https://registry.yarnpkg.com/ace-builds/-/ace-builds-1.35.5.tgz#6cddd56de260295473a24f3acc0efdb8bf8157e1"
integrity sha512-yh3V5BLHlN6gwbmk5sV00WRRvdEggJGJ3AIHhOOGHlgDWNWCSvOnHPO7Chb+AqaxxHuvpxOdXd7ZQesaiuJQZQ==

acorn-globals@^4.1.0:
version "4.3.4"
Expand Down Expand Up @@ -5702,9 +5702,9 @@ core-js-compat@^3.37.1:
browserslist "^4.23.0"

core-js@3:
version "3.37.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.37.1.tgz#d21751ddb756518ac5a00e4d66499df981a62db9"
integrity sha512-Xn6qmxrQZyB0FFY8E3bgRXei3lWDJHhvI+u0q9TKIYM49G8pAr0FgnnrFRAmsbptZL1yxRADVXn+x5AGsbBfyw==
version "3.38.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.38.1.tgz#aa375b79a286a670388a1a363363d53677c0383e"
integrity sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==

core-js@^2.6.5:
version "2.6.11"
Expand Down Expand Up @@ -6715,22 +6715,22 @@ elementary-circuits-directed-graph@^1.0.4:
strongly-connected-components "^1.0.1"

embla-carousel-react@^8.0.0-rc11:
version "8.1.5"
resolved "https://registry.yarnpkg.com/embla-carousel-react/-/embla-carousel-react-8.1.5.tgz#64867a2812c0c5beb7fe215651ce1f8d9f4855d5"
integrity sha512-xFmfxgJd7mpWDHQ4iyK1Qs+5BTTwu4bkn+mSROKiUH9nKpPHTeilQ+rpeQDCHRrAPeshD67aBk0/p6FxWxXsng==
version "8.1.8"
resolved "https://registry.yarnpkg.com/embla-carousel-react/-/embla-carousel-react-8.1.8.tgz#ccca22c12d97407f12c3dd8f6fafae6e82e4c578"
integrity sha512-b8DcmC+j1vqVWSM6rU/GYGyY6Kp9LX8OoikZPBKmV6qL8s94sSPGl6jtDLLUtV8TTIQGMYOlOKUgoMAt/0TwOQ==
dependencies:
embla-carousel "8.1.5"
embla-carousel-reactive-utils "8.1.5"
embla-carousel "8.1.8"
embla-carousel-reactive-utils "8.1.8"

[email protected].5:
version "8.1.5"
resolved "https://registry.yarnpkg.com/embla-carousel-reactive-utils/-/embla-carousel-reactive-utils-8.1.5.tgz#87475b9478a60c92be883bccecebbf4f180796f9"
integrity sha512-76uZTrSaEGGta+qpiGkMFlLK0I7N04TdjZ2obrBhyggYIFDWlxk1CriIEmt2lisLNsa1IYXM85kr863JoCMSyg==
[email protected].8:
version "8.1.8"
resolved "https://registry.yarnpkg.com/embla-carousel-reactive-utils/-/embla-carousel-reactive-utils-8.1.8.tgz#8c2577516216c16cfe24b345fda0fa53d8072f40"
integrity sha512-bwV/23WD3Ecm0YuQ4I6Syzs3tdVJw0Oj3VCZlEODv1kH8LZ5kNDLgX2Uvx5brvoe2hpifBHPBQ8gYlxNL5kMPA==

[email protected].5:
version "8.1.5"
resolved "https://registry.yarnpkg.com/embla-carousel/-/embla-carousel-8.1.5.tgz#d958083cb16f19e7412bf8f93fa125b21311ac93"
integrity sha512-R6xTf7cNdR2UTNM6/yUPZlJFRmZSogMiRjJ5vXHO65II5MoUlrVYUAP0fHQei/py82Vf15lj+WI+QdhnzBxA2g==
[email protected].8:
version "8.1.8"
resolved "https://registry.yarnpkg.com/embla-carousel/-/embla-carousel-8.1.8.tgz#cb4e02a1467909d8d59aba2063ab8e2e6262b68c"
integrity sha512-KuHPA8qcAts6YE6ELtt38XYAb26hnKw8Ga0lSXmrhm1oI97t6oACFkqSsy33dfeZQEhaZB6VwWvaWQJRJVgSgA==

emittery@^0.13.1:
version "0.13.1"
Expand Down Expand Up @@ -8855,7 +8855,7 @@ graphemer@^1.4.0:
"@tanstack/react-query" "4.36.1"
"@types/create-react-class" "15.6.8"
"@types/jquery" "3.5.30"
"@types/react" "18.3.3"
"@types/react" "18.3.4"
babel-preset-graylog "file:packages/babel-preset-graylog"
create-react-class "15.7.0"
eslint-config-graylog "file:packages/eslint-config-graylog"
Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<byte-buddy.version>1.14.19</byte-buddy.version>
<caffeine.version>3.1.8</caffeine.version>
<cef-parser.version>0.0.1.10</cef-parser.version>
<classgraph.version>4.8.174</classgraph.version>
<classgraph.version>4.8.175</classgraph.version>
<commons-codec.version>1.17.1</commons-codec.version>
<commons-csv.version>1.11.0</commons-csv.version>
<commons-email.version>1.6.0</commons-email.version>
Expand Down Expand Up @@ -169,7 +169,7 @@
<shiro.version>2.0.1</shiro.version>
<snakeyaml.version>2.2</snakeyaml.version>
<snappy-java.version>1.1.10.6</snappy-java.version>
<oshi.version>6.6.2</oshi.version>
<oshi.version>6.6.3</oshi.version>
<siv-mode.version>1.5.2</siv-mode.version>
<slf4j.version>2.0.16</slf4j.version>
<streamex.version>0.8.2</streamex.version>
Expand Down Expand Up @@ -419,7 +419,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.27.0</version>
<version>1.27.1</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -539,7 +539,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.2</version>
<version>3.1.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -579,7 +579,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
<version>3.1.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit e810a64

Please sign in to comment.