mirror of
https://github.com/goauthentik/authentik
synced 2026-05-10 09:02:18 +02:00
* web: Fix stale notifications. * Fix overlap of API and notifications drawers. * Fix issues surrounding duplicate context controller values. * Clean up drawer events, alignment. * Export parts. Fix z-index, colors. * Fix formatting, alignment. repeated renders. * Fix indent. * Fix progress bar fade out, positioning, labels. * Fix clickable area. * Ignore clickable icons. * Clean up logging. * Fix width. * Move event listeners into decorator. * Fix double counting of notifications. * Fix ARIA lables. * Fix empty state ARIA. * Fix order of locale updating. * Fix rebase. * web: fix notification count update * Update selector. * web: Fix CAPTCHA locale. * Clean up logging. --------- Co-authored-by: macmoritz <tratarmoritz@gmail.com>
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { DEFAULT_CONFIG } from "#common/api/config";
|
|
import { isGuest } from "#common/users";
|
|
|
|
import { ReactiveContextController } from "#elements/controllers/ReactiveContextController";
|
|
import { SessionMixin } from "#elements/mixins/session";
|
|
import { VersionContext, VersionMixin } from "#elements/mixins/version";
|
|
import type { ReactiveElementHost } from "#elements/types";
|
|
|
|
import { AdminApi, Version } from "@goauthentik/api";
|
|
|
|
import { ContextProvider } from "@lit/context";
|
|
|
|
export class VersionContextController extends ReactiveContextController<Version> {
|
|
protected static override logPrefix = "version";
|
|
|
|
public host: ReactiveElementHost<SessionMixin & VersionMixin>;
|
|
public context: ContextProvider<VersionContext>;
|
|
|
|
constructor(host: ReactiveElementHost<SessionMixin & VersionMixin>, initialValue?: Version) {
|
|
super();
|
|
|
|
this.host = host;
|
|
this.context = new ContextProvider(this.host, {
|
|
context: VersionContext,
|
|
initialValue,
|
|
});
|
|
}
|
|
|
|
protected apiEndpoint(requestInit?: RequestInit) {
|
|
return new AdminApi(DEFAULT_CONFIG).adminVersionRetrieve(requestInit);
|
|
}
|
|
|
|
protected doRefresh(version: Version) {
|
|
this.context.setValue(version);
|
|
this.host.version = version;
|
|
}
|
|
|
|
public hostUpdate() {
|
|
const { currentUser } = this.host;
|
|
|
|
if (currentUser && !isGuest(currentUser) && !this.host.version && !this.abortController) {
|
|
this.refresh();
|
|
|
|
return;
|
|
}
|
|
|
|
if (!currentUser) {
|
|
this.abort("Session Invalidated");
|
|
}
|
|
}
|
|
}
|