web: Replace lingui.js with lit-localize (#5761)
* \#\# Details
web: replace lingui with lit/localize
\#\# Changes
This rather massive shift replaces the lingui and `t()` syntax with lit-localize, XLIFF, and the `msg()`
syntax used by lit-localize. 90% of this work was mechanized; simple perl scripts found and replaced
all uses of `t()` with the appropriate corresponding syntax for `msg()` and `msg(str())`.
The XLIFF files were auto-generated from the PO files. They have not been audited, and they should be
checked over by professional translators. The actual _strings_ have not been changed, but as this was
a mechanized change there is always the possibility of mis-translation-- not by the translator, but by
the script.
* web: revise lit/localize: fix two installation issues.
* web: revise localization
TL;DR:
- Replaced all of Lingui's `t()` syntax with `msg()` syntax.
- Mechanically (i.e with a script) converted all of the PO files to XLIFF files
- Refactored the localization code to be a bit smarter:
- the function `getBestMatchLocale` takes the locale lists and a requested locale, and returns the
first match of:
- The locale's code exactly matches the requested locale
- The locale code exactly matches the prefix of the requested locale (i.e the "en" part of "en-US")
- the locale code's prefix exactly matches the prefix of the requested locale
This function is passed to lit-locate's `loadLocale()`.
- `activateLocale()` just calls `loadLocale()` now.
- `autodetectLanguage` searches the following, and picks the first that returns a valid locale
object, before passing it to `loadLocale()`:
- The User's settings
- A `?locale=` component found in `window.location.search`
- The `window.navigator.language` field
- English
The `msg()` only runs when it's run. This seems obvious, but it means that you cannot cache
strings at load time; they must be kept inside functions that are re-run so that the `msg()` engine
can look up the strings in the preferred language of the user at that moment.
You can use thunks-of-strings if you really need them that way.
* Including the 'xliff-converter' in case anyone wants to review it.
* The xliff-converter is tagged as 'xliff-converter', but has been
deleted.
\#\# Details
- Resolves #5171
\#\# Changes
\#\#\# New Features
- Adds a "Add an Application" to the LibraryView if there are no applications and the user is an administrator.
\#\#\# Breaking Changes
- Adds breaking change which causes \<issue\>.
\#\# Checklist
- [ ] Local tests pass (`ak test authentik/`)
- [ ] The code has been formatted (`make lint-fix`)
If an API change has been made
- [ ] The API schema has been updated (`make gen-build`)
If changes to the frontend have been made
- [ ] The code has been formatted (`make web`)
- [ ] The translation files have been updated (`make i18n-extract`)
If applicable
- [ ] The documentation has been updated
- [ ] The documentation has been formatted (`make website`)
* web: fix redundant locales for zh suite.
* web: prettier pass for locale update
* web: localization moderization
Changed the names of the lit-localize commands to make it clear they're
part of the localization effort, and not just "build" and "extract".
* update transifex config
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* fix package lock?
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* use build not compile
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* web: conversion to lit-localize
The CI produced a list of problems that I hadn't caught earlier,
due to a typo ("localize build" is correct, "localize compile" is
not) I had left in package.json. They were minor and linty, but
it was still wise to fix them.
* web: replace lingui with lit/locale
This commit fixes some minor linting issues that were hidden by a typo in package.json. The
issues were not apparently problematic from a Javascript point of view, but they pointed
to sloppy thinking in the progression of types through the system, so I cleaned them
up and formalized the types from LocaleModule to AkLocale.
* web: replace lingui with lit/localize
One problem that has repeatedly come up is that localize's templates do not produce
JavaScript that conforms with our shop style. I've replaced `build-locale` with
a two-step that builds the locale *and* ensures that it conforms to the shop style
via `prettier` every time.
* web: replace lingui with lit-locale
This commit applies the most recent bundle of translations to the
new lit-locale aspect component. It also revises the algorithm
for *finding* the correct locale, replacing the complex fall-back
with some rather straightforward regular expressions.
In the case of Chinese, the fallback comes at the end of the
selection list, which may not be, er, politically valuable
(since Taiwan and Hong Kong come before, being exceptions that
need to be tested). If we need a different order for presentation,
that'll be a future feature.
* web: replace lingui with lit/locale
Well, that was embarassing.
---------
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -6,8 +6,7 @@ import "@goauthentik/elements/Expand";
|
||||
import "@goauthentik/elements/Spinner";
|
||||
import { PFSize } from "@goauthentik/elements/Spinner";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg, str } from "@lit/localize";
|
||||
import { CSSResult, TemplateResult, css, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { until } from "lit/directives/until.js";
|
||||
@ -62,7 +61,7 @@ export class EventInfo extends AKElement {
|
||||
<dl class="pf-c-description-list pf-m-horizontal">
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`UID`}</span>
|
||||
<span class="pf-c-description-list__text">${msg("UID")}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">${context.pk}</div>
|
||||
@ -70,7 +69,7 @@ export class EventInfo extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`Name`}</span>
|
||||
<span class="pf-c-description-list__text">${msg("Name")}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">${context.name}</div>
|
||||
@ -78,7 +77,7 @@ export class EventInfo extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`App`}</span>
|
||||
<span class="pf-c-description-list__text">${msg("App")}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">${context.app}</div>
|
||||
@ -86,7 +85,7 @@ export class EventInfo extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`Model Name`}</span>
|
||||
<span class="pf-c-description-list__text">${msg("Model Name")}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">${context.model_name}</div>
|
||||
@ -103,7 +102,7 @@ export class EventInfo extends AKElement {
|
||||
return html`<dl class="pf-c-description-list pf-m-horizontal">
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`Message`}</span>
|
||||
<span class="pf-c-description-list__text">${msg("Message")}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">${context.message}</div>
|
||||
@ -111,7 +110,7 @@ export class EventInfo extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`Subject`}</span>
|
||||
<span class="pf-c-description-list__text">${msg("Subject")}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">${context.subject}</div>
|
||||
@ -119,7 +118,7 @@ export class EventInfo extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`From`}</span>
|
||||
<span class="pf-c-description-list__text">${msg("From")}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">${context.from_email}</div>
|
||||
@ -127,7 +126,7 @@ export class EventInfo extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`To`}</span>
|
||||
<span class="pf-c-description-list__text">${msg("To")}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
@ -143,13 +142,13 @@ export class EventInfo extends AKElement {
|
||||
defaultResponse(): TemplateResult {
|
||||
return html`<div class="pf-l-flex">
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Context`}</div>
|
||||
<div class="pf-c-card__title">${msg("Context")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<code>${JSON.stringify(this.event?.context, null, 4)}</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`User`}</div>
|
||||
<div class="pf-c-card__title">${msg("User")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<code>${JSON.stringify(this.event?.user, null, 4)}</code>
|
||||
</div>
|
||||
@ -212,7 +211,7 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
case EventActions.ModelUpdated:
|
||||
case EventActions.ModelDeleted:
|
||||
return html`
|
||||
<div class="pf-c-card__title">${t`Affected model:`}</div>
|
||||
<div class="pf-c-card__title">${msg("Affected model:")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
${this.getModelInfo(this.event.context?.model as EventModel)}
|
||||
</div>
|
||||
@ -220,7 +219,7 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
case EventActions.AuthorizeApplication:
|
||||
return html`<div class="pf-l-flex">
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Authorized application:`}</div>
|
||||
<div class="pf-c-card__title">${msg("Authorized application:")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
${this.getModelInfo(
|
||||
this.event.context.authorized_application as EventModel,
|
||||
@ -228,7 +227,7 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
</div>
|
||||
</div>
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Using flow`}</div>
|
||||
<div class="pf-c-card__title">${msg("Using flow")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<span
|
||||
>${until(
|
||||
@ -250,13 +249,13 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
</div>
|
||||
<ak-expand>${this.defaultResponse()}</ak-expand>`;
|
||||
case EventActions.EmailSent:
|
||||
return html`<div class="pf-c-card__title">${t`Email info:`}</div>
|
||||
return html`<div class="pf-c-card__title">${msg("Email info:")}</div>
|
||||
<div class="pf-c-card__body">${this.getEmailInfo(this.event.context)}</div>
|
||||
<ak-expand>
|
||||
<iframe srcdoc=${this.event.context.body}></iframe>
|
||||
</ak-expand>`;
|
||||
case EventActions.SecretView:
|
||||
return html` <div class="pf-c-card__title">${t`Secret:`}</div>
|
||||
return html` <div class="pf-c-card__title">${msg("Secret:")}</div>
|
||||
${this.getModelInfo(this.event.context.secret as EventModel)}`;
|
||||
case EventActions.SystemException:
|
||||
return html` <a
|
||||
@ -264,11 +263,11 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
target="_blank"
|
||||
href=${this.buildGitHubIssueUrl(this.event.context)}
|
||||
>
|
||||
${t`Open issue on GitHub...`}
|
||||
${msg("Open issue on GitHub...")}
|
||||
</a>
|
||||
<div class="pf-l-flex">
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Exception`}</div>
|
||||
<div class="pf-c-card__title">${msg("Exception")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<pre>${this.event.context.message}</pre>
|
||||
</div>
|
||||
@ -278,13 +277,13 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
case EventActions.PropertyMappingException:
|
||||
return html`<div class="pf-l-flex">
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Exception`}</div>
|
||||
<div class="pf-c-card__title">${msg("Exception")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<pre>${this.event.context.message || this.event.context.error}</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Expression`}</div>
|
||||
<div class="pf-c-card__title">${msg("Expression")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<code>${this.event.context.expression}</code>
|
||||
</div>
|
||||
@ -294,15 +293,15 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
case EventActions.PolicyException:
|
||||
return html`<div class="pf-l-flex">
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Binding`}</div>
|
||||
<div class="pf-c-card__title">${msg("Binding")}</div>
|
||||
${this.getModelInfo(this.event.context.binding as EventModel)}
|
||||
</div>
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Request`}</div>
|
||||
<div class="pf-c-card__title">${msg("Request")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<ul class="pf-c-list">
|
||||
<li>
|
||||
${t`Object`}:
|
||||
${msg("Object")}:
|
||||
${this.getModelInfo(
|
||||
(this.event.context.request as EventContext)
|
||||
.obj as EventModel,
|
||||
@ -310,7 +309,7 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
</li>
|
||||
<li>
|
||||
<span
|
||||
>${t`Context`}:
|
||||
>${msg("Context")}:
|
||||
<code
|
||||
>${JSON.stringify(
|
||||
(this.event.context.request as EventContext)
|
||||
@ -325,7 +324,7 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
</div>
|
||||
</div>
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Exception`}</div>
|
||||
<div class="pf-c-card__title">${msg("Exception")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<code
|
||||
>${this.event.context.message || this.event.context.error}</code
|
||||
@ -337,15 +336,15 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
case EventActions.PolicyExecution:
|
||||
return html`<div class="pf-l-flex">
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Binding`}</div>
|
||||
<div class="pf-c-card__title">${msg("Binding")}</div>
|
||||
${this.getModelInfo(this.event.context.binding as EventModel)}
|
||||
</div>
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Request`}</div>
|
||||
<div class="pf-c-card__title">${msg("Request")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<ul class="pf-c-list">
|
||||
<li>
|
||||
${t`Object`}:
|
||||
${msg("Object")}:
|
||||
${this.getModelInfo(
|
||||
(this.event.context.request as EventContext)
|
||||
.obj as EventModel,
|
||||
@ -353,7 +352,7 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
</li>
|
||||
<li>
|
||||
<span
|
||||
>${t`Context`}:
|
||||
>${msg("Context")}:
|
||||
<code
|
||||
>${JSON.stringify(
|
||||
(this.event.context.request as EventContext)
|
||||
@ -368,15 +367,15 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
</div>
|
||||
</div>
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Result`}</div>
|
||||
<div class="pf-c-card__title">${msg("Result")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<ul class="pf-c-list">
|
||||
<li>
|
||||
${t`Passing`}:
|
||||
${msg("Passing")}:
|
||||
${(this.event.context.result as EventContext).passing}
|
||||
</li>
|
||||
<li>
|
||||
${t`Messages`}:
|
||||
${msg("Messages")}:
|
||||
<ul class="pf-c-list">
|
||||
${(
|
||||
(this.event.context.result as EventContext)
|
||||
@ -395,7 +394,7 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
return html`<div class="pf-c-card__title">${this.event.context.message}</div>
|
||||
<ak-expand>${this.defaultResponse()}</ak-expand>`;
|
||||
case EventActions.UpdateAvailable:
|
||||
return html`<div class="pf-c-card__title">${t`New version available!`}</div>
|
||||
return html`<div class="pf-c-card__title">${msg("New version available!")}</div>
|
||||
<a
|
||||
target="_blank"
|
||||
href="https://github.com/goauthentik/authentik/releases/tag/version%2F${this
|
||||
@ -409,7 +408,7 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
if ("using_source" in this.event.context) {
|
||||
return html`<div class="pf-l-flex">
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Using source`}</div>
|
||||
<div class="pf-c-card__title">${msg("Using source")}</div>
|
||||
${this.getModelInfo(this.event.context.using_source as EventModel)}
|
||||
</div>
|
||||
</div>`;
|
||||
@ -417,18 +416,18 @@ new?labels=bug,from_authentik&title=${encodeURIComponent(title)}
|
||||
return this.defaultResponse();
|
||||
case EventActions.LoginFailed:
|
||||
return html` <div class="pf-c-card__title">
|
||||
${t`Attempted to log in as ${this.event.context.username}`}
|
||||
${msg(str`Attempted to log in as ${this.event.context.username}`)}
|
||||
</div>
|
||||
<ak-expand>${this.defaultResponse()}</ak-expand>`;
|
||||
case EventActions.Logout:
|
||||
if (Object.keys(this.event.context).length === 0) {
|
||||
return html`<span>${t`No additional data available.`}</span>`;
|
||||
return html`<span>${msg("No additional data available.")}</span>`;
|
||||
}
|
||||
return this.defaultResponse();
|
||||
case EventActions.SystemTaskException:
|
||||
return html`<div class="pf-l-flex">
|
||||
<div class="pf-l-flex__item">
|
||||
<div class="pf-c-card__title">${t`Exception`}</div>
|
||||
<div class="pf-c-card__title">${msg("Exception")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<pre>${this.event.context.message}</pre>
|
||||
</div>
|
||||
|
||||
@ -7,8 +7,7 @@ import { PaginatedResponse } from "@goauthentik/elements/table/Table";
|
||||
import { TableColumn } from "@goauthentik/elements/table/Table";
|
||||
import { TablePage } from "@goauthentik/elements/table/TablePage";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg, str } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
|
||||
@ -19,7 +18,7 @@ export class EventListPage extends TablePage<Event> {
|
||||
expandable = true;
|
||||
|
||||
pageTitle(): string {
|
||||
return t`Event Log`;
|
||||
return msg("Event Log");
|
||||
}
|
||||
pageDescription(): string | undefined {
|
||||
return;
|
||||
@ -45,12 +44,12 @@ export class EventListPage extends TablePage<Event> {
|
||||
|
||||
columns(): TableColumn[] {
|
||||
return [
|
||||
new TableColumn(t`Action`, "action"),
|
||||
new TableColumn(t`User`, "user"),
|
||||
new TableColumn(t`Creation Date`, "created"),
|
||||
new TableColumn(t`Client IP`, "client_ip"),
|
||||
new TableColumn(t`Tenant`, "tenant_name"),
|
||||
new TableColumn(t`Actions`),
|
||||
new TableColumn(msg("Action"), "action"),
|
||||
new TableColumn(msg("User"), "user"),
|
||||
new TableColumn(msg("Creation Date"), "created"),
|
||||
new TableColumn(msg("Client IP"), "client_ip"),
|
||||
new TableColumn(msg("Tenant"), "tenant_name"),
|
||||
new TableColumn(msg("Actions")),
|
||||
];
|
||||
}
|
||||
|
||||
@ -65,16 +64,16 @@ export class EventListPage extends TablePage<Event> {
|
||||
${item.user.on_behalf_of
|
||||
? html`<small>
|
||||
<a href="#/identity/users/${item.user.on_behalf_of.pk}"
|
||||
>${t`On behalf of ${item.user.on_behalf_of.username}`}</a
|
||||
>${msg(str`On behalf of ${item.user.on_behalf_of.username}`)}</a
|
||||
>
|
||||
</small>`
|
||||
: html``}`
|
||||
: html`-`,
|
||||
html`<span>${item.created?.toLocaleString()}</span>`,
|
||||
html`<div>${item.clientIp || t`-`}</div>
|
||||
html`<div>${item.clientIp || msg("-")}</div>
|
||||
|
||||
<small>${EventGeo(item)}</small>`,
|
||||
html`<span>${item.tenant?.name || t`-`}</span>`,
|
||||
html`<span>${item.tenant?.name || msg("-")}</span>`,
|
||||
html`<a href="#/events/log/${item.pk}">
|
||||
<i class="fas fa-share-square"></i>
|
||||
</a>`,
|
||||
|
||||
@ -5,8 +5,7 @@ import { EventWithContext } from "@goauthentik/common/events";
|
||||
import { AKElement } from "@goauthentik/elements/Base";
|
||||
import "@goauthentik/elements/PageHeader";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg, str } from "@lit/localize";
|
||||
import { CSSResult, TemplateResult, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
|
||||
@ -41,24 +40,24 @@ export class EventViewPage extends AKElement {
|
||||
|
||||
render(): TemplateResult {
|
||||
if (!this.event) {
|
||||
return html`<ak-page-header icon="pf-icon pf-icon-catalog" header=${t`Loading`}>
|
||||
return html`<ak-page-header icon="pf-icon pf-icon-catalog" header=${msg("Loading")}>
|
||||
</ak-page-header> `;
|
||||
}
|
||||
return html`<ak-page-header
|
||||
icon="pf-icon pf-icon-catalog"
|
||||
header=${t`Event ${this.event.pk}`}
|
||||
header=${msg(str`Event ${this.event.pk}`)}
|
||||
>
|
||||
</ak-page-header>
|
||||
<section class="pf-c-page__main-section pf-m-no-padding-mobile">
|
||||
<div class="pf-l-grid pf-m-gutter">
|
||||
<div class="pf-c-card pf-l-grid__item pf-m-12-col pf-m-4-col-on-xl">
|
||||
<div class="pf-c-card__title">${t`Event info`}</div>
|
||||
<div class="pf-c-card__title">${msg("Event info")}</div>
|
||||
<div class="pf-c-card__body">
|
||||
<dl class="pf-c-description-list pf-m-horizontal">
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Action`}</span
|
||||
>${msg("Action")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -69,7 +68,9 @@ export class EventViewPage extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`App`}</span>
|
||||
<span class="pf-c-description-list__text"
|
||||
>${msg("App")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
@ -79,7 +80,9 @@ export class EventViewPage extends AKElement {
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${t`User`}</span>
|
||||
<span class="pf-c-description-list__text"
|
||||
>${msg("User")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
@ -97,7 +100,9 @@ export class EventViewPage extends AKElement {
|
||||
href="#/identity/users/${this
|
||||
.event.user.on_behalf_of
|
||||
.pk}"
|
||||
>${t`On behalf of ${this.event.user.on_behalf_of.username}`}</a
|
||||
>${msg(
|
||||
str`On behalf of ${this.event.user.on_behalf_of.username}`,
|
||||
)}</a
|
||||
>
|
||||
</small>`
|
||||
: html``}`
|
||||
@ -108,7 +113,7 @@ export class EventViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Created`}</span
|
||||
>${msg("Created")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
@ -120,12 +125,12 @@ export class EventViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Client IP`}</span
|
||||
>${msg("Client IP")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
<div>${this.event.clientIp || t`-`}</div>
|
||||
<div>${this.event.clientIp || msg("-")}</div>
|
||||
<small>${EventGeo(this.event)}</small>
|
||||
</div>
|
||||
</dd>
|
||||
@ -133,12 +138,12 @@ export class EventViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text"
|
||||
>${t`Tenant`}</span
|
||||
>${msg("Tenant")}</span
|
||||
>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
${this.event.tenant?.name || t`-`}
|
||||
${this.event.tenant?.name || msg("-")}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@ -5,8 +5,7 @@ import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
import { customElement } from "lit/decorators.js";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
@ -39,9 +38,9 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return t`Successfully updated rule.`;
|
||||
return msg("Successfully updated rule.");
|
||||
} else {
|
||||
return t`Successfully created rule.`;
|
||||
return msg("Successfully created rule.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +59,7 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
|
||||
|
||||
renderForm(): TemplateResult {
|
||||
return html`<form class="pf-c-form pf-m-horizontal">
|
||||
<ak-form-element-horizontal label=${t`Name`} ?required=${true} name="name">
|
||||
<ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.name)}"
|
||||
@ -68,7 +67,7 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
|
||||
required
|
||||
/>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Group`} name="group">
|
||||
<ak-form-element-horizontal label=${msg("Group")} name="group">
|
||||
<ak-search-select
|
||||
.fetchObjects=${async (query?: string): Promise<Group[]> => {
|
||||
const args: CoreGroupsListRequest = {
|
||||
@ -93,10 +92,16 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
|
||||
>
|
||||
</ak-search-select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Select the group of users which the alerts are sent to. If no group is selected the rule is disabled.`}
|
||||
${msg(
|
||||
"Select the group of users which the alerts are sent to. If no group is selected the rule is disabled.",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Transports`} ?required=${true} name="transports">
|
||||
<ak-form-element-horizontal
|
||||
label=${msg("Transports")}
|
||||
?required=${true}
|
||||
name="transports"
|
||||
>
|
||||
<select class="pf-c-form-control" multiple>
|
||||
${this.eventTransports?.results.map((transport) => {
|
||||
const selected = Array.from(this.instance?.transports || []).some((su) => {
|
||||
@ -108,13 +113,15 @@ export class RuleForm extends ModelForm<NotificationRule, string> {
|
||||
})}
|
||||
</select>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Select which transports should be used to notify the user. If none are selected, the notification will only be shown in the authentik UI.`}
|
||||
${msg(
|
||||
"Select which transports should be used to notify the user. If none are selected, the notification will only be shown in the authentik UI.",
|
||||
)}
|
||||
</p>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Hold control/command to select multiple items.`}
|
||||
${msg("Hold control/command to select multiple items.")}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Severity`} ?required=${true} name="severity">
|
||||
<ak-form-element-horizontal label=${msg("Severity")} ?required=${true} name="severity">
|
||||
<ak-radio
|
||||
.options=${[
|
||||
{
|
||||
|
||||
@ -10,8 +10,7 @@ import { PaginatedResponse } from "@goauthentik/elements/table/Table";
|
||||
import { TableColumn } from "@goauthentik/elements/table/Table";
|
||||
import { TablePage } from "@goauthentik/elements/table/TablePage";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
|
||||
@ -26,10 +25,12 @@ export class RuleListPage extends TablePage<NotificationRule> {
|
||||
return true;
|
||||
}
|
||||
pageTitle(): string {
|
||||
return t`Notification Rules`;
|
||||
return msg("Notification Rules");
|
||||
}
|
||||
pageDescription(): string {
|
||||
return t`Send notifications whenever a specific Event is created and matched by policies.`;
|
||||
return msg(
|
||||
"Send notifications whenever a specific Event is created and matched by policies.",
|
||||
);
|
||||
}
|
||||
pageIcon(): string {
|
||||
return "pf-icon pf-icon-attention-bell";
|
||||
@ -49,17 +50,17 @@ export class RuleListPage extends TablePage<NotificationRule> {
|
||||
|
||||
columns(): TableColumn[] {
|
||||
return [
|
||||
new TableColumn(t`Name`, "name"),
|
||||
new TableColumn(t`Severity`, "severity"),
|
||||
new TableColumn(t`Sent to group`, "group"),
|
||||
new TableColumn(t`Actions`),
|
||||
new TableColumn(msg("Name"), "name"),
|
||||
new TableColumn(msg("Severity"), "severity"),
|
||||
new TableColumn(msg("Sent to group"), "group"),
|
||||
new TableColumn(msg("Actions")),
|
||||
];
|
||||
}
|
||||
|
||||
renderToolbarSelected(): TemplateResult {
|
||||
const disabled = this.selectedElements.length < 1;
|
||||
return html`<ak-forms-delete-bulk
|
||||
objectLabel=${t`Notification rule(s)`}
|
||||
objectLabel=${msg("Notification rule(s)")}
|
||||
.objects=${this.selectedElements}
|
||||
.usedBy=${(item: NotificationRule) => {
|
||||
return new EventsApi(DEFAULT_CONFIG).eventsRulesUsedByList({
|
||||
@ -73,7 +74,7 @@ export class RuleListPage extends TablePage<NotificationRule> {
|
||||
}}
|
||||
>
|
||||
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
|
||||
${t`Delete`}
|
||||
${msg("Delete")}
|
||||
</button>
|
||||
</ak-forms-delete-bulk>`;
|
||||
}
|
||||
@ -84,10 +85,10 @@ export class RuleListPage extends TablePage<NotificationRule> {
|
||||
html`${SeverityToLabel(item.severity)}`,
|
||||
html`${item.groupObj
|
||||
? html`<a href="#/identity/groups/${item.groupObj.pk}">${item.groupObj.name}</a>`
|
||||
: t`None (rule disabled)`}`,
|
||||
: msg("None (rule disabled)")}`,
|
||||
html`<ak-forms-modal>
|
||||
<span slot="submit"> ${t`Update`} </span>
|
||||
<span slot="header"> ${t`Update Notification Rule`} </span>
|
||||
<span slot="submit"> ${msg("Update")} </span>
|
||||
<span slot="header"> ${msg("Update Notification Rule")} </span>
|
||||
<ak-event-rule-form slot="form" .instancePk=${item.pk}> </ak-event-rule-form>
|
||||
<button slot="trigger" class="pf-c-button pf-m-plain">
|
||||
<i class="fas fa-edit"></i>
|
||||
@ -99,10 +100,10 @@ export class RuleListPage extends TablePage<NotificationRule> {
|
||||
renderObjectCreate(): TemplateResult {
|
||||
return html`
|
||||
<ak-forms-modal>
|
||||
<span slot="submit"> ${t`Create`} </span>
|
||||
<span slot="header"> ${t`Create Notification Rule`} </span>
|
||||
<span slot="submit"> ${msg("Create")} </span>
|
||||
<span slot="header"> ${msg("Create Notification Rule")} </span>
|
||||
<ak-event-rule-form slot="form"> </ak-event-rule-form>
|
||||
<button slot="trigger" class="pf-c-button pf-m-primary">${t`Create`}</button>
|
||||
<button slot="trigger" class="pf-c-button pf-m-primary">${msg("Create")}</button>
|
||||
</ak-forms-modal>
|
||||
`;
|
||||
}
|
||||
@ -111,8 +112,10 @@ export class RuleListPage extends TablePage<NotificationRule> {
|
||||
return html` <td role="cell" colspan="4">
|
||||
<div class="pf-c-table__expandable-row-content">
|
||||
<p>
|
||||
${t`These bindings control upon which events this rule triggers. Bindings to
|
||||
groups/users are checked against the user of the event.`}
|
||||
${msg(
|
||||
`These bindings control upon which events this rule triggers.
|
||||
Bindings to groups/users are checked against the user of the event.`,
|
||||
)}
|
||||
</p>
|
||||
<ak-bound-policies-list .target=${item.pk}> </ak-bound-policies-list>
|
||||
</div>
|
||||
|
||||
@ -5,8 +5,7 @@ import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||
import "@goauthentik/elements/forms/Radio";
|
||||
import "@goauthentik/elements/forms/SearchSelect";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
@ -38,9 +37,9 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.instance) {
|
||||
return t`Successfully updated transport.`;
|
||||
return msg("Successfully updated transport.");
|
||||
} else {
|
||||
return t`Successfully created transport.`;
|
||||
return msg("Successfully created transport.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +69,7 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
|
||||
|
||||
renderForm(): TemplateResult {
|
||||
return html`<form class="pf-c-form pf-m-horizontal">
|
||||
<ak-form-element-horizontal label=${t`Name`} ?required=${true} name="name">
|
||||
<ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
|
||||
<input
|
||||
type="text"
|
||||
value="${ifDefined(this.instance?.name)}"
|
||||
@ -78,27 +77,27 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
|
||||
required
|
||||
/>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Mode`} ?required=${true} name="mode">
|
||||
<ak-form-element-horizontal label=${msg("Mode")} ?required=${true} name="mode">
|
||||
<ak-radio
|
||||
@change=${(ev: CustomEvent<NotificationTransportModeEnum>) => {
|
||||
this.onModeChange(ev.detail);
|
||||
}}
|
||||
.options=${[
|
||||
{
|
||||
label: t`Local (notifications will be created within authentik)`,
|
||||
label: msg("Local (notifications will be created within authentik)"),
|
||||
value: NotificationTransportModeEnum.Local,
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
label: t`Email`,
|
||||
label: msg("Email"),
|
||||
value: NotificationTransportModeEnum.Email,
|
||||
},
|
||||
{
|
||||
label: t`Webhook (generic)`,
|
||||
label: msg("Webhook (generic)"),
|
||||
value: NotificationTransportModeEnum.Webhook,
|
||||
},
|
||||
{
|
||||
label: t`Webhook (Slack/Discord)`,
|
||||
label: msg("Webhook (Slack/Discord)"),
|
||||
value: NotificationTransportModeEnum.WebhookSlack,
|
||||
},
|
||||
]}
|
||||
@ -108,7 +107,7 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
?hidden=${!this.showWebhook}
|
||||
label=${t`Webhook URL`}
|
||||
label=${msg("Webhook URL")}
|
||||
name="webhookUrl"
|
||||
?required=${true}
|
||||
>
|
||||
@ -120,7 +119,7 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
?hidden=${!this.showWebhook}
|
||||
label=${t`Webhook Mapping`}
|
||||
label=${msg("Webhook Mapping")}
|
||||
name="webhookMapping"
|
||||
>
|
||||
<ak-search-select
|
||||
@ -163,10 +162,12 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
|
||||
<i class="fas fa-check" aria-hidden="true"></i>
|
||||
</span>
|
||||
</span>
|
||||
<span class="pf-c-switch__label">${t`Send once`}</span>
|
||||
<span class="pf-c-switch__label">${msg("Send once")}</span>
|
||||
</label>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Only send notification once, for example when sending a webhook into a chat channel.`}
|
||||
${msg(
|
||||
"Only send notification once, for example when sending a webhook into a chat channel.",
|
||||
)}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
</form>`;
|
||||
|
||||
@ -9,8 +9,7 @@ import { PaginatedResponse } from "@goauthentik/elements/table/Table";
|
||||
import { TableColumn } from "@goauthentik/elements/table/Table";
|
||||
import { TablePage } from "@goauthentik/elements/table/TablePage";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators.js";
|
||||
|
||||
@ -22,10 +21,10 @@ export class TransportListPage extends TablePage<NotificationTransport> {
|
||||
return true;
|
||||
}
|
||||
pageTitle(): string {
|
||||
return t`Notification Transports`;
|
||||
return msg("Notification Transports");
|
||||
}
|
||||
pageDescription(): string {
|
||||
return t`Define how notifications are sent to users, like Email or Webhook.`;
|
||||
return msg("Define how notifications are sent to users, like Email or Webhook.");
|
||||
}
|
||||
pageIcon(): string {
|
||||
return "pf-icon pf-icon-export";
|
||||
@ -47,16 +46,16 @@ export class TransportListPage extends TablePage<NotificationTransport> {
|
||||
|
||||
columns(): TableColumn[] {
|
||||
return [
|
||||
new TableColumn(t`Name`, "name"),
|
||||
new TableColumn(t`Mode`, "mode"),
|
||||
new TableColumn(t`Actions`),
|
||||
new TableColumn(msg("Name"), "name"),
|
||||
new TableColumn(msg("Mode"), "mode"),
|
||||
new TableColumn(msg("Actions")),
|
||||
];
|
||||
}
|
||||
|
||||
renderToolbarSelected(): TemplateResult {
|
||||
const disabled = this.selectedElements.length < 1;
|
||||
return html`<ak-forms-delete-bulk
|
||||
objectLabel=${t`Notification transport(s)`}
|
||||
objectLabel=${msg("Notification transport(s)")}
|
||||
.objects=${this.selectedElements}
|
||||
.usedBy=${(item: NotificationTransport) => {
|
||||
return new EventsApi(DEFAULT_CONFIG).eventsTransportsUsedByList({
|
||||
@ -70,7 +69,7 @@ export class TransportListPage extends TablePage<NotificationTransport> {
|
||||
}}
|
||||
>
|
||||
<button ?disabled=${disabled} slot="trigger" class="pf-c-button pf-m-danger">
|
||||
${t`Delete`}
|
||||
${msg("Delete")}
|
||||
</button>
|
||||
</ak-forms-delete-bulk>`;
|
||||
}
|
||||
@ -80,8 +79,8 @@ export class TransportListPage extends TablePage<NotificationTransport> {
|
||||
html`${item.name}`,
|
||||
html`${item.modeVerbose}`,
|
||||
html`<ak-forms-modal>
|
||||
<span slot="submit"> ${t`Update`} </span>
|
||||
<span slot="header"> ${t`Update Notification Transport`} </span>
|
||||
<span slot="submit"> ${msg("Update")} </span>
|
||||
<span slot="header"> ${msg("Update Notification Transport")} </span>
|
||||
<ak-event-transport-form slot="form" .instancePk=${item.pk}>
|
||||
</ak-event-transport-form>
|
||||
<button slot="trigger" class="pf-c-button pf-m-plain">
|
||||
@ -104,10 +103,10 @@ export class TransportListPage extends TablePage<NotificationTransport> {
|
||||
renderObjectCreate(): TemplateResult {
|
||||
return html`
|
||||
<ak-forms-modal>
|
||||
<span slot="submit"> ${t`Create`} </span>
|
||||
<span slot="header"> ${t`Create Notification Transport`} </span>
|
||||
<span slot="submit"> ${msg("Create")} </span>
|
||||
<span slot="header"> ${msg("Create Notification Transport")} </span>
|
||||
<ak-event-transport-form slot="form"> </ak-event-transport-form>
|
||||
<button slot="trigger" class="pf-c-button pf-m-primary">${t`Create`}</button>
|
||||
<button slot="trigger" class="pf-c-button pf-m-primary">${msg("Create")}</button>
|
||||
</ak-forms-modal>
|
||||
`;
|
||||
}
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import { EventWithContext } from "@goauthentik/common/events";
|
||||
import { KeyUnknown } from "@goauthentik/elements/forms/Form";
|
||||
|
||||
import { t } from "@lingui/macro";
|
||||
|
||||
import { msg } from "@lit/localize";
|
||||
import { TemplateResult, html } from "lit";
|
||||
|
||||
import { EventActions, SeverityEnum } from "@goauthentik/api";
|
||||
@ -23,71 +22,71 @@ export function ActionToLabel(action?: EventActions): string {
|
||||
if (!action) return "";
|
||||
switch (action) {
|
||||
case EventActions.Login:
|
||||
return t`Login`;
|
||||
return msg("Login");
|
||||
case EventActions.LoginFailed:
|
||||
return t`Failed login`;
|
||||
return msg("Failed login");
|
||||
case EventActions.Logout:
|
||||
return t`Logout`;
|
||||
return msg("Logout");
|
||||
case EventActions.UserWrite:
|
||||
return t`User was written to`;
|
||||
return msg("User was written to");
|
||||
case EventActions.SuspiciousRequest:
|
||||
return t`Suspicious request`;
|
||||
return msg("Suspicious request");
|
||||
case EventActions.PasswordSet:
|
||||
return t`Password set`;
|
||||
return msg("Password set");
|
||||
case EventActions.SecretView:
|
||||
return t`Secret was viewed`;
|
||||
return msg("Secret was viewed");
|
||||
case EventActions.SecretRotate:
|
||||
return t`Secret was rotated`;
|
||||
return msg("Secret was rotated");
|
||||
case EventActions.InvitationUsed:
|
||||
return t`Invitation used`;
|
||||
return msg("Invitation used");
|
||||
case EventActions.AuthorizeApplication:
|
||||
return t`Application authorized`;
|
||||
return msg("Application authorized");
|
||||
case EventActions.SourceLinked:
|
||||
return t`Source linked`;
|
||||
return msg("Source linked");
|
||||
case EventActions.ImpersonationStarted:
|
||||
return t`Impersonation started`;
|
||||
return msg("Impersonation started");
|
||||
case EventActions.ImpersonationEnded:
|
||||
return t`Impersonation ended`;
|
||||
return msg("Impersonation ended");
|
||||
case EventActions.FlowExecution:
|
||||
return t`Flow execution`;
|
||||
return msg("Flow execution");
|
||||
case EventActions.PolicyExecution:
|
||||
return t`Policy execution`;
|
||||
return msg("Policy execution");
|
||||
case EventActions.PolicyException:
|
||||
return t`Policy exception`;
|
||||
return msg("Policy exception");
|
||||
case EventActions.PropertyMappingException:
|
||||
return t`Property Mapping exception`;
|
||||
return msg("Property Mapping exception");
|
||||
case EventActions.SystemTaskExecution:
|
||||
return t`System task execution`;
|
||||
return msg("System task execution");
|
||||
case EventActions.SystemTaskException:
|
||||
return t`System task exception`;
|
||||
return msg("System task exception");
|
||||
case EventActions.SystemException:
|
||||
return t`General system exception`;
|
||||
return msg("General system exception");
|
||||
case EventActions.ConfigurationError:
|
||||
return t`Configuration error`;
|
||||
return msg("Configuration error");
|
||||
case EventActions.ModelCreated:
|
||||
return t`Model created`;
|
||||
return msg("Model created");
|
||||
case EventActions.ModelUpdated:
|
||||
return t`Model updated`;
|
||||
return msg("Model updated");
|
||||
case EventActions.ModelDeleted:
|
||||
return t`Model deleted`;
|
||||
return msg("Model deleted");
|
||||
case EventActions.EmailSent:
|
||||
return t`Email sent`;
|
||||
return msg("Email sent");
|
||||
case EventActions.UpdateAvailable:
|
||||
return t`Update available`;
|
||||
return msg("Update available");
|
||||
default:
|
||||
return action;
|
||||
}
|
||||
}
|
||||
|
||||
export function SeverityToLabel(severity: SeverityEnum | null | undefined): string {
|
||||
if (!severity) return t`Unknown severity`;
|
||||
if (!severity) return msg("Unknown severity");
|
||||
switch (severity) {
|
||||
case SeverityEnum.Alert:
|
||||
return t`Alert`;
|
||||
return msg("Alert");
|
||||
case SeverityEnum.Notice:
|
||||
return t`Notice`;
|
||||
return msg("Notice");
|
||||
case SeverityEnum.Warning:
|
||||
return t`Warning`;
|
||||
return msg("Warning");
|
||||
}
|
||||
return t`Unknown severity`;
|
||||
return msg("Unknown severity");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user