mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 00:18:27 +00:00
Add learn more links for Custom SCEP profile errors (#28905)
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:   # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [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.
This commit is contained in:
parent
93091ea718
commit
0be4e4db39
1 changed files with 45 additions and 0 deletions
|
|
@ -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}{" "}
|
||||
<CustomLink
|
||||
url="https://fleetdm.com/learn-more-about/certificate-authorities"
|
||||
text="Learn more"
|
||||
variant="flash-message-link"
|
||||
newTab
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const generateCustomSCEPProfileErrMsg = (errMsg: string) => {
|
||||
return (
|
||||
<span>
|
||||
Couldn't add. {errMsg}{" "}
|
||||
<CustomLink
|
||||
url="https://fleetdm.com/learn-more-about/custom-scep-configuration-profile"
|
||||
text="Learn more"
|
||||
variant="flash-message-link"
|
||||
newTab
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
/** 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<IApiError>) => {
|
|||
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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue