Skip to content

Commit

Permalink
MARP-1484 Return 204 for externaldocument instead of 404 in details p…
Browse files Browse the repository at this point in the history
…age (#244)
  • Loading branch information
phhung-axonivy authored Nov 22, 2024
1 parent 536ebde commit 9013065
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public ResponseEntity<ExternalDocumentModel> findExternalDocument(
in = ParameterIn.PATH) String version) {
ExternalDocumentMeta externalDocument = externalDocumentService.findExternalDocument(id, version);
if (externalDocument == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

var model = ExternalDocumentModel.builder().productId(externalDocument.getProductId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,27 @@ export class ProductDetailInformationTabComponent implements OnChanges {
this.productDetailService.getExternalDocumentForProductByVersion(this.productDetail.id, this.extractVersionValue(version))
.subscribe({
next: response => {
this.externalDocumentLink = response.relativeLink;
this.displayExternalDocName = response.artifactName;
if (response) {
this.externalDocumentLink = response.relativeLink;
this.displayExternalDocName = response.artifactName;
} else {
this.resetValues();
}
this.loadingService.hide();
},
error: () => {
this.externalDocumentLink = '';
this.displayExternalDocName = '';
this.resetValues();
this.loadingService.hide();
}
});
this.displayVersion = this.extractVersionValue(this.selectedVersion);
}

resetValues() {
this.externalDocumentLink = '';
this.displayExternalDocName = '';
}

extractVersionValue(versionDisplayName: string) {
return versionDisplayName.replace(VERSION.displayPrefix, '');
}
Expand Down

0 comments on commit 9013065

Please sign in to comment.