a9398c92ce
* Web: Detangling some circular dependencies in Admin and User Admin, User, and Flow should not dependend upon each other, at least not in a circular way. If Admin and User depend on Flow, that's fine, but Flow should not correspondingly depend upon elements of either; if they have something in common, let's put them in `@goauthentik/common` or find some other smart place to store them. This commit refactors the intentToLabel and actionToLabel functions into `@goauthentik/common/labels` and converts them to static tables for maintenance purposes. * web: "Consistency is the hobgoblin of small minds" - Ralph Waldo Emerson * web: I found these confusing to look at, so I added comments. * web: remove admin-to-user component reference(s) There was only one: AppIcon. This has been moved to `components`. Touching the LibraryApplications page triggered a cyclomatic complexity check. Extracting the expansion block and streamlining the class and style declarations with lit directives helped. * web: remove admin from elements This commit removes the two references from `elements` to `admin`: the list of UserEvents and a reference to the FlowSearch type, used by the Forms manager to decide how to extract a value. For FlowSearch, a different convention for detecting the type was implemented (instances of the object have a unique fieldname for the value holder). UserEvents and ObjectChangelog have been moved to `components` as they're clearly dependent upon the API. This defers work on removing Admin from Components, as that is (again) references going the wrong way, but that can happen later. * web: remove admin-to-user component reference(s) (#6856) There was only one: AppIcon. This has been moved to `components`. Touching the LibraryApplications page triggered a cyclomatic complexity check. Extracting the expansion block and streamlining the class and style declarations with lit directives helped. * This was supposed to be merged. * web: remove `./element`⇢`./user` references The offender here is UserDevicesList, which despite being in `elements` is only used by the admin/user/UserViewPage. The problem is that UserDevicesList, despite being in `admin`, inherits from `user`, so moving it would have created a new admin⇢user reference, and the whole point of this exercise is to get rid of references that point "up" from the foundational pieces to the views, or that refer to components in sibling applications. After examining UserDevicesList, I realized that *every feature* of MFADevicesList had been overridden: the rows, the columns, the toolbar, and the endpoint all had custom overrides. Nothing was left of MFADevicesList after that. Even the property that the web component used had been completely changed. The only thing they had in common was that they both inherited from `Table<Device>`. Refactoring UserDevicesList so that it inherited directly from `Table<Device>` and then moving it into `./admin/users` was the obvious and correct step. Both used the same label table, so that went into the `common/labels` folder. Along the way, I cleaned up a few minor details. Just little things, like the repeated invocation of: ``` new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorAdminMETHODDestroy({ id: device.pk }); ``` This is repeated five times, once for each Method. By creating these: ``` const api = new AuthenticatorsApi(DEFAULT_CONFIG); const id = { id: device.pk }; ``` The method invocation could be just `api.authenticatorsMETHODDestroy(id)`, which is easier on the eyes. See the MFADevicesPage for the full example. Similarly, ``` return [ new TableColumn(msg("Name"), ""), new TableColumn(msg("Type"), ""), new TableColumn("") ]; ``` is more straightforward as: ``` const headers = [msg("Name"), msg("Type"), ""]; return headers.map((th) => new TableColumn(th, "")); ``` We've labeled what we're working with, and web developers ought to know that `th` is the HTML code for `table header`. I've had to alter what files are scanned in pre-commit mode; it doesn't handle renamed files very well, and at the moment a file that is renamed is not scanned, as its "new" name is not straightforwardly displayed, not even by `git porcelain`. * web: make the table of column headers look like a table * web: build failure thanks to local cache; fixed * Update web/src/common/labels.ts Co-authored-by: Jens L. <jens@goauthentik.io> Signed-off-by: Ken Sternberg <133134217+kensternberg-authentik@users.noreply.github.com> --------- Signed-off-by: Ken Sternberg <133134217+kensternberg-authentik@users.noreply.github.com> Co-authored-by: Jens L. <jens@goauthentik.io>
126 lines
5.4 KiB
JSON
126 lines
5.4 KiB
JSON
{
|
|
"name": "@goauthentik/web",
|
|
"version": "0.0.0",
|
|
"private": true,
|
|
"license": "MIT",
|
|
"scripts": {
|
|
"extract-locales": "lit-localize extract",
|
|
"build-locales": "run-s build-locales:build",
|
|
"build-locales:build": "lit-localize build",
|
|
"build-locales:repair": "prettier --write ./src/locale-codes.ts",
|
|
"rollup:build": "cross-env NODE_OPTIONS='--max_old_space_size=4096' rollup -c ./rollup.config.mjs",
|
|
"rollup:build-proxy": "cross-env NODE_OPTIONS='--max_old_space_size=4096' rollup -c ./rollup.proxy.mjs",
|
|
"rollup:watch": "cross-env NODE_OPTIONS='--max_old_space_size=4096' rollup -c -w",
|
|
"build": "run-s build-locales rollup:build",
|
|
"build-proxy": "run-s build-locales rollup:build-proxy",
|
|
"watch": "run-s build-locales rollup:watch",
|
|
"lint": "eslint . --max-warnings 0 --fix",
|
|
"lint:precommit": "eslint --max-warnings 0 --config ./.eslintrc.precommit.json $(git status --porcelain | grep '^[M?][M?]' | cut -c8- | grep -E '\\.(ts|js|tsx|jsx)$') ",
|
|
"lint:spelling": "codespell -D - -D ../.github/codespell-dictionary.txt -I ../.github/codespell-words.txt -S './src/locales/**' ./src -s",
|
|
"lit-analyse": "lit-analyzer src",
|
|
"precommit": "run-s tsc lit-analyse lint:precommit lint:spelling prettier",
|
|
"prettier-check": "prettier --check .",
|
|
"prettier": "prettier --write .",
|
|
"tsc:execute": "tsc --noEmit -p .",
|
|
"tsc": "run-s build-locales tsc:execute",
|
|
"storybook": "storybook dev -p 6006",
|
|
"storybook:build": "cross-env NODE_OPTIONS='--max_old_space_size=4096' storybook build"
|
|
},
|
|
"dependencies": {
|
|
"@codemirror/lang-html": "^6.4.6",
|
|
"@codemirror/lang-javascript": "^6.2.1",
|
|
"@codemirror/lang-python": "^6.1.3",
|
|
"@codemirror/lang-xml": "^6.0.2",
|
|
"@codemirror/legacy-modes": "^6.3.3",
|
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
"@formatjs/intl-listformat": "^7.4.2",
|
|
"@fortawesome/fontawesome-free": "^6.4.2",
|
|
"@goauthentik/api": "^2023.8.3-1694462695",
|
|
"@lit-labs/context": "^0.4.1",
|
|
"@lit-labs/task": "^3.0.2",
|
|
"@lit/localize": "^0.11.4",
|
|
"@open-wc/lit-helpers": "^0.6.0",
|
|
"@patternfly/elements": "^2.4.0",
|
|
"@patternfly/patternfly": "^4.224.2",
|
|
"@sentry/browser": "^7.69.0",
|
|
"@sentry/tracing": "^7.69.0",
|
|
"@webcomponents/webcomponentsjs": "^2.8.0",
|
|
"base64-js": "^1.5.1",
|
|
"chart.js": "^4.4.0",
|
|
"chartjs-adapter-moment": "^1.0.1",
|
|
"codemirror": "^6.0.1",
|
|
"construct-style-sheets-polyfill": "^3.1.0",
|
|
"core-js": "^3.32.2",
|
|
"country-flag-icons": "^1.5.7",
|
|
"fuse.js": "^6.6.2",
|
|
"lit": "^2.8.0",
|
|
"mermaid": "^10.4.0",
|
|
"rapidoc": "^9.3.4",
|
|
"style-mod": "^4.1.0",
|
|
"webcomponent-qr-code": "^1.2.0",
|
|
"yaml": "^2.3.2"
|
|
},
|
|
"devDependencies": {
|
|
"@babel/core": "^7.22.17",
|
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
"@babel/plugin-proposal-decorators": "^7.22.15",
|
|
"@babel/plugin-transform-private-methods": "^7.22.5",
|
|
"@babel/plugin-transform-private-property-in-object": "^7.22.11",
|
|
"@babel/plugin-transform-runtime": "^7.22.15",
|
|
"@babel/preset-env": "^7.22.15",
|
|
"@babel/preset-typescript": "^7.22.15",
|
|
"@hcaptcha/types": "^1.0.3",
|
|
"@jackfranklin/rollup-plugin-markdown": "^0.4.0",
|
|
"@jeysal/storybook-addon-css-user-preferences": "^0.2.0",
|
|
"@lit/localize-tools": "^0.6.10",
|
|
"@rollup/plugin-babel": "^6.0.3",
|
|
"@rollup/plugin-commonjs": "^25.0.4",
|
|
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
"@rollup/plugin-replace": "^5.0.2",
|
|
"@rollup/plugin-terser": "^0.4.3",
|
|
"@rollup/plugin-typescript": "^11.1.3",
|
|
"@storybook/addon-essentials": "^7.4.0",
|
|
"@storybook/addon-links": "^7.4.0",
|
|
"@storybook/blocks": "^7.1.1",
|
|
"@storybook/web-components": "^7.4.0",
|
|
"@storybook/web-components-vite": "^7.4.0",
|
|
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
|
|
"@types/chart.js": "^2.9.38",
|
|
"@types/codemirror": "5.60.10",
|
|
"@types/grecaptcha": "^3.0.4",
|
|
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
|
"@typescript-eslint/parser": "^6.7.0",
|
|
"babel-plugin-macros": "^3.1.0",
|
|
"babel-plugin-tsconfig-paths": "^1.0.3",
|
|
"cross-env": "^7.0.3",
|
|
"eslint": "^8.49.0",
|
|
"eslint-config-google": "^0.14.0",
|
|
"eslint-plugin-custom-elements": "0.0.8",
|
|
"eslint-plugin-lit": "^1.9.1",
|
|
"eslint-plugin-sonarjs": "^0.21.0",
|
|
"eslint-plugin-storybook": "^0.6.13",
|
|
"lit-analyzer": "^1.2.1",
|
|
"npm-run-all": "^4.1.5",
|
|
"prettier": "^3.0.3",
|
|
"pyright": "^1.1.327",
|
|
"react": "^18.2.0",
|
|
"react-dom": "^18.2.0",
|
|
"rollup": "^3.29.1",
|
|
"rollup-plugin-copy": "^3.5.0",
|
|
"rollup-plugin-cssimport": "^1.0.3",
|
|
"rollup-plugin-postcss-lit": "^2.1.0",
|
|
"storybook": "^7.4.0",
|
|
"storybook-addon-mock": "^4.2.1",
|
|
"ts-lit-plugin": "^1.2.1",
|
|
"tslib": "^2.6.2",
|
|
"turnstile-types": "^1.1.2",
|
|
"typescript": "^5.2.2",
|
|
"vite-tsconfig-paths": "^4.2.1"
|
|
},
|
|
"optionalDependencies": {
|
|
"@esbuild/darwin-arm64": "^0.19.3",
|
|
"@esbuild/linux-amd64": "^0.18.11",
|
|
"@esbuild/linux-arm64": "^0.19.3"
|
|
}
|
|
}
|