mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05:00
Added resource
to data available to audit log
- this allows us to hydrate the post title into the UI - needs work to support non-post and missing resources
This commit is contained in:
parent
2d1d810198
commit
83702c7e86
2 changed files with 55 additions and 50 deletions
|
@ -8,11 +8,15 @@ export default class ParseAuditLogEvent extends Helper {
|
||||||
const action = getAction(ev);
|
const action = getAction(ev);
|
||||||
const actionIcon = getActionIcon(ev);
|
const actionIcon = getActionIcon(ev);
|
||||||
const getActor = () => this.store.findRecord('user', ev.actor_id, {reload: false});
|
const getActor = () => this.store.findRecord('user', ev.actor_id, {reload: false});
|
||||||
|
const getResource = () => this.store.findRecord(ev.resource_type, ev.resource_id, {reload: false});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
get actor() {
|
get actor() {
|
||||||
return getActor();
|
return getActor();
|
||||||
},
|
},
|
||||||
|
get resource() {
|
||||||
|
return getResource();
|
||||||
|
},
|
||||||
actionIcon,
|
actionIcon,
|
||||||
action,
|
action,
|
||||||
original: ev
|
original: ev
|
||||||
|
|
|
@ -9,61 +9,62 @@
|
||||||
<div class="view-container">
|
<div class="view-container">
|
||||||
{{#let (audit-log-event-fetcher pageSize=50) as |eventsFetcher|}}
|
{{#let (audit-log-event-fetcher pageSize=50) as |eventsFetcher|}}
|
||||||
{{#if eventsFetcher.data}}
|
{{#if eventsFetcher.data}}
|
||||||
<div class="gh-list-scrolling">
|
<div class="gh-list-scrolling">
|
||||||
<table class="gh-list">
|
<table class="gh-list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>User</th>
|
<th>User</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
<th>Time</th>
|
<th>Time</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#each eventsFetcher.data as |event|}}
|
{{#each eventsFetcher.data as |event|}}
|
||||||
{{#let (parse-audit-log-event event) as |ev|}}
|
{{#let (parse-audit-log-event event) as |ev|}}
|
||||||
<tr>
|
<tr>
|
||||||
<div class="gh-list-data">
|
<div class="gh-list-data">
|
||||||
<div class="flex items-center">
|
<div class="flex">
|
||||||
<div class="w-80">
|
<span class="user-list-item-figure" style={{background-image-style ev.actor.profileImageUrl}}>
|
||||||
<h3 class="ma0 pa0 gh-members-list-name">{{ev.actor.name}}</h3>
|
<span class="hidden">Photo of {{ev.actor.name}}</span>
|
||||||
</div>
|
</span>
|
||||||
</div>
|
<h3 class="ma0 pa0 gh-members-list-name">{{ev.actor.name}}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="gh-list-data">
|
</div>
|
||||||
<div class="gh-members-activity-container">
|
<div class="gh-list-data">
|
||||||
<div class="gh-members-activity-icon">{{svg-jar ev.actionIcon}}</div>
|
<div class="gh-members-activity-container">
|
||||||
<div class="gh-members-activity-event">
|
<div class="gh-members-activity-icon">{{svg-jar ev.actionIcon}}</div>
|
||||||
<span class="gh-members-activity-description">
|
<div class="gh-members-activity-event">
|
||||||
{{capitalize-first-letter ev.action}} <strong>{{ev.original.resource_id}}</strong>
|
<span class="gh-members-activity-description">
|
||||||
</span>
|
{{capitalize-first-letter ev.action}} <strong>{{ev.resource.title}}</strong>
|
||||||
</div>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="gh-list-data">{{moment-format ev.original.created_at "DD MMM YYYY HH:mm:ss"}}</div>
|
</div>
|
||||||
</tr>
|
<div class="gh-list-data">{{moment-format ev.original.created_at "DD MMM YYYY HH:mm:ss"}}</div>
|
||||||
{{/let}}
|
</tr>
|
||||||
{{/each}}
|
{{/let}}
|
||||||
</tbody>
|
{{/each}}
|
||||||
</table>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
{{#if (not (or eventsFetcher.isLoading eventsFetcher.hasReachedEnd))}}
|
{{#if (not (or eventsFetcher.isLoading eventsFetcher.hasReachedEnd))}}
|
||||||
<GhScrollTrigger @enter={{eventsFetcher.loadNextPage}} @triggerOffset={{250}} />
|
<GhScrollTrigger @enter={{eventsFetcher.loadNextPage}} @triggerOffset={{250}} />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#unless eventsFetcher.isLoading}}
|
{{#unless eventsFetcher.isLoading}}
|
||||||
<div class="no-posts-box">
|
<div class="no-posts-box">
|
||||||
<div class="no-posts">
|
<div class="no-posts">
|
||||||
{{svg-jar "activity-placeholder" class="gh-members-placeholder"}}
|
{{svg-jar "activity-placeholder" class="gh-members-placeholder"}}
|
||||||
<h4>No staff activity yet</h4>
|
<h4>No staff activity yet</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if eventsFetcher.isLoading}}
|
{{#if eventsFetcher.isLoading}}
|
||||||
<div class="no-posts-box"><GhLoadingSpinner /></div>
|
<div class="no-posts-box"><GhLoadingSpinner /></div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/let}}
|
{{/let}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Add table
Reference in a new issue