From 844723bfbc210bb1df56f19d27e8ad98c8d52455 Mon Sep 17 00:00:00 2001 From: Jordan Montgomery Date: Thu, 8 May 2025 12:19:08 -0400 Subject: [PATCH] Add NDES error message (#28960) For #28948 adds LearnMoreLink for NDES error messages as well. Also refactored the code that creates the errors slightly to genericize in case we need to add more links in the future - [x] A detailed QA plan exists on the associated ticket (if it isn't there, work with the product group's QA engineer to add it) - [ ] Manual QA for all new/changed functionality - [x] For unreleased bug fixes in a release candidate, confirmed that the fix is not expected to adversely impact load test results or alerted the release DRI if additional load testing is needed. --- .../components/ProfileUploader/helpers.tsx | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/frontend/pages/ManageControlsPage/OSSettings/cards/CustomSettings/components/ProfileUploader/helpers.tsx b/frontend/pages/ManageControlsPage/OSSettings/cards/CustomSettings/components/ProfileUploader/helpers.tsx index c9575f7421..737f354d49 100644 --- a/frontend/pages/ManageControlsPage/OSSettings/cards/CustomSettings/components/ProfileUploader/helpers.tsx +++ b/frontend/pages/ManageControlsPage/OSSettings/cards/CustomSettings/components/ProfileUploader/helpers.tsx @@ -37,12 +37,12 @@ const generateUnsupportedVariableErrMsg = (errMsg: string) => { : DEFAULT_ERROR_MESSAGE; }; -const generateCAVarsErrMsg = (errMsg: string) => { +const generateLearnMoreErrMsg = (errMsg: string, learnMoreUrl: string) => { return ( <> Couldn't add. {errMsg}{" "} { ); }; -const generateCustomSCEPProfileErrMsg = (errMsg: string) => { - return ( - - Couldn't add. {errMsg}{" "} - - - ); -}; - /** We want to add some additional messageing to some of the error messages so * we add them in this function. Otherwise, we'll just return the error message from the * API. @@ -129,7 +115,10 @@ export const getErrorMessage = (err: AxiosResponse) => { "can't be used if variables for SCEP URL and Challenge are not specified" ) ) { - return generateCAVarsErrMsg(apiReason); + return generateLearnMoreErrMsg( + apiReason, + "https://fleetdm.com/learn-more-about/certificate-authorities" + ); } if ( @@ -137,7 +126,21 @@ export const getErrorMessage = (err: AxiosResponse) => { "SCEP profile for custom SCEP certificate authority requires" ) ) { - return generateCustomSCEPProfileErrMsg(apiReason); + return generateLearnMoreErrMsg( + apiReason, + "https://fleetdm.com/learn-more-about/custom-scep-configuration-profile" + ); + } + + if ( + apiReason.includes( + "SCEP profile for NDES certificate authority requires: $FLEET_VAR_NDES_SCEP_CHALLENGE" + ) + ) { + return generateLearnMoreErrMsg( + apiReason, + "https://fleetdm.com/learn-more-about/ndes-scep-configuration-profile" + ); } return `Couldn't add. ${apiReason}` || DEFAULT_ERROR_MESSAGE;