Skip to content

Commit ea63855

Browse files
authored
Merge pull request #1347 from ds-ashanmugavel/chore/xxx-bug-FE
chore[XXXX]: fixed fullscreen bug
2 parents d1dcf78 + 2d3219d commit ea63855

File tree

6 files changed

+44
-8
lines changed

6 files changed

+44
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ _**For better traceability add the corresponding GitHub issue number in each cha
1717
- #1328 Fixed semanticDataModel translation and part name within notification detail / edit view.
1818
- #908 Renamed header in notification detail for parts from Supplier Parts to Affected parts
1919
- #1151 Display of null values within contracts in datepicker to be empty if null
20+
- #1310 fixed part tree fullscreen error message
2021
- #1318 fix testdata v14 where parts had the wrong bpn
2122

2223
### Removed

frontend/src/app/modules/page/parts/detail/parts-detail.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
</mat-card-header>
202202
<mat-card-content class="part-detail--relation__container">
203203
<ng-container>
204-
<app-part-relation [isStandalone]="false" [showMiniMap]="false"></app-part-relation>
204+
<app-part-relation [isStandalone]="false" [showMiniMap]="false" [isAsBuilt]="isAsBuiltPart"></app-part-relation>
205205
<mat-icon onkeydown="openRelationPage(partDetails.data)" (click)="openRelationPage(partDetails.data)" class="part-detail--relation__icon"
206206
>open_in_new
207207
</mat-icon>

frontend/src/app/modules/page/parts/detail/parts-detail.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class PartsDetailComponent {
6363

6464
public currentPartId: string;
6565
public pageIndexHistory: {AS_BUILT_PAGE: string, AS_PLANNED_PAGE: string}
66-
private isAsBuiltPart: boolean;
66+
public isAsBuiltPart: boolean;
6767

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

frontend/src/app/modules/shared/modules/part-details/core/partDetails.facade.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,18 @@ export class PartDetailsFacade {
7070
);
7171
}
7272

73-
public getRootPart(id: string): Observable<View<Part>> {
74-
return this.partsService.getPart(id).pipe(
75-
map((part: Part) => ({ data: part })),
76-
catchError((error: Error) => of({ error })),
77-
);
73+
public getRootPart(id: string, isAsBuilt: boolean): Observable<View<Part>> {
74+
if (isAsBuilt){
75+
return this.partsService.getPartByIdAsBuilt(id).pipe(
76+
map((part: Part) => ({ data: part })),
77+
catchError((error: Error) => of({ error })),
78+
);
79+
}else {
80+
return this.partsService.getPartByIdAsPlanned(id).pipe(
81+
map((part: Part) => ({ data: part })),
82+
catchError((error: Error) => of({ error })),
83+
);
84+
}
7885
}
7986

8087
public getChildPartDetails(part): Observable<Part[]> {

frontend/src/app/modules/shared/modules/relations/presentation/part-relation.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import { delay, switchMap, takeWhile, tap } from 'rxjs/operators';
5050
export class PartRelationComponent implements OnInit, OnDestroy {
5151
@Input() isStandalone = true;
5252
@Input() showMiniMap = true;
53+
@Input() isAsBuilt = true;
5354

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

8081
const partId = params.get('partId');
81-
return partId ? this.partDetailsFacade.getRootPart(partId) : this.partDetailsFacade.selectedPart$;
82+
return partId ? this.partDetailsFacade.getRootPart(partId, this.isAsBuilt) : this.partDetailsFacade.selectedPart$;
8283
}),
8384
tap(viewData => this._rootPart$.update(viewData)),
8485
takeWhile(({ data }) => !data, true),

frontend/src/app/modules/shared/service/parts.service.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,34 @@ export class PartsService {
125125
);
126126
}
127127

128+
public getPartByIdAsBuilt(id: string): Observable<Part> {
129+
if (!id || typeof id !== 'string') {
130+
throw new Error('invalid ID');
131+
}
132+
133+
const encodedId = encodeURIComponent(id);
134+
135+
return this.apiService.get<PartResponse>(`${ this.url }/assets/as-built/${ encodedId }`).pipe(
136+
map(part => PartsAssembler.assemblePart(part, MainAspectType.AS_BUILT)),
137+
catchError(() => of(null)),
138+
);
139+
140+
141+
}
128142

143+
public getPartByIdAsPlanned(id: string): Observable<Part> {
144+
if (!id || typeof id !== 'string') {
145+
throw new Error('invalid ID');
146+
}
147+
148+
const encodedId = encodeURIComponent(id);
149+
150+
return this.apiService.get<PartResponse>(`${ this.url }/assets/as-planned/${ encodedId }`).pipe(
151+
map(part => PartsAssembler.assemblePart(part, MainAspectType.AS_PLANNED)),
152+
catchError(() => of(null)),
153+
);
154+
155+
}
129156
public getPartDetailOfIds(assetIds: string[], isAsBuilt?: boolean): Observable<Part[]> {
130157

131158
if (isAsBuilt !== undefined) {

0 commit comments

Comments
 (0)