web: change "tenant" to "brand" in all context uses, and update SidebarBrand and DefaultBrand to match.

This commit is contained in:
Ken Sternberg 2023-12-04 11:01:53 -08:00
parent 8c6f83b88e
commit 24278d0781
6 changed files with 17 additions and 20 deletions

View File

@ -8,7 +8,7 @@ import "@goauthentik/elements/forms/FormGroup";
import "@goauthentik/elements/forms/HorizontalFormElement"; import "@goauthentik/elements/forms/HorizontalFormElement";
import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
import "@goauthentik/elements/forms/SearchSelect"; import "@goauthentik/elements/forms/SearchSelect";
import { DefaultTenant } from "@goauthentik/elements/sidebar/SidebarBrand"; import { DefaultBrand } from "@goauthentik/elements/sidebar/SidebarBrand";
import YAML from "yaml"; import YAML from "yaml";
import { msg } from "@lit/localize"; import { msg } from "@lit/localize";
@ -95,7 +95,7 @@ export class TenantForm extends ModelForm<Tenant, string> {
type="text" type="text"
value="${first( value="${first(
this.instance?.brandingTitle, this.instance?.brandingTitle,
DefaultTenant.brandingTitle, DefaultBrand.brandingTitle,
)}" )}"
class="pf-c-form-control" class="pf-c-form-control"
required required
@ -111,10 +111,7 @@ export class TenantForm extends ModelForm<Tenant, string> {
> >
<input <input
type="text" type="text"
value="${first( value="${first(this.instance?.brandingLogo, DefaultBrand.brandingLogo)}"
this.instance?.brandingLogo,
DefaultTenant.brandingLogo,
)}"
class="pf-c-form-control" class="pf-c-form-control"
required required
/> />
@ -131,7 +128,7 @@ export class TenantForm extends ModelForm<Tenant, string> {
type="text" type="text"
value="${first( value="${first(
this.instance?.brandingFavicon, this.instance?.brandingFavicon,
DefaultTenant.brandingFavicon, DefaultBrand.brandingFavicon,
)}" )}"
class="pf-c-form-control" class="pf-c-form-control"
required required

View File

@ -2,7 +2,7 @@ import { EVENT_REQUEST_POST } from "@goauthentik/common/constants";
import { getCookie } from "@goauthentik/common/utils"; import { getCookie } from "@goauthentik/common/utils";
import { import {
CurrentTenant, CurrentTenant as CurrentBrand,
FetchParams, FetchParams,
Middleware, Middleware,
RequestContext, RequestContext,
@ -18,8 +18,8 @@ export interface RequestInfo {
} }
export class LoggingMiddleware implements Middleware { export class LoggingMiddleware implements Middleware {
brand: CurrentTenant; brand: CurrentBrand;
constructor(brand: CurrentTenant) { constructor(brand: CurrentBrand) {
this.brand = brand; this.brand = brand;
} }

View File

@ -9,13 +9,13 @@ import { LitElement } from "lit";
import AKGlobal from "@goauthentik/common/styles/authentik.css"; import AKGlobal from "@goauthentik/common/styles/authentik.css";
import ThemeDark from "@goauthentik/common/styles/theme-dark.css"; import ThemeDark from "@goauthentik/common/styles/theme-dark.css";
import { Config, CurrentTenant, UiThemeEnum } from "@goauthentik/api"; import { Config, CurrentTenant as CurrentBrand, UiThemeEnum } from "@goauthentik/api";
import { AdoptedStyleSheetsElement } from "./types"; import { AdoptedStyleSheetsElement } from "./types";
type AkInterface = HTMLElement & { type AkInterface = HTMLElement & {
getTheme: () => Promise<UiThemeEnum>; getTheme: () => Promise<UiThemeEnum>;
tenant?: CurrentTenant; brand?: CurrentBrand;
uiConfig?: UIConfig; uiConfig?: UIConfig;
config?: Config; config?: Config;
}; };

View File

@ -10,13 +10,13 @@ import PFPage from "@patternfly/patternfly/components/Page/page.css";
import PFGlobal from "@patternfly/patternfly/patternfly-base.css"; import PFGlobal from "@patternfly/patternfly/patternfly-base.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css";
import { CurrentTenant, UiThemeEnum } from "@goauthentik/api"; import { CurrentTenant as CurrentBrand, UiThemeEnum } from "@goauthentik/api";
// If the viewport is wider than MIN_WIDTH, the sidebar // If the viewport is wider than MIN_WIDTH, the sidebar
// is shown besides the content, and not overlaid. // is shown besides the content, and not overlaid.
export const MIN_WIDTH = 1200; export const MIN_WIDTH = 1200;
export const DefaultTenant: CurrentTenant = { export const DefaultBrand: CurrentBrand = {
brandingLogo: "/static/dist/assets/icons/icon_left_brand.svg", brandingLogo: "/static/dist/assets/icons/icon_left_brand.svg",
brandingFavicon: "/static/dist/assets/icons/icon.png", brandingFavicon: "/static/dist/assets/icons/icon.png",
brandingTitle: "authentik", brandingTitle: "authentik",
@ -85,7 +85,7 @@ export class SidebarBrand extends WithBrandConfig(AKElement) {
<a href="#/" class="pf-c-page__header-brand-link"> <a href="#/" class="pf-c-page__header-brand-link">
<div class="pf-c-brand ak-brand"> <div class="pf-c-brand ak-brand">
<img <img
src=${this.brand?.brandingLogo ?? DefaultTenant.brandingLogo} src=${this.brand?.brandingLogo ?? DefaultBrand.brandingLogo}
alt="authentik Logo" alt="authentik Logo"
loading="lazy" loading="lazy"
/> />

View File

@ -4,7 +4,7 @@ import { globalAK } from "@goauthentik/common/global";
import { first, getCookie } from "@goauthentik/common/utils"; import { first, getCookie } from "@goauthentik/common/utils";
import { Interface } from "@goauthentik/elements/Interface"; import { Interface } from "@goauthentik/elements/Interface";
import "@goauthentik/elements/ak-locale-context"; import "@goauthentik/elements/ak-locale-context";
import { DefaultTenant } from "@goauthentik/elements/sidebar/SidebarBrand"; import { DefaultBrand } from "@goauthentik/elements/sidebar/SidebarBrand";
import "rapidoc"; import "rapidoc";
import { CSSResult, TemplateResult, css, html } from "lit"; import { CSSResult, TemplateResult, css, html } from "lit";
@ -103,7 +103,7 @@ export class APIBrowser extends Interface {
<img <img
alt="authentik Logo" alt="authentik Logo"
class="logo" class="logo"
src="${first(this.brand?.brandingLogo, DefaultTenant.brandingLogo)}" src="${first(this.brand?.brandingLogo, DefaultBrand.brandingLogo)}"
/> />
</div> </div>
</rapi-doc> </rapi-doc>

View File

@ -19,7 +19,7 @@ import "@goauthentik/elements/notifications/NotificationDrawer";
import { getURLParam, updateURLParams } from "@goauthentik/elements/router/RouteMatch"; import { getURLParam, updateURLParams } from "@goauthentik/elements/router/RouteMatch";
import "@goauthentik/elements/router/RouterOutlet"; import "@goauthentik/elements/router/RouterOutlet";
import "@goauthentik/elements/sidebar/Sidebar"; import "@goauthentik/elements/sidebar/Sidebar";
import { DefaultTenant } from "@goauthentik/elements/sidebar/SidebarBrand"; import { DefaultBrand } from "@goauthentik/elements/sidebar/SidebarBrand";
import "@goauthentik/elements/sidebar/SidebarItem"; import "@goauthentik/elements/sidebar/SidebarItem";
import { ROUTES } from "@goauthentik/user/Routes"; import { ROUTES } from "@goauthentik/user/Routes";
import "@patternfly/elements/pf-tooltip/pf-tooltip.js"; import "@patternfly/elements/pf-tooltip/pf-tooltip.js";
@ -192,8 +192,8 @@ export class UserInterface extends Interface {
<a href="#/" class="pf-c-page__header-brand-link"> <a href="#/" class="pf-c-page__header-brand-link">
<img <img
class="pf-c-brand" class="pf-c-brand"
src="${first(this.brand?.brandingLogo, DefaultTenant.brandingLogo)}" src="${first(this.brand?.brandingLogo, DefaultBrand.brandingLogo)}"
alt="${(this.brand?.brandingTitle, DefaultTenant.brandingTitle)}" alt="${(this.brand?.brandingTitle, DefaultBrand.brandingTitle)}"
/> />
</a> </a>
</div> </div>