Ghost/ghost/admin/app/controllers/settings/history.js
Daniel Lockyer b226b03f09
Renamed Audit Log to History
refs https://github.com/TryGhost/Toolbox/issues/356

- this commit updates the route to `/settings/history` and moves all the
  files to their new name so we can avoid further cleanup down the line
2022-09-06 11:49:29 +01:00

45 lines
1.2 KiB
JavaScript

import Controller from '@ember/controller';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
import {tracked} from '@glimmer/tracking';
export default class HistoryController extends Controller {
@service router;
@service settings;
@service store;
queryParams = ['excludedEvents', 'excludedResources', 'user'];
@tracked excludedEvents = null;
@tracked excludedResources = null;
@tracked user = null;
get fullExcludedEvents() {
return (this.excludedEvents || '').split(',');
}
get fullExcludedResources() {
return (this.excludedResources || '').split(',');
}
get userRecord() {
if (!this.user) {
return null;
}
// TODO: {reload: true} here shouldn't be needed but without it
// the template renders nothing if the record is already in the store
return this.store.findRecord('user', this.user, {reload: true});
}
@action
changeExcludedItems({excludedEvents, excludedResources} = {}) {
this.router.transitionTo({queryParams: {excludedEvents, excludedResources}});
}
@action
changeUser(user) {
this.router.transitionTo({queryParams: {user: user?.id}});
}
}