Skip to content

Commit

Permalink
Merge pull request #1347 from ds-ashanmugavel/chore/xxx-bug-FE
Browse files Browse the repository at this point in the history
chore[XXXX]: fixed fullscreen bug
  • Loading branch information
ds-mwesener authored Aug 5, 2024
2 parents d1dcf78 + 2d3219d commit ea63855
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ _**For better traceability add the corresponding GitHub issue number in each cha
- #1328 Fixed semanticDataModel translation and part name within notification detail / edit view.
- #908 Renamed header in notification detail for parts from Supplier Parts to Affected parts
- #1151 Display of null values within contracts in datepicker to be empty if null
- #1310 fixed part tree fullscreen error message
- #1318 fix testdata v14 where parts had the wrong bpn

### Removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
</mat-card-header>
<mat-card-content class="part-detail--relation__container">
<ng-container>
<app-part-relation [isStandalone]="false" [showMiniMap]="false"></app-part-relation>
<app-part-relation [isStandalone]="false" [showMiniMap]="false" [isAsBuilt]="isAsBuiltPart"></app-part-relation>
<mat-icon onkeydown="openRelationPage(partDetails.data)" (click)="openRelationPage(partDetails.data)" class="part-detail--relation__icon"
>open_in_new
</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class PartsDetailComponent {

public currentPartId: string;
public pageIndexHistory: {AS_BUILT_PAGE: string, AS_PLANNED_PAGE: string}
private isAsBuiltPart: boolean;
public isAsBuiltPart: boolean;

constructor(public readonly partDetailsFacade: PartDetailsFacade, private readonly router: Router, private readonly route: ActivatedRoute, public roleService: RoleService, private location: Location, private sharedPartService: SharedPartService) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,18 @@ export class PartDetailsFacade {
);
}

public getRootPart(id: string): Observable<View<Part>> {
return this.partsService.getPart(id).pipe(
map((part: Part) => ({ data: part })),
catchError((error: Error) => of({ error })),
);
public getRootPart(id: string, isAsBuilt: boolean): Observable<View<Part>> {
if (isAsBuilt){
return this.partsService.getPartByIdAsBuilt(id).pipe(
map((part: Part) => ({ data: part })),
catchError((error: Error) => of({ error })),
);
}else {
return this.partsService.getPartByIdAsPlanned(id).pipe(
map((part: Part) => ({ data: part })),
catchError((error: Error) => of({ error })),
);
}
}

public getChildPartDetails(part): Observable<Part[]> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { delay, switchMap, takeWhile, tap } from 'rxjs/operators';
export class PartRelationComponent implements OnInit, OnDestroy {
@Input() isStandalone = true;
@Input() showMiniMap = true;
@Input() isAsBuilt = true;

public readonly htmlIdBase = 'app-part-relation-';
public readonly subscriptions = new Subscription();
Expand Down Expand Up @@ -78,7 +79,7 @@ export class PartRelationComponent implements OnInit, OnDestroy {
if (this.partDetailsFacade.selectedPart) return this.partDetailsFacade.selectedPart$;

const partId = params.get('partId');
return partId ? this.partDetailsFacade.getRootPart(partId) : this.partDetailsFacade.selectedPart$;
return partId ? this.partDetailsFacade.getRootPart(partId, this.isAsBuilt) : this.partDetailsFacade.selectedPart$;
}),
tap(viewData => this._rootPart$.update(viewData)),
takeWhile(({ data }) => !data, true),
Expand Down
27 changes: 27 additions & 0 deletions frontend/src/app/modules/shared/service/parts.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,34 @@ export class PartsService {
);
}

public getPartByIdAsBuilt(id: string): Observable<Part> {
if (!id || typeof id !== 'string') {
throw new Error('invalid ID');
}

const encodedId = encodeURIComponent(id);

return this.apiService.get<PartResponse>(`${ this.url }/assets/as-built/${ encodedId }`).pipe(
map(part => PartsAssembler.assemblePart(part, MainAspectType.AS_BUILT)),
catchError(() => of(null)),
);


}

public getPartByIdAsPlanned(id: string): Observable<Part> {
if (!id || typeof id !== 'string') {
throw new Error('invalid ID');
}

const encodedId = encodeURIComponent(id);

return this.apiService.get<PartResponse>(`${ this.url }/assets/as-planned/${ encodedId }`).pipe(
map(part => PartsAssembler.assemblePart(part, MainAspectType.AS_PLANNED)),
catchError(() => of(null)),
);

}
public getPartDetailOfIds(assetIds: string[], isAsBuilt?: boolean): Observable<Part[]> {

if (isAsBuilt !== undefined) {
Expand Down

0 comments on commit ea63855

Please sign in to comment.