diff --git a/authentik/root/messages/storage.py b/authentik/root/messages/storage.py index e9204527e..cdbc92627 100644 --- a/authentik/root/messages/storage.py +++ b/authentik/root/messages/storage.py @@ -27,6 +27,7 @@ class ChannelsStorage(BaseStorage): uid, { "type": "event.update", + "message_type": "message", "level": message.level_tag, "tags": message.tags, "message": message.message, diff --git a/web/src/common/ws.ts b/web/src/common/ws.ts index d9dc5004e..ffd1689a3 100644 --- a/web/src/common/ws.ts +++ b/web/src/common/ws.ts @@ -4,7 +4,7 @@ import { MessageLevel } from "../elements/messages/Message"; import { showMessage } from "../elements/messages/MessageContainer"; export interface WSMessage { - type: string; + message_type: string; } export class WebsocketClient { diff --git a/web/src/elements/PageHeader.ts b/web/src/elements/PageHeader.ts index 1ec36d1cb..b3dd34b58 100644 --- a/web/src/elements/PageHeader.ts +++ b/web/src/elements/PageHeader.ts @@ -4,8 +4,10 @@ import PFContent from "@patternfly/patternfly/components/Content/content.css"; import AKGlobal from "../authentik.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFButton from "@patternfly/patternfly/components/Button/button.css"; -import { EVENT_SIDEBAR_TOGGLE, TITLE_DEFAULT } from "../constants"; -import { tenant } from "../api/Config"; +import { EVENT_NOTIFICATION_TOGGLE, EVENT_SIDEBAR_TOGGLE, TITLE_DEFAULT } from "../constants"; +import { DEFAULT_CONFIG, tenant } from "../api/Config"; +import { until } from "lit-html/directives/until"; +import { EventsApi } from "../../api/dist"; @customElement("ak-page-header") export class PageHeader extends LitElement { @@ -44,12 +46,12 @@ export class PageHeader extends LitElement { flex-direction: row; min-height: 114px; } - button.pf-c-button.pf-m-plain.sidebar-trigger { + .pf-c-button.pf-m-plain { background-color: var(--pf-c-page__main-section--m-light--BackgroundColor); border-radius: 0px; } .pf-c-page__main-section { - width: 100%; + flex-grow: 1; display: flex; flex-direction: column; justify-content: center; @@ -57,6 +59,13 @@ export class PageHeader extends LitElement { img.pf-icon { max-height: 24px; } + .sidebar-trigger, + .notification-trigger { + font-size: 24px; + } + .notification-trigger.has-notifications { + color: #2B9AF3; + } `]; } @@ -92,7 +101,26 @@ export class PageHeader extends LitElement { ${this.description ? html`
${this.description}
` : html``} - `; + + ${until(new EventsApi(DEFAULT_CONFIG).eventsNotificationsList({ + seen: false, + ordering: "-created", + pageSize: 1, + }).then(r => { + return html` + `; + }))}`; } } diff --git a/web/src/elements/messages/MessageContainer.ts b/web/src/elements/messages/MessageContainer.ts index 6cbc105c8..a036d2f11 100644 --- a/web/src/elements/messages/MessageContainer.ts +++ b/web/src/elements/messages/MessageContainer.ts @@ -33,7 +33,7 @@ export class MessageContainer extends LitElement { constructor() { super(); this.addEventListener(EVENT_WS_MESSAGE, ((e: CustomEvent