Fixed self-service checkbox appearing when iOS or iPadOS app is selected. (#22287)

This commit is contained in:
Luke Heath 2024-09-23 15:14:34 -05:00 committed by GitHub
parent 631dc6075d
commit 31633148ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 16 deletions

View file

@ -0,0 +1 @@
- Fixed self-service checkbox appearing when iOS or iPadOS app is selected.

View file

@ -177,6 +177,9 @@ const AppStoreVpp = ({
const onSelectApp = (app: IVppApp) => {
setIsSubmitDisabled(false);
setSelectedApp(app);
if (app.platform === "ios" || app.platform === "ipados") {
setIsSelfService(false);
}
};
const onAddSoftware = async () => {
@ -209,6 +212,27 @@ const AppStoreVpp = ({
onExit();
};
const renderSelfServiceContent = (platform: string) => {
if (platform !== "ios" && platform !== "ipados") {
return (
<Checkbox
value={isSelfService}
onChange={(newVal: boolean) => setIsSelfService(newVal)}
className={`${baseClass}__self-service-checkbox`}
tooltipContent={
<>
End users can install from <b>Fleet Desktop</b> {">"}{" "}
<b>Self-service</b>.
</>
}
>
Self-service
</Checkbox>
);
}
return null;
};
const renderContent = () => {
if (isLoadingVppInfo || isLoadingVppApps) {
return <Spinner />;
@ -238,19 +262,9 @@ const AppStoreVpp = ({
apps, head to{" "}
<CustomLink url="https://business.apple.com" text="ABM" newTab />
</div>
<Checkbox
value={isSelfService}
onChange={(newVal: boolean) => setIsSelfService(newVal)}
className={`${baseClass}__self-service-checkbox`}
tooltipContent={
<>
End users can install from <b>Fleet Desktop</b> {">"}{" "}
<b>Self-service</b>.
</>
}
>
Self-service
</Checkbox>
{renderSelfServiceContent(
(selectedApp && selectedApp.platform) || ""
)}
</div>
);
}

View file

@ -35,13 +35,15 @@ const generateAlreadyAvailableMessage = (msg: string) => {
// eslint-disable-next-line import/prefer-default-export
export const getErrorMessage = (e: unknown) => {
const reason = getErrorReason(e);
let reason = getErrorReason(e);
// software is already available for install
if (reason.toLowerCase().includes("already")) {
return generateAlreadyAvailableMessage(reason);
}
return DEFAULT_ERROR_MESSAGE;
if (reason && !reason.endsWith(".")) {
reason += ".";
}
return reason || DEFAULT_ERROR_MESSAGE;
};
export const getUniqueAppId = (app: IVppApp) =>