mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 16:39:01 +00:00
parent
e02ad241ea
commit
ecaea6104d
3 changed files with 60 additions and 54 deletions
|
|
@ -128,7 +128,7 @@ export const isLinuxLike = (platform: string) => {
|
|||
);
|
||||
};
|
||||
|
||||
export const isAppleDevice = (platform: string) => {
|
||||
export const isAppleDevice = (platform = "") => {
|
||||
return HOST_APPLE_PLATFORMS.includes(
|
||||
platform as typeof HOST_APPLE_PLATFORMS[number]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -157,8 +157,31 @@ const DeviceUserPage = ({
|
|||
}
|
||||
);
|
||||
|
||||
const {
|
||||
data: deviceCertificates,
|
||||
isLoading: isLoadingDeviceCertificates,
|
||||
isError: isErrorDeviceCertificates,
|
||||
refetch: refetchDeviceCertificates,
|
||||
} = useQuery(
|
||||
["hostCertificates", deviceAuthToken],
|
||||
() =>
|
||||
deviceUserAPI.getDeviceCertificates(
|
||||
deviceAuthToken,
|
||||
DEFAULT_CERTIFICATES_PAGE,
|
||||
DEFAULT_CERTIFICATES_PAGE_SIZE
|
||||
),
|
||||
{
|
||||
...DEFAULT_USE_QUERY_OPTIONS,
|
||||
// FIXME: is it worth disabling for unsupported platforms? we'd have to workaround the a
|
||||
// catch-22 where we need to know the platform to know if it's supported but we also need to
|
||||
// be able to include the cert refetch in the hosts query hook.
|
||||
enabled: !!deviceUserAPI,
|
||||
}
|
||||
);
|
||||
|
||||
const refetchExtensions = () => {
|
||||
deviceMapping !== null && refetchDeviceMapping();
|
||||
deviceCertificates && refetchDeviceCertificates();
|
||||
};
|
||||
|
||||
const isRefetching = ({
|
||||
|
|
@ -253,25 +276,7 @@ const DeviceUserPage = ({
|
|||
self_service: hasSelfService = false,
|
||||
} = dupResponse || {};
|
||||
const isPremiumTier = license?.tier === "premium";
|
||||
const isAppleHost = host && isAppleDevice(host.platform);
|
||||
|
||||
const {
|
||||
data: deviceCertificates,
|
||||
isLoading: isLoadingDeviceCertificates,
|
||||
isError: isErrorDeviceCertificates,
|
||||
} = useQuery(
|
||||
["hostCertificates", deviceAuthToken],
|
||||
() =>
|
||||
deviceUserAPI.getDeviceCertificates(
|
||||
deviceAuthToken,
|
||||
DEFAULT_CERTIFICATES_PAGE,
|
||||
DEFAULT_CERTIFICATES_PAGE_SIZE
|
||||
),
|
||||
{
|
||||
...DEFAULT_USE_QUERY_OPTIONS,
|
||||
enabled: !!deviceUserAPI && isAppleHost,
|
||||
}
|
||||
);
|
||||
const isAppleHost = isAppleDevice(host?.platform);
|
||||
|
||||
const summaryData = normalizeEmptyValues(pick(host, HOST_SUMMARY_DATA));
|
||||
|
||||
|
|
@ -453,7 +458,7 @@ const DeviceUserPage = ({
|
|||
deviceMapping={deviceMapping}
|
||||
munki={deviceMacAdminsData?.munki}
|
||||
/>
|
||||
{isAppleHost && deviceCertificates?.certificates.length && (
|
||||
{isAppleHost && !!deviceCertificates?.certificates.length && (
|
||||
<CertificatesCard
|
||||
isMyDevicePage
|
||||
data={deviceCertificates}
|
||||
|
|
|
|||
|
|
@ -274,10 +274,42 @@ const HostDetailsPage = ({
|
|||
}
|
||||
);
|
||||
|
||||
const {
|
||||
data: hostCertificates,
|
||||
isLoading: isLoadingHostCertificates,
|
||||
isError: isErrorHostCertificates,
|
||||
refetch: refetchHostCertificates,
|
||||
} = useQuery<
|
||||
IGetHostCertificatesResponse,
|
||||
Error,
|
||||
IGetHostCertificatesResponse
|
||||
>(
|
||||
[
|
||||
"host-certificates",
|
||||
host_id,
|
||||
DEFAULT_CERTIFICATES_PAGE,
|
||||
DEFAULT_CERTIFICATES_PAGE_SIZE,
|
||||
],
|
||||
() =>
|
||||
hostAPI.getHostCertificates(
|
||||
hostIdFromURL,
|
||||
DEFAULT_CERTIFICATES_PAGE,
|
||||
DEFAULT_CERTIFICATES_PAGE_SIZE
|
||||
),
|
||||
{
|
||||
...DEFAULT_USE_QUERY_OPTIONS,
|
||||
// FIXME: is it worth disabling for unsupported platforms? we'd have to workaround the a
|
||||
// catch-22 where we need to know the platform to know if it's supported but we also need to
|
||||
// be able to include the cert refetch in the hosts query hook.
|
||||
enabled: !!hostIdFromURL,
|
||||
}
|
||||
);
|
||||
|
||||
const refetchExtensions = () => {
|
||||
deviceMapping !== null && refetchDeviceMapping();
|
||||
macadmins !== null && refetchMacadmins();
|
||||
mdm?.enrollment_status !== null && refetchMdm();
|
||||
hostCertificates && refetchHostCertificates();
|
||||
};
|
||||
|
||||
const {
|
||||
|
|
@ -462,37 +494,6 @@ const HostDetailsPage = ({
|
|||
}
|
||||
);
|
||||
|
||||
const {
|
||||
data: hostCertificates,
|
||||
isLoading: isLoadingHostCertificates,
|
||||
isError: isErrorHostCertificates,
|
||||
} = useQuery<
|
||||
IGetHostCertificatesResponse,
|
||||
Error,
|
||||
IGetHostCertificatesResponse
|
||||
>(
|
||||
[
|
||||
"host-certificates",
|
||||
host_id,
|
||||
DEFAULT_CERTIFICATES_PAGE,
|
||||
DEFAULT_CERTIFICATES_PAGE_SIZE,
|
||||
],
|
||||
() =>
|
||||
hostAPI.getHostCertificates(
|
||||
hostIdFromURL,
|
||||
DEFAULT_CERTIFICATES_PAGE,
|
||||
DEFAULT_CERTIFICATES_PAGE_SIZE
|
||||
),
|
||||
{
|
||||
...DEFAULT_USE_QUERY_OPTIONS,
|
||||
enabled:
|
||||
!!hostIdFromURL &&
|
||||
(host?.platform === "darwin" ||
|
||||
host?.platform === "ios" ||
|
||||
host?.platform === "ipados"),
|
||||
}
|
||||
);
|
||||
|
||||
const featuresConfig = host?.team_id
|
||||
? teams?.find((t) => t.id === host.team_id)?.features
|
||||
: config?.features;
|
||||
|
|
@ -957,7 +958,7 @@ const HostDetailsPage = ({
|
|||
/>
|
||||
)}
|
||||
{(isIosOrIpadosHost || isDarwinHost) &&
|
||||
hostCertificates?.certificates.length && (
|
||||
!!hostCertificates?.certificates.length && (
|
||||
<CertificatesCard
|
||||
data={hostCertificates}
|
||||
hostPlatform={host.platform}
|
||||
|
|
@ -980,7 +981,7 @@ const HostDetailsPage = ({
|
|||
hostTeamId={host.team_id || 0}
|
||||
hostMDMEnrolled={host.mdm.connected_to_fleet}
|
||||
/>
|
||||
{host?.platform === "darwin" && macadmins?.munki?.version && (
|
||||
{isDarwinHost && macadmins?.munki?.version && (
|
||||
<MunkiIssuesCard
|
||||
isLoading={isLoadingHost}
|
||||
munkiIssues={macadmins.munki_issues}
|
||||
|
|
|
|||
Loading…
Reference in a new issue