Improved level data loading #300

This commit is contained in:
Sven Heidemann 2023-04-14 22:01:06 +02:00
parent 4da87ae3cb
commit 2b866b5ab1
3 changed files with 14 additions and 11 deletions

View File

@ -62,6 +62,17 @@ export class Queries {
}
createdAt
modifiedAt
}
}
}
`;
static levelWithHistoryQuery = `
query LevelHistory($serverId: ID, $id: ID) {
servers(filter: {id: $serverId}) {
levelCount
levels(filter: {id: $id}) {
id
history {
id
@ -233,16 +244,6 @@ export class Queries {
createdAt
modifiedAt
history {
id
emojiName
roleId
autoRole
deleted
dateFrom
dateTo
}
}
}
}

View File

@ -184,7 +184,7 @@
</td>
<td>
<div class="btn-wrapper">
<app-history-btn *ngIf="!isEditingNew" [id] ="level.history" translationKey="view.server.levels.header"></app-history-btn>
<app-history-btn *ngIf="!isEditingNew" [id]="level.id" [query]="query" translationKey="view.server.levels.header"></app-history-btn>
<button *ngIf="!editing" pButton pInitEditableRow class="btn icon-btn" icon="pi pi-pencil"
(click)="onRowEditInit(dt, level, ri)" [disabled]="!user || user.isModerator && !user.isAdmin"></button>
<button *ngIf="!editing" pButton class="btn icon-btn danger-icon-btn" icon="pi pi-trash"

View File

@ -61,6 +61,8 @@ export class LevelsComponent implements OnInit, OnDestroy {
private server: Server = {};
public user: UserDTO | null = null;
query: string = Queries.levelWithHistoryQuery;
public constructor(
private authService: AuthService,
private spinner: SpinnerService,