From 15ac26edb88279984be15f8c51434ff07931eb9a Mon Sep 17 00:00:00 2001 From: Jens L Date: Tue, 5 Sep 2023 21:34:34 +0200 Subject: [PATCH] web: don't import entire SourceViewPage in flow and user interface (#6761) Signed-off-by: Jens Langhammer --- web/src/admin/sources/SourceViewPage.ts | 12 ------------ web/src/admin/sources/utils.ts | 13 +++++++++++++ .../stages/identification/IdentificationStage.ts | 2 +- .../user/user-settings/sources/SourceSettings.ts | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 web/src/admin/sources/utils.ts diff --git a/web/src/admin/sources/SourceViewPage.ts b/web/src/admin/sources/SourceViewPage.ts index 3c010bdb0..d0050fdf9 100644 --- a/web/src/admin/sources/SourceViewPage.ts +++ b/web/src/admin/sources/SourceViewPage.ts @@ -14,18 +14,6 @@ import { ifDefined } from "lit/directives/if-defined.js"; import { Source, SourcesApi } from "@goauthentik/api"; -export function renderSourceIcon(name: string, iconUrl: string | undefined | null): TemplateResult { - const icon = html``; - if (iconUrl) { - if (iconUrl.startsWith("fa://")) { - const url = iconUrl.replaceAll("fa://", ""); - return html``; - } - return html`${name}`; - } - return icon; -} - @customElement("ak-source-view") export class SourceViewPage extends AKElement { @property({ type: String }) diff --git a/web/src/admin/sources/utils.ts b/web/src/admin/sources/utils.ts new file mode 100644 index 000000000..83ff0b967 --- /dev/null +++ b/web/src/admin/sources/utils.ts @@ -0,0 +1,13 @@ +import { TemplateResult, html } from "lit"; + +export function renderSourceIcon(name: string, iconUrl: string | undefined | null): TemplateResult { + const icon = html``; + if (iconUrl) { + if (iconUrl.startsWith("fa://")) { + const url = iconUrl.replaceAll("fa://", ""); + return html``; + } + return html`${name}`; + } + return icon; +} diff --git a/web/src/flow/stages/identification/IdentificationStage.ts b/web/src/flow/stages/identification/IdentificationStage.ts index 6e302f9a7..49b530026 100644 --- a/web/src/flow/stages/identification/IdentificationStage.ts +++ b/web/src/flow/stages/identification/IdentificationStage.ts @@ -1,4 +1,4 @@ -import { renderSourceIcon } from "@goauthentik/admin/sources/SourceViewPage"; +import { renderSourceIcon } from "@goauthentik/app/admin/sources/utils"; import "@goauthentik/elements/Divider"; import "@goauthentik/elements/EmptyState"; import "@goauthentik/elements/forms/FormElement"; diff --git a/web/src/user/user-settings/sources/SourceSettings.ts b/web/src/user/user-settings/sources/SourceSettings.ts index 718c7d1c8..203eef9f3 100644 --- a/web/src/user/user-settings/sources/SourceSettings.ts +++ b/web/src/user/user-settings/sources/SourceSettings.ts @@ -1,4 +1,4 @@ -import { renderSourceIcon } from "@goauthentik/admin/sources/SourceViewPage"; +import { renderSourceIcon } from "@goauthentik/app/admin/sources/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { EVENT_REFRESH } from "@goauthentik/common/constants"; import { me } from "@goauthentik/common/users";