From 78d75134f95dad937db29a1eb449cba02a5cabfe Mon Sep 17 00:00:00 2001 From: Eduard Gert Date: Sat, 9 Mar 2024 17:14:41 +0100 Subject: [PATCH] Add better description for posture check activity events (#349) --- src/modules/activity/ActivityDescription.tsx | 259 ++++++++++++------- src/modules/activity/ActivityTypeIcon.tsx | 5 + 2 files changed, 172 insertions(+), 92 deletions(-) diff --git a/src/modules/activity/ActivityDescription.tsx b/src/modules/activity/ActivityDescription.tsx index 4baca2d..137ab98 100644 --- a/src/modules/activity/ActivityDescription.tsx +++ b/src/modules/activity/ActivityDescription.tsx @@ -31,6 +31,10 @@ export default function ActivityDescription({ event }: Props) { if (!m) return null; + /** + * Setup Key + */ + if (event.activity_code == "setupkey.revoke") return (
@@ -54,13 +58,6 @@ export default function ActivityDescription({ event }: Props) {
); - if (event.activity_code == "dashboard.login") - return ( -
- {m.username} logged in to the dashboard -
- ); - if (event.activity_code == "setupkey.group.delete") return (
@@ -77,6 +74,20 @@ export default function ActivityDescription({ event }: Props) {
); + /** + * Dashboard + */ + if (event.activity_code == "dashboard.login") + return ( +
+ {m.username} logged in to the dashboard +
+ ); + + /** + * Policy + */ + if (event.activity_code == "policy.update") return (
@@ -98,6 +109,10 @@ export default function ActivityDescription({ event }: Props) {
); + /** + * Route + */ + if (event.activity_code == "route.delete") return (
@@ -122,6 +137,10 @@ export default function ActivityDescription({ event }: Props) {
); + /** + * User + */ + if (event.activity_code == "user.peer.delete") return (
@@ -150,6 +169,86 @@ export default function ActivityDescription({ event }: Props) {
); + if (event.activity_code == "user.invite") + return ( +
+ {event.meta.username} {event.meta.email}{" "} + was invited. +
+ ); + + if (event.activity_code == "user.group.add") + return ( +
+ Group {event.meta.group} was added to user{" "} + {event.meta.username} +
+ ); + + if (event.activity_code == "user.block") + return ( +
+ User {event.meta.username}{" "} + {event.meta.email} + was blocked +
+ ); + + if (event.activity_code == "user.unblock") + return ( +
+ User {event.meta.username}{" "} + {event.meta.email} + was unblocked +
+ ); + + if (event.activity_code == "user.delete") + return ( +
+ User {event.meta.username}{" "} + {event.meta.email} was deleted +
+ ); + + if (event.activity_code == "user.group.delete") + return ( +
+ Group {event.meta.group} was removed from user{" "} + {event.meta.username} {event.meta.email} +
+ ); + + if (event.activity_code == "user.role.update") + return ( +
+ Role {event.meta.role} was updated of user{" "} + {event.meta.username} {event.meta.email} +
+ ); + + /** + * Service User + */ + + if (event.activity_code == "service.user.create") + return ( +
+ Service user {event.meta.name} was created +
+ ); + + if (event.activity_code == "service.user.delete") + return ( +
+ Service user {event.meta.name} was deleted +
+ ); + + /** + * Peer + */ + if (event.activity_code == "peer.group.delete") return (
@@ -216,6 +315,10 @@ export default function ActivityDescription({ event }: Props) {
); + /** + * Group + */ + if (event.activity_code == "group.add") return (
@@ -223,6 +326,17 @@ export default function ActivityDescription({ event }: Props) {
); + if (event.activity_code == "group.delete") + return ( +
+ Group {event.meta.name} was deleted +
+ ); + + /** + * Account + */ + if (event.activity_code == "account.create") return (
@@ -230,21 +344,18 @@ export default function ActivityDescription({ event }: Props) {
); - if (event.activity_code == "user.invite") - return ( -
- {event.meta.username} {event.meta.email}{" "} - was invited. -
- ); + if (event.activity_code == "account.setting.peer.login.expiration.update") + return
Global login expiration was updated
; - if (event.activity_code == "user.group.add") - return ( -
- Group {event.meta.group} was added to user{" "} - {event.meta.username} -
- ); + if (event.activity_code == "account.setting.peer.login.expiration.enable") + return
Global login expiration was enabled
; + + if (event.activity_code == "account.setting.peer.login.expiration.disable") + return
Global login expiration was disabled
; + + /** + * Nameserver + */ if (event.activity_code == "nameserver.group.add") return ( @@ -267,14 +378,9 @@ export default function ActivityDescription({ event }: Props) { ); - if (event.activity_code == "account.setting.peer.login.expiration.update") - return
Global login expiration was updated
; - - if (event.activity_code == "account.setting.peer.login.expiration.enable") - return
Global login expiration was enabled
; - - if (event.activity_code == "account.setting.peer.login.expiration.disable") - return
Global login expiration was disabled
; + /** + * Personal Access Token + */ if (event.activity_code == "personal.access.token.create") return ( @@ -292,68 +398,9 @@ export default function ActivityDescription({ event }: Props) { ); - if (event.activity_code == "user.block") - return ( -
- User {event.meta.username}{" "} - {event.meta.email} - was blocked -
- ); - - if (event.activity_code == "user.unblock") - return ( -
- User {event.meta.username}{" "} - {event.meta.email} - was unblocked -
- ); - - if (event.activity_code == "user.delete") - return ( -
- User {event.meta.username}{" "} - {event.meta.email} was deleted -
- ); - - if (event.activity_code == "user.group.delete") - return ( -
- Group {event.meta.group} was removed from user{" "} - {event.meta.username} {event.meta.email} -
- ); - - if (event.activity_code == "user.role.update") - return ( -
- Role {event.meta.role} was updated of user{" "} - {event.meta.username} {event.meta.email} -
- ); - - if (event.activity_code == "service.user.create") - return ( -
- Service user {event.meta.name} was created -
- ); - - if (event.activity_code == "service.user.delete") - return ( -
- Service user {event.meta.name} was deleted -
- ); - - if (event.activity_code == "group.delete") - return ( -
- Group {event.meta.name} was deleted -
- ); + /** + * Integration + */ if (event.activity_code == "integration.create") { if (!event.meta.platform) return "Integration created"; @@ -385,7 +432,10 @@ export default function ActivityDescription({ event }: Props) { ); } - // Group was added to DNS Management Setting that disables DNS for the group + /** + * DNS + */ + if (event.activity_code == "dns.setting.disabled.management.group.add") return (
@@ -402,6 +452,31 @@ export default function ActivityDescription({ event }: Props) {
); + /** + * Posture Checks + */ + + if (event.activity_code == "posture.check.updated") + return ( +
+ Posture check {m.name} was updated +
+ ); + + if (event.activity_code == "posture.check.created") + return ( +
+ Posture check {m.name} was created +
+ ); + + if (event.activity_code == "posture.check.deleted") + return ( +
+ Posture check {m.name} was deleted +
+ ); + // TODO add activity texts // rule.add // rule.update diff --git a/src/modules/activity/ActivityTypeIcon.tsx b/src/modules/activity/ActivityTypeIcon.tsx index 7b1e1ac..e42667d 100644 --- a/src/modules/activity/ActivityTypeIcon.tsx +++ b/src/modules/activity/ActivityTypeIcon.tsx @@ -12,6 +12,7 @@ import { NetworkIcon, Server, Shield, + ShieldCheck, User, } from "lucide-react"; import React from "react"; @@ -70,6 +71,10 @@ export default function ActivityTypeIcon({ return ; } else if (code.startsWith("service")) { return ; + } else if (code.startsWith("posture")) { + return ( + + ); } else { return (