Skip to content
Snippets Groups Projects
Commit 05efa274 authored by Kawtar Laariche's avatar Kawtar Laariche
Browse files

#22: :bug: show the latest version id

parent c6aa8629
No related branches found
No related tags found
No related merge requests found
...@@ -58,12 +58,12 @@ interface SolutionData { ...@@ -58,12 +58,12 @@ interface SolutionData {
revisionId: string; revisionId: string;
solution: PublicSolutionDetailsModel; solution: PublicSolutionDetailsModel;
catalogs: Catalog[]; catalogs: Catalog[];
picture: any; picture?: any;
averageRatings: AverageRatings; averageRatings?: AverageRatings;
allRatings: AllUserRating[]; allRatings?: AllUserRating[];
comments: any; comments: any;
authors: AuthorPublisherModel[]; authors: AuthorPublisherModel[];
relatedSolutions: PublicSolution[]; relatedSolutions?: PublicSolution[];
} }
@Component({ @Component({
...@@ -163,6 +163,9 @@ export class ModelDetailsComponent implements OnInit { ...@@ -163,6 +163,9 @@ export class ModelDetailsComponent implements OnInit {
.pipe(map((details) => !!details?.userId)); .pipe(map((details) => !!details?.userId));
this.data$ = this.activatedRoute.params.pipe( this.data$ = this.activatedRoute.params.pipe(
tap((params) => {
console.log({ params });
}),
map((params) => ({ map((params) => ({
solutionId: params['solutionId'] as string, solutionId: params['solutionId'] as string,
revisionId: params['revisionId'] as string, revisionId: params['revisionId'] as string,
...@@ -178,22 +181,26 @@ export class ModelDetailsComponent implements OnInit { ...@@ -178,22 +181,26 @@ export class ModelDetailsComponent implements OnInit {
solution: of(solution), solution: of(solution),
catalogs: catalogs:
this.publicSolutionsService.getCatalogsOfSolution(solutionId), this.publicSolutionsService.getCatalogsOfSolution(solutionId),
picture: picture: this.publicSolutionsService
this.publicSolutionsService.getPictureOfSolution(solutionId), .getPictureOfSolution(solutionId)
averageRatings: .pipe(catchError(() => of(null))),
this.publicSolutionsService.getAverageRatings(solutionId), averageRatings: this.publicSolutionsService
allRatings: .getAverageRatings(solutionId)
this.publicSolutionsService.getAllRatings(solutionId), .pipe(catchError(() => of({} as AverageRatings))),
comments: this.publicSolutionsService.getComment( allRatings: this.publicSolutionsService
solutionId, .getAllRatings(solutionId)
revisionId, .pipe(catchError(() => of([]))),
), comments: this.publicSolutionsService
authors: this.publicSolutionsService.getModelAuthors( .getComment(solutionId, revisionId)
solutionId, .pipe(
revisionId, catchError(() => of({ response_body: { content: [] } })),
), ),
relatedSolutions: authors: this.publicSolutionsService
this.publicSolutionsService.relatedSolutions(solution), .getModelAuthors(solutionId, revisionId)
.pipe(catchError(() => of([]))),
relatedSolutions: this.publicSolutionsService
.relatedSolutions(solution)
.pipe(catchError(() => of([]))),
}), }),
), ),
tap((data) => { tap((data) => {
...@@ -424,7 +431,9 @@ export class ModelDetailsComponent implements OnInit { ...@@ -424,7 +431,9 @@ export class ModelDetailsComponent implements OnInit {
private processSideEffects(data: SolutionData): void { private processSideEffects(data: SolutionData): void {
this.revisionsList = this.getRevisionsList(data.solution); this.revisionsList = this.getRevisionsList(data.solution);
this.selectedDefaultRevision = this.revisionsList[0]; this.selectedDefaultRevision = this.revisionsList.filter(
(rv) => rv.revisionId === this.revisionId,
)[0];
this.setRevisionInService(this.selectedDefaultRevision); this.setRevisionInService(this.selectedDefaultRevision);
if (data.catalogs.length > 0) { if (data.catalogs.length > 0) {
...@@ -433,10 +442,10 @@ export class ModelDetailsComponent implements OnInit { ...@@ -433,10 +442,10 @@ export class ModelDetailsComponent implements OnInit {
} }
this.setVersionIdInService(); this.setVersionIdInService();
this.createImageFromBlob(data.picture); this.createImageFromBlob(data.picture);
this.updateStarWidth(data.averageRatings); this.updateStarWidth(data.averageRatings || ({} as AverageRatings));
this.calculateRatings(data.allRatings); this.calculateRatings(data.allRatings || []);
this.setAuthorListInService(data.authors); this.setAuthorListInService(data.authors);
this.removeCurrentSolution(data.relatedSolutions, data.solution); this.removeCurrentSolution(data.relatedSolutions || [], data.solution);
} }
triggerDeployment(menuEntry: { triggerDeployment(menuEntry: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment