Skip to content

Commit d47a058

Browse files
committed
Show when an event was triggered via the API directly
1 parent 4f3651b commit d47a058

File tree

6 files changed

+26
-2
lines changed

6 files changed

+26
-2
lines changed

resources/scripts/api/definitions/user/models.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface ActivityLog extends Model<'actor'> {
2323
batch: UUID | null;
2424
event: string;
2525
ip: string;
26+
isApi: boolean;
2627
description: string | null;
2728
properties: Record<string, string | unknown>;
2829
hasAdditionalMetadata: boolean;

resources/scripts/api/definitions/user/transformers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default class Transformers {
3434
batch: attributes.batch,
3535
event: attributes.event,
3636
ip: attributes.ip,
37+
isApi: attributes.is_api,
3738
description: attributes.description,
3839
properties: attributes.properties,
3940
hasAdditionalMetadata: attributes.has_additional_metadata ?? false,

resources/scripts/components/dashboard/activity/ActivityLogContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default () => {
5555
<ActivityLogEntry key={activity.timestamp.toString() + activity.event} activity={activity}>
5656
{typeof activity.properties.useragent === 'string' &&
5757
<Tooltip content={activity.properties.useragent} placement={'top'}>
58-
<DesktopComputerIcon className={'ml-2 w-4 h-4 cursor-pointer'}/>
58+
<span><DesktopComputerIcon/></span>
5959
</Tooltip>
6060
}
6161
</ActivityLogEntry>

resources/scripts/components/elements/activity/ActivityLogEntry.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { format, formatDistanceToNowStrict } from 'date-fns';
77
import { ActivityLog } from '@definitions/user';
88
import { useLocation } from 'react-router';
99
import ActivityLogMetaButton from '@/components/elements/activity/ActivityLogMetaButton';
10+
import { TerminalIcon } from '@heroicons/react/solid';
11+
import classNames from 'classnames';
12+
import style from './style.module.css';
1013

1114
interface Props {
1215
activity: ActivityLog;
@@ -48,7 +51,14 @@ export default ({ activity, children }: Props) => {
4851
>
4952
{activity.event}
5053
</Link>
51-
{children}
54+
<div className={classNames(style.icons, 'group-hover:text-gray-300')}>
55+
{activity.isApi &&
56+
<Tooltip placement={'top'} content={'Performed using API Key'}>
57+
<span><TerminalIcon/></span>
58+
</Tooltip>
59+
}
60+
{children}
61+
</div>
5262
</div>
5363
<p className={'mt-1 text-sm break-words line-clamp-2 pr-4'}>
5464
<Translate ns={'activity'} values={activity.properties}>

resources/scripts/components/elements/activity/ActivityLogMetaButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default ({ meta }: { meta: Record<string, unknown> }) => {
2222
</Dialog.Buttons>
2323
</Dialog>
2424
<button
25+
aria-describedby={'View additional event metadata'}
2526
className={'p-2 transition-colors duration-100 text-gray-400 group-hover:text-gray-300 group-hover:hover:text-gray-50'}
2627
onClick={() => setOpen(true)}
2728
>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.icons {
2+
@apply flex space-x-1 mx-2 transition-colors duration-100 text-gray-400;
3+
4+
& > span {
5+
@apply px-1 py-px cursor-pointer hover:text-gray-50;
6+
}
7+
8+
& svg {
9+
@apply w-4 h-4;
10+
}
11+
}

0 commit comments

Comments
 (0)