From 89fbea33057ffd667191dd5a68b0eb0858e762e6 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 28 Dec 2023 15:12:27 +0100 Subject: [PATCH] fix web stuff Signed-off-by: Jens Langhammer --- .../admin/admin-settings/AdminSettingsForm.ts | 69 +++++++++++-------- .../admin/admin-settings/AdminSettingsPage.ts | 4 +- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/web/src/admin/admin-settings/AdminSettingsForm.ts b/web/src/admin/admin-settings/AdminSettingsForm.ts index 803e64183..ae9aaffe6 100644 --- a/web/src/admin/admin-settings/AdminSettingsForm.ts +++ b/web/src/admin/admin-settings/AdminSettingsForm.ts @@ -10,8 +10,9 @@ import "@goauthentik/elements/forms/SearchSelect"; import "@goauthentik/elements/utils/TimeDeltaHelp"; import { msg } from "@lit/localize"; -import { TemplateResult, html } from "lit"; +import { CSSResult, TemplateResult, html } from "lit"; import { customElement, property } from "lit/decorators.js"; +import { ifDefined } from "lit/directives/if-defined.js"; import PFList from "@patternfly/patternfly/components/List/list.css"; @@ -45,47 +46,55 @@ export class AdminSettingsForm extends Form { ${msg( "Configure how authentik should show avatars for users. The following values can be set:", )}

-

-

    -
  • none: ${msg( +
      +
    • + none: + ${msg( "Disables per-user avatars and just shows a 1x1 pixel transparent picture", - )}
    • -
    • gravatar: ${msg( - "Uses gravatar with the user's email address", - )}
    • -
    • initials: ${msg( - "Generated avatars based on the user's name", - )}
    • -
    • ${msg( + )} +
    • +
    • + gravatar: + ${msg("Uses gravatar with the user's email address")} +
    • +
    • + initials: + ${msg("Generated avatars based on the user's name")} +
    • +
    • + ${msg( "Any URL: If you want to use images hosted on another server, you can set any URL. Additionally, these placeholders can be used:", )} -
        -
      • %(username)s: ${msg( - "The user's username", - )}
      • -
      • %(mail_hash)s: ${msg( - "The email address, md5 hashed", - )}
      • -
      • %(upn)s: ${msg( - "The user's UPN, if set (otherwise an empty string)", - )}
      • -
      -
    • -
    • ${msg( +
        +
      • + %(username)s: ${msg("The user's username")} +
      • +
      • + %(mail_hash)s: + ${msg("The email address, md5 hashed")} +
      • +
      • + %(upn)s: + ${msg("The user's UPN, if set (otherwise an empty string)")} +
      • +
      +
    • +
    • + ${msg( html`An attribute path like attributes.something.avatar, which can be used in combination with the file field to allow users to upload custom avatars for themselves.`, - )}
    • -
    -

    + )} +
  • +

${msg( "Multiple values can be set, comma-separated, and authentik will fallback to the next mode when no avatar could be found.", @@ -125,7 +134,7 @@ export class AdminSettingsForm extends Form { name="eventRetention" label=${msg("Event retention")} required - value="${this._settings?.eventRetention}" + value="${ifDefined(this._settings?.eventRetention)}" .bighelp=${html`

${msg("Duration after which events will be deleted from the database.")}

diff --git a/web/src/admin/admin-settings/AdminSettingsPage.ts b/web/src/admin/admin-settings/AdminSettingsPage.ts index 4f1a81e38..beec8881e 100644 --- a/web/src/admin/admin-settings/AdminSettingsPage.ts +++ b/web/src/admin/admin-settings/AdminSettingsPage.ts @@ -59,7 +59,7 @@ export class AdminSettingsPage extends AKElement { this.loadSettings(); } - async save(): void { + async save(): Promise { const form = this.shadowRoot?.querySelector("ak-admin-settings-form"); if (!form) { return; @@ -74,7 +74,7 @@ export class AdminSettingsPage extends AKElement { return; } this.loadSettings(); - form.settings = this.settings; + form.settings = this.settings!; form.resetForm(); }