refactor path generation (#41126)

<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #38965 

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

## Testing
- [x] QA'd all new/changed functionality manually
This commit is contained in:
Jahziel Villasana-Espinoza
2026-03-06 12:11:37 -05:00
committed by GitHub
parent 7e438f1303
commit 248f35b78e
2 changed files with 19 additions and 16 deletions
+1
View File
@@ -0,0 +1 @@
- Fixed an issue where iOS/iPadOS hosts couldn't add app store apps from the host library page.
@@ -369,23 +369,25 @@ const HostSoftwareLibrary = ({
const onAddSoftware = useCallback(() => {
// "Add Software" path dependent on host's platform
const addSoftwarePathForHostPlatform = () => {
if (isIPadOrIPhoneHost || isAndroidHost) {
return getPathWithQueryParams(PATHS.SOFTWARE_ADD_APP_STORE, {
platform: isAndroidHost ? "android" : "apple",
});
}
if (isMacOSHost || isWindowsHost) {
return PATHS.SOFTWARE_ADD_FLEET_MAINTAINED;
}
return PATHS.SOFTWARE_ADD_PACKAGE;
};
let path = "";
const params: {
fleet_id: number;
platform?: string;
} = { fleet_id: hostTeamId };
router.push(
getPathWithQueryParams(addSoftwarePathForHostPlatform(), {
fleet_id: hostTeamId,
})
);
switch (true) {
case isIPadOrIPhoneHost || isAndroidHost:
path = PATHS.SOFTWARE_ADD_APP_STORE;
params.platform = isAndroidHost ? "android" : "apple";
break;
case isMacOSHost || isWindowsHost:
path = PATHS.SOFTWARE_ADD_FLEET_MAINTAINED;
break;
default:
path = PATHS.SOFTWARE_ADD_PACKAGE;
}
router.push(getPathWithQueryParams(path, params));
}, [
hostTeamId,
isIPadOrIPhoneHost,