This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/web
Ken Sternberg dc655c9283
web: clear "blanked" placeholder when present (#15)
- Renames "SearchSelect.ts" to "ak-search-select.ts", the better to reflect that it is a web
  component.
- Moves it into an independent folder named "SearchSelect" so that all existing folders that use it
  don't need any renaming or manipulation.
- Refactors SearchSelect.ts in the following ways:
  - Re-arranges the properties declaration so the seven properties actually used by callers are at
    the top; comments and documents every property.
  - Separates out the `renderItem` and `renderEmptyItem` HTML blocks into their own templates.
  - Separates `renderItem` further into `renderItemWithDescription` and
    `RenderItemWithoutDescription`; prior to this, there were multiple conditionals handling the
    description issue
  - Separates `renderItems` into `renderItemsAsGroups` and `renderItems`; this documents what each
    function does and removes multiple conditionals
  - Isolates the `groupedItems()` logic into a single method, moving the *how* away from the *what*.
  - Replaces the manual styling of `renderMenu()` into a lit-element `styleMap()`.  This makes the
    actual render a lot more readable!
  - Refactors the `value` logic into its own method, as a _getter_.
  - Refactors the ad-hoc handlers for `focus`, `input`, and `blur` into functions on the `render()`
    method itself.
    - Alternatively, I could have put the handlers as methods on the ak-search-select Node itself;
      Lit would automatically bind `this` correctly if referenced through the `@event` syntax.
      Moving them *out* of the `render()` method would require significantly more testing, however,
      as that would change the code flow enough it might have risked the original behavior.  By
      leaving them in the `render()` scope, this guarantees their original behavior -- whether that
      behavior is correct or not.
- FIXES #15
  - Having isolated as much functionality as was possible, it was easy to change the `onFocus()`
    event so that when the user focuses on the `<input>` object, if it's currently populated with
    the empty option and the user specified `isBlankable`, clear it.
  - **Notice**: This creates a new, possibly undesirable behavior; since it's not possible to know
    *why* the input object is currently empty, in the event that it is currently empty as a result
    of this clearing there is no way to know when the "empty option" marker needs to be put back.

This is an incredibly complex bit of code, the sort that really shouldn't be written by application
teams. The behavior is undefined in a number of cases, and although none of those cases are fatal,
some of them are quite annoying. I recommend that we seriously consider adopting a third-party
solution.

Selects (and DataLists) are notoriously difficult to get right on the desktop; they are almost
impossible to get right on mobile. Every responsible implementation of Selects has a
"default-to-native" experience on mobile because, for the most part, the mobile native experience is
excellent -- delta wanting two-line `<option>` blocks and `<optiongroup>`s, both of which we do
want.

This component implements:

- Rendering the `<input>` element and handling its behavior
- Rendering the `<select>` element and handling its behavior
- Mediating between these two components
- Fetching the data for the `<select>` component from the back-end
- Filtering the data via a partial-match search through the `<input>` element
- Distinguishing between hard-affirm and soft-affirm "No choice" options
- Dispatching the `<select>` element via a portal, the better to control rendering.

That's a *lot* of responsibilities! And it makes Storybooking this component non-viable. I recommend
breaking this up further, but I've already spent a lot of time just doing the refactoring and
getting the new behavior as right as possible, so for now I'm just going to submit the clean-up and
come back to this later.
2023-12-21 22:36:56 +01:00
..
.storybook web: fix storybook build after npm update (#7855) 2023-12-18 15:57:39 +01:00
authentik/sources sources/oauth: fix reddit (#5557) 2023-05-09 23:41:24 +02:00
icons web, website: compress images (#6121) 2023-08-02 12:06:03 +00:00
scripts web: fix storybook build after npm update (#7855) 2023-12-18 15:57:39 +01:00
src web: clear "blanked" placeholder when present (#15) 2023-12-21 22:36:56 +01:00
xliff providers/scim: use lock for sync (#7948) 2023-12-21 14:43:40 +01:00
.babelrc web/admin: simplify sidebar renderer (#6797) 2023-09-11 12:58:55 -07:00
.dockerignore root: fix references to helm chart 2021-06-13 14:30:44 +02:00
.eslintignore web: bump @typescript-eslint/eslint-plugin from 5.61.0 to 6.0.0 in /web (#6210) 2023-07-11 14:32:50 +02:00
.eslintrc.json web: laying the groundwork for future expansion (#7045) 2023-10-02 13:33:27 -07:00
.eslintrc.precommit.json web: Detangling some circular dependencies in Admin and User (#6852) 2023-09-13 10:16:24 -07:00
.gitignore web: the return of pseudolocalization (#7190) 2023-10-16 13:54:43 -07:00
.prettierignore enterprise: initial enterprise (#5721) 2023-07-17 17:57:08 +02:00
.prettierrc.json web: bump prettier from 2.8.8 to 3.0.0 in /web (#6329) 2023-07-21 18:19:19 +02:00
README.md web: Add storybook (#5865) 2023-06-07 13:05:33 +02:00
lit-localize.json web: locales: rename fr_FR to fr to match transifex 2023-10-02 13:31:21 +02:00
package-lock.json web: bump API Client version (#7964) 2023-12-21 15:30:00 +01:00
package.json web: bump API Client version (#7964) 2023-12-21 15:30:00 +01:00
robots.txt root: move webapp to /web (#347) 2020-11-28 19:43:42 +01:00
rollup.config.mjs web: refactor sidebar capabilities for categorical subsections (#7482) 2023-11-20 10:24:59 -08:00
rollup.proxy.mjs web: bump rollup from 2.79.1 to 3.28.1 in /web (#6616) 2023-08-24 17:13:03 +02:00
security.txt root: update supported versions 2023-01-20 14:23:21 +01:00
static.go outposts: release binary outposts (#1954) 2021-12-17 19:49:32 +00:00
static_outpost.go outposts: release binary outposts (#1954) 2021-12-17 19:49:32 +00:00
tsconfig.json web: Replace ad-hoc toggle control with ak-toggle-group (#6470) 2023-08-28 20:00:25 +02:00
web-test-runner.config.mjs web: basic cleanup of buttons (#6107) 2023-07-18 08:29:42 -07:00

README.md

authentik WebUI

This is the default UI for the authentik server. The documentation is going to be a little sparse for awhile, but at least let's get started.

Comments

NOTE: The comments in this section are for specific changes to this repository that cannot be reliably documented any other way. For the most part, they contain comments related to custom settings in JSON files, which do not support comments.

  • tsconfig.json:
    • compilerOptions.useDefineForClassFields: false is required to make TSC use the "classic" form of field definition when compiling class definitions. Storybook does not handle the ESNext proposed definition mechanism (yet).
    • compilerOptions.plugins.ts-lit-plugin.rules.no-unknown-tag-name: "off": required to support rapidoc, which exports its tag late.
    • compilerOptions.plugins.ts-lit-plugin.rules.no-missing-import: "off": lit-analyzer currently does not support path aliases very well, and cannot find the definition files associated with imports using them.
    • compilerOptions.plugins.ts-lit-plugin.rules.no-incompatible-type-binding: "warn": lit-analyzer does not support generics well when parsing a subtype of HTMLElement. As a result, this threw too many errors to be supportable.