Ghost/ghost/admin/app/templates/settings/audit-log.hbs
Daniel Lockyer 7b160493db
Added support for integration actors in Audit Log UI
refs https://github.com/TryGhost/Toolbox/issues/356

- this enables showing when an integration is the actor doing something
- still need to add a fallback for missing icons
2022-08-18 17:00:56 +02:00

80 lines
3.7 KiB
Handlebars

<section class="gh-canvas gh-members-activity">
<GhCanvasHeader class="gh-canvas-header">
<h2 class="gh-canvas-title" data-test-screen-title>
<LinkTo @route="settings">Settings</LinkTo>
<span>{{svg-jar "arrow-right"}}</span>
<LinkTo @route="settings.audit-log" data-test-link="audit-log-back">Audit log</LinkTo>
</h2>
</GhCanvasHeader>
<div class="view-container">
{{#let (audit-log-event-fetcher pageSize=50) as |eventsFetcher|}}
{{#if eventsFetcher.data}}
<div class="gh-list-scrolling">
<table class="gh-list">
<thead>
<tr>
<th>User</th>
<th>Action</th>
<th>When</th>
</tr>
</thead>
<tbody>
{{#each eventsFetcher.data as |event|}}
{{#let (parse-audit-log-event event) as |ev|}}
<tr>
<div class="gh-list-data gh-list-cellwidth-30">
<div class="flex items-center">
<span class="user-list-item-figure" style={{background-image-style (or ev.actor.profileImageUrl ev.actor.iconImage)}}>
<span class="hidden">Photo of {{ev.actor.name}}</span>
</span>
<h3 class="ma0 pa0 gh-members-list-name">{{ev.actor.name}}</h3>
</div>
</div>
<div class="gh-list-data gh-list-cellwidth-50">
<div class="gh-members-activity-container">
<div class="gh-members-activity-icon">{{svg-jar ev.actionIcon}}</div>
<div class="gh-members-activity-event">
<span class="gh-members-activity-description">
{{capitalize-first-letter ev.action}}
{{#if (or ev.resource.title ev.resource.name)}}
<LinkTo @route="editor.edit" @models={{array ev.resource.displayName ev.resource.id}} class="permalink">
<strong>{{if ev.resource.title ev.resource.title ev.resource.name}}</strong>
</LinkTo>
{{else}}
<br/><small>{{ev.original.resource_id}}</small>
{{/if}}
</span>
</div>
</div>
</div>
<div class="gh-list-data">{{moment-format ev.original.created_at "DD MMM YYYY HH:mm:ss"}}</div>
</tr>
{{/let}}
{{/each}}
</tbody>
</table>
{{#if (not (or eventsFetcher.isLoading eventsFetcher.hasReachedEnd))}}
<GhScrollTrigger @enter={{eventsFetcher.loadNextPage}} @triggerOffset={{250}} />
{{/if}}
</div>
{{else}}
{{#unless eventsFetcher.isLoading}}
<div class="no-posts-box">
<div class="no-posts">
{{svg-jar "activity-placeholder" class="gh-members-placeholder"}}
<h4>No staff activity yet</h4>
</div>
</div>
{{/unless}}
{{/if}}
{{#if eventsFetcher.isLoading}}
<div class="no-posts-box"><GhLoadingSpinner /></div>
{{/if}}
{{/let}}
</div>
</section>
{{outlet}}