2022-08-16 13:40:33 +03:00
|
|
|
import Controller from '@ember/controller';
|
2022-08-22 16:33:18 +03:00
|
|
|
import {action} from '@ember/object';
|
|
|
|
import {inject as service} from '@ember/service';
|
|
|
|
import {tracked} from '@glimmer/tracking';
|
2022-08-16 13:40:33 +03:00
|
|
|
|
2022-09-06 13:48:45 +03:00
|
|
|
export default class HistoryController extends Controller {
|
2022-08-22 16:33:18 +03:00
|
|
|
@service router;
|
|
|
|
@service settings;
|
|
|
|
@service store;
|
|
|
|
|
2022-08-22 18:12:36 +03:00
|
|
|
queryParams = ['excludedEvents', 'excludedResources', 'user'];
|
2022-08-22 16:33:18 +03:00
|
|
|
|
2022-08-22 18:12:36 +03:00
|
|
|
@tracked excludedEvents = null;
|
2022-08-22 16:33:18 +03:00
|
|
|
@tracked excludedResources = null;
|
|
|
|
@tracked user = null;
|
|
|
|
|
2022-08-22 18:12:36 +03:00
|
|
|
get fullExcludedEvents() {
|
|
|
|
return (this.excludedEvents || '').split(',');
|
|
|
|
}
|
|
|
|
|
2022-08-22 16:33:18 +03:00
|
|
|
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
|
2022-08-22 18:12:36 +03:00
|
|
|
changeExcludedItems({excludedEvents, excludedResources} = {}) {
|
|
|
|
this.router.transitionTo({queryParams: {excludedEvents, excludedResources}});
|
2022-08-22 16:33:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
changeUser(user) {
|
|
|
|
this.router.transitionTo({queryParams: {user: user?.id}});
|
|
|
|
}
|
2022-08-16 13:40:33 +03:00
|
|
|
}
|