diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-04-06 15:35:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-06 15:35:09 +0200 |
| commit | 0d4f19003324e196fffae3f252786e30197dfa4c (patch) | |
| tree | 08ba4eb3b0e067ae933c636ca3967c45058fd69f /opendc-web/opendc-web-ui/next.config.js | |
| parent | af87540d49d58c465f0847c016814d58cfeb44fc (diff) | |
| parent | 9f0b7ddd0d62e4dc43a69ea8fafd06be1a663f9f (diff) | |
merge: Integrate UI into Quarkus web application (#69)
This pull request adds a Quarkus extension that integrates with the existing Quarkus web application to provide access to the OpenDC web UI. The benefit of this approach is that in this way, OpenDC can be distributed as a single JVM application to the user, which can host its own web UI directly.
Furthermore, this pull request also adds support for unauthenticated access to the API when accessing in dev mode, so that users do not have to setup Auth0 in order to use OpenDC locally.
## Implementation Notes :hammer_and_pick:
* Do not use next/image
* Migrate to next-global-css
* Update PatternFly to latest version
* Add Gradle integration with Next.js project
* Build web UI via Gradle
* Support building WebJar for OpenDC web UI
* Add extension for serving OpenDC web UI
* Include web UI in development mode
* Add workaround for Quarkus Gradle build issues
* Add support for unauthenticated user access
## External Dependencies :four_leaf_clover:
* [node-gradle](https://github.com/node-gradle/gradle-node-plugin)
Diffstat (limited to 'opendc-web/opendc-web-ui/next.config.js')
| -rw-r--r-- | opendc-web/opendc-web-ui/next.config.js | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/opendc-web/opendc-web-ui/next.config.js b/opendc-web/opendc-web-ui/next.config.js index 1dfe4156..d8029108 100644 --- a/opendc-web/opendc-web-ui/next.config.js +++ b/opendc-web/opendc-web-ui/next.config.js @@ -22,39 +22,24 @@ // PatternFly 4 uses global CSS imports in its distribution files. Therefore, // we need to transpile the modules before we can use them. -const withTM = require('next-transpile-modules')([ - '@patternfly/react-core', - '@patternfly/react-styles', - '@patternfly/react-table', - '@patternfly/react-tokens', -]) +const { withGlobalCss } = require('next-global-css') +const { PHASE_DEVELOPMENT_SERVER } = require("next/constants"); +const withConfig = withGlobalCss() -module.exports = withTM({ +module.exports = (phase) => withConfig({ + basePath: process.env.NEXT_BASE_PATH && '/' + process.env.NEXT_BASE_PATH, reactStrictMode: true, experimental: { - eslint: true, + eslint: true }, + distDir: phase === PHASE_DEVELOPMENT_SERVER ? 'build/next-dev' : 'build/next', async redirects() { return [ { source: '/', destination: '/projects', - permanent: true, - }, - ] - }, - webpack: (config, options) => { - if (options.dev) { - config.optimization.splitChunks = { - cacheGroups: { - vendor: { - test: /[\\/]node_modules[\\/]/, - name: 'transpiled-modules', - chunks: 'all', - }, - }, + permanent: true } - } - return config + ] } }) |
