From 0be4e4db398aa498f250c8cc5850e3b482fcae9d Mon Sep 17 00:00:00 2001 From: Jordan Montgomery Date: Wed, 7 May 2025 12:20:58 -0400 Subject: [PATCH] Add learn more links for Custom SCEP profile errors (#28905) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For #28870 Adds the proper "learn more" links to these errors as shown in the Custom SCEP renewal Figma https://www.figma.com/design/R4HhMXjwTjRelmq3V6n8aS/-27984-Renew-certificates-from-custom-SCEP-certificate-authority-on-macOS?node-id=7304-92: ![Screenshot 2025-05-07 at 9 50 59 AM](https://github.com/user-attachments/assets/f11fb064-0fab-42ad-b8b0-c28705eda921) ![Screenshot 2025-05-07 at 9 51 16 AM](https://github.com/user-attachments/assets/c8822e03-71f7-4fb1-b323-02422f8497b2) # Checklist for submitter If some of the following don't apply, delete the relevant line. - [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) - [x] 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 | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) 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 45bda9ce45..c9575f7421 100644 --- a/frontend/pages/ManageControlsPage/OSSettings/cards/CustomSettings/components/ProfileUploader/helpers.tsx +++ b/frontend/pages/ManageControlsPage/OSSettings/cards/CustomSettings/components/ProfileUploader/helpers.tsx @@ -2,6 +2,7 @@ import React from "react"; import { AxiosResponse } from "axios"; import { IApiError } from "interfaces/errors"; import { generateSecretErrMsg } from "pages/SoftwarePage/helpers"; +import CustomLink from "components/CustomLink"; export const parseFile = async (file: File): Promise<[string, string]> => { // get the file name and extension @@ -36,6 +37,34 @@ const generateUnsupportedVariableErrMsg = (errMsg: string) => { : DEFAULT_ERROR_MESSAGE; }; +const generateCAVarsErrMsg = (errMsg: 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. @@ -95,5 +124,21 @@ export const getErrorMessage = (err: AxiosResponse) => { return generateUnsupportedVariableErrMsg(apiReason); } + if ( + apiReason.includes( + "can't be used if variables for SCEP URL and Challenge are not specified" + ) + ) { + return generateCAVarsErrMsg(apiReason); + } + + if ( + apiReason.includes( + "SCEP profile for custom SCEP certificate authority requires" + ) + ) { + return generateCustomSCEPProfileErrMsg(apiReason); + } + return `Couldn't add. ${apiReason}` || DEFAULT_ERROR_MESSAGE; };