Replace Snowpack with Vite (#2936)

This commit is contained in:
Jon Koops 2022-08-02 14:11:38 +02:00 committed by GitHub
parent d786e07b87
commit 9fffb87aa7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 688 additions and 10044 deletions

View file

@ -1,7 +1,7 @@
/** @type {import("eslint").Linter.Config } */
module.exports = {
root: true,
ignorePatterns: ["node_modules", "build", "keycloak-theme", "server"],
ignorePatterns: ["node_modules", "dist", "keycloak-theme", "server"],
parserOptions: {
project: "./tsconfig.eslint.json",
extraFileExtensions: [".mjs"],

150
.gitignore vendored
View file

@ -1,143 +1,35 @@
# Created by https://www.gitignore.io/api/node,react
# Edit at https://www.gitignore.io/?templates=node,react
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
node_modules
dist
dist-ssr
*.local
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Cypress
assets
**/cypress.env.json
cypress/downloads
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# Yarn lockfile
yarn.lock
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# rollup.js default build output
dist/
lib/
# Uncomment the public line if your project uses Gatsby
# https://nextjs.org/blog/next-9-1#public-directory-support
# https://create-react-app.dev/docs/using-the-public-folder/#docsNav
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# Temporary folders
tmp/
temp/
### react ###
.DS_*
**/*.backup.*
**/*.back.*
**/node_modules
*.sublime*
psd
thumb
sketch
# End of https://www.gitignore.io/api/node,react
# snowpack
.snowpack
build/
# server-install
server/
# VS Code #
###########
**/*.code-workspace
# Cypress #
###########
/assets
**/cypress.env.json
cypress/downloads/
# IntelliJ #
*.iml
.idea
# Keycloak server
server

View file

@ -44,12 +44,12 @@ You'll only have to run this command once, unless you remove the server director
### Running the development server
Now that the Keycloak sever is running it's time to run the development server for the Admin UI. This server is used to build the Admin UI in a manner that it can be iterated on quickly in a browser, using features such as [Hot Module Replacement (HMR) and Fast Refresh](https://www.snowpack.dev/concepts/hot-module-replacement).
Now that the Keycloak sever is running it's time to run the development server for the Admin UI. This server is used to build the Admin UI in a manner that it can be iterated on quickly in a browser, using features such as [Hot Module Replacement (HMR)](https://vitejs.dev/guide/features.html#hot-module-replacement) and [Fast Refresh](https://www.npmjs.com/package/react-refresh).
To start the development server run the following command:
```bash
npm run start
npm run dev
```
Once the process of optimization is done your browser will automatically open your local host on port `8080`. From here you will be redirected to the Keycloak server to authenticate, which you can do with the default username and password (`admin`).
@ -67,37 +67,6 @@ Every time you create a commit it should be automatically linted and formatted f
```bash
npm run lint
```
## Theming
It's possible to theme the Admin UI interface, this is useful if you want to apply your own branding so that the product looks familiar to your users. The Admin UI comes with two built-in themes called `keycloak` and `rh-sso`, by default the `keycloak` theme will be used when building the application.
This behavior can be changed by passing in a `THEME_NAME` environment variable, for example if wanted to build the application using the `rh-sso` theme we can do the following:
```bash
THEME_NAME=rh-sso npm run build
```
And likewise if we wanted to start a development server with this theme:
```
THEME_NAME=rh-sso npm run start
```
To make it simpler to build the `rh-sso` theme there are some shorthand NPM scripts available that you can run instead:
```bash
# Run a production build with the 'rh-sso' theme
npm run build:rh-sso
# Or for development
npm run start:rh-sso
```
### Creating your own theme
All themes are located in the `themes/` directory of the project, if you want to create a new theme you can create a new directory here and name it the same as your theme. Copy the files from the default theme here and customize them to your liking.
## Integration testing with Cypress
This repository contains integration tests developed with the [Cypress framework](https://www.cypress.io/).

View file

@ -5,5 +5,6 @@
"types": ["node", "cypress", "@testing-library/cypress", "@4tw/cypress-drag-drop"],
"module": "ES2015",
"target": "ES2015",
"useDefineForClassFields": false,
}
}

64
index.html Normal file
View file

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Web site to manage keycloak" />
<title>Keycloak Administration Console</title>
<style>
body, #app {
height: 100%;
}
.container,
.container-fluid,
#load-container {
padding: 0;
margin: 0;
}
.container,
.container-fluid,
#load-container {
width: 100vw;
}
.keycloak__loading-container {
height: 100vh;
width: 100%;
background-color: #f0f0f0;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin: 0;
}
#loading-text {
z-index: 1000;
font-size: 20px;
font-weight: 600;
padding-top: 32px;
}
</style>
</head>
<body>
<div id="app">
<div class="container container-fluid" id="load-container">
<div class="keycloak__loading-container">
<span class="pf-c-spinner pf-m-xl" role="progressbar" aria-valuetext="Loading...">
<span class="pf-c-spinner__clipper"></span>
<span class="pf-c-spinner__lead-ball"></span>
<span class="pf-c-spinner__tail-ball"></span>
</span>
<div>
<p id="loading-text">Loading the admin console</p>
</div>
</div>
</div>
</div>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module" src="/src/main.tsx"></script> </body>
</html>

View file

@ -162,7 +162,7 @@
<outputDirectory>target/classes/theme/keycloak.v2/admin/resources</outputDirectory>
<resources>
<resource>
<directory>../build</directory>
<directory>../dist</directory>
</resource>
</resources>
</configuration>
@ -200,18 +200,17 @@
<regex>false</regex>
<replacements>
<replacement>
<token>src="/</token>
<token>src="</token>
<value>src="${resourceUrl}/</value>
</replacement>
<replacement>
<token>href="/</token>
<token>href="</token>
<value>href="${resourceUrl}/</value>
</replacement>
<replacement>
<token><![CDATA[<body style="height: 100%;">]]></token>
<token><![CDATA[</body>]]></token>
<value xml:space="preserve">
<![CDATA[
<body style="height: 100%;">
<script id="environment" type="application/json">
{
"loginRealm": "${loginRealm!"master"}",
@ -225,6 +224,7 @@
"isRunningAsTheme": true
}
</script>
</body>
]]>
</value>
</replacement>

9965
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -12,11 +12,10 @@
"node": "^18"
},
"scripts": {
"build": "snowpack build",
"build:rh-sso": "THEME_NAME=rh-sso snowpack build",
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint . --ext js,jsx,mjs,ts,tsx",
"start": "snowpack dev",
"start:rh-sso": "THEME_NAME=rh-sso snowpack dev",
"test": "vitest",
"cy:open": "cypress open --e2e --browser chrome",
"cy:run": "cypress run --browser chrome",
@ -55,11 +54,6 @@
"@cypress/webpack-batteries-included-preprocessor": "^2.2.3",
"@cypress/webpack-preprocessor": "^5.12.0",
"@octokit/rest": "^19.0.1",
"@snowpack/app-scripts-react": "^2.0.1",
"@snowpack/plugin-postcss": "^1.4.3",
"@snowpack/plugin-react-refresh": "^2.5.0",
"@snowpack/plugin-typescript": "^1.2.1",
"@snowpack/plugin-webpack": "^3.0.0",
"@testing-library/cypress": "^8.0.3",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.5",
@ -73,7 +67,6 @@
"@types/react": "^17.0.45",
"@types/react-dom": "^17.0.16",
"@types/react-router-dom": "^5.3.3",
"@types/snowpack-env": "^2.3.4",
"@types/tar-fs": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
@ -93,16 +86,13 @@
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"node-fetch": "^3.2.10",
"postcss": "^8.4.14",
"postcss-import": "^14.1.0",
"postcss-svg": "^3.0.0",
"prettier": "^2.7.1",
"progress-promise": "^0.0.6",
"snowpack": "3.8.6",
"tar-fs": "^2.1.1",
"ts-node": "^10.9.1",
"typescript": "^4.7.4",
"vite": "^3.0.4",
"vite-plugin-checker": "^0.4.8",
"vitest": "^0.20.2",
"webpack": "^5.74.0"
},

View file

@ -1,6 +0,0 @@
const postImport = require("postcss-import");
const postcssSVG = require("postcss-svg");
module.exports = {
plugins: [postImport(), postcssSVG()],
};

63
public/favicon.svg Normal file
View file

@ -0,0 +1,63 @@
<svg id="Layer_1" data-name="Layer 1" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs id="defs10">
<clipPath id="clip-path">
<path class="cls-1" id="rect4" d="M-1018.62 565.7H862.62v1175.78h-1881.24z" />
</clipPath>
<clipPath id="clip-path-2">
<path class="cls-1" id="rect7" d="M0 0h512v512H0z" />
</clipPath>
<style id="style2">.cls-1{fill:none}.cls-24{fill:#d0d0d0}.cls-26{fill:#d9d9d9}.cls-28{fill:#d8d8d8}.cls-29{fill:#e2e2e2}.cls-31{fill:#dedede}.cls-36{fill:#00b8e3}.cls-37{fill:#33c6e9}.cls-38{fill:#008aaa}</style>
</defs>
<g clip-path="url(#clip-path)" id="g36" stroke-width="1.51">
<path d="M-42.82 358l245 24.8 199.4 2z" id="path14" fill="#b17c81" stroke="#b17c81" />
<path d="M-42.82 358l444.44 26.79 227.18-2z" id="path16" fill="#a2747c" stroke="#a2747c" />
<path d="M401.62 384.74l163.69 138.89 63.49-140.87z" id="path18" fill="#996976" stroke="#996976" />
<path d="M202.22 382.76l54.56 14.88 144.84-12.9z" id="path20" fill="#aa787e" stroke="#aa787e" />
<path d="M401.62 384.74L356 537.52l209.32-13.89z" id="path22" fill="#b2777e" stroke="#b2777e" />
<path d="M256.78 397.64L356 537.52l45.63-152.78z" id="path24" fill="#b27a7f" stroke="#b27a7f" />
<path d="M256.78 397.64l-92.26 135.91 191.47 4z" id="path26" fill="#c78485" stroke="#c78485" />
<path d="M202.22 382.76l-37.7 150.79 92.26-135.91z" id="path28" fill="#c08184" stroke="#c08184" />
<path d="M-42.82 358l207.34 175.55 37.7-150.79z" id="path30" fill="#c48485" stroke="#c48485" />
<path d="M-42.82 358l-51.59 137.9 258.93 37.7z" id="path32" fill="#d58b88" stroke="#d58b88" />
<path d="M-94.41 495.85L-33.89 598l198.41-64.48z" id="path34" fill="#e09790" stroke="#e09790" />
</g>
<g clip-path="url(#clip-path-2)" id="g110">
<path d="M438.48 152a3.79 3.79 0 01-3.32-1.89L377.39 49.94a3.91 3.91 0 00-3.39-1.89H138.33a3.79 3.79 0 00-3.33 1.89L75 153.89l-55.83 100.2a3.88 3.88 0 000 3.82L75 358l60 104a3.79 3.79 0 003.32 1.89H374a3.91 3.91 0 003.36-1.89l57.84-100.1a3.79 3.79 0 013.32-1.89h71.93a4.32 4.32 0 004.32-4.32V156.32a4.32 4.32 0 00-4.32-4.32h-72z" id="path38" fill="#4d4d4d" />
<path d="M72.85 157.64l-55.191 98.369 5.871 12.931 54.845 89.592L114.19 360l287.27-.02H461l38.264-9.68 15.496-42.81.01-49.36v-45.72L510.46 152h-71.98l-22.11.01H147.94l-75.09 5.63" id="path27674" fill="#e2e2e2" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-opacity="1" fill-opacity="1" />
<path class="cls-1" d="M510.46 152H78.34a3.91 3.91 0 00-3.34 1.89v.07l-2.14 3.69-26.45 45.83-29.23 50.63a3.8 3.8 0 000 3.83l6.35 11L75 358.06a3.84 3.84 0 003.34 1.94h432.18a4.27 4.27 0 004.24-4.28V156.34a4.32 4.32 0 00-4.3-4.34z" id="path40" />
<path d="M88.1 245.5l-64.57 23.44-6.35-11a3.8 3.8 0 010-3.83l29.23-50.63z" id="path42" fill="#e1e1e1" />
<path id="polygon44" fill="#c8c8c8" d="M472.21 264.21l42.56-6.08v49.36l-42.56-43.28z" />
<path d="M472.21 264.21l42.55 43.28v48.21a4.27 4.27 0 01-4.24 4.28H461z" id="path46" fill="#c2c2c2" />
<path id="polygon48" fill="#c7c7c7" d="M472.21 264.21L461 359.98h-59.54l-18.04-43.45 88.79-52.32z" />
<path id="polygon50" fill="#cecece" d="M472.21 264.21l42.56-51.8v45.72l-42.56 6.08z" />
<path d="M514.77 156.33v56.08l-42.55 51.8L440.12 152h70.33a4.32 4.32 0 014.32 4.33z" id="path52" fill="#d3d3d3" />
<path id="polygon54" fill="#c6c6c6" d="M401.46 359.98h-31.4l-8.14-11.67 21.5-31.78 18.04 43.45z" />
<path id="polygon56" fill="#d5d5d5" d="M472.21 264.21l-117.79-49.79 61.95-62.41h23.75l32.09 112.2z" />
<path class="cls-24" d="M354.42 214.42l29 102.11 88.8-52.32z" id="path58" />
<path id="polygon60" fill="#bfbfbf" d="M370.06 359.98h-8.52l.38-11.67 8.14 11.67z" />
<path class="cls-26" id="polygon62" d="M416.37 152.01l-61.95 62.41-11.18-55.82 23.92-6.59h49.21z" />
<path d="M354.42 214.42l-143 33 150.5 100.89z" id="path64" fill="#d4d4d4" />
<path class="cls-24" d="M354.42 214.42l7.49 133.9 21.5-31.78z" id="path66" />
<path class="cls-26" d="M343.24 158.6l-131.77 88.79 143-33z" id="path68" />
<path class="cls-28" id="polygon70" d="M211.47 247.39L149.5 359.98h-35.31L88.1 245.5l123.37 1.89z" />
<path class="cls-29" d="M147.94 152L88.1 245.5l-15.25-87.86 2.15-3.7v-.07a3.91 3.91 0 013.33-1.87h69.61z" id="path72" />
<path class="cls-28" d="M114.19 360H78.33a3.84 3.84 0 01-3.33-2l-51.47-89.06L88.1 245.5z" id="path74" />
<path id="polygon76" fill="#e4e4e4" d="M46.41 203.47l26.44-45.83L88.1 245.5z" />
<path class="cls-31" id="polygon78" d="M276.77 152.01H172.39l39.08 95.38 131.77-88.79-39.72-6.59h-26.75z" />
<path class="cls-31" id="polygon80" d="M156.09 152.01h-8.15L88.1 245.5l123.37 1.89-39.08-95.38h-16.3z" />
<path id="polygon82" fill="#c5c5c5" d="M333.23 359.98h28.31l.38-11.67-28.69 11.67z" />
<path class="cls-24" id="polygon84" d="M361.92 348.31L211.47 247.39l27.1 112.59h94.66l28.69-11.67z" />
<path id="polygon86" fill="#d1d1d1" d="M149.5 359.98H238.57l-27.1-112.59-61.97 112.59z" />
<path id="polygon88" fill="#ddd" d="M343.65 152.01l-.41 6.59 23.92-6.59H343.65z" />
<path id="polygon90" fill="#e3e3e3" d="M303.52 152.01l39.72 6.59-3.66-6.59h-36.06z" />
<path class="cls-29" id="polygon92" d="M339.58 152.01l3.66 6.59.41-6.59h-4.07z" />
<path class="cls-36" d="M235.15 153.81L177 254.46a3.38 3.38 0 00-.42 1.64h-40.51l79.74-138.18a3.14 3.14 0 011.19 1.15l.11.11 18.08 31.41a3.49 3.49 0 01-.04 3.22z" id="path94" />
<path class="cls-37" d="M235.08 361.89l-18 31.27a3.51 3.51 0 01-1.22 1.15L136 256.14h40.6a3.09 3.09 0 00.38 1.57.37.37 0 00.07.17l58 100.58a3.41 3.41 0 01.03 3.43z" id="path96" />
<path class="cls-38" d="M215.81 117.92L136.07 256.1l-20 34.66-19.1-33.12a3.09 3.09 0 01-.38-1.57 3.38 3.38 0 01.42-1.64l19.3-33.43 58.75-101.74a3.4 3.4 0 013-1.75h36.04a3.58 3.58 0 011.71.41z" id="path98" />
<path class="cls-36" d="M215.81 394.31a3.58 3.58 0 01-1.71.45H178a3.4 3.4 0 01-3-1.75l-53.72-93-5.28-9.22 20-34.66z" id="path100" />
<path class="cls-38" d="M376.19 256.1l-79.8 138.21a3.73 3.73 0 01-1.19-1.15l-.07-.1L277 361.72a3.49 3.49 0 010-3.22l58.06-100.65a3.38 3.38 0 00.49-1.75h40.57z" id="path102" />
<path class="cls-36" d="M415.68 256.1a3.38 3.38 0 01-.49 1.75l-78.13 135.31a3.42 3.42 0 01-2.9 1.61h-36a3.72 3.72 0 01-1.75-.45l79.78-138.22 20-34.62 19 32.91a3.35 3.35 0 01.49 1.71z" id="path104" />
<path class="cls-36" d="M376.19 256.1h-40.56a3.35 3.35 0 00-.49-1.71l-58-100.55a3.41 3.41 0 010-3.46l18.08-31.3a3.73 3.73 0 011.19-1.15z" id="path106" />
<path class="cls-37" d="M396.2 221.44l-20 34.62-79.81-138.14a3.72 3.72 0 011.75-.45h36a3.42 3.42 0 012.9 1.61z" id="path108" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.6 KiB

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

@ -1,55 +0,0 @@
import proxy from "http2-proxy";
import path from "node:path";
const themeName = process.env.THEME_NAME ?? "keycloak";
const themePath = path.join("themes", themeName);
/** @type {import("snowpack").SnowpackUserConfig } */
export default {
mount: {
[themePath]: { url: "/", static: true },
public: { url: "/", static: true },
src: { url: "/" },
"node_modules/@patternfly/patternfly/assets/fonts": {
url: "/assets/fonts",
static: true,
},
"node_modules/@patternfly/patternfly/assets/pficon": {
url: "/assets/pficon",
static: true,
},
"node_modules/@patternfly/patternfly/assets/images": {
url: "/assets/images",
static: true,
},
},
plugins: [
"@snowpack/plugin-postcss",
[
"@snowpack/plugin-webpack",
{
outputPattern: {
css: "[name].[contenthash].css",
},
extendConfig: {
output: { publicPath: "auto", path: path.resolve(".", "build") },
},
},
],
"@snowpack/plugin-react-refresh",
"@snowpack/plugin-typescript",
],
routes: [
{
src: "/admin/.*",
dest: (req, res) =>
proxy.web(req, res, {
hostname: "localhost",
port: 8180,
}),
},
],
devOptions: {
hmrErrorOverlay: false,
},
};

View file

@ -1,6 +1,3 @@
@import "@patternfly/patternfly/patternfly.min.css";
@import "@patternfly/patternfly/patternfly-addons.css";
img.keycloak__pageheader_brand {
height: 35px;
}

View file

@ -1,3 +1,6 @@
import "@patternfly/patternfly/patternfly-addons.css";
import "@patternfly/react-core/dist/styles/base.css";
import React, { StrictMode } from "react";
import ReactDOM from "react-dom";
@ -7,12 +10,6 @@ import { initI18n } from "./i18n";
import "./index.css";
// Hot Module Replacement (HMR) - Remove this snippet to remove HMR.
// Learn more: https://snowpack.dev/concepts/hot-module-replacement
if (import.meta.hot) {
import.meta.hot.accept();
}
async function initialize() {
const { keycloak, adminClient } = await initAdminClient();

1
src/vite-env.d.ts vendored Normal file
View file

@ -0,0 +1 @@
/// <reference types="vite/client" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 B

View file

@ -1,75 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link id="favicon" rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Web site to manage keycloak" />
<title>Keycloak Administration Console</title>
<style>
.container,
.container-fluid,
#load-container {
padding: 0;
margin: 0;
}
.container,
.container-fluid,
#load-container {
width: 100vw;
}
.keycloak__loading-container {
height: 100vh;
width: 100%;
background-color: #f0f0f0;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin: 0;
}
#loading-text {
z-index: 1000;
font-size: 20px;
font-weight: 600;
padding-top: 32px;
}
</style>
</head>
<body style="height: 100%;">
<div id="app" style="height: 100%">
<div class="container container-fluid" id="load-container">
<div class="keycloak__loading-container">
<span class="pf-c-spinner pf-m-xl" role="progressbar" aria-valuetext="Loading...">
<span class="pf-c-spinner__clipper"></span>
<span class="pf-c-spinner__lead-ball"></span>
<span class="pf-c-spinner__tail-ball"></span>
</span>
<div>
<p id="loading-text">Loading the admin console</p>
</div>
</div>
</div>
</div>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module" src="/index.js"></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
-->
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -1,85 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link id="favicon" rel="icon" href="./favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Web site to manage Red Hat Single Sign-On" />
<title>Red Hat Single Sign-On Administration Console</title>
<style>
.container,
.container-fluid,
#load-container {
padding: 0;
margin: 0;
}
.container,
.container-fluid,
#load-container {
width: 100vw;
}
.keycloak__loading-container {
height: 100vh;
width: 100%;
background-color: #f0f0f0;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin: 0;
}
#loading-text {
z-index: 1000;
font-size: 20px;
font-weight: 600;
padding-top: 32px;
}
/* Theme specific styling */
.keycloak__pageheader_brand {
height: 16px;
}
body {
--pf-global--primary-color--100: red;
--pf-global--active-color--400: darkred;
}
</style>
</head>
<body style="height: 100%;">
<div id="app" style="height: 100%">
<div class="container container-fluid" id="load-container">
<div class="keycloak__loading-container">
<span class="pf-c-spinner pf-m-xl" role="progressbar" aria-valuetext="Loading...">
<span class="pf-c-spinner__clipper"></span>
<span class="pf-c-spinner__lead-ball"></span>
<span class="pf-c-spinner__tail-ball"></span>
</span>
<div>
<p id="loading-text">Loading the admin console</p>
</div>
</div>
</div>
</div>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module" src="index.js"></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
-->
</body>
</html>

View file

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 223.4 12.5" style="enable-background:new 0 0 223.4 12.5;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;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1,0.2,0.3,0.5,0.5,0.7
c0.2,0.3,0.3,0.5,0.4,0.6c0-0.1,0-0.3,0-0.5c0-0.2,0-0.5,0-0.7c0-0.3,0-0.5,0-0.8c0-0.3,0-0.5,0-0.6V0.2h2.4v12.1H221.2z"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 8.2 KiB

View file

@ -3,7 +3,7 @@
"include": ["**/*", ".eslintrc.js"],
"exclude": [
"node_modules",
"build",
"dist",
"keycloak-theme",
"server"
]

View file

@ -1,12 +1,26 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"baseUrl": "./",
},
"include": ["src"],
"exclude": [
"**/*.test.ts",
"**/*.test.tsx"
],
"extends": "@snowpack/app-scripts-react/tsconfig.base.json",
"compilerOptions": {
"types": ["snowpack-env"],
"esModuleInterop": true
}
}
"references": [{ "path": "./tsconfig.node.json" }]
}

8
tsconfig.node.json Normal file
View file

@ -0,0 +1,8 @@
{
"compilerOptions": {
"composite": true,
"module": "esnext",
"moduleResolution": "node"
},
"include": ["vite.config.ts"]
}

36
types/static.d.ts vendored
View file

@ -1,36 +0,0 @@
/* Use this file to declare any custom file extensions for importing */
/* Use this folder to also add/extend a package d.ts file, if needed. */
declare module "*.css";
declare module "*.svg" {
const ref: string;
export default ref;
}
declare module "*.bmp" {
const ref: string;
export default ref;
}
declare module "*.gif" {
const ref: string;
export default ref;
}
declare module "*.jpg" {
const ref: string;
export default ref;
}
declare module "*.jpeg" {
const ref: string;
export default ref;
}
declare module "*.png" {
const ref: string;
export default ref;
}
declare module "*.webp" {
const ref: string;
export default ref;
}
declare module "*.json" {
const value: any;
export default value;
}

View file

@ -1,13 +1,28 @@
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
import checker from "vite-plugin-checker";
// https://vitejs.dev/config/
export default defineConfig({
base: "",
server: {
port: 8080,
},
resolve: {
// Resolve the 'module' entrypoint at all times (not the default due to Node.js compatibility issues).
mainFields: ["module"],
},
plugins: [react({ jsxRuntime: "classic" })],
optimizeDeps: {
// Enable optimization of dependencies using esbuild (see https://vitejs.dev/guide/migration.html#using-esbuild-deps-optimization-at-build-time).
disabled: false,
},
build: {
commonjsOptions: {
// Ensure `@rollup/plugin-commonjs` is not loaded, using esbuild instead (see https://vitejs.dev/guide/migration.html#using-esbuild-deps-optimization-at-build-time).
include: [],
},
},
plugins: [react({ jsxRuntime: "classic" }), checker({ typescript: true })],
test: {
setupFiles: "vitest.setup.ts",
watch: false,