Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const DeleteHostModal = ({
hostsCount >= 500;

return (
<Modal title="Delete host" onExit={onCancel} className={baseClass}>
<Modal title="Delete" onExit={onCancel} className={baseClass}>
<>
<p>
This will remove the record of <b>{hostText()}</b> and associated data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ describe("TransferHostModal", () => {
it("renders title for single host and label", () => {
setup();

expect(screen.getByText("Transfer host")).toBeInTheDocument();
screen.queryByRole;
expect(
screen.getByText((content, element) => {
return (
element?.tagName.toLowerCase() === "span" && content === "Transfer"
);
})
).toBeInTheDocument();

expect(
screen.getByText("Transfer host to:", { selector: "label" })
Expand All @@ -49,7 +56,13 @@ describe("TransferHostModal", () => {
it("pluralizes title and label when multipleHosts is true", () => {
setup({ multipleHosts: true });

expect(screen.getByText("Transfer hosts")).toBeInTheDocument();
expect(
screen.getByText((content, element) => {
return (
element?.tagName.toLowerCase() === "span" && content === "Transfer"
);
})
).toBeInTheDocument();

expect(
screen.getByText("Transfer selected hosts to:", { selector: "label" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ const TransferHostModal = ({
};

return (
<Modal
onExit={onCancel}
title={`Transfer host${multipleHosts ? "s" : ""}`}
className={baseClass}
>
<Modal onExit={onCancel} title="Transfer" className={baseClass}>
<>
<form className={`${baseClass}__form`}>
<Dropdown
Expand Down
10 changes: 8 additions & 2 deletions frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,13 @@ Observer plus must be checked against host's team id */
showRefetchSpinner={showRefetchSpinner}
onRefetchHost={onRefetchHost}
renderActionsDropdown={renderActionsDropdown}
hostMdmDeviceStatus={hostMdmDeviceStatus}
// Setting this to "locking" because if a host is "locating", it is also
// "locking"; an iOS/iPadOS host isn't "locked" until the location is found.
hostMdmDeviceStatus={
hostMdmDeviceStatus === "locating"
? "locking"
: hostMdmDeviceStatus
}
hostMdmEnrollmentStatus={host.mdm?.enrollment_status || undefined}
/>
</div>
Expand Down Expand Up @@ -1687,7 +1693,7 @@ Observer plus must be checked against host's team id */
}}
onClickLock={() => {
setShowLockHostModal(true);
setShowLocationModal(undefined);
setShowLocationModal(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wert, why didn't TS catch this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no clue!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I don't think we actually want to change this, see #37660 (comment)

cc @RachelElysia @iansltx

}}
detailsUpdatedAt={host.detail_updated_at}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ const IosOrIpadLockPreview = () => {
<p>
Instead of &quot;Fleet&quot;, the message will show the{" "}
<b>Organization name</b> that you configured in{" "}
<Link to={PATHS.ADMIN_ORGANIZATION_INFO}>Organization settings</Link>.
<CustomLink
url={PATHS.ADMIN_ORGANIZATION_INFO}
text={"Organization settings"}
/>
.
</p>
<img src={IphoneLockPreview} alt="iPhone with a lock screen message" />
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const UnlockModal = ({
};

return (
<Modal className={baseClass} title="Unlock host" onExit={onClose}>
<Modal className={baseClass} title="Unlock" onExit={onClose}>
<>
<div className={`${baseClass}__modal-content`}>
{renderModalContent()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const WipeModal = ({ id, hostName, onSuccess, onClose }: IWipeModalProps) => {
};

return (
<Modal className={baseClass} title="Wipe host" onExit={onClose}>
<Modal className={baseClass} title="Wipe" onExit={onClose}>
<>
<div className={`${baseClass}__modal-content`}>
<p>All content will be erased on this host.</p>
Expand Down
6 changes: 1 addition & 5 deletions frontend/pages/hosts/details/cards/HostHeader/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ export const DEVICE_STATUS_TAGS: DeviceStatusTagConfig = {
title: "LOCK PENDING",
tagType: "warning",
generateTooltip: () => (
<>
Host will lock when it comes online. If the host is
<br />
online, it will lock the next time it checks in to Fleet.
</>
<>Host will lock the next time it checks in to Fleet.</>
),
},
wiped: {
Expand Down
9 changes: 5 additions & 4 deletions frontend/pages/hosts/details/cards/Vitals/Vitals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,16 @@ const Vitals = ({
const renderGeolocation = () => {
const geolocation = vitalsData.geolocation;

if (!isIosOrIpadosHost && !geolocation) {
const isAdeIDevice =
isIosOrIpadosHost && mdm?.enrollment_status === "On (automatic)";

if (!isAdeIDevice && !geolocation) {
return null;
}

const geoLocationButton = (
<Button variant="text-link" onClick={toggleLocationModal}>
{isIosOrIpadosHost
? "Show location"
: getCityCountryLocation(geolocation)}
{isAdeIDevice ? "Show location" : getCityCountryLocation(geolocation)}
</Button>
);
return <DataSet title="Location" value={geoLocationButton} />;
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/hosts/details/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const API_TO_UI_DEVICE_STATUS_MAP: Record<
lock: "locking",
wiped: "wiped",
wipe: "wiping",
location: "locking",
location: "locating",
};

const deviceUpdatingStates = ["unlocking", "locking", "wiping"] as const;
Expand Down
Loading