Fixed user warnings
All checks were successful
Deploy prod on push / pre-build (push) Successful in 1s
Deploy prod on push / build-bot (push) Successful in 3m7s
Deploy prod on push / build-web (push) Successful in 1m48s
Deploy prod on push / deploy (push) Successful in 21s

This commit is contained in:
2024-01-26 19:20:22 +01:00
parent fbdac4f57a
commit 219fffc344
5 changed files with 46 additions and 26 deletions

View File

@@ -520,10 +520,10 @@ export class Queries {
`;
static userWarningsQuery = `
query userWarnings($serverId: ID, $page: Page, $sort: Sort) {
query userWarnings($serverId: ID, $filter: UserWarningFilter, $page: Page, $sort: Sort) {
servers(filter: {id: $serverId}) {
userWarningCount
userWarnings(page: $page, sort: $sort) {
userWarnings(filter: $filter, page: $page, sort: $sort) {
id
user {
id

View File

@@ -48,21 +48,21 @@
<th hideable-th="description" [parent]="this" [sortable]="true">
<div class="table-header-label">
<div class="table-header-text">{{'common.description' | translate}}</div>
<p-sortIcon field="name" class="table-header-icon"></p-sortIcon>
<p-sortIcon field="description" class="table-header-icon"></p-sortIcon>
</div>
</th>
<th hideable-th="member" [parent]="this" [sortable]="true">
<div class="table-header-label">
<div class="table-header-text">{{'common.member' | translate}}</div>
<p-sortIcon field="attribute" class="table-header-icon"></p-sortIcon>
<p-sortIcon field="user" class="table-header-icon"></p-sortIcon>
</div>
</th>
<th hideable-th="author" [parent]="this" [sortable]="true">
<div class="table-header-label">
<div class="table-header-text">{{'common.author' | translate}}</div>
<p-sortIcon field="operator" class="table-header-icon"></p-sortIcon>
<p-sortIcon field="author" class="table-header-icon"></p-sortIcon>
</div>
</th>

View File

@@ -14,7 +14,7 @@ import { TranslateService } from "@ngx-translate/core";
import { DataService } from "../../../../../../services/data/data.service";
import { SidebarService } from "../../../../../../services/sidebar/sidebar.service";
import { ActivatedRoute } from "@angular/router";
import { Query, UserListQuery, UserWarningQuery } from "../../../../../../models/graphql/query.model";
import { UserListQuery, UserWarningQuery } from "../../../../../../models/graphql/query.model";
import { catchError, debounceTime, takeUntil } from "rxjs/operators";
import { LazyLoadEvent } from "primeng/api";
import { Table } from "primeng/table";
@@ -78,12 +78,28 @@ export class UserWarningComponent extends ComponentWithTable implements OnInit,
}
public ngOnInit(): void {
this.setFilterForm();
this.loading = true;
this.data.getServerFromRoute(this.route).then(async server => {
this.server = server;
this.spinner.showSpinner();
let authUser = await this.authService.getLoggedInUser();
this.user = authUser?.users?.find(u => u.server == this.server.id) ?? null;
this.setFilterForm();
this.data.query<UserListQuery>(Queries.liteUsersQuery, {
serverId: this.server.id, filter: {
leftServer: false
}
},
(x: { servers: Server[] }) => {
return x.servers[0];
}
).subscribe(data => {
this.users = data.users;
});
this.spinner.hideSpinner();
this.loadNextPage();
});
}
@@ -96,27 +112,13 @@ export class UserWarningComponent extends ComponentWithTable implements OnInit,
this.data.query<UserWarningQuery>(Queries.userWarningsQuery, {
serverId: this.server.id, filter: this.filter, page: this.page, sort: this.sort
},
(data: Query) => {
return data.servers[0];
(x: { servers: Server[] }) => {
return x.servers[0];
}
).subscribe(data => {
this.totalRecords = data.userWarningCount;
this.userWarnings = data.userWarnings;
this.data.query<UserListQuery>(Queries.liteUsersQuery, {
serverId: this.server.id, filter: {
leftServer: false
}
},
(x: { servers: Server[] }) => {
return x.servers[0];
}
).subscribe(data => {
this.users = data.users;
this.spinner.hideSpinner();
this.loading = false;
});
this.loading = false;
});
}
@@ -138,6 +140,24 @@ export class UserWarningComponent extends ComponentWithTable implements OnInit,
this.filter.id = undefined;
}
if (changes.description) {
this.filter.description = changes.description;
} else {
this.filter.description = undefined;
}
if (changes.user) {
this.filter.user = { name: changes.user };
} else {
this.filter.user = undefined;
}
if (changes.author) {
this.filter.author = { name: changes.author };
} else {
this.filter.author = undefined;
}
if (this.page.pageSize)
this.page.pageSize = 10;