38272e8a68
* web: break circular dependency between AKElement & Interface. This commit changes the way the root node of the web application shell is discovered by child components, such that the base class shared by both no longer results in a circular dependency between the two models. I've run this in isolation and have seen no failures of discovery; the identity token exists as soon as the Interface is constructed and is found by every item on the page. * web: fix broken typescript references This built... and then it didn't? Anyway, the current fix is to provide type information the AkInterface for the data that consumers require. * Refactor the Table component for legiibility. This commit does not change the functionality of the Table, nor does it require any changes to existing uses of the Table. It will probably be easier to review this by looking at the `View Code` in the upper-right-hand corner of GitHub's reviewer; that or side-by-side, if your monitor is wide-enough. The existing Table component is used 49 times (at last count) in authentik, and those uses are wide-ranging and complex, but they all come down to a couple of entries: - Displaying a row of summary information - Permitting the display of more complex ("expanded") information - Displaying a collection of rows - Displaying a collection of rows grouped by some header - Pagination of many rows - Permitting an action on the visible rows - *Not* blocking events that may happen on a cell or expansion - Providing a toolbar - Providing a display of "selected items" when using the table as a multi-select with many pages of items (chips display) - Providing sort functionality on columns - Providing the ability to filter the table from the back-end This commit changes none of that. What this commit does is re-arrange the innards of Table.ts into smaller units: - The RowGroup's "checkbox" and "expansion" segments are pulled out into their own functions, which makes the RowGroup's actual functionality much easier to see and understand. The same is true of the rowGroup's selection and expansion handlers. - Almost all in-line decisions and event handlers have been extracted and named, to make it easier to see and understand what's happening inside what is otherwise a jumble of HTML. - The TablePagination code was duplicated-- and one of the duplicates was wrong! So I've deduplicated it and fixed the bug. - In many cases, the conditional code grew organically, resulting in some pretty hard-to-understand conditions. - A really good example is the `itemSelectHandler`; there are two possible events that result in a change, and the consequences of that change may be that *all* checkboxes are unchecked. In all cases where there's an add/remove option, I've opted to remove the specific object always (even if it's not present!), and then add it if it's actually an add. Logically coherent as long as the accessors are not also mutators. It was not possible to redefine the `columns()` function to take anything other than a TableColumn object; I wanted to be able to replace all of the `new TableColumn("Foo")` with just `"Foo"`, building the TableColumn dynamically at construction time. Unfortunately, some of our most complex tables dynamically re-arrange the columns (RBAC, for example, draws an empty table, fetches the content, then redraws with the columns based on what was retrieved), and detecting that change and rebuilding those columns proved more difficult than anticipated. I may contemplate an alternative column specification if I find myself building a lot of tables. Likewise, it was not possible to replace all of our uses of the empty `html` declaration with the Lit-preferred `nothing` sigil; hard-coded `TemplateResult` entries scattered throughout the code caused massive type inconsistencies, since a type of `TemplateResult | nothing` is unique thanks to `nothing`'s underlying Symbol. It is for this issue that Typescript itself recommends you "prefer allowing Typescript infer the return type." I may revisit this issue later. I've added a `prequick` command to `package.json`; this one runs *only* the Typescript type checker, lit-analyse, and `eslint:precommit`, the last of which lints only the files touched since the last commit. This is fast, intended to support quick checks of code quality not normally displayed in the IDE. * web: refactor table After talking to Jens, I've put back the positional variable and eslint escape; it's better to document existing practices than try to force something. I also misunderstood the role of `inner` in one bit of code, and have restored its functionality. Looking through the code, though, I can see a case where it will fail; it's expecting `inner` to be either undefined or a TemplateResult; if there's no error message, the error message defaults to a blank TemplateResult, which is _not_ undefined, and will result in a blank table. This will only happen under very weird network failures, but... |
||
---|---|---|
.. | ||
.storybook | ||
authentik/sources | ||
icons | ||
scripts | ||
src | ||
xliff | ||
.babelrc | ||
.dockerignore | ||
.eslintignore | ||
.eslintrc.json | ||
.eslintrc.precommit.json | ||
.gitignore | ||
.prettierignore | ||
.prettierrc.json | ||
lit-localize.json | ||
package-lock.json | ||
package.json | ||
README.md | ||
robots.txt | ||
rollup.config.mjs | ||
rollup.proxy.mjs | ||
security.txt | ||
static.go | ||
static_outpost.go | ||
tsconfig.json | ||
web-test-runner.config.mjs |
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 ofHTMLElement
. As a result, this threw too many errors to be supportable.