diff --git a/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.html b/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.html
new file mode 100644
index 00000000..c245aff5
--- /dev/null
+++ b/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+ {{"reports.a4a6.firstName" | translate}} |
+ {{element.firstname}} |
+
+
+ {{"reports.a4a6.surName" | translate}} |
+ {{element.name}} |
+
+
+ Ext_ID |
+ {{element.userExtId}} |
+
+
+ {{"reports.a4a6.email" | translate}} |
+ {{element.email}} |
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.scss b/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.scss
new file mode 100644
index 00000000..dc4510a5
--- /dev/null
+++ b/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.scss
@@ -0,0 +1,8 @@
+.table-container {
+ padding-bottom: 0.5em;
+ max-height: 30em;
+ overflow: auto;
+ margin-top: 0.5em;
+ margin-bottom: 2em;
+}
+
diff --git a/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.spec.ts b/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.spec.ts
new file mode 100644
index 00000000..056ce969
--- /dev/null
+++ b/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.spec.ts
@@ -0,0 +1,45 @@
+import {ComponentFixture, TestBed} from '@angular/core/testing';
+
+import {ProfilesTableComponent} from './profiles-table.component';
+import {ObliqueTestingModule} from "@oblique/oblique";
+import {TranslateModule} from "@ngx-translate/core";
+import {HttpClientTestingModule} from "@angular/common/http/testing";
+import {MatTableModule} from "@angular/material/table";
+import {SelectedProfilesService} from "../../selected-profiles.service";
+import {CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA} from "@angular/core";
+import {UnitTree} from "../unit-search.component";
+import {NestedTreeControl} from "@angular/cdk/tree";
+
+describe('ProfilesTableComponent', () => {
+ let component: ProfilesTableComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [ObliqueTestingModule, HttpClientTestingModule, TranslateModule.forRoot(), MatTableModule],
+ declarations: [ProfilesTableComponent],
+ providers: [
+ {provide: 'REPORT_HOST', useValue: 'REPORT_HOST'},
+ {provide: SelectedProfilesService, useValue: new SelectedProfilesService()},
+ ],
+ schemas: [NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA],
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ProfilesTableComponent);
+ component = fixture.componentInstance;
+
+ component.authority = 'BUV'
+ component.node = {} as any
+ component.treeControl = new NestedTreeControl(_ => [])
+
+
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.ts b/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.ts
new file mode 100644
index 00000000..d2b12cb1
--- /dev/null
+++ b/src/app/report/report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component.ts
@@ -0,0 +1,60 @@
+import {Component, Inject, Input} from '@angular/core';
+import {NestedTreeControl} from "@angular/cdk/tree";
+import {UnitTree} from "../unit-search.component";
+import {EiamProfile, SelectedProfilesService} from "../../selected-profiles.service";
+import {Observable} from "rxjs";
+import {MatTableDataSource} from "@angular/material/table";
+import {map} from "rxjs/operators";
+import {HttpClient} from "@angular/common/http";
+
+type ProfilesObservableStore = {
+ [unitId: string]: Observable>
+}
+
+@Component({
+ selector: 'ec-profiles-table',
+ templateUrl: './profiles-table.component.html',
+ styleUrls: ['./profiles-table.component.scss']
+})
+export class ProfilesTableComponent {
+
+ @Input()
+ node: UnitTree
+
+ @Input()
+ treeControl: NestedTreeControl
+
+ @Input()
+ authority: string
+
+ profileObservablesStore: ProfilesObservableStore = {}
+
+ readonly TABLE_ROWS = [
+ 'select',
+ 'firstname',
+ 'name',
+ 'userExtId',
+ 'email',
+ ]
+
+ private readonly PROFILES_URL: string
+
+ constructor(public readonly selectedProfilesService: SelectedProfilesService,
+ private readonly http: HttpClient,
+ @Inject('REPORT_HOST') private readonly REPORT_HOST: string) {
+ this.PROFILES_URL = REPORT_HOST + '/api/v2/report/unit/profiles'
+
+ }
+
+ /** Stores and returns the Observables for fetching Eiam profiles. We store them in order to avoid creating
+ * new Observables, causing infinite loop of the change detection because of how the async pipe works. */
+ getProfiles$(unit: UnitTree): Observable> {
+ if (!this.profileObservablesStore[unit.id]) {
+ this.profileObservablesStore[unit.id] = this.http.post(this.PROFILES_URL, {
+ id: unit.id,
+ authority: this.authority
+ }).pipe(map(profiles => new MatTableDataSource(profiles)))
+ }
+ return this.profileObservablesStore[unit.id]
+ }
+}
diff --git a/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.html b/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.html
index edf99391..69c8a4be 100644
--- a/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.html
+++ b/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.html
@@ -52,55 +52,9 @@
-
-
-
-
-
-
-
- |
-
-
-
- |
-
-
- {{"reports.a4a6.firstName" | translate}} |
- {{element.firstname}} |
-
-
- {{"reports.a4a6.surName" | translate}} |
- {{element.name}} |
-
-
- Ext_ID |
- {{element.userExtId}} |
-
-
- {{"reports.a4a6.email" | translate}} |
- {{element.email}} |
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -117,6 +71,8 @@
+
diff --git a/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.scss b/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.scss
index b5c75213..a83ba802 100644
--- a/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.scss
+++ b/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.scss
@@ -65,13 +65,6 @@
padding-left: 2em;
}
-.table-container {
- max-height: 30em;
- overflow: auto;
- margin-top: 0.5em;
- margin-bottom: 2em;
-}
-
.profiles-container {
width: 100%;
diff --git a/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.spec.ts b/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.spec.ts
index fafd53bc..d08384ab 100644
--- a/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.spec.ts
+++ b/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.spec.ts
@@ -64,13 +64,13 @@ describe('UnitSearchComponent', () => {
it('should perform post request if its the first change', () => {
component.ngOnChanges({authority: new SimpleChange('de', 'de', true)})
- expect(post).toHaveBeenCalledWith("REPORT_HOST/api/v2/unit/tree", {authority: 'buv', language: 'de'})
+ expect(post).toHaveBeenCalledWith("REPORT_HOST/api/v2/report/unit/tree", {authority: 'buv', language: 'de'})
});
it('should perform post request if authority has changed', () => {
component.ngOnChanges({authority: new SimpleChange('be', 'buv', false)})
- expect(post).toHaveBeenCalledWith("REPORT_HOST/api/v2/unit/tree", {authority: 'buv', language: 'de'})
+ expect(post).toHaveBeenCalledWith("REPORT_HOST/api/v2/report/unit/tree", {authority: 'buv', language: 'de'})
});
it('should not perform post request if authority is null', () => {
diff --git a/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.ts b/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.ts
index 94ddf4bb..6e646391 100644
--- a/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.ts
+++ b/src/app/report/report-parameter/report-a4-a6/unit-search/unit-search.component.ts
@@ -3,10 +3,7 @@ import {NestedTreeControl} from "@angular/cdk/tree";
import {MatTreeNestedDataSource} from "@angular/material/tree";
import {TranslateService} from "@ngx-translate/core";
import {HttpClient} from "@angular/common/http";
-import {Observable} from "rxjs";
-import {MatTableDataSource} from "@angular/material/table";
-import {map} from "rxjs/operators";
-import {EiamProfile, SelectedProfilesService} from "../selected-profiles.service";
+import {SelectedProfilesService} from "../selected-profiles.service";
import {FormArray} from "@angular/forms";
export interface UnitTree {
@@ -17,10 +14,6 @@ export interface UnitTree {
parent?: UnitTree
}
-type ProfilesObservableStore = {
- [unitId: string]: Observable>
-}
-
@Component({
selector: 'ec-unit-search',
templateUrl: './unit-search.component.html',
@@ -38,17 +31,8 @@ export class UnitSearchComponent implements OnChanges {
treeControl = new NestedTreeControl(node => node.children);
treeDataSource = new MatTreeNestedDataSource();
organisationSearchValue = ''
- profileObservablesStore: ProfilesObservableStore = {}
-
- readonly TABLE_ROWS = [
- 'select',
- 'firstname',
- 'name',
- 'userExtId',
- 'email',
- ]
+
private readonly UNIT_TREE_URL: string
- private readonly PROFILES_URL: string
constructor(
private readonly translate: TranslateService,
@@ -56,7 +40,6 @@ export class UnitSearchComponent implements OnChanges {
public readonly selectedProfilesService: SelectedProfilesService,
@Inject('REPORT_HOST') private readonly REPORT_HOST: string) {
this.UNIT_TREE_URL = REPORT_HOST + '/api/v2/report/unit/tree'
- this.PROFILES_URL = REPORT_HOST + '/api/v2/report/unit/profiles'
}
ngOnChanges(changes: SimpleChanges) {
@@ -80,18 +63,6 @@ export class UnitSearchComponent implements OnChanges {
isVisible = (_: number, node: UnitTree) => !!node.children && node.children.length > 0;
- /** Stores and returns the Observables for fetching Eiam profiles. We store them in order to avoid creating
- * new Observables, causing infinite loop of the change detection because of how the async pipe works. */
- getProfiles$(unit: UnitTree): Observable> {
- if (!this.profileObservablesStore[unit.id]) {
- this.profileObservablesStore[unit.id] = this.http.post(this.PROFILES_URL, {
- id: unit.id,
- authority: this.authority
- }).pipe(map(profiles => new MatTableDataSource(profiles)))
- }
- return this.profileObservablesStore[unit.id]
- }
-
/** Sets `hidden` property on the unit trees based on the search value. */
setHiddenBySearchValue(unitTrees: UnitTree[], first = true): void {
if (!unitTrees) {
diff --git a/src/app/report/report.module.ts b/src/app/report/report.module.ts
index f8f553a8..e2284544 100644
--- a/src/app/report/report.module.ts
+++ b/src/app/report/report.module.ts
@@ -55,30 +55,33 @@ import {IssuerSearchComponent} from './report-parameter/report-a4-a6/issuer-sear
import {MatPaginatorModule} from "@angular/material/paginator";
import {MatSortModule} from "@angular/material/sort";
import {REPORT_ERROR_STATE_MATCHER} from "./errorStateMatcher";
+import { ProfilesTableComponent } from './report-parameter/report-a4-a6/unit-search/profiles-table/profiles-table.component';
@NgModule({
- declarations: [
- ReportComponent,
- SelectReportTypeComponent,
- ReportParameterComponent,
- ReportGenerationComponent,
- ReportA2Component,
- ReportA7Component,
- ReportEndComponent,
- DataRoomSelectionFieldsetComponent,
- DateFromToFieldsetComponent,
- CertTypeSelectionFieldsetComponent,
- ReportEndComponent,
- UnitSearchComponent,
- DataRoomSelectionFieldsetComponent,
- DateFromToFieldsetComponent,
- CertTypeSelectionFieldsetComponent,
- ReportA4A6Component,
- UnitSearchComponent,
- SelectedProfilesComponent,
- FieldWrapperComponent,
- IssuerSearchComponent
- ],
+ declarations: [
+ ReportComponent,
+ SelectReportTypeComponent,
+ ReportParameterComponent,
+ ReportGenerationComponent,
+ ReportA2Component,
+ ReportA7Component,
+ ReportEndComponent,
+ DataRoomSelectionFieldsetComponent,
+ DateFromToFieldsetComponent,
+ CertTypeSelectionFieldsetComponent,
+ ReportEndComponent,
+ UnitSearchComponent,
+ DataRoomSelectionFieldsetComponent,
+ DateFromToFieldsetComponent,
+ CertTypeSelectionFieldsetComponent,
+ ReportA4A6Component,
+ UnitSearchComponent,
+ SelectedProfilesComponent,
+ FieldWrapperComponent,
+ IssuerSearchComponent,
+ ProfilesTableComponent,
+ ProfilesTableComponent
+ ],
imports: [
SharedModule,
ObButtonModule,