Skip to content

Commit

Permalink
Add error toast message when CSR generation fails (#337)
Browse files Browse the repository at this point in the history
- Read-only user will now see a error toast message when trying to generate a CSR.

 - Defect: https://jazz07.rchland.ibm.com:13443/jazz/web/projects/CSSD#action=com.ibm.team.workitem.viewWorkItem&id=671025

Signed-off-by: Nabil Ananthamangalath <[email protected]>
  • Loading branch information
nabilpandiyalayil authored and rfrandse committed Jan 8, 2025
1 parent efc7858 commit 4c8aad5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@
"errorAddCertificate": "Error adding certificate.",
"errorDeleteCertificate": "Error deleting certificate.",
"errorReplaceCertificate": "Error replacing certificate.",
"errorGenerateCsr": "Error generating CSR.",
"successAddCertificate": "Successfully added %{certificate}.",
"successAddedHTTPCertificate": "Successfully added %{certificate}. Reload the browser page to see the changes.",
"successDeleteCertificate": "Successfully deleted %{certificate}.",
Expand Down
5 changes: 4 additions & 1 deletion src/store/modules/SecurityAndAccess/CertificatesStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,10 @@ const CertificatesStore = {
)
//TODO: Success response also throws error so
// can't accurately show legitimate error in UI
.catch((error) => console.log(error));
.catch((error) => {
console.log(error);
throw new Error(i18n.t('pageCertificates.toast.errorGenerateCsr'));
});
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ export default {
this.csrString = CSRString;
this.$bvModal.show('csr-string');
this.$v.$reset();
});
})
.catch(({ message }) => this.errorToast(message));
},
resetForm() {
for (let key of Object.keys(this.form)) {
Expand Down

0 comments on commit 4c8aad5

Please sign in to comment.