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

View File

@ -184,7 +184,7 @@
</td> </td>
<td> <td>
<div class="btn-wrapper"> <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" <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> (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" <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 = {}; private server: Server = {};
public user: UserDTO | null = null; public user: UserDTO | null = null;
query: string = Queries.levelWithHistoryQuery;
public constructor( public constructor(
private authService: AuthService, private authService: AuthService,
private spinner: SpinnerService, private spinner: SpinnerService,