Skip to content

Commit a522e3a

Browse files
fix: audit actor name column width (#1319)
1 parent 0591e4f commit a522e3a

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

ui/src/pages/audit-logs/list/actor-cell.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ import KeyIcon from "~/assets/icons/key.svg?react";
77
type ActorCellProps = {
88
size?: "large" | "small";
99
value: AuditRecordActor;
10+
maxLength?: number;
1011
};
1112

12-
export default function ActorCell({ size = "large", value }: ActorCellProps) {
13-
const name = getAuditLogActorName(value);
13+
export default function ActorCell({
14+
size = "large",
15+
value,
16+
maxLength,
17+
}: ActorCellProps) {
18+
const name = getAuditLogActorName(value, maxLength);
1419
const isSystem = value.type === ACTOR_TYPES.SYSTEM;
1520
const isServiceUser = value.type === ACTOR_TYPES.SERVICE_USER;
1621

ui/src/pages/audit-logs/list/list.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
.name-column {
2828
padding-left: var(--rs-space-7);
29-
max-width: 200px;
29+
max-width: 240px;
3030
}
3131
.org-column {
3232
max-width: 200px;

ui/src/pages/audit-logs/list/sidepanel-details.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default function SidePanelDetails({
6969
href={`/users/${actor?.id}`}
7070
label="Actor"
7171
data-test-id="actor-link">
72-
<ActorCell value={actor!} size="small" />
72+
<ActorCell value={actor!} size="small" maxLength={12} />
7373
</SidepanelListItemLink>
7474
<SidepanelListItemLink
7575
isLink={!!orgId && !isZeroUUID(orgId)}

ui/src/pages/audit-logs/util.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ import {
55
AuditRecordSchema,
66
} from "@raystack/proton/frontier";
77

8-
export const getAuditLogActorName = (actor?: AuditRecordActor) => {
8+
export const getAuditLogActorName = (
9+
actor?: AuditRecordActor,
10+
maxLength = 15,
11+
) => {
912
if (actor?.type === ACTOR_TYPES.SYSTEM) return "System";
1013

1114
const name = actor?.title || actor?.name || "-";
1215

13-
if (actor?.metadata?.["is_super_user"] === true) return name + " (Admin)";
16+
if (actor?.metadata?.["is_super_user"] === true)
17+
if (name.length > maxLength)
18+
return name.substring(0, maxLength) + "..." + " (Admin)";
19+
else return name + " (Admin)";
1420

1521
return name;
1622
};

0 commit comments

Comments
 (0)