mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
Revert codestyle changes (#40)
* Revert "7f7efbb94bab8574e42d942ad82d414e007b2970" Code style changes should probably be part of a PR
This commit is contained in:
@@ -5,95 +5,95 @@ import { AdminModel } from '../../services/adminModel';
|
||||
import { BaseTable, BaseTableState } from '../base-table';
|
||||
import { AdminChatLog } from '../shared/admin-chat-log/admin-chat-log';
|
||||
import {
|
||||
faBell, faSync, faClock, faTrash, faComments, faHdd, faMicrochip, faCertificate, faClone, faPatreon
|
||||
faBell, faSync, faClock, faTrash, faComments, faHdd, faMicrochip, faCertificate, faClone, faPatreon
|
||||
} from '../../../client/icons';
|
||||
|
||||
let state: BaseTableState;
|
||||
|
||||
@Component({
|
||||
selector: 'admin-events',
|
||||
templateUrl: 'admin-events.pug',
|
||||
selector: 'admin-events',
|
||||
templateUrl: 'admin-events.pug',
|
||||
})
|
||||
export class AdminEvents extends BaseTable<Event> implements OnInit, OnDestroy {
|
||||
readonly bellIcon = faBell;
|
||||
readonly syncIcon = faSync;
|
||||
readonly clockIcon = faClock;
|
||||
readonly trashIcon = faTrash;
|
||||
readonly commentsIcon = faComments;
|
||||
readonly hddIcon = faHdd;
|
||||
readonly ramIcon = faMicrochip;
|
||||
readonly certificateIcon = faCertificate;
|
||||
readonly duplicateIcon = faClone;
|
||||
readonly patreonIcon = faPatreon;
|
||||
@ViewChild('chatLog', { static: true }) chatLog!: AdminChatLog;
|
||||
private chatEvent?: Event;
|
||||
constructor(private model: AdminModel) {
|
||||
super();
|
||||
}
|
||||
get status() {
|
||||
return this.model.state.status;
|
||||
}
|
||||
get isLowDiskSpace() {
|
||||
return this.model.isLowDiskSpace;
|
||||
}
|
||||
get isLowMemory() {
|
||||
return this.model.isLowMemory;
|
||||
}
|
||||
get isOldCertificate() {
|
||||
return this.model.isOldCertificate;
|
||||
}
|
||||
get isOldPatreon() {
|
||||
return this.model.isOldPatreon;
|
||||
}
|
||||
get items() {
|
||||
return this.model.events;
|
||||
}
|
||||
get duplicateEntries() {
|
||||
return this.model.duplicateEntries;
|
||||
}
|
||||
get notifications() {
|
||||
return this.model.notifications;
|
||||
}
|
||||
ngOnInit() {
|
||||
this.model.updated = () => this.updateItems();
|
||||
this.setState(state);
|
||||
this.updateItems();
|
||||
}
|
||||
ngOnDestroy() {
|
||||
this.model.updated = () => { };
|
||||
}
|
||||
cleanupDeleted() {
|
||||
this.model.cleanupDeletedEvents();
|
||||
}
|
||||
refreshDuplicates() {
|
||||
this.model.checkDuplicateEntries(true);
|
||||
}
|
||||
removeEvents(olderThan: number) {
|
||||
const date = fromNow(-olderThan);
|
||||
const oldEvents = this.items.filter(e => e.updatedAt.getTime() < date.getTime());
|
||||
return Promise.all(oldEvents.map(e => this.model.removeEvent(e._id).then(() => this.removedEvent(e))));
|
||||
}
|
||||
showChat(e?: ChatEvent) {
|
||||
this.chatEvent = e && e.event;
|
||||
this.chatLog.show(e && e.account);
|
||||
}
|
||||
addChat(e: ChatEvent) {
|
||||
if (e.account) {
|
||||
this.chatLog.add(e.account);
|
||||
}
|
||||
}
|
||||
removedEvent(e: Event) {
|
||||
if (this.chatEvent === e) {
|
||||
this.chatLog.close();
|
||||
}
|
||||
}
|
||||
toggleNotifications() {
|
||||
this.model.toggleNotifications();
|
||||
}
|
||||
protected onChange() {
|
||||
state = this.getState();
|
||||
}
|
||||
protected updatePage() {
|
||||
super.updatePage();
|
||||
}
|
||||
readonly bellIcon = faBell;
|
||||
readonly syncIcon = faSync;
|
||||
readonly clockIcon = faClock;
|
||||
readonly trashIcon = faTrash;
|
||||
readonly commentsIcon = faComments;
|
||||
readonly hddIcon = faHdd;
|
||||
readonly ramIcon = faMicrochip;
|
||||
readonly certificateIcon = faCertificate;
|
||||
readonly duplicateIcon = faClone;
|
||||
readonly patreonIcon = faPatreon;
|
||||
@ViewChild('chatLog', { static: true }) chatLog!: AdminChatLog;
|
||||
private chatEvent?: Event;
|
||||
constructor(private model: AdminModel) {
|
||||
super();
|
||||
}
|
||||
get status() {
|
||||
return this.model.state.status;
|
||||
}
|
||||
get isLowDiskSpace() {
|
||||
return this.model.isLowDiskSpace;
|
||||
}
|
||||
get isLowMemory() {
|
||||
return this.model.isLowMemory;
|
||||
}
|
||||
get isOldCertificate() {
|
||||
return this.model.isOldCertificate;
|
||||
}
|
||||
get isOldPatreon() {
|
||||
return this.model.isOldPatreon;
|
||||
}
|
||||
get items() {
|
||||
return this.model.events;
|
||||
}
|
||||
get duplicateEntries() {
|
||||
return this.model.duplicateEntries;
|
||||
}
|
||||
get notifications() {
|
||||
return this.model.notifications;
|
||||
}
|
||||
ngOnInit() {
|
||||
this.model.updated = () => this.updateItems();
|
||||
this.setState(state);
|
||||
this.updateItems();
|
||||
}
|
||||
ngOnDestroy() {
|
||||
this.model.updated = () => { };
|
||||
}
|
||||
cleanupDeleted() {
|
||||
this.model.cleanupDeletedEvents();
|
||||
}
|
||||
refreshDuplicates() {
|
||||
this.model.checkDuplicateEntries(true);
|
||||
}
|
||||
removeEvents(olderThan: number) {
|
||||
const date = fromNow(-olderThan);
|
||||
const oldEvents = this.items.filter(e => e.updatedAt.getTime() < date.getTime());
|
||||
return Promise.all(oldEvents.map(e => this.model.removeEvent(e._id).then(() => this.removedEvent(e))));
|
||||
}
|
||||
showChat(e?: ChatEvent) {
|
||||
this.chatEvent = e && e.event;
|
||||
this.chatLog.show(e && e.account);
|
||||
}
|
||||
addChat(e: ChatEvent) {
|
||||
if (e.account) {
|
||||
this.chatLog.add(e.account);
|
||||
}
|
||||
}
|
||||
removedEvent(e: Event) {
|
||||
if (this.chatEvent === e) {
|
||||
this.chatLog.close();
|
||||
}
|
||||
}
|
||||
toggleNotifications() {
|
||||
this.model.toggleNotifications();
|
||||
}
|
||||
protected onChange() {
|
||||
state = this.getState();
|
||||
}
|
||||
protected updatePage() {
|
||||
super.updatePage();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user