Commit Graph

21 Commits

Author SHA1 Message Date
Dennis Oelkers
aa3a0fa986 Removing obsolete options from TS config file, fix invalid imports. (#24726) 2026-01-15 09:25:51 +01:00
Dennis Oelkers
191b514557 Pinning typescript to 5.5.2 and fixing type fallout. (#19722)
* Pinning `typescript` to `5.5.2` and fixing type fallout.

* Fixing up test.

* Fixing linter hint.
2024-06-25 10:29:25 +02:00
Dennis Oelkers
eec36ab626 Pin @types/react version across the project. (#12942)
Prior to this change, we depended on the `@types/react` version being pulled in implicitly. This results in the version depending on the set of other dependencies and can change through a dependency update. In order to avoid this, this change is now adding an explicit dependency to it, pinning it to the most recent `17.x` version. Although we are on `16.x`, this is the version which matches our expected typings the most.
2022-06-29 14:51:37 +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
Dennis Oelkers
f7db951db3 Enable noUnusedParameters and noUncheckedIndexedAccess for TypeScript. (#12176)
* Enable `noUnusedParameters` and `noUncheckedIndexedAccess` for TypeScript.

This change is making the TypeScript config gradually stricter by
enabling:

  - [noUnusedParameters](https://www.typescriptlang.org/tsconfig#noUnusedParameters)
  - [noUncheckedIndexedAccess](https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess)

and fixing the resulting fallout.

* Prefixing unused parameters.

* Adding name hint to ignored parameters.
2022-04-14 09:57:15 +02:00
Dennis Oelkers
894e31f524 Use stricter settings in TypeScript config. (#10901)
* Add missing import.

* Check if value is not number and has key.

* Enabling `noImplicitThis`.

* Enable `strictBindCallApply`.

* Enable `noFallthroughCasesInSwitch` & `noImplicitReturns`.

* Enabling `noUncheckedIndexedAccess`.

* Removing unused imports/variables, enabling `noUnusedLocals`.

* Adding `@types` packages for `numeral` and `react-router`.

* Adding `react-bootstrap` types.

* Adding types for `ua-parser-js`.

* Adding types for `md5`.

* Adding types for `clipboard`.

* Adding types for `react-window`.

* Adding types for `enzyme-adapter-react-16`.

* Updating yarn lockfile due to rebase.
2021-06-29 15:25:48 +02:00
Dennis Oelkers
70a13a3f09 Migrating test directory to TypeScript. (#9583)
* Renaming `authenticationBackends`.

* Migrating `authenticationBackends`.

* Treating polymorphic config structure as `unknown`.

* Renaming `entityShareState`.

* Migrating `entityShareState`.

* Renaming `fields`.

* Renaming `permissions`.

* Migrating `permissions`.

* Renaming `roles`.

* Renaming `sharedEntities`.

* Renaming `userOverviews`.

* Renaming `users`.

* Migrating `users`.

* Adding `test` dir to roots.

* Renaming `AsMock`.

* Migrating `asMock`, fixing fallout.

* Renaming `MockAction`.

* Migrating `MockAction`.

* Fixing fallout from typing `mockAction`.

* Renaming `StoreMock`.

* Migrating `StoreMock`.

* Renaming `suppressConsole`.

* Migrating `suppressConsole`.

* Renaming `wrappedEnzyme`.

* Migrating `wrappedEnzyme`.

* Renaming `wrappedTestingLibrary`.

* Migrating `wrappedTestingLibrary`.

* Fixing linter hints.
2020-11-23 16:42:14 +01:00
Dennis Oelkers
bfe7f9e721 Enable Downlevel Iteration for TypeScript. (#9552)
This change is adding the `downlevelIteration` compiler flag, which
enables us to treat objects implementing the iterator interface as
arrays. A common use case is e.g.:

```
const dedup = [...new Set(23, 42, 17, 23)];
```
2020-11-19 14:00:37 +01:00
Dennis Oelkers
2b29a6013e Include files from test in lookup scope as well. 2020-11-17 11:58:55 +01:00
Dennis Oelkers
e7f3c66ecb Disabling allowJs for the start. 2020-11-11 16:19:10 +01:00
Dennis Oelkers
dee7f79574 Removing trailing , 2020-11-11 14:26:46 +01:00
Dennis Oelkers
2ea3d3e8bd Disabling strict for now, adding paths for module resolution. 2020-11-11 14:26:46 +01:00
Dennis Oelkers
c5ffce07fe Adding basic TS config. 2020-11-11 14:26:46 +01: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
Dennis Oelkers
5d0aa5dc60 Re-enable code splitting, add tree shaking for webpack. (#7598)
* Enable generating true ES6 modules.

* Fixup changed default exports.

* Fixing linter hints.
2020-03-02 10:59:10 -06:00
Dennis Oelkers
a00034c355 Cleaning up unused frontend code from previous search. (#7338)
* Removing (Stream)SearchPage and references.

* Removing `NoSearchResults`.

* Removing `MalformedSearchQuery`.

* Removing `QueryInput`.

* Removing `SearchExecutionError`.

* Removing `RefreshControls`.

* Removing `AddSearchCountToDashboard`.

* Removing `AddDecoratorButton`.

* Removing `ChangedMessageField`.

* Removing `DecoratedMessageFieldMarker`.

* Removing `DecoratedSidebarMessageField`.

* Removing `Decorator`.

* Removing `DecoratorList`.

* Removing `DecoratorSidebar`.

* Removing `FieldAnalyzersSidebar`.

* Removing `LegacyHistogram`.

* Removing `MessageFieldDescription`.

* Removing `MessageField`.

* Removing `MessageFieldSearchActions`.

* Removing `MessageTablePaginator`.

* Removing `ResultTable`.

* Removing `SavedSearchControls`.

* Removing `SearchResult`.

* Removing `SearchSidebar`.

* Removing `ShowQueryModal`.

* Removing `SidebarMessageField`.

* Removing `AppWithSearchbar`.

* Removing `SearchBar`.

* Removing css for `ChangedMessageField`.

* Removing css for decorator components.

* Removing css for `NoSearchResult` component.

* Removing css for `SidebarMessageField` component.

* Removing `GracePeriodInput` component.

* Removing `FieldGraphs` component.

* Removing `LegacyFieldGraph` component.

* Removing `FieldQuickValues` component.

* Removing css for `FieldQuickValues` component.

* Removing now unused widget references.

* Removing `FieldStatistics` component.

* Removing `FieldAnalyzerMapComponent` component.

* Removing `field-analyzers` directory.

* Removing `result-histogram` module.

* Removing `AlertsAnnotator` module.

* Removing `queryParser` and dependencies.

* Removing `FileSaver` module.

* Removing `MapsStore` module.

* Removing `FieldHistogramTransformer` module.

* Removing `AddToDashboardMenu` component.

* Removing `DashboardsPage` component.

* Removing `DashboardListPage` component.

* Removing `DashboardList` component.

* Removing `Dashboard` component.

* Removing `EditDashboardModal` component.

* Removing `ShowDashboardPage` component.

* Removing `EditDashboardModalTrigger` component.

* Removing `widgets` directory.

* Removing `fieldcharts` module.

* Removing components from package index.

* Removing `FieldGraphsStore`.

* Removing `FieldQuickValuesStore`.

* Removing `FieldStatisticsStore`.

* Using Plotly in `TrafficGraph`.

* Removing legacy visualizations.

* Removing legacy map visualization, moving css into place.

* Removing `SavedSearchesStore`.

* Removing rickshaw residues.

* Removing `HistogramDataStore`.

* Removing `graphHelper` module.

* Removing leftover world countries file.

* Adapting `DelegatedSearchPage` test.

* Adapting `MessageList` test.

* Adapting `AppRouter` test.

* Revert "Removing `MessageField`."

This reverts commit 091444c87d6a35f53f756302473e73885e780936.

* Revert "Removing `MessageFieldDescription`."

This reverts commit 48ada8cec56ef50c7761bfc8e86631181fd410d0.

* Revert "Removing `MessageFieldSearchActions`."

This reverts commit 74be4e25ba9b94d2be02da777df5f148d941519c.

* Updating snapshots.

* Removing `SourcesStore`.

* Removing `WidgetsStore`.

* Removing `DashboardsStore`.

* Removing `HistogramFormatter`.

* Removing `FieldsStore`.

* Removing `MessageFieldsStore`.

* Removing `MessageCountsStore`.

* Removing `RefreshStore`.

* Removing `FocusStore`.

* Removing `D3Utils` module.

* Removing `MomentUtils` module.

* Removing `SearchUtils` module.

* Removing `DashboardWidgetHeader` component.

* Removing duplicate `contrastingColor` module.

* Removing `WidgetFilterMenu` component.

* Removing `StaticMessageList` css.

* Removing `AggregationConfigGenerator` module.

* Removing `DebugHandler` component.

* Including "node" types for TS automatically.

This is required now that the `WidgetsStore` which was importing node
types through a comment was removed. Instead of importing the types in
the `SearchStore` through a comment again, this change is now adding the
`node` types explicitly to the TS config files.

* Disabling linter hint.

* Adding flow stub for crossfilter.

* Disabling linter warning for now.
2020-02-07 11:00:13 +01:00
Dennis Oelkers
d3fe740197 Fix the way TypeScript loads type definitions. (#4642)
* Fix the way TypeScript loads type definitions.

Before this change, ts-loader/tsc just included the node types
explicitly. This lead to problems with duplicate inclusions for plugins
which transitively depend on typings.

This PR changes this behavior to the more standard one of defining which
types to include instead of including the types file explicitly.

* Removing explicit inclusion of node type, leaving that to consumers.

With this change, the node type is not explicitly included in ts. It is
left to the components using node functions to include them. This allows
us to make it work for:

  a) compilations of projects with @types/node installed
  b) compilations of projects without @types/node.

For the latter, the inclusion of a reference path for the `WidgetsStore`
with a relative reference allows the compiler to find the @types/node
package of the graylog2-web-interface module.

* Removing all type inclusion per default.
2018-03-09 18:04:18 +01:00
Dennis Oelkers
80ca3020c2 Updating web dependencies. (#4037)
* Updating web dependencies.

* Removing old typescript declarations.

* Removing now unused ecmaFeatures from ESLint config.

* Adding typings for globally available node functions.

* Explicitly including ts files (implicitly including others) and node definitions.

* Updating vendor module ids.
2017-08-28 14:02:23 +02:00
Kay Roepke
4e75a2145d move files to web-interface 2015-12-04 13:34:00 +01:00