Mitglieder auf einem Server anzeigen #130 #206

Merged
edraft merged 18 commits from #130 into 1.0.0 2023-02-18 14:56:39 +01:00
Showing only changes of commit 1ca6debc59 - Show all commits

View File

@ -10,7 +10,7 @@ import { LazyLoadEvent, MenuItem } from "primeng/api";
import { Table } from "primeng/table";
import { User, UserFilter } from "../../../../models/data/user.model";
import { Queries } from "../../../../models/graphql/queries.model";
import { LevelListQuery, UserListQuery } from "../../../../models/graphql/query.model";
import { LevelListQuery, Query, UserListQuery } from "../../../../models/graphql/query.model";
import { DataService } from "../../../../services/data/data.service";
import { Page } from "../../../../models/graphql/filter/page.model";
import { Sort, SortDirection } from "../../../../models/graphql/filter/sort.model";
@ -18,6 +18,8 @@ import { SidebarService } from "../../../../services/sidebar/sidebar.service";
import { Mutations } from "../../../../models/graphql/mutations.model";
import { throwError } from "rxjs";
import { UpdateUserMutationResult } from "../../../../models/graphql/result.model";
import { Server } from "../../../../models/data/server.model";
import { ActivatedRoute, Router } from "@angular/router";
@Component({
selector: "app-members",
@ -84,11 +86,33 @@ export class MembersComponent {
private fb: FormBuilder,
private translate: TranslateService,
private data: DataService,
private sidebar: SidebarService
private sidebar: SidebarService,
private route: ActivatedRoute,
private router: Router,
) {
}
ngOnInit(): void {
this.spinner.showSpinner();
if (!this.route.snapshot.params["serverId"]) {
this.spinner.hideSpinner();
this.router.navigate(['/dashboard']);
return;
}
this.data.query<Server>(Queries.serversQuery, {
filter: { id: this.route.snapshot.params["serverId"] }
},
function(data: Query) {
return data.servers.length > 0 ? data.servers[0] : null;
}
).subscribe(server => {
this.sidebar.setServer(server);
this.spinner.hideSpinner();
});
this.spinner.showSpinner();
this.data.query<LevelListQuery>(Queries.levelQuery, {
filter: {