Utilize a unique ID for activity logs to improve rendering perf
This commit is contained in:
parent
e878015109
commit
d6c30092ec
|
@ -18,6 +18,10 @@ class ActivityLogTransformer extends BaseClientTransformer
|
||||||
public function transform(ActivityLog $model): array
|
public function transform(ActivityLog $model): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
// This is not for security, it is only to provide a unique identifier to
|
||||||
|
// the front-end for each entry to improve rendering performance since there
|
||||||
|
// is nothing else sufficiently unique to key off at this point.
|
||||||
|
'id' => sha1($model->id),
|
||||||
'batch' => $model->batch,
|
'batch' => $model->batch,
|
||||||
'event' => $model->event,
|
'event' => $model->event,
|
||||||
'is_api' => !is_null($model->api_key_id),
|
'is_api' => !is_null($model->api_key_id),
|
||||||
|
|
|
@ -20,6 +20,7 @@ interface SSHKey extends Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ActivityLog extends Model<'actor'> {
|
interface ActivityLog extends Model<'actor'> {
|
||||||
|
id: string;
|
||||||
batch: UUID | null;
|
batch: UUID | null;
|
||||||
event: string;
|
event: string;
|
||||||
ip: string | null;
|
ip: string | null;
|
||||||
|
|
|
@ -31,6 +31,7 @@ export default class Transformers {
|
||||||
const { actor } = attributes.relationships || {};
|
const { actor } = attributes.relationships || {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: attributes.id,
|
||||||
batch: attributes.batch,
|
batch: attributes.batch,
|
||||||
event: attributes.event,
|
event: attributes.event,
|
||||||
ip: attributes.ip,
|
ip: attributes.ip,
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default () => {
|
||||||
) : (
|
) : (
|
||||||
<div className={'bg-gray-700'}>
|
<div className={'bg-gray-700'}>
|
||||||
{data?.items.map((activity) => (
|
{data?.items.map((activity) => (
|
||||||
<ActivityLogEntry key={activity.timestamp.toString() + activity.event} activity={activity}>
|
<ActivityLogEntry key={activity.id} activity={activity}>
|
||||||
{typeof activity.properties.useragent === 'string' && (
|
{typeof activity.properties.useragent === 'string' && (
|
||||||
<Tooltip content={activity.properties.useragent} placement={'top'}>
|
<Tooltip content={activity.properties.useragent} placement={'top'}>
|
||||||
<span>
|
<span>
|
||||||
|
|
|
@ -52,7 +52,7 @@ export default () => {
|
||||||
) : (
|
) : (
|
||||||
<div className={'bg-gray-700'}>
|
<div className={'bg-gray-700'}>
|
||||||
{data?.items.map((activity) => (
|
{data?.items.map((activity) => (
|
||||||
<ActivityLogEntry key={activity.timestamp.toString() + activity.event} activity={activity}>
|
<ActivityLogEntry key={activity.id} activity={activity}>
|
||||||
<span />
|
<span />
|
||||||
</ActivityLogEntry>
|
</ActivityLogEntry>
|
||||||
))}
|
))}
|
||||||
|
|
Loading…
Reference in New Issue