Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore[XXXX]: fixed fullscreen bug #1347

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

### Removed
- #1227 Removed scrollbar on approval dialog
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