Skip to content

Commit

Permalink
Port cloud-4.0 changes to master (#823)
Browse files Browse the repository at this point in the history
* Bump package.json version to 4.0.0-rc.2

* [graylog-plugin-integrations] prepare release 4.0.0-rc.2

* Bump package.json version to 4.0.0-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Change license to SSPL (#654)

See the following links for more details:

- https://www.graylog.org/post/graylog-announces-4-0-release-of-its-log-management-platform
- https://www.graylog.org/post/graylog-v4-0-licensing-sspl

* Bump package.json version to 4.0.0

* [graylog-plugin-integrations] prepare release 4.0.0

* Bump package.json version to 4.0.1-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Slack Notification Plugin - add field Message Backlog Limit. (#639) (#659)

* add backlog size in ui and adjust names

* update unit tests

* added debug statements

* fix failing junit test

* add input group for backlog size field

* toggle backlog item messages

* slack message backlog description

* min and max backlog message size

* added junit test for backlog

* backlog textfield is numeric

* null check and fix unit test

* fix CheckReturnValue error in unit test

* code clean up

* pr feedback

* remove backlog from slack message payload

* reformat code

* fix junit assert expectations

* add code comments and fix unit test

* reset default backlog size, fix help message

* add ui field for toggling

* toggling backlog

* disable message backlog override

* add min value and help block description

* Update src/main/java/org/graylog/integrations/notifications/types/SlackEventNotification.java

Co-authored-by: Bernd Ahlers <[email protected]>

* making max limit to 50

* help block description

* set max value

* verbiage fix

* refine help block

* fix label for backlog

* custom message description fix

* custom message help block , invalid template error message

* refine control label text

* Update src/web/event-notifications/event-notification-types/SlackNotificationForm.jsx

Co-authored-by: Rob Curtis <[email protected]>

* fix label for message backlog

* fix license header

* Update src/test/java/org/graylog/integrations/notifications/types/SlackClientTest.java

Co-authored-by: Rob Curtis <[email protected]>

* fix unit test

* remove max value

* pf feedback

* pr feedback

* remove backlog references

* backlog cannot be less than 0

* code and unit test clean up

* fix comment

* limit backlog when number is greater than zero

* Update src/main/java/org/graylog/integrations/notifications/types/SlackEventNotification.java

Co-authored-by: Rob Curtis <[email protected]>

* ignoring failing junit test

* Update src/web/event-notifications/event-notification-types/SlackNotificationForm.jsx

Co-authored-by: Rob Curtis <[email protected]>

* refine exception handling and enable ignored unit test

* fix spacing

* junit clean up

* add unit test for exception scenario

* import cleanup

* cleanup unit test

* reformat code, optimize imports, increase junit test coverage

* seperate exception blocks to handle temporary,permanent,runtime exceptions

* fix exception mapping

* pr feedback

* remove log.error

* fix comment

Co-authored-by: Bernd Ahlers <[email protected]>
Co-authored-by: Rob Curtis <[email protected]>

Co-authored-by: Bernd Ahlers <[email protected]>
Co-authored-by: Rob Curtis <[email protected]>

* Backport #658 to 4.0.1 (#663)

* Update Slack plugin to allow Discord webhooks (#661) (#665)

* Update Slack plugin to allow Discord webhooks with Slack formatting

* Expand Discord url support

* Bump package.json version to 4.0.1

* [graylog-plugin-integrations] prepare release 4.0.1

* Bump package.json version to 4.0.2-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Disable cloudwatch on cloud

Do not register cloudwatch input on cloud environments, since that is
not supported yet.

Fixes Graylog2/graylog-plugin-cloud#619

* Update Guice config to split forwarder and server (#686)

* Sync cloud 4.0 (#712)

* Bump package.json version to 4.0.2

* [graylog-plugin-integrations] prepare release 4.0.2

* Bump package.json version to 4.0.3-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

Co-authored-by: Jenkins <[email protected]>

* Sync cloud 4.0 (#739)

* Bump package.json version to 4.0.2

* [graylog-plugin-integrations] prepare release 4.0.2

* Bump package.json version to 4.0.3-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Initial version of USERID parsing for Palo9x input (#719) (#729)

* Bump package.json version to 4.0.3

* [graylog-plugin-integrations] prepare release 4.0.3

* Bump package.json version to 4.0.4-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Refactor PaloAltoTypeParser to improve performance (#737)

Refs #726

Co-authored-by: Jenkins <[email protected]>
Co-authored-by: Rob Curtis <[email protected]>

* Support AWS custom Input UI in Forwarder (#736)

* Re-enable AWS input for cloud

* Clean up URLs

- Clean up `Routes` object, since only one route in that object was
  being mounted and used
- Remove unused props from the previous cleanup

* Update Icon name

* Fix issues in components

- Move state update in `CloudWatch` inside `useEffect`
- Fix linter errors in `CloudWatch`
- Move styled component outside of render in `AWSAuthenticationTypes`,
  since that caused a console error

* Provide an embeddable version of CloudWatchApp

So far the custom Input UI was meant to be run in a full page on its
own, but in Forwarders we will embed that UI into another page. The
biggest change is removing page headers, but we may also do some styling
or other modifications eventually.

* Set up test environment

* Add option to submit Input externally

This converts the form data into a generic InputCreate request that can
be submitted to other resources, like the regular Inputs API or the
Forwarder API.

* Use formDataAdapter to AWS requests from form data

* Add frontend test to maven build

* Remove flow check from build

We don't use flow annotations on this plugin.

* Move form data into a fixture

Making tests easier to read and avoiding so much repetition.

* Sync cloud 4.0 (#748)

* Bump package.json version to 4.0.2

* [graylog-plugin-integrations] prepare release 4.0.2

* Bump package.json version to 4.0.3-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Initial version of USERID parsing for Palo9x input (#719) (#729)

* Bump package.json version to 4.0.3

* [graylog-plugin-integrations] prepare release 4.0.3

* Bump package.json version to 4.0.4-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Refactor PaloAltoTypeParser to improve performance (#737)

Refs #726

* Bump package.json version to 4.0.4

* [graylog-plugin-integrations] prepare release 4.0.4

* Bump package.json version to 4.0.5-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Bump package.json version to 4.0.5

* [graylog-plugin-integrations] prepare release 4.0.5

* Bump package.json version to 4.0.6-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

Co-authored-by: Jenkins <[email protected]>
Co-authored-by: Rob Curtis <[email protected]>

* Bump elliptic to 6.5.4 (#771)

Fixes: GHSA-r9p9-mrjm-926w

* Sync cloud 4.0 (#797)

* Bump package.json version to 4.0.2

* [graylog-plugin-integrations] prepare release 4.0.2

* Bump package.json version to 4.0.3-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Initial version of USERID parsing for Palo9x input (#719) (#729)

* Bump package.json version to 4.0.3

* [graylog-plugin-integrations] prepare release 4.0.3

* Bump package.json version to 4.0.4-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Refactor PaloAltoTypeParser to improve performance (#737)

Refs #726

* Bump package.json version to 4.0.4

* [graylog-plugin-integrations] prepare release 4.0.4

* Bump package.json version to 4.0.5-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Bump package.json version to 4.0.5

* [graylog-plugin-integrations] prepare release 4.0.5

* Bump package.json version to 4.0.6-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

* Bump package.json version to 4.0.6

* [graylog-plugin-integrations] prepare release 4.0.6

* Bump package.json version to 4.0.7-SNAPSHOT

* [graylog-plugin-integrations] prepare for next development iteration

Co-authored-by: Jenkins <[email protected]>
Co-authored-by: Rob Curtis <[email protected]>

* Update web configuration

* Fix test

Co-authored-by: Jenkins <[email protected]>
Co-authored-by: Bernd Ahlers <[email protected]>
Co-authored-by: Priya <[email protected]>
Co-authored-by: Rob Curtis <[email protected]>
Co-authored-by: Marco Pfatschbacher <[email protected]>
Co-authored-by: Donald Morton <[email protected]>
  • Loading branch information
7 people authored May 18, 2021
1 parent 6841032 commit dd78d4c
Show file tree
Hide file tree
Showing 20 changed files with 6,596 additions and 922 deletions.
19 changes: 19 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* 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>.
*/
const coreBabelConfig = require('../graylog2-server/graylog2-web-interface/babel.config.js');

module.exports = { ...coreBabelConfig };
37 changes: 37 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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>.
*/
const fs = require('fs');
const buildConfig = require('./build.config');

const packageJson = JSON.parse(fs.readFileSync('package.json'));
const webSrcPrefix = buildConfig.web_src_path;
const {
moduleDirectories,
moduleNameMapper
} = packageJson.jest;

const jestConfig = {
...packageJson.jest,
moduleDirectories: [].concat(moduleDirectories, [`${webSrcPrefix}/src`, `${webSrcPrefix}/test`]),
moduleNameMapper: {
...moduleNameMapper,
'^react$': `${webSrcPrefix}/node_modules/react/index.js`,
'^react-dom$': `${webSrcPrefix}/node_modules/react-dom/index.js`,
'^styled-components$': `${webSrcPrefix}/node_modules/styled-components`,
},
};
module.exports = jestConfig;
49 changes: 45 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,62 @@
},
"scripts": {
"build": "webpack",
"test": "jest",
"lint": "eslint src",
"lint:path": "eslint",
"test": "jest",
"flow-check": "flow check"
"lint:styles": "stylelint './src/web/**/*.{js,jsx,ts,tsx}' --syntax css-in-js",
"lint:styles:path": "stylelint --syntax css-in-js"
},
"eslintConfig": {
"extends": "graylog"
},
"stylelint": {
"extends": "stylelint-config-graylog"
},
"jest": {
"preset": "jest-preset-graylog",
"setupFiles": [],
"testEnvironment": "enzyme",
"testEnvironmentOptions": {
"enzymeAdapter": "react16"
},
"moduleDirectories": [
"src",
"src/test",
"node_modules"
],
"moduleNameMapper": {
"^aws/(.+)$": "web/aws/$1"
},
"roots": [
"src"
],
"transform": {
"^.+\\.[tj]sx?$": "babel-jest"
}
},
"keywords": [
"graylog"
],
"author": "Graylog, Inc. <[email protected]>",
"dependencies": {
"graylog-web-plugin": "file:../graylog2-server/graylog2-web-interface/packages/graylog-web-plugin"
},
"private": true,
"devDependencies": {}
"devDependencies": {
"@babel/core": "7.12.10",
"@babel/plugin-proposal-class-properties": "7.10.4",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-transform-runtime": "7.11.5",
"@babel/preset-env": "7.11.5",
"@babel/preset-react": "7.12.10",
"@testing-library/user-event": "^13.0.2",
"babel-plugin-add-module-exports": "1.0.4",
"babel-plugin-dynamic-import-node": "2.3.3",
"babel-plugin-styled-components": "1.11.1",
"identity-obj-proxy": "^3.0.0"
},
"resolutions": {
"jest-environment-jsdom": "^26.0.1"
},
"private": true
}
34 changes: 34 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,38 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>web-interface-build</id>
<activation>
<property>
<name>!skip.web.build</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
<executions>
<execution>
<id>yarn test</id>
<goals>
<goal>yarn</goal>
</goals>
<phase>test</phase>
<configuration>
<arguments>test</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
40 changes: 40 additions & 0 deletions src/test/web/aws/FormData.fixtures.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// eslint-disable-next-line import/prefer-default-export
import { AWS_AUTH_TYPES, DEFAULT_KINESIS_LOG_TYPE } from 'aws/common/constants';

export const exampleFormDataWithKeySecretAuth = {
awsAuthenticationType: { value: AWS_AUTH_TYPES.keysecret },
awsCloudWatchAddFlowLogPrefix: { value: true },
awsCloudWatchAssumeARN: { value: '' },
awsCloudWatchAwsKey: { value: 'mykey' },
awsCloudWatchAwsRegion: { value: 'us-east-1' },
awsCloudWatchBatchSize: { value: 10000 },
awsEndpointCloudWatch: { value: undefined },
awsCloudWatchGlobalInput: { value: false },
awsCloudWatchKinesisInputType: { value: DEFAULT_KINESIS_LOG_TYPE },
awsCloudWatchKinesisStream: { value: 'my-stream' },
awsCloudWatchName: { value: 'My Input' },
awsCloudWatchThrottleEnabled: { value: false },
awsEndpointDynamoDB: { value: undefined },
awsEndpointIAM: { value: undefined },
awsEndpointKinesis: { value: undefined },
awsCloudWatchAwsSecret: { value: 'mysecret' },
};

export const exampleFormDataWithAutomaticAuth = {
awsAuthenticationType: { value: AWS_AUTH_TYPES.automatic },
awsCloudWatchAddFlowLogPrefix: { value: true },
awsCloudWatchAssumeARN: { value: '' },
awsCloudWatchAwsRegion: { value: 'us-east-1' },
awsCloudWatchBatchSize: { value: 10000 },
awsEndpointCloudWatch: { value: undefined },
awsCloudWatchGlobalInput: { value: false },
awsCloudWatchKinesisInputType: { value: DEFAULT_KINESIS_LOG_TYPE },
awsCloudWatchKinesisStream: { value: 'my-stream' },
awsCloudWatchName: { value: 'My Input' },
awsCloudWatchThrottleEnabled: { value: false },
awsEndpointDynamoDB: { value: undefined },
awsEndpointIAM: { value: undefined },
awsEndpointKinesis: { value: undefined },
key: 'mykey',
secret: 'mysecret',
};
17 changes: 17 additions & 0 deletions src/test/web/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* 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>.
*/
module.exports = 'test-file-stub';
14 changes: 7 additions & 7 deletions src/web/aws/authentication/AWSAuthenticationTypes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*/
import React, { useCallback, useContext, useEffect, useState } from 'react';
import React, { useContext, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import styled, { css } from 'styled-components';

Expand All @@ -26,6 +26,12 @@ import KeySecret from './KeySecret';
import Automatic from './Automatic';
import ARN from './ARN';

const AuthWrapper = styled.div(({ theme }) => css`
margin: 0 0 21px 9px;
padding: 3px 0 3px 21px;
border-left: 3px solid ${theme.colors.gray[80]};
`);

const AWSAuthenticationTypes = ({ onChange }) => {
const { clearField, formData } = useContext(FormDataContext);

Expand All @@ -43,12 +49,6 @@ const AWSAuthenticationTypes = ({ onChange }) => {
onChange({ target: { name: 'awsAuthenticationType', value: defaultAuthTypeValue } });
}, []);

const AuthWrapper = useCallback(styled.div(({ theme }) => css`
margin: 0 0 21px 9px;
padding: 3px 0 3px 21px;
border-left: 3px solid ${theme.colors.gray[80]};
`), []);

const isType = (type) => {
return currentType === type;
};
Expand Down
2 changes: 1 addition & 1 deletion src/web/aws/authentication/Automatic.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const Automatic = () => {
<tr>
<td colSpan="2">
<SectionNote>
For more information, check out the <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html" target="_blank" rel="noopener noreferrer">AWS Credential Configuration Documentation <Icon name="external-link" /></a>
For more information, check out the <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html" target="_blank" rel="noopener noreferrer">AWS Credential Configuration Documentation <Icon name="external-link-alt" /></a>
</SectionNote>
</td>
</tr>
Expand Down
Loading

0 comments on commit dd78d4c

Please sign in to comment.