Commit Graph

87 Commits

Author SHA1 Message Date
Dennis Oelkers
69bb1ded6f Updating webpack-cli/webpack-merge to v6. (#23588) 2025-09-11 15:47:13 +02:00
Dennis Oelkers
ff352d63c7 Refactoring webpack config: multiple compilers, use webpack-dev-server (#15028)
* Using multiple compilers for webpack build.

* Use single compiler, feed plugin names into template.

* Adding back reload option.

* Using `webpack-dev-server`.

* Converting webpack configs to TS.

* Adding license header.

* Migrating `core` module back to JS`.

* Fixing up handling of `config.js`.

* Fixing linter hints.

* Removing unused import.

* Removing unused HMR plugin.

* Using `$GRAYLOG_API_URL` for proxying if present.

* Removing unused packages.

* Typing `global.pluginNames`.

* Removing `webpack-dev-middleware` & `webpack-hot-middleware`.

* Adding license header.

* Bumping `csstype` to `3.1.1`.
2023-03-28 11:23:23 +02:00
Dennis Oelkers
18793308c5 Use more aggressive chunking for web assets. (#14976) 2023-03-27 15:55:59 +02:00
Dennis Oelkers
e2cad59ca1 Updating esbuild-loader to v3.0.0. (#14656)
* Updating `esbuild-loader` to `v3.0.0`.

* Changing format of `vendor` bundle to `cjs`.
2023-03-14 17:06:51 +01:00
Dennis Oelkers
c4aed2b0b5 Extend browser support back to Chrome 68. (#14688)
* Extend browser support back to Chrome 68.

This change is extending our browser support to go back to Chrome 68 in order to support outdated browser versions commonly found e.g. on smart TVs. The cut is made at Chrome 68 in order to support at least the [last three version of webOS](https://webostv.developer.lge.com/develop/specifications/web-api-and-web-engine).

Fixes #14677.

* Adding changelog snippet.
2023-02-21 15:47:34 +01:00
Dennis Oelkers
36d4ff193b Construct target for esbuild dynamically based on browserslist. (#14072)
* Retrieving esbuild targets dynamically.

* Adding license header.
2022-12-01 14:18:55 +01:00
Dennis Oelkers
f029eb5ef0 Use esbuild to transpile frontend assets. (Take II) (#14071)
* Using `esbuild`/`esbuild-loader` for transpilation.

* Turning function into actual class.

* Simplifying config.

* Adjusting target.

* Fixing up imports with side-effects.

* Using identical targets for minifying.
2022-11-29 16:21:32 +01:00
Dennis Oelkers
35a4fa7bbe Improve styling of login form. (#13780)
* Migrating components to TS, adding types.

* Cleaning up component a bit.

* Styling login page differently.

* Cleaning up.

* Using brand color for button.

* Moving chrome to `LoginChrome` component, reusing it.

* Improving typing.

* Fix color of hovered sign-in button.

* Use labels instead of placeholders.

* Fixing up test for `LoginBox`.

* Adding license header.

* Fixing up prop improvement.

* Sticking notifications to top of container.

* Fixing width of container.

* Added changelog snippet.

* Smaller styling improvements

* Removing .jpeg to .jpg to avoid dev server restart.

* Fixing linter hint

Co-authored-by: Linus Pahl <linus@graylog.com>
2022-11-28 15:05:11 +01:00
Dennis Oelkers
8bd8107da1 Revert "Use esbuild to transpile frontend assets. (#13886)" (#14068)
This reverts commit 3e7dd9329a.
2022-11-28 12:49:01 +01:00
Dennis Oelkers
3e7dd9329a Use esbuild to transpile frontend assets. (#13886)
* Using `esbuild`/`esbuild-loader` for transpilation.

* Turning function into actual class.

* Simplifying config.

* Adjusting target.
2022-11-25 14:44:58 +01:00
Dennis Oelkers
9041a6de6c Avoid compiling internal packages during installation. (#13784)
* Avoid compiling packages during installation.

* Fixing up linter hints.
2022-11-24 16:45:14 +01:00
Dennis Oelkers
a9771993b1 Enforcing usage of babel-preset-graylog from core. (#13179) 2022-08-02 12:43:10 -04:00
Dennis Oelkers
da9a647608 Adding separate package for shared babel config. (#12713)
* Adding separate package for shared babel config.

* Adding back `shippedProposals` setting.

* Bumping and pinning versions.

* Adding dependabot config for babel preset module.
2022-06-08 17:17:08 +02:00
Dennis Oelkers
becb20c156 Generate backend API types for frontend from maven run. (#12525)
* Writing swagger definition from maven run.

* Adding parameters to API generator.

* Generate API files.

* Write overview as well.

* Using classgraph.

* Adding first attempt to generate TS signatures from swagger defs.

* Starting to generate function stubs.

* Starting from api summary to generate defs.

* Cleanup, writing to files, using correct default path.

* Adding accept header information to `request` call.

* Adding import statement.

* Adding `request` stub.

* Moving swagger spec generation out of web profile.

* Generate single-quote string literals.

* Creating proper template string for routes.

* Rename conflicting overloaded function names.

* Map banned function names.

* Generate enum types as union types.

* Ordering function parameters by optionality.

* Supporting enum operation parameters.

* Using single quotes for string literals as paths.

* Support type aliases for named array types.

* Fixing up `Optional`s.

* Avoid generating banned models.

* Cleaning parameter names before usage.

* Generating `any` for `Response`, mapping `any` to `unknown`.

* Mapping more types, handling optional types better.

* Adding indexer signature if additional properties are present.

* Using variable name from `PathParam` annotation for parameter name if present.

* Properly handle inline object types.

* Map inline object models.

* Fixing some type issues.

* Removing type.

* Generate api package index.

* Quoting prop names if needed, making more props readonly.

* Wrap additional properties if they contain type literal.

* Fix boolean default values, ban more types, quote prop names starting with @.

* Handling optionals better.

* Adding task to generate api typedefs.

* Merge default value into allowed values for enum.

* Better merging of default values into enum, handling `long` types.

* Turning `request` into `__request__` to avoid clashes.

* Removing `Type` from banned models.

* Making script work with `ts-node`.

* Dissected frontend typing generator script into parser |> emitter.

* Adding tests.

* Fixing enum parsing.

* Adding/updating tests.

* Generating api specs through yarn task.

* Adding `@graylog/server-api` alias.

* Moving generator test to better place.

* Cleaning up `Generator`.

* Adding license headers.

* Assigning correct phases to frontend goals.

* Removing shebang from generator script.

* Extract types from `response` parameter of `ApiOperation` annotation.

* Suppressing `no-console` errors for scripts.

* Fixing linter hints.

* Using idempotent target directory specification.

* Handling arrays without any type definition.

* Using correct phases for types generation.

* Removing target directory before.

* Using unknown type as const.

* Fixing `request` helper.

* Fix including web assets in production jar.

* Improving maven phases, ordering execution through order in pom.
2022-04-27 11:56:01 +02:00
Othello Maurer
d528b9aaf2 Revert "Generate backend API types for frontend from maven run. (#11568)" (#12518)
This reverts commit 3a051f3f54.
2022-04-25 18:47:51 +02:00
Dennis Oelkers
3a051f3f54 Generate backend API types for frontend from maven run. (#11568)
* Writing swagger definition from maven run.

* Adding parameters to API generator.

* Generate API files.

* Write overview as well.

* Using classgraph.

* Adding first attempt to generate TS signatures from swagger defs.

* Starting to generate function stubs.

* Starting from api summary to generate defs.

* Cleanup, writing to files, using correct default path.

* Adding accept header information to `request` call.

* Adding import statement.

* Adding `request` stub.

* Moving swagger spec generation out of web profile.

* Generate single-quote string literals.

* Creating proper template string for routes.

* Rename conflicting overloaded function names.

* Map banned function names.

* Generate enum types as union types.

* Ordering function parameters by optionality.

* Supporting enum operation parameters.

* Using single quotes for string literals as paths.

* Support type aliases for named array types.

* Fixing up `Optional`s.

* Avoid generating banned models.

* Cleaning parameter names before usage.

* Generating `any` for `Response`, mapping `any` to `unknown`.

* Mapping more types, handling optional types better.

* Adding indexer signature if additional properties are present.

* Using variable name from `PathParam` annotation for parameter name if present.

* Properly handle inline object types.

* Map inline object models.

* Fixing some type issues.

* Removing type.

* Generate api package index.

* Quoting prop names if needed, making more props readonly.

* Wrap additional properties if they contain type literal.

* Fix boolean default values, ban more types, quote prop names starting with @.

* Handling optionals better.

* Adding task to generate api typedefs.

* Merge default value into allowed values for enum.

* Better merging of default values into enum, handling `long` types.

* Turning `request` into `__request__` to avoid clashes.

* Removing `Type` from banned models.

* Making script work with `ts-node`.

* Dissected frontend typing generator script into parser |> emitter.

* Adding tests.

* Fixing enum parsing.

* Adding/updating tests.

* Generating api specs through yarn task.

* Adding `@graylog/server-api` alias.

* Moving generator test to better place.

* Cleaning up `Generator`.

* Adding license headers.

* Assigning correct phases to frontend goals.

* Removing shebang from generator script.

* Extract types from `response` parameter of `ApiOperation` annotation.

* Suppressing `no-console` errors for scripts.

* Fixing linter hints.

* Using idempotent target directory specification.

* Handling arrays without any type definition.

* Using correct phases for types generation.

* Removing target directory before.

* Using unknown type as const.

* Fixing `request` helper.
2022-04-25 14:48:46 +02:00
Bernd Ahlers
9997546c29 Remove UI support for the GRAYLOG_API_URL environment variable (#12417)
The GRAYLOG_API_URL environment variable was used for two development
features:

- Configuring the proxy backend for the development web server
  (devServer.js)
- Configuring the backend URL for the user interface (AppConfig.ts)

The latter will break cookie authentication when GRAYLOG_API_URL is set
because the URL might point to a different host than the web interface.
That prevents the cookie to be used for requests to the backend due to
the same-origin policy.

This commit removes the handling of the environment variable in the UI.

The development web server proxy backend can still be configured using
the variable.
2022-04-08 08:46:23 +02:00
Dennis Oelkers
6a8994740f Updating to Webpack 5. (#11626)
* Updating to Webpack 5.

* Adding explicit dependency for `buffer`.

* Updating vendor module ids.

* Logging error when loading component async fails.

* Adding root directory of plugin as parameter to `PluginWebpackConfig`.

* Removing unused loaders.

* Revert "Removing unused loaders."

This reverts commit 7ec4d8e0717f0a3eb35c8db829fd91b4d7f8cb03.

* Slight updates of webpack packages.

* Disabling linter hints.

* Adjusting tests.

* Updating terser plugin, removing obsolete source map option.

* Fixing import order.

* Readding `HashedModuleIdsPlugin`.

* Updating yarn lockfile.

* Updating vendor module ids.

* Removing explicit loader references.
2021-12-02 12:11:53 +01:00
Dennis Oelkers
8d19d8cff5 Replacing (Action|Store|Combined)Provider with singleton. (#11424) 2021-10-07 07:09:25 -05:00
Edmundo Alvarez
52c126a5d7 Merge remote-tracking branch 'origin/master' into cloud-to-master 2021-05-04 15:00:27 +02:00
Edmundo Alvarez
5c0f0b8b22 Replace @babel/polyfill with core-js. (#10253) (#10451)
* Replacing `@babel/polyfill` with core-js.

* Including `core-js` in separate `polyfill` chunk.

* Adding license header.

Co-authored-by: Dennis Oelkers <dennis@graylog.com>
2021-04-26 09:03:35 +02:00
Dennis Oelkers
2e8de88a99 Replace @babel/polyfill with core-js. (#10253)
* Replacing `@babel/polyfill` with core-js.

* Including `core-js` in separate `polyfill` chunk.

* Adding license header.
2021-03-17 09:08:43 +01:00
Bernd Ahlers
294f2eb9d3 Make webpack /api proxy host and port configurable (#10202)
* Make webpack /api proxy host and port configurable

* Use a single "--api-url" parameter instead of two

That allows the usage of TLS enabled server backends.

* Use GRAYLOG_HTTP_PUBLISH_URI as apiUrl if set

* Rename env to GRAYLOG_API_URL

Keep backwards compat for old name and use case.

* Fix linter warning

* Fix linter warning
2021-03-05 15:07:34 +01:00
Dennis Oelkers
8075966461 Cleaning up packages, removing unused version pins. (#10107)
* Removing unused `babel-core` dependency, updating `babel-loader`.

* Replacing deprecated `babel-eslint` with `@babel/eslint-parser`, removing unneeded peer dependencies.

* Updating yarn lockfile.

* Removing unused `script-loader`.

* Removing unneeded version pinning for `ace-builds`.

* Removing unneeded version pinning for `upath`.

* Removing `phantomjs-prebuilt` - not needed anymore.

* Removing obsolete usage of `eslint-loader`.

* Removing obsolete usage of `extract-text-webpack-plugin`.

* Moving chroma types to `devDependencies`.
2021-02-23 12:03:05 +01:00
Gaya Kessler
7b0232f993 Import CSS modules as global to prevent rewriting classnames (#10026)
* import css modules as global

* revert to using css options generate
2021-02-08 15:47:02 +01:00
Gaya Kessler
1a44cce49d Update css-loader, less-loader, style-loader dependencies and configuration (#8875)
* updated dependencies

* fix import style

* fix less and style loader options

* remove icon font path

* ability to load eot

* add lazy loading capability

* support leaflet lazy

* use new style of importing lazy

* fix insertAt definitions

* add comment why

* ignore lazy loading files for normal css

* update how to import modules

* update importstyle leaflet

* update import style editwidget

* updated lock file

* fix webpack config for leaflet

* fix lazy loading in jest

* fix linting

* add no-alert exception to ignore

* fix flow module mapping

* update style-loader to latest

* update css-loader

* fix lazy loading jest module

* update requires to import

* set css module class transformation to be global
2021-02-05 10:33:14 +01:00
Othello Maurer
a6a5442399 Merge remote-tracking branch 'origin/4.0' into sync-cloud-4-0 2020-11-17 12:17:12 +01:00
Bernd Ahlers
29aa0ab4bd Change license to SSPL (#9505)
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
2020-11-16 18:42:14 +01:00
Bernd Ahlers
f35df42e16 Change license to SSPL (#9504)
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
2020-11-16 18:41:59 +01:00
Dennis Oelkers
821971b2f5 Only add ForkTsCheckerWebpackPlugin once. 2020-11-11 14:26:47 +01:00
Dennis Oelkers
a8e0ed0273 Adding transpile type checking to webpack. 2020-11-11 14:26:46 +01:00
Dennis Oelkers
2d3408d354 Adding .ts(x) to webpack. 2020-11-11 14:26:46 +01:00
Othello Maurer
30a53232b9 Expose isCloud to frontend (#9165)
* Expose `isCloud` to frontend

Still needs cleaning up and will probably fail if the cloud plugin is
not loaded.

* Don't use environment variable to transport value for isCloud

* new approach: don't use template but webpack define plugin instead

* Fix ESLint warnings

* Add "CLOUD" to dev badge also for narrow screens

* Add missing parentheses

* Remove extra space from badge

Co-authored-by: Gaya Kessler <gaya@theclevernode.com>

* Simplify expression

Co-authored-by: Gaya Kessler <gaya@theclevernode.com>

* Remove parentheses

Co-authored-by: Gaya Kessler <gaya@theclevernode.com>

Co-authored-by: Gaya Kessler <gaya@theclevernode.com>
(cherry picked from commit 608f1f7194)
2020-11-05 15:24:06 +01:00
Gaya Kessler
c620780645 Run analysers in production mode (#8979)
* make sure npm scripts which start with 'build' are built in production mode

* lint fix
2020-09-29 11:53:47 +02:00
dependabot-preview[bot]
34ceaaf26f Bump copy-webpack-plugin from 5.1.1 to 6.1.0 in /graylog2-web-interface (#8971) 2020-09-17 10:17:47 +00:00
Dennis Oelkers
c282447af6 Merge actual plugin webpack config into dev webpack config. 2020-08-19 13:24:41 +02:00
dependabot-preview[bot]
bb75b459a0 Bump html-webpack-plugin from 3.2.0 to 4.2.0 in /graylog2-web-interface/packages/graylog-web-plugin (#7862)
* Bump html-webpack-plugin

Bumps [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) from 3.2.0 to 4.2.0.
- [Release notes](https://github.com/jantimon/html-webpack-plugin/releases)
- [Changelog](https://github.com/jantimon/html-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jantimon/html-webpack-plugin/compare/v3.2.0...v4.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Updating html-webpack-plugin to 4.2.0

* Simplifying index.html template.

* Extracting and reusing chunk sorter.

* Removing `chunks` field and sorting based on filename.

* Updating yarn lockfile.

* Adapting checkProductionBuild.js as well.

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Dennis Oelkers <dennis@graylog.com>
2020-06-10 17:17:09 +02:00
Dennis Oelkers
1387303482 Removing remaining TypeScript code and dependencies. (#7904)
* Removing `SearchStore` and references.

* Removing typescript and tooling.

* Updating yarn lockfile.

* Updating yarn lockfile.

* Removing now unneeded mock.
2020-04-23 09:55:32 +02:00
Linus Pahl
89a7a02525 Reimplement opensans-npm-webfont and remove self hosted fonts (#7859)
* Disable esModule option for font related file-loader

* Reimplement opensans-npm-webfont

* Remove open sans font files and font-face definition

* Import only needed fonts from opensans-npm-webfont to optimize font-loading for older browsers
2020-04-09 10:39:38 -05:00
dependabot-preview[bot]
136df5a1ec Bump html-webpack-plugin from 3.2.0 to 4.0.2 in /graylog2-web-interface/packages/graylog-web-plugin (#7764)
* Bump html-webpack-plugin

Bumps [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) from 3.2.0 to 4.0.2.
- [Release notes](https://github.com/jantimon/html-webpack-plugin/releases)
- [Changelog](https://github.com/jantimon/html-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jantimon/html-webpack-plugin/compare/v3.2.0...v4.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump html-webpack-plugin

Bumps [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) from 3.2.0 to 4.0.2.
- [Release notes](https://github.com/jantimon/html-webpack-plugin/releases)
- [Changelog](https://github.com/jantimon/html-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jantimon/html-webpack-plugin/compare/v3.2.0...v4.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* yarn.lock

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Kyle Knight <kyle@graylog.com>
2020-03-30 09:33:38 +02:00
dependabot-preview[bot]
6d0e2c0f9d Bump url-loader from 1.1.2 to 4.0.0 in /graylog2-web-interface (#7706)
* Bump url-loader from 1.1.2 to 4.0.0 in /graylog2-web-interface

Bumps [url-loader](https://github.com/webpack-contrib/url-loader) from 1.1.2 to 4.0.0.
- [Release notes](https://github.com/webpack-contrib/url-loader/releases)
- [Changelog](https://github.com/webpack-contrib/url-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/url-loader/compare/v1.1.2...v4.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Update webpack.config

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Kyle Knight <kyle@graylog.com>
2020-03-26 16:37:38 +01:00
Linus Pahl
ff6a86a3f9 Allow bootstrap component style overwrite (#6594)
* Make bootstrap styling easier to overwrite by moving it's style tag at the top of the html head

* Remove not needed important in WidgetQueryControls

* Remove css specificity workaround for Button component

* Remove css important properties, which are no longer needed, due to new bootstrap style specificity

* Remove redundant buttonStyles file
2019-10-16 17:12:41 +02:00
Kyle Knight
3783d99c1c Themed Buttons (#6440)
* Themable Buttons

* ThemeProvider

Tracking webpack build issue

Update vendor manifest

Organize

btn theming

Themed Buttons

* todo

* Updated snapshot

* theme alias

* update snapshots

* Updating to latest code styles

* Fix webpack-resolver for jest-watch

* UserPreferencesButton test

* Fix Views Widget test
2019-09-30 10:14:10 +02:00
Dennis Oelkers
c8f7bb0f07 Passing FEATURES flag to production build too. (#6487) 2019-09-24 15:57:09 +02:00
Dennis Oelkers
b69b54b78e Allowing to enable (experimental) frontend features for development. (#6367)
This change is adding a simple way to enable frontend features for
development which are disabled per default. The change is two-fold:

  * Evaluating a `FEATURES` environment variable which contains a
comma-delimited string of feature names to enable
  * Adding a `AppConfig.isFeatureEnabled` function, which returns a
boolean indicating if the given feature is enabled or not. This can be
used in the code to conditionally render parts of the UI.

Notes:

The content of the `FEATURES` can contain multiple features separated by
commas. Additionally, individual feature flags are compared
case-insensitively, so `FEATURES=Time_Travel` will enable the
`time_travel` feature as well.

Example:

If a feature `time_travel` is developed but should not be enabled by
default, developers can do a `FEATURES=time_travel yarn run start` to
enable it for their development environment. In the code, something like
this can be done:

```
<div>
  {AppConfig.isFeatureEnabled('time_travel') && <TimeTravel />}
  ...
  {AppConfig.isFeatureEnabled('time_travel') || <OldBoringStuff />}
</div>
```
2019-08-29 11:11:13 +02:00
Kyle Knight
a009b89753 Replacing uglify with Terser for better ES6 support (#6219)
* Replacing uglify with Terser for better ES6 support

* lint

* Remove the unneeded disabled compress option
2019-07-31 10:27:47 +02:00
Bernd Ahlers
4998e37f96 Move web build and cache directory into target/ (#5853)
The "build" and "cache" directories are currently located in the project
root of plugins. This change moves them to the "target/web" directory.

That way we don't need any custom configuration to remove these
directories on "mvn clean" and they should also not be indexed by
IntelliJ and consume resources. (most developers exclude the "build" and
"cache" directories in IntelliJ for performance reasons)
2019-04-26 16:34:29 +02:00
Edmundo Alvarez
7d4fa09384 Enable source maps in production builds (#5530)
The `sourceMap` option should be passed to the `UglifyJsPlugin`
configuration:
https://webpack.js.org/plugins/uglifyjs-webpack-plugin/#sourcemap

Fixes #5528
2019-01-16 18:08:14 +01:00
Edmundo Alvarez
28993f9d51 Fix assets compression on production builds (#5527)
Due to a bug in uglify-js 3.4.9, compressing conditionals during asset
minimization is broken, leading to #5450.

This commit disables conditionals compression until we can test it is fixed
in a future uglify-js release.

There are several reports in the upstream project, one of them is:
https://github.com/mishoo/UglifyJS2/issues/3269

Fixes #5450
2019-01-16 17:24:52 +01:00
Marco Pfatschbacher
4b18bf92ea Use nicer local css style class names for development (#5320)
This makes it easier to grep for a certain style
in our code.

See https://github.com/webpack-contrib/css-loader#localidentname
2018-12-07 11:18:23 +01:00