events: add mark_all_seen

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-09-04 22:08:12 +02:00
parent 7c1a7bfd9d
commit 2db8b07578
6 changed files with 100 additions and 6 deletions

View File

@ -19,6 +19,8 @@ import AKGlobal from "../../authentik.css";
import PFContent from "@patternfly/patternfly/components/Content/content.css";
import { EVENT_NOTIFICATION_DRAWER_TOGGLE } from "../../constants";
import { ActionToLabel } from "../../pages/events/utils";
import { showMessage } from "../messages/MessageContainer";
import { MessageLevel } from "../messages/Message";
@customElement("ak-notification-drawer")
export class NotificationDrawer extends LitElement {
@ -31,6 +33,12 @@ export class NotificationDrawer extends LitElement {
static get styles(): CSSResult[] {
return [PFBase, PFButton, PFNotificationDrawer, PFContent, PFDropdown, AKGlobal].concat(
css`
.pf-c-drawer__body {
height: 100%;
}
.pf-c-notification-drawer__body {
flex-grow: 1;
}
.pf-c-notification-drawer__header {
height: 114px;
align-items: center;
@ -143,7 +151,7 @@ export class NotificationDrawer extends LitElement {
}}
class="pf-c-button pf-m-plain"
type="button"
aria-label="Close"
aria-label=${t`Close`}
>
<i class="fas fa-times" aria-hidden="true"></i>
</button>
@ -155,6 +163,25 @@ export class NotificationDrawer extends LitElement {
${this.notifications.results.map((n) => this.renderItem(n))}
</ul>
</div>
<div class="pf-c-notification-drawer__footer">
<button
@click=${() => {
new EventsApi(DEFAULT_CONFIG)
.eventsNotificationsMarkAllSeenCreate()
.then(() => {
showMessage({
level: MessageLevel.success,
message: t`Successfully cleared notifications`,
});
});
}}
class="pf-c-button pf-m-secondary pf-m-block"
type="button"
aria-label=${t`Clear all`}
>
${t`Clear all`}
</button>
</div>
</div>
</div>`;
}

View File

@ -276,6 +276,7 @@ msgstr "Application(s)"
#: src/interfaces/AdminInterface.ts
#: src/pages/LibraryPage.ts
#: src/pages/applications/ApplicationListPage.ts
#: src/pages/outposts/OutpostForm.ts
msgid "Applications"
msgstr "Applications"
@ -685,6 +686,11 @@ msgstr "Clear Flow cache"
msgid "Clear Policy cache"
msgstr "Clear Policy cache"
#: src/elements/notifications/NotificationDrawer.ts
#: src/elements/notifications/NotificationDrawer.ts
msgid "Clear all"
msgstr "Clear all"
#: src/pages/flows/FlowForm.ts
msgid "Clear background image"
msgstr "Clear background image"
@ -730,6 +736,7 @@ msgstr "Client Secret"
msgid "Client type"
msgstr "Client type"
#: src/elements/notifications/NotificationDrawer.ts
#: src/pages/outposts/OutpostDeploymentModal.ts
#: src/pages/users/UserListPage.ts
msgid "Close"
@ -3186,7 +3193,6 @@ msgid "Provider(s)"
msgstr "Provider(s)"
#: src/interfaces/AdminInterface.ts
#: src/pages/outposts/OutpostForm.ts
#: src/pages/outposts/OutpostListPage.ts
#: src/pages/providers/ProviderListPage.ts
msgid "Providers"
@ -3910,6 +3916,10 @@ msgstr "Successful"
msgid "Successfully cleared flow cache"
msgstr "Successfully cleared flow cache"
#: src/elements/notifications/NotificationDrawer.ts
msgid "Successfully cleared notifications"
msgstr "Successfully cleared notifications"
#: src/pages/policies/PolicyListPage.ts
msgid "Successfully cleared policy cache"
msgstr "Successfully cleared policy cache"

View File

@ -276,6 +276,7 @@ msgstr ""
#: src/interfaces/AdminInterface.ts
#: src/pages/LibraryPage.ts
#: src/pages/applications/ApplicationListPage.ts
#: src/pages/outposts/OutpostForm.ts
msgid "Applications"
msgstr ""
@ -679,6 +680,11 @@ msgstr ""
msgid "Clear Policy cache"
msgstr ""
#: src/elements/notifications/NotificationDrawer.ts
#: src/elements/notifications/NotificationDrawer.ts
msgid "Clear all"
msgstr ""
#: src/pages/flows/FlowForm.ts
msgid "Clear background image"
msgstr ""
@ -724,6 +730,7 @@ msgstr ""
msgid "Client type"
msgstr ""
#: src/elements/notifications/NotificationDrawer.ts
#: src/pages/outposts/OutpostDeploymentModal.ts
#: src/pages/users/UserListPage.ts
msgid "Close"
@ -3178,7 +3185,6 @@ msgid "Provider(s)"
msgstr ""
#: src/interfaces/AdminInterface.ts
#: src/pages/outposts/OutpostForm.ts
#: src/pages/outposts/OutpostListPage.ts
#: src/pages/providers/ProviderListPage.ts
msgid "Providers"
@ -3902,6 +3908,10 @@ msgstr ""
msgid "Successfully cleared flow cache"
msgstr ""
#: src/elements/notifications/NotificationDrawer.ts
msgid "Successfully cleared notifications"
msgstr ""
#: src/pages/policies/PolicyListPage.ts
msgid "Successfully cleared policy cache"
msgstr ""