Fixed server view in sidebar #130
This commit is contained in:
parent
dfe4f28e24
commit
1ca6debc59
@ -10,7 +10,7 @@ import { LazyLoadEvent, MenuItem } from "primeng/api";
|
|||||||
import { Table } from "primeng/table";
|
import { Table } from "primeng/table";
|
||||||
import { User, UserFilter } from "../../../../models/data/user.model";
|
import { User, UserFilter } from "../../../../models/data/user.model";
|
||||||
import { Queries } from "../../../../models/graphql/queries.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 { DataService } from "../../../../services/data/data.service";
|
||||||
import { Page } from "../../../../models/graphql/filter/page.model";
|
import { Page } from "../../../../models/graphql/filter/page.model";
|
||||||
import { Sort, SortDirection } from "../../../../models/graphql/filter/sort.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 { Mutations } from "../../../../models/graphql/mutations.model";
|
||||||
import { throwError } from "rxjs";
|
import { throwError } from "rxjs";
|
||||||
import { UpdateUserMutationResult } from "../../../../models/graphql/result.model";
|
import { UpdateUserMutationResult } from "../../../../models/graphql/result.model";
|
||||||
|
import { Server } from "../../../../models/data/server.model";
|
||||||
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-members",
|
selector: "app-members",
|
||||||
@ -84,11 +86,33 @@ export class MembersComponent {
|
|||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
private data: DataService,
|
private data: DataService,
|
||||||
private sidebar: SidebarService
|
private sidebar: SidebarService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
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.spinner.showSpinner();
|
||||||
this.data.query<LevelListQuery>(Queries.levelQuery, {
|
this.data.query<LevelListQuery>(Queries.levelQuery, {
|
||||||
filter: {
|
filter: {
|
||||||
|
Loading…
Reference in New Issue
Block a user