diff --git a/frontend/pages/hosts/details/cards/Software/helpers.tsx b/frontend/pages/hosts/details/cards/Software/helpers.tsx index e251728bdf85..2020a1487090 100644 --- a/frontend/pages/hosts/details/cards/Software/helpers.tsx +++ b/frontend/pages/hosts/details/cards/Software/helpers.tsx @@ -18,6 +18,15 @@ const createVPPTokenExpiredMessage = () => ( ); +// determines if we want to show the API message as is to the user. +const showAPIMessage = (message: string) => { + return ( + message.includes("MDM is turned off") || + message.includes("No available licenses") || + message.includes("Software title is not available for install") + ); +}; + // eslint-disable-next-line import/prefer-default-export export const getErrorMessage = (e: unknown) => { const reason = upperFirst(trimEnd(getErrorReason(e), ".")); @@ -27,8 +36,8 @@ export const getErrorMessage = (e: unknown) => { } else if (reason.includes("can be installed only on")) { return createOnlyInstallableOnMacOSMessage(reason); } else if (reason.includes("VPP token expired")) { - createVPPTokenExpiredMessage(); - } else if (reason.includes("MDM is turned off")) { + return createVPPTokenExpiredMessage(); + } else if (showAPIMessage(reason)) { return reason; }