web: don't import entire SourceViewPage in flow and user interface (#6761)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
77e7c31567
commit
7e9e2ec53d
|
@ -14,18 +14,6 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
|
|
||||||
import { Source, SourcesApi } from "@goauthentik/api";
|
import { Source, SourcesApi } from "@goauthentik/api";
|
||||||
|
|
||||||
export function renderSourceIcon(name: string, iconUrl: string | undefined | null): TemplateResult {
|
|
||||||
const icon = html`<i class="fas fa-share-square" title="${name}"></i>`;
|
|
||||||
if (iconUrl) {
|
|
||||||
if (iconUrl.startsWith("fa://")) {
|
|
||||||
const url = iconUrl.replaceAll("fa://", "");
|
|
||||||
return html`<i class="fas ${url}" title="${name}"></i>`;
|
|
||||||
}
|
|
||||||
return html`<img src="${iconUrl}" alt="${name}" />`;
|
|
||||||
}
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@customElement("ak-source-view")
|
@customElement("ak-source-view")
|
||||||
export class SourceViewPage extends AKElement {
|
export class SourceViewPage extends AKElement {
|
||||||
@property({ type: String })
|
@property({ type: String })
|
||||||
|
|
13
web/src/admin/sources/utils.ts
Normal file
13
web/src/admin/sources/utils.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import { TemplateResult, html } from "lit";
|
||||||
|
|
||||||
|
export function renderSourceIcon(name: string, iconUrl: string | undefined | null): TemplateResult {
|
||||||
|
const icon = html`<i class="fas fa-share-square" title="${name}"></i>`;
|
||||||
|
if (iconUrl) {
|
||||||
|
if (iconUrl.startsWith("fa://")) {
|
||||||
|
const url = iconUrl.replaceAll("fa://", "");
|
||||||
|
return html`<i class="fas ${url}" title="${name}"></i>`;
|
||||||
|
}
|
||||||
|
return html`<img src="${iconUrl}" alt="${name}" />`;
|
||||||
|
}
|
||||||
|
return icon;
|
||||||
|
}
|
|
@ -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/Divider";
|
||||||
import "@goauthentik/elements/EmptyState";
|
import "@goauthentik/elements/EmptyState";
|
||||||
import "@goauthentik/elements/forms/FormElement";
|
import "@goauthentik/elements/forms/FormElement";
|
||||||
|
|
|
@ -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 { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { EVENT_REFRESH } from "@goauthentik/common/constants";
|
import { EVENT_REFRESH } from "@goauthentik/common/constants";
|
||||||
import { me } from "@goauthentik/common/users";
|
import { me } from "@goauthentik/common/users";
|
||||||
|
|
Reference in a new issue