web/admin: improve display of rule severity
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		@ -14,7 +14,20 @@ import { t } from "@lingui/macro";
 | 
			
		||||
import { TemplateResult, html } from "lit";
 | 
			
		||||
import { customElement, property } from "lit/decorators.js";
 | 
			
		||||
 | 
			
		||||
import { EventsApi, NotificationRule } from "@goauthentik/api";
 | 
			
		||||
import { EventsApi, NotificationRule, SeverityEnum } from "@goauthentik/api";
 | 
			
		||||
 | 
			
		||||
export function SeverityToLabel(severity: SeverityEnum | null | undefined): string {
 | 
			
		||||
    if (!severity) return t`Unknown severity`;
 | 
			
		||||
    switch (severity) {
 | 
			
		||||
        case SeverityEnum.Alert:
 | 
			
		||||
            return t`Alert`;
 | 
			
		||||
        case SeverityEnum.Notice:
 | 
			
		||||
            return t`Notice`;
 | 
			
		||||
        case SeverityEnum.Warning:
 | 
			
		||||
            return t`Warning`;
 | 
			
		||||
    }
 | 
			
		||||
    return t`Unknown severity`;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@customElement("ak-event-rule-list")
 | 
			
		||||
export class RuleListPage extends TablePage<NotificationRule> {
 | 
			
		||||
@ -80,7 +93,7 @@ export class RuleListPage extends TablePage<NotificationRule> {
 | 
			
		||||
    row(item: NotificationRule): TemplateResult[] {
 | 
			
		||||
        return [
 | 
			
		||||
            html`${item.name}`,
 | 
			
		||||
            html`${item.severity}`,
 | 
			
		||||
            html`${SeverityToLabel(item.severity)}`,
 | 
			
		||||
            html`${item.groupObj?.name || t`None (rule disabled)`}`,
 | 
			
		||||
            html`<ak-forms-modal>
 | 
			
		||||
                <span slot="submit"> ${t`Update`} </span>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user