Skip to content

Commit

Permalink
show correct install error messages for VPP software (#20732)
Browse files Browse the repository at this point in the history
relates to #20710, #20709

a quick fix to show the correct install software error messages.
includes:

1. error message for no available VPP app licenses
2. Error when Vpp app is deleted and user tried to install
  • Loading branch information
ghernandez345 authored Jul 26, 2024
1 parent 07f6ed1 commit 6abb854
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions frontend/pages/hosts/details/cards/Software/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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), "."));
Expand All @@ -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;
}

Expand Down

0 comments on commit 6abb854

Please sign in to comment.