Skip to content

Commit

Permalink
[VAS] Bug 11519: collect filing plan not loading because of access co…
Browse files Browse the repository at this point in the history
…ntract fixes (#1367)
  • Loading branch information
laedanrex authored Jun 13, 2023
1 parent 9a5a3fa commit dbda331
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const NODE_SELECT_VALUE_ACCESSOR: any = {
export class FilingPlanComponent implements ControlValueAccessor, OnChanges {

@Input() tenantIdentifier: number;
/** @deprecated should be removed */
@Input() accessContract: string;
@Input() mode: FilingPlanMode;
@Input() componentId: string = uuid();
Expand Down Expand Up @@ -51,7 +52,7 @@ export class FilingPlanComponent implements ControlValueAccessor, OnChanges {

initFiningTree() {
this.filingPlanService
.loadTree(this.tenantIdentifier, this.accessContract, this.componentId)
.loadTree(this.tenantIdentifier, this.componentId)
.subscribe(nodes => {
this.nestedDataSource.data = nodes;
this.nestedTreeControl.dataNodes = nodes;
Expand All @@ -60,7 +61,7 @@ export class FilingPlanComponent implements ControlValueAccessor, OnChanges {
}

ngOnChanges(changes: SimpleChanges): void {
if (changes.accessContract) {
if (changes.tenantIdentifier) {
this.initFiningTree();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ export class FilingPlanService {
this.cache[accessContractId] = { value };
}

public loadTree(tenantIdentifier: number, accessContractId: string, idPrefix: string): Observable<Node[]> {
let units$ = this.getCachedValue(accessContractId);
public loadTree(tenantIdentifier: number, idPrefix: string): Observable<Node[]> {
const tenantId = tenantIdentifier.toString();
let units$ = this.getCachedValue(tenantId);
if (!units$) {
this._pending++;
const headers = new HttpHeaders({
'X-Tenant-Id': tenantIdentifier.toString(),
'X-Access-Contract-Id': accessContractId,
'X-Tenant-Id': tenantId,
});
units$ = this.searchUnitApi.getFilingPlan(headers).pipe(
catchError(() => {
Expand All @@ -97,7 +97,7 @@ export class FilingPlanService {
tap(() => this._pending--),
shareReplay(1)
);
this.setCachedValue(units$, accessContractId);
this.setCachedValue(units$, tenantId);
}
return units$.pipe(
map((results) => {
Expand Down

0 comments on commit dbda331

Please sign in to comment.