Files
authentik/web/src/admin/sources/SourceViewPage.ts
Ken Sternberg be9ae7d4f7 web: cleanup/loading attribute always true (#14288)
* web: Add InvalidationFlow to Radius Provider dialogues

## What

- Bugfix: adds the InvalidationFlow to the Radius Provider dialogues
  - Repairs: `{"invalidation_flow":["This field is required."]}` message, which was *not* propagated
    to the Notification.
- Nitpick: Pretties `?foo=${true}` expressions: `s/\?([^=]+)=\$\{true\}/\1/`

## Note

Yes, I know I'm going to have to do more magic when we harmonize the forms, and no, I didn't add the
Property Mappings to the wizard, and yes, I know I'm going to have pain with the *new* version of
the wizard. But this is a serious bug; you can't make Radius servers with *either* of the current
dialogues at the moment.

* This (temporary) change is needed to prevent the unit tests from failing.

\# What

\# Why

\# How

\# Designs

\# Test Steps

\# Other Notes

* Revert "This (temporary) change is needed to prevent the unit tests from failing."

This reverts commit dddde09be5.

* web: remove Lit syntax from always true attributes

## What

Replaces instances of `?loading=${true}` and `?loading="${true}"` with `loading`

## Why

The Lit syntax is completely unnecessary when the attribute's state is constant, and it's a few
(just a few) extra CPU cycles for Lit to process that.

More to the point, it annoys me.

## How

```
$ perl -pi.bak -e 's/\?loading=\$\{true\}/loading/' $(rg -l '\?loading=\$\{true\}')
$ find . -name '*.bak' -exec rm {} \;
$ perl -pi.bak -e 's/\?loading="\$\{true\}"/loading/' $(rg -l '\?loading="\$\{true\}"')
$ find . -name '*.bak' -exec rm {} \;
```

* Prettier had opinions

* Trigger Build
2025-05-06 08:49:48 -07:00

85 lines
3.1 KiB
TypeScript

import "@goauthentik/admin/sources/kerberos/KerberosSourceViewPage";
import "@goauthentik/admin/sources/ldap/LDAPSourceViewPage";
import "@goauthentik/admin/sources/oauth/OAuthSourceViewPage";
import "@goauthentik/admin/sources/plex/PlexSourceViewPage";
import "@goauthentik/admin/sources/saml/SAMLSourceViewPage";
import "@goauthentik/admin/sources/scim/SCIMSourceViewPage";
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
import { AKElement } from "@goauthentik/elements/Base";
import "@goauthentik/elements/EmptyState";
import "@goauthentik/elements/PageHeader";
import "@goauthentik/elements/buttons/SpinnerButton";
import { TemplateResult, html } from "lit";
import { customElement, property } from "lit/decorators.js";
import { ifDefined } from "lit/directives/if-defined.js";
import { Source, SourcesApi } from "@goauthentik/api";
@customElement("ak-source-view")
export class SourceViewPage extends AKElement {
@property({ type: String })
set sourceSlug(slug: string) {
new SourcesApi(DEFAULT_CONFIG)
.sourcesAllRetrieve({
slug: slug,
})
.then((source) => {
this.source = source;
});
}
@property({ attribute: false })
source?: Source;
renderSource(): TemplateResult {
if (!this.source) {
return html`<ak-empty-state loading ?fullHeight=${true}></ak-empty-state>`;
}
switch (this.source?.component) {
case "ak-source-kerberos-form":
return html`<ak-source-kerberos-view
sourceSlug=${this.source.slug}
></ak-source-kerberos-view>`;
case "ak-source-ldap-form":
return html`<ak-source-ldap-view
sourceSlug=${this.source.slug}
></ak-source-ldap-view>`;
case "ak-source-oauth-form":
return html`<ak-source-oauth-view
sourceSlug=${this.source.slug}
></ak-source-oauth-view>`;
case "ak-source-saml-form":
return html`<ak-source-saml-view
sourceSlug=${this.source.slug}
></ak-source-saml-view>`;
case "ak-source-plex-form":
return html`<ak-source-plex-view
sourceSlug=${this.source.slug}
></ak-source-plex-view>`;
case "ak-source-scim-form":
return html`<ak-source-scim-view
sourceSlug=${this.source.slug}
></ak-source-scim-view>`;
default:
return html`<p>Invalid source type ${this.source.component}</p>`;
}
}
render(): TemplateResult {
return html`<ak-page-header
icon="pf-icon pf-icon-middleware"
header=${ifDefined(this.source?.name)}
description=${ifDefined(this.source?.verboseName)}
>
</ak-page-header>
${this.renderSource()}`;
}
}
declare global {
interface HTMLElementTagNameMap {
"ak-source-view": SourceViewPage;
}
}