web: improve UI for event actions

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-07-23 22:27:51 +02:00
parent a745022f06
commit 464c27ef17
5 changed files with 265 additions and 3 deletions

View file

@ -1,6 +1,6 @@
import { t } from "@lingui/macro";
import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
import { EventsApi, Notification } from "authentik-api";
import { EventActions, EventsApi, Notification } from "authentik-api";
import { AKResponse } from "../../api/Client";
import { DEFAULT_CONFIG } from "../../api/Config";
import PFBase from "@patternfly/patternfly/patternfly-base.css";
@ -10,6 +10,7 @@ import PFButton from "@patternfly/patternfly/components/Button/button.css";
import AKGlobal from "../../authentik.css";
import PFContent from "@patternfly/patternfly/components/Content/content.css";
import { EVENT_NOTIFICATION_TOGGLE } from "../../constants";
import { ActionToLabel } from "../../pages/events/utils";
@customElement("ak-notification-drawer")
export class NotificationDrawer extends LitElement {
@ -70,7 +71,7 @@ export class NotificationDrawer extends LitElement {
<i class="fas fa-info-circle" aria-hidden="true"></i>
</span>
<h2 class="pf-c-notification-drawer__list-item-header-title">
${item.event?.action}
${ActionToLabel(item.event?.action)}
</h2>
</div>
<div class="pf-c-notification-drawer__list-item-action">

View file

@ -208,6 +208,10 @@ msgstr "Application"
msgid "Application Icon"
msgstr "Application Icon"
#: src/pages/events/utils.ts
msgid "Application authorized"
msgstr "Application authorized"
#: src/flows/stages/consent/ConsentStage.ts
msgid "Application requires following permissions:"
msgstr "Application requires following permissions:"
@ -676,6 +680,10 @@ msgstr "Confidential clients are capable of maintaining the confidentiality of t
msgid "Configuration"
msgstr "Configuration"
#: src/pages/events/utils.ts
msgid "Configuration error"
msgstr "Configuration error"
#: src/pages/stages/authenticator_duo/AuthenticatorDuoStageForm.ts
#: src/pages/stages/authenticator_static/AuthenticatorStaticStageForm.ts
#: src/pages/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts
@ -1299,6 +1307,10 @@ msgstr "Email address"
msgid "Email info:"
msgstr "Email info:"
#: src/pages/events/utils.ts
msgid "Email sent"
msgstr "Email sent"
#: src/pages/stages/prompt/PromptForm.ts
msgid "Email: Text field with Email type."
msgstr "Email: Text field with Email type."
@ -1505,6 +1517,10 @@ msgstr "External host"
msgid "Failed attempts before cancel"
msgstr "Failed attempts before cancel"
#: src/pages/events/utils.ts
msgid "Failed login"
msgstr "Failed login"
#: src/pages/admin-overview/charts/LDAPSyncStatusChart.ts
msgid "Failed sources"
msgstr "Failed sources"
@ -1674,6 +1690,10 @@ msgstr "From address"
msgid "GID start number"
msgstr "GID start number"
#: src/pages/events/utils.ts
msgid "General system exception"
msgstr "General system exception"
#: src/pages/admin-overview/AdminOverviewPage.ts
msgid "General system status"
msgstr "General system status"
@ -1857,6 +1877,14 @@ msgstr "If your authentik Instance is using a self-signed certificate, set this
msgid "Impersonate"
msgstr "Impersonate"
#: src/pages/events/utils.ts
msgid "Impersonation ended"
msgstr "Impersonation ended"
#: src/pages/events/utils.ts
msgid "Impersonation started"
msgstr "Impersonation started"
#: src/pages/flows/FlowListPage.ts
#: src/pages/flows/FlowListPage.ts
msgid "Import"
@ -1918,6 +1946,10 @@ msgstr "Invalidation flow"
msgid "Invitation"
msgstr "Invitation"
#: src/pages/events/utils.ts
msgid "Invitation used"
msgstr "Invitation used"
#: src/interfaces/AdminInterface.ts
#: src/pages/stages/invitation/InvitationListPage.ts
msgid "Invitations"
@ -2136,6 +2168,10 @@ msgstr "Local"
msgid "Log the currently pending user in."
msgstr "Log the currently pending user in."
#: src/pages/events/utils.ts
msgid "Login"
msgstr "Login"
#: src/pages/sources/ldap/LDAPSourceForm.ts
msgid "Login password is synced from LDAP into authentik automatically. Enable this option only to write password changes in authentik back to LDAP."
msgstr "Login password is synced from LDAP into authentik automatically. Enable this option only to write password changes in authentik back to LDAP."
@ -2157,6 +2193,10 @@ msgstr "Logins over the last 24 hours"
msgid "Logo"
msgstr "Logo"
#: src/pages/events/utils.ts
msgid "Logout"
msgstr "Logout"
#: src/pages/providers/oauth2/OAuth2ProviderViewPage.ts
msgid "Logout URL"
msgstr "Logout URL"
@ -2247,6 +2287,18 @@ msgstr "Mode"
msgid "Model Name"
msgstr "Model Name"
#: src/pages/events/utils.ts
msgid "Model created"
msgstr "Model created"
#: src/pages/events/utils.ts
msgid "Model deleted"
msgstr "Model deleted"
#: src/pages/events/utils.ts
msgid "Model updated"
msgstr "Model updated"
#: src/interfaces/AdminInterface.ts
msgid "Monitor"
msgstr "Monitor"
@ -2665,6 +2717,10 @@ msgstr "Password"
msgid "Password field"
msgstr "Password field"
#: src/pages/events/utils.ts
msgid "Password set"
msgstr "Password set"
#: src/pages/stages/identification/IdentificationStageForm.ts
msgid "Password stage"
msgstr "Password stage"
@ -2730,6 +2786,14 @@ msgstr "Policy binding"
msgid "Policy engine mode"
msgstr "Policy engine mode"
#: src/pages/events/utils.ts
msgid "Policy exception"
msgstr "Policy exception"
#: src/pages/events/utils.ts
msgid "Policy execution"
msgstr "Policy execution"
#: src/pages/policies/BoundPoliciesList.ts
msgid "Policy {0}"
msgstr "Policy {0}"
@ -2798,6 +2862,10 @@ msgstr "Prompts"
msgid "Property Mapping"
msgstr "Property Mapping"
#: src/pages/events/utils.ts
msgid "Property Mapping exception"
msgstr "Property Mapping exception"
#: src/interfaces/AdminInterface.ts
#: src/pages/property-mappings/PropertyMappingListPage.ts
msgid "Property Mappings"
@ -3144,6 +3212,14 @@ msgstr "Search..."
msgid "Secret key"
msgstr "Secret key"
#: src/pages/events/utils.ts
msgid "Secret was rotation"
msgstr "Secret was rotation"
#: src/pages/events/utils.ts
msgid "Secret was viewed"
msgstr "Secret was viewed"
#: src/pages/events/EventInfo.ts
msgid "Secret:"
msgstr "Secret:"
@ -3349,6 +3425,10 @@ msgstr "Something went wrong! Please try again later."
msgid "Source"
msgstr "Source"
#: src/pages/events/utils.ts
msgid "Source linked"
msgstr "Source linked"
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts
msgid "Source {0}"
msgstr "Source {0}"
@ -3768,6 +3848,10 @@ msgstr "Superuser-groups"
msgid "Superusers"
msgstr "Superusers"
#: src/pages/events/utils.ts
msgid "Suspicious request"
msgstr "Suspicious request"
#: src/pages/policies/password/PasswordPolicyForm.ts
msgid "Symbol charset"
msgstr "Symbol charset"
@ -3797,6 +3881,14 @@ msgstr "System Overview"
msgid "System Tasks"
msgstr "System Tasks"
#: src/pages/events/utils.ts
msgid "System task exception"
msgstr "System task exception"
#: src/pages/events/utils.ts
msgid "System task execution"
msgstr "System task execution"
#: src/pages/outposts/ServiceConnectionDockerForm.ts
msgid "TLS Authentication Certificate"
msgstr "TLS Authentication Certificate"
@ -4255,6 +4347,10 @@ msgstr "Update Token"
msgid "Update User"
msgstr "Update User"
#: src/pages/events/utils.ts
msgid "Update available"
msgstr "Update available"
#: src/pages/user-settings/UserDetailsPage.ts
msgid "Update details"
msgstr "Update details"
@ -4375,6 +4471,10 @@ msgstr "User object filter"
msgid "User password writeback"
msgstr "User password writeback"
#: src/pages/events/utils.ts
msgid "User was written to"
msgstr "User was written to"
#: src/pages/policies/BoundPoliciesList.ts
#: src/pages/users/UserViewPage.ts
msgid "User {0}"

View file

@ -208,6 +208,10 @@ msgstr ""
msgid "Application Icon"
msgstr ""
#: src/pages/events/utils.ts
msgid "Application authorized"
msgstr ""
#: src/flows/stages/consent/ConsentStage.ts
msgid "Application requires following permissions:"
msgstr ""
@ -670,6 +674,10 @@ msgstr ""
msgid "Configuration"
msgstr ""
#: src/pages/events/utils.ts
msgid "Configuration error"
msgstr ""
#: src/pages/stages/authenticator_duo/AuthenticatorDuoStageForm.ts
#: src/pages/stages/authenticator_static/AuthenticatorStaticStageForm.ts
#: src/pages/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts
@ -1291,6 +1299,10 @@ msgstr ""
msgid "Email info:"
msgstr ""
#: src/pages/events/utils.ts
msgid "Email sent"
msgstr ""
#: src/pages/stages/prompt/PromptForm.ts
msgid "Email: Text field with Email type."
msgstr ""
@ -1497,6 +1509,10 @@ msgstr ""
msgid "Failed attempts before cancel"
msgstr ""
#: src/pages/events/utils.ts
msgid "Failed login"
msgstr ""
#: src/pages/admin-overview/charts/LDAPSyncStatusChart.ts
msgid "Failed sources"
msgstr ""
@ -1666,6 +1682,10 @@ msgstr ""
msgid "GID start number"
msgstr ""
#: src/pages/events/utils.ts
msgid "General system exception"
msgstr ""
#: src/pages/admin-overview/AdminOverviewPage.ts
msgid "General system status"
msgstr ""
@ -1849,6 +1869,14 @@ msgstr ""
msgid "Impersonate"
msgstr ""
#: src/pages/events/utils.ts
msgid "Impersonation ended"
msgstr ""
#: src/pages/events/utils.ts
msgid "Impersonation started"
msgstr ""
#: src/pages/flows/FlowListPage.ts
#: src/pages/flows/FlowListPage.ts
msgid "Import"
@ -1910,6 +1938,10 @@ msgstr ""
msgid "Invitation"
msgstr ""
#: src/pages/events/utils.ts
msgid "Invitation used"
msgstr ""
#: src/interfaces/AdminInterface.ts
#: src/pages/stages/invitation/InvitationListPage.ts
msgid "Invitations"
@ -2128,6 +2160,10 @@ msgstr ""
msgid "Log the currently pending user in."
msgstr ""
#: src/pages/events/utils.ts
msgid "Login"
msgstr ""
#: src/pages/sources/ldap/LDAPSourceForm.ts
msgid "Login password is synced from LDAP into authentik automatically. Enable this option only to write password changes in authentik back to LDAP."
msgstr ""
@ -2149,6 +2185,10 @@ msgstr ""
msgid "Logo"
msgstr ""
#: src/pages/events/utils.ts
msgid "Logout"
msgstr ""
#: src/pages/providers/oauth2/OAuth2ProviderViewPage.ts
msgid "Logout URL"
msgstr ""
@ -2239,6 +2279,18 @@ msgstr ""
msgid "Model Name"
msgstr ""
#: src/pages/events/utils.ts
msgid "Model created"
msgstr ""
#: src/pages/events/utils.ts
msgid "Model deleted"
msgstr ""
#: src/pages/events/utils.ts
msgid "Model updated"
msgstr ""
#: src/interfaces/AdminInterface.ts
msgid "Monitor"
msgstr ""
@ -2657,6 +2709,10 @@ msgstr ""
msgid "Password field"
msgstr ""
#: src/pages/events/utils.ts
msgid "Password set"
msgstr ""
#: src/pages/stages/identification/IdentificationStageForm.ts
msgid "Password stage"
msgstr ""
@ -2722,6 +2778,14 @@ msgstr ""
msgid "Policy engine mode"
msgstr ""
#: src/pages/events/utils.ts
msgid "Policy exception"
msgstr ""
#: src/pages/events/utils.ts
msgid "Policy execution"
msgstr ""
#: src/pages/policies/BoundPoliciesList.ts
msgid "Policy {0}"
msgstr ""
@ -2790,6 +2854,10 @@ msgstr ""
msgid "Property Mapping"
msgstr ""
#: src/pages/events/utils.ts
msgid "Property Mapping exception"
msgstr ""
#: src/interfaces/AdminInterface.ts
#: src/pages/property-mappings/PropertyMappingListPage.ts
msgid "Property Mappings"
@ -3136,6 +3204,14 @@ msgstr ""
msgid "Secret key"
msgstr ""
#: src/pages/events/utils.ts
msgid "Secret was rotation"
msgstr ""
#: src/pages/events/utils.ts
msgid "Secret was viewed"
msgstr ""
#: src/pages/events/EventInfo.ts
msgid "Secret:"
msgstr ""
@ -3341,6 +3417,10 @@ msgstr ""
msgid "Source"
msgstr ""
#: src/pages/events/utils.ts
msgid "Source linked"
msgstr ""
#: src/pages/user-settings/settings/SourceSettingsOAuth.ts
msgid "Source {0}"
msgstr ""
@ -3760,6 +3840,10 @@ msgstr ""
msgid "Superusers"
msgstr ""
#: src/pages/events/utils.ts
msgid "Suspicious request"
msgstr ""
#: src/pages/policies/password/PasswordPolicyForm.ts
msgid "Symbol charset"
msgstr ""
@ -3789,6 +3873,14 @@ msgstr ""
msgid "System Tasks"
msgstr ""
#: src/pages/events/utils.ts
msgid "System task exception"
msgstr ""
#: src/pages/events/utils.ts
msgid "System task execution"
msgstr ""
#: src/pages/outposts/ServiceConnectionDockerForm.ts
msgid "TLS Authentication Certificate"
msgstr ""
@ -4240,6 +4332,10 @@ msgstr ""
msgid "Update User"
msgstr ""
#: src/pages/events/utils.ts
msgid "Update available"
msgstr ""
#: src/pages/user-settings/UserDetailsPage.ts
msgid "Update details"
msgstr ""
@ -4360,6 +4456,10 @@ msgstr ""
msgid "User password writeback"
msgstr ""
#: src/pages/events/utils.ts
msgid "User was written to"
msgstr ""
#: src/pages/policies/BoundPoliciesList.ts
#: src/pages/users/UserViewPage.ts
msgid "User {0}"

View file

@ -8,6 +8,7 @@ import { PAGE_SIZE } from "../../constants";
import { TableColumn } from "../../elements/table/Table";
import { TablePage } from "../../elements/table/TablePage";
import "./EventInfo";
import { ActionToLabel } from "./utils";
@customElement("ak-event-list")
export class EventListPage extends TablePage<Event> {
@ -51,7 +52,7 @@ export class EventListPage extends TablePage<Event> {
row(item: EventWithContext): TemplateResult[] {
return [
html`<div>${item.action}</div>
html`<div>${ActionToLabel(item.action)}</div>
<small>${item.app}</small>`,
item.user?.username ?
html`<a href="#/identity/users/${item.user.pk}">

View file

@ -0,0 +1,60 @@
import { t } from "@lingui/macro";
import { EventActions } from "authentik-api";
export function ActionToLabel(action?: EventActions): string {
if (!action) return "";
switch (action) {
case EventActions.Login:
return t`Login`;
case EventActions.LoginFailed:
return t`Failed login`;
case EventActions.Logout:
return t`Logout`;
case EventActions.UserWrite:
return t`User was written to`;
case EventActions.SuspiciousRequest:
return t`Suspicious request`;
case EventActions.PasswordSet:
return t`Password set`;
case EventActions.SecretView:
return t`Secret was viewed`;
case EventActions.SecretRotate:
return t`Secret was rotation`;
case EventActions.InvitationUsed:
return t`Invitation used`;
case EventActions.AuthorizeApplication:
return t`Application authorized`;
case EventActions.SourceLinked:
return t`Source linked`;
case EventActions.ImpersonationStarted:
return t`Impersonation started`;
case EventActions.ImpersonationEnded:
return t`Impersonation ended`;
case EventActions.PolicyExecution:
return t`Policy execution`;
case EventActions.PolicyException:
return t`Policy exception`;
case EventActions.PropertyMappingException:
return t`Property Mapping exception`;
case EventActions.SystemTaskExecution:
return t`System task execution`;
case EventActions.SystemTaskException:
return t`System task exception`;
case EventActions.SystemException:
return t`General system exception`;
case EventActions.ConfigurationError:
return t`Configuration error`;
case EventActions.ModelCreated:
return t`Model created`;
case EventActions.ModelUpdated:
return t`Model updated`;
case EventActions.ModelDeleted:
return t`Model deleted`;
case EventActions.EmailSent:
return t`Email sent`;
case EventActions.UpdateAvailable:
return t`Update available`;
default:
return action;
}
}