diff --git a/src/app/core/admin/admin-entity/admin-entity.component.spec.ts b/src/app/core/admin/admin-entity/admin-entity.component.spec.ts index 26fd519626..df5a79dd01 100644 --- a/src/app/core/admin/admin-entity/admin-entity.component.spec.ts +++ b/src/app/core/admin/admin-entity/admin-entity.component.spec.ts @@ -29,6 +29,8 @@ import { FontAwesomeTestingModule } from "@fortawesome/angular-fontawesome/testi import { EntityMapperService } from "../../entity/entity-mapper/entity-mapper.service"; import { EntityActionsService } from "../../entity/entity-actions/entity-actions.service"; import { EntitySchemaField } from "../../entity/schema/entity-schema-field"; +import { ActivatedRoute } from "@angular/router"; +import { of } from "rxjs"; describe("AdminEntityComponent", () => { let component: AdminEntityComponent; @@ -59,7 +61,9 @@ describe("AdminEntityComponent", () => { [viewConfigId]: { component: "EntityDetails", config: viewConfig }, [entityConfigId]: {}, }; - + const mockActivatedRoute = { + queryParams: of({ mode: "list" }), + }; mockConfigService = jasmine.createSpyObj(["getConfig"]); mockConfigService.getConfig.and.returnValue(config[viewConfigId]); @@ -88,6 +92,10 @@ describe("AdminEntityComponent", () => { provide: EntityActionsService, useValue: jasmine.createSpyObj(["showSnackbarConfirmationWithUndo"]), }, + { + provide: ActivatedRoute, + useValue: mockActivatedRoute, + }, ], }); fixture = TestBed.createComponent(AdminEntityComponent); diff --git a/src/app/core/admin/admin-entity/admin-entity.component.ts b/src/app/core/admin/admin-entity/admin-entity.component.ts index 4e1afb9e96..04e58d89eb 100644 --- a/src/app/core/admin/admin-entity/admin-entity.component.ts +++ b/src/app/core/admin/admin-entity/admin-entity.component.ts @@ -28,7 +28,7 @@ import { MatSidenavContent, } from "@angular/material/sidenav"; import { FaIconComponent } from "@fortawesome/angular-fontawesome"; -import { RouterLink } from "@angular/router"; +import { RouterLink, ActivatedRoute } from "@angular/router"; import { MatListItem, MatNavList } from "@angular/material/list"; import { AdminEntityDetailsComponent } from "../admin-entity-details/admin-entity-details/admin-entity-details.component"; @@ -72,10 +72,18 @@ export class AdminEntityComponent implements OnInit { private location: Location, private entityMapper: EntityMapperService, private entityActionsService: EntityActionsService, + private routes: ActivatedRoute, ) {} ngOnInit(): void { this.init(); + this.routes.queryParams.subscribe((params) => { + if (params.mode === "details") { + this.mode = "details"; + } else if (params.mode === "list") { + this.mode = "list"; + } + }); } private init() { diff --git a/src/app/core/entity-details/entity-details/entity-details.component.html b/src/app/core/entity-details/entity-details/entity-details.component.html index 58d5043fcf..bcbc5eded0 100644 --- a/src/app/core/entity-details/entity-details/entity-details.component.html +++ b/src/app/core/entity-details/entity-details/entity-details.component.html @@ -32,6 +32,8 @@