
* web: fix esbuild issue with style sheets Getting ESBuild, Lit, and Storybook to all agree on how to read and parse stylesheets is a serious pain. This fix better identifies the value types (instances) being passed from various sources in the repo to the three *different* kinds of style processors we're using (the native one, the polyfill one, and whatever the heck Storybook does internally). Falling back to using older CSS instantiating techniques one era at a time seems to do the trick. It's ugly, but in the face of the aggressive styling we use to avoid Flashes of Unstyled Content (FLoUC), it's the logic with which we're left. In standard mode, the following warning appears on the console when running a Flow: ``` Autofocus processing was blocked because a document already has a focused element. ``` In compatibility mode, the following **error** appears on the console when running a Flow: ``` crawler-inject.js:1106 Uncaught TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'. at initDomMutationObservers (crawler-inject.js:1106:18) at crawler-inject.js:1114:24 at Array.forEach (<anonymous>) at initDomMutationObservers (crawler-inject.js:1114:10) at crawler-inject.js:1549:1 initDomMutationObservers @ crawler-inject.js:1106 (anonymous) @ crawler-inject.js:1114 initDomMutationObservers @ crawler-inject.js:1114 (anonymous) @ crawler-inject.js:1549 ``` Despite this error, nothing seems to be broken and flows work as anticipated. * web: you have no missed messages This commit uncovers a few places where a human-readable string was not property cast into the internationalized form and internationalizes them in order to conform to our policy of keeping the product viable outside of the English-speaking world. * Restored SAML spacing manually. Not sure why that was necessary. * Restored WS spacing manually. Not sure why that was necessary. * Restored RouteMatch spacing manually. Not sure why that was necessary. * Restored RAC spacing manually. Not sure why that was necessary.
111 lines
3.3 KiB
TypeScript
111 lines
3.3 KiB
TypeScript
import { PFSize } from "@goauthentik/common/enums.js";
|
|
import { AKElement } from "@goauthentik/elements/Base";
|
|
import { MODAL_BUTTON_STYLES } from "@goauthentik/elements/buttons/ModalButton";
|
|
import { ModalShowEvent } from "@goauthentik/elements/controllers/ModalOrchestrationController.js";
|
|
import { Table } from "@goauthentik/elements/table/Table";
|
|
|
|
import { msg } from "@lit/localize";
|
|
import { CSSResult } from "lit";
|
|
import { TemplateResult, html } from "lit";
|
|
import { property } from "lit/decorators.js";
|
|
|
|
import PFBackdrop from "@patternfly/patternfly/components/Backdrop/backdrop.css";
|
|
import PFContent from "@patternfly/patternfly/components/Content/content.css";
|
|
import PFModalBox from "@patternfly/patternfly/components/ModalBox/modal-box.css";
|
|
import PFPage from "@patternfly/patternfly/components/Page/page.css";
|
|
import PFBullseye from "@patternfly/patternfly/layouts/Bullseye/bullseye.css";
|
|
import PFStack from "@patternfly/patternfly/layouts/Stack/stack.css";
|
|
|
|
export abstract class TableModal<T> extends Table<T> {
|
|
@property()
|
|
size: PFSize = PFSize.Large;
|
|
|
|
@property({ type: Boolean })
|
|
set open(value: boolean) {
|
|
this._open = value;
|
|
if (value) {
|
|
this.fetch();
|
|
}
|
|
}
|
|
|
|
get open(): boolean {
|
|
return this._open;
|
|
}
|
|
|
|
_open = false;
|
|
|
|
static get styles(): CSSResult[] {
|
|
return super.styles.concat(
|
|
PFModalBox,
|
|
PFBullseye,
|
|
PFContent,
|
|
PFBackdrop,
|
|
PFPage,
|
|
PFStack,
|
|
MODAL_BUTTON_STYLES,
|
|
);
|
|
}
|
|
|
|
public async fetch(): Promise<void> {
|
|
if (!this.open) {
|
|
return;
|
|
}
|
|
return super.fetch();
|
|
}
|
|
|
|
closeModal() {
|
|
this.resetForms();
|
|
this.open = false;
|
|
}
|
|
|
|
resetForms(): void {
|
|
this.querySelectorAll<HTMLFormElement>("[slot=form]").forEach((form) => {
|
|
if ("resetForm" in form) {
|
|
form?.resetForm();
|
|
}
|
|
});
|
|
}
|
|
|
|
onClick(): void {
|
|
this.open = true;
|
|
this.dispatchEvent(new ModalShowEvent(this));
|
|
this.querySelectorAll("*").forEach((child) => {
|
|
if ("requestUpdate" in child) {
|
|
(child as AKElement).requestUpdate();
|
|
}
|
|
});
|
|
}
|
|
|
|
renderModalInner(): TemplateResult {
|
|
return this.renderTable();
|
|
}
|
|
|
|
renderModal(): TemplateResult {
|
|
return html`<div
|
|
class="pf-c-backdrop"
|
|
@click=${(e: PointerEvent) => {
|
|
e.stopPropagation();
|
|
}}
|
|
>
|
|
<div class="pf-l-bullseye">
|
|
<div class="pf-c-modal-box ${this.size}" role="dialog" aria-modal="true">
|
|
<button
|
|
@click=${() => (this.open = false)}
|
|
class="pf-c-button pf-m-plain"
|
|
type="button"
|
|
aria-label=${msg("Close dialog")}
|
|
>
|
|
<i class="fas fa-times" aria-hidden="true"></i>
|
|
</button>
|
|
${this.renderModalInner()}
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
|
|
render(): TemplateResult {
|
|
return html` <slot name="trigger" @click=${() => this.onClick()}></slot>
|
|
${this.open ? this.renderModal() : ""}`;
|
|
}
|
|
}
|