From 9e3d1f0baa587700e5d803df3c776ac32b3c1e68 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 3 Mar 2021 10:41:04 +0100 Subject: [PATCH] web: fix circular dependency --- web/src/elements/AdminLoginsChart.ts | 2 +- web/src/elements/messages/MessageContainer.ts | 21 ------------------- .../pages/admin-overview/AdminOverviewPage.ts | 2 +- .../pages/applications/ApplicationViewPage.ts | 2 +- 4 files changed, 3 insertions(+), 24 deletions(-) diff --git a/web/src/elements/AdminLoginsChart.ts b/web/src/elements/AdminLoginsChart.ts index 3d154fa54..2d82dbf27 100644 --- a/web/src/elements/AdminLoginsChart.ts +++ b/web/src/elements/AdminLoginsChart.ts @@ -14,7 +14,7 @@ export interface LoginMetrics { @customElement("ak-admin-logins-chart") export class AdminLoginsChart extends LitElement { - @property() + @property({type: Array}) url: string[] = []; chart?: Chart; diff --git a/web/src/elements/messages/MessageContainer.ts b/web/src/elements/messages/MessageContainer.ts index 9061a7e75..2f66d8721 100644 --- a/web/src/elements/messages/MessageContainer.ts +++ b/web/src/elements/messages/MessageContainer.ts @@ -1,6 +1,5 @@ import { gettext } from "django"; import { LitElement, html, customElement, TemplateResult, property } from "lit-element"; -import { DefaultClient } from "../../api/Client"; import "./Message"; import { APIMessage } from "./Message"; @@ -15,7 +14,6 @@ export function showMessage(message: APIMessage): void { @customElement("ak-message-container") export class MessageContainer extends LitElement { - url = DefaultClient.makeUrl(["root", "messages"]); @property({attribute: false}) messages: APIMessage[] = []; @@ -36,10 +34,6 @@ export class MessageContainer extends LitElement { } } - firstUpdated(): void { - this.fetchMessages(); - } - connect(): void { const wsUrl = `${window.location.protocol.replace("http", "ws")}//${ window.location.host @@ -74,21 +68,6 @@ export class MessageContainer extends LitElement { }); } - /* Fetch messages which were stored in the session. - * This mostly gets messages which were created when the user arrives/leaves the site - * and especially the login flow */ - fetchMessages(): Promise { - console.debug("authentik/messages: fetching messages over direct api"); - return fetch(this.url) - .then((r) => r.json()) - .then((r: APIMessage[]) => { - r.forEach((m: APIMessage) => { - this.messages.push(m); - this.requestUpdate(); - }); - }); - } - render(): TemplateResult { return html`