diff --git a/kdb-web/src/app/modules/view/server/members/members.component.ts b/kdb-web/src/app/modules/view/server/members/members.component.ts index 29745b75..112adf62 100644 --- a/kdb-web/src/app/modules/view/server/members/members.component.ts +++ b/kdb-web/src/app/modules/view/server/members/members.component.ts @@ -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(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(Queries.levelQuery, { filter: {