UI – Read "unavailable" when iPad/iPhone refetch is unsuccessful (#21120)

## Addresses #21119 

<img width="1498" alt="Screenshot 2024-08-06 at 8 32 15 PM"
src="https://github.com/user-attachments/assets/03df66be-ea29-4169-8bb3-9254fe82ed68">

- [x] Manual QA for all new/changed functionality

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
jacobshandling 2024-08-07 10:00:56 -07:00 committed by GitHub
parent 50ba783a25
commit 3b34bbf1ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 6 deletions

View file

@ -108,3 +108,7 @@ export const isAppleDevice = (platform: string) => {
platform as typeof HOST_APPLE_PLATFORMS[number]
);
};
// TODO - improve all platform types to be Platform
export const isIPadOrIPhone = (platform: string | Platform) =>
["ios", "ipados"].includes(platform);

View file

@ -53,7 +53,7 @@ import {
HOST_OSQUERY_DATA,
} from "utilities/constants";
import { Platform } from "interfaces/platform";
import { isIPadOrIPhone, Platform } from "interfaces/platform";
import Spinner from "components/Spinner";
import TabsWrapper from "components/TabsWrapper";
@ -335,7 +335,11 @@ const HostDetailsPage = ({
} else {
renderFlash(
"error",
`This host is offline. Please try refetching host vitals later.`
`This host is ${
isIPadOrIPhone(returnedHost.platform)
? "unavailable"
: "offline"
}. Please try refetching host vitals later.`
);
setShowRefetchSpinner(false);
}

View file

@ -12,7 +12,7 @@ import deviceAPI, {
IGetDeviceSoftwareResponse,
} from "services/entities/device_user";
import { IHostSoftware, ISoftware } from "interfaces/software";
import { Platform } from "interfaces/platform";
import { isIPadOrIPhone, Platform } from "interfaces/platform";
import { DEFAULT_USE_QUERY_OPTIONS } from "utilities/constants";
import { NotificationContext } from "context/notification";
import { AppContext } from "context/app";
@ -98,7 +98,7 @@ const HostSoftware = ({
}: IHostSoftwareProps) => {
const { renderFlash } = useContext(NotificationContext);
const vulnFilterAndNotSupported =
["ios", "ipados"].includes(platform ?? "") && queryParams.vulnerable;
isIPadOrIPhone(platform ?? "") && queryParams.vulnerable;
const {
isGlobalAdmin,
isGlobalMaintainer,

View file

@ -11,6 +11,7 @@ import { ISoftwareDropdownFilterVal } from "pages/SoftwarePage/SoftwareTitles/So
import {
ApplePlatform,
APPLE_PLATFORM_DISPLAY_NAMES,
isIPadOrIPhone,
Platform,
} from "interfaces/platform";
@ -189,8 +190,7 @@ const HostSoftwareTable = ({
const memoizedEmptyComponent = useCallback(() => {
const vulnFilterAndNotSupported =
["ios", "ipados"].includes(platform) &&
hostSoftwareFilter === "vulnerableSoftware";
isIPadOrIPhone(platform) && hostSoftwareFilter === "vulnerableSoftware";
return vulnFilterAndNotSupported ? (
<VulnsNotSupported
platformText={APPLE_PLATFORM_DISPLAY_NAMES[platform as ApplePlatform]}