web/admin: fix flow diagram not updating on flow changes

closes #2932

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2022-05-23 19:48:33 +02:00
parent 7895d59da3
commit b2a42a68a4
3 changed files with 691 additions and 811 deletions

View File

@ -8,7 +8,7 @@ import AKGlobal from "../authentik.css";
import PFTabs from "@patternfly/patternfly/components/Tabs/tabs.css";
import PFGlobal from "@patternfly/patternfly/patternfly-base.css";
import { CURRENT_CLASS, ROUTE_SEPARATOR } from "../constants";
import { CURRENT_CLASS, EVENT_REFRESH, ROUTE_SEPARATOR } from "../constants";
import { getURLParams, updateURLParams } from "./router/RouteMatch";
@customElement("ak-tabs")
@ -72,6 +72,14 @@ export class Tabs extends LitElement {
const params: { [key: string]: string | undefined } = {};
params[this.pageIdentifier] = slot;
updateURLParams(params);
const page = this.querySelector(`[slot='${this.currentPage}']`);
if (!page) return;
page.dispatchEvent(
new CustomEvent(EVENT_REFRESH, {
bubbles: true,
composed: true,
}),
);
}
renderTab(page: Element): TemplateResult {
@ -90,7 +98,7 @@ export class Tabs extends LitElement {
if (this.pageIdentifier in params) {
if (this.querySelector(`[slot='${params[this.pageIdentifier]}']`) !== null) {
// To update the URL to match with the current slot
this.currentPage = params[this.pageIdentifier];
this.currentPage = params[this.pageIdentifier] as string;
}
}
}