From 0d5aca058b36d80710e3665caf620492ecd3748e Mon Sep 17 00:00:00 2001 From: Mohamed Khelif Date: Mon, 26 Feb 2024 16:37:38 -0500 Subject: [PATCH] Move spawnhostcard and add deprecated notice --- .../SpawnHostCard.stories.tsx | 2 +- .../spawnHost/SpawnHostCard/constants.ts | 6 +++++ .../index.tsx} | 23 +++++++++++++++---- src/pages/spawn/spawnHost/SpawnHostTable.tsx | 2 +- src/pages/spawn/spawnHost/index.ts | 1 - 5 files changed, 26 insertions(+), 8 deletions(-) rename src/pages/spawn/spawnHost/{ => SpawnHostCard}/SpawnHostCard.stories.tsx (95%) create mode 100644 src/pages/spawn/spawnHost/SpawnHostCard/constants.ts rename src/pages/spawn/spawnHost/{SpawnHostCard.tsx => SpawnHostCard/index.tsx} (82%) diff --git a/src/pages/spawn/spawnHost/SpawnHostCard.stories.tsx b/src/pages/spawn/spawnHost/SpawnHostCard/SpawnHostCard.stories.tsx similarity index 95% rename from src/pages/spawn/spawnHost/SpawnHostCard.stories.tsx rename to src/pages/spawn/spawnHost/SpawnHostCard/SpawnHostCard.stories.tsx index fa5affa789..67eba81fd0 100644 --- a/src/pages/spawn/spawnHost/SpawnHostCard.stories.tsx +++ b/src/pages/spawn/spawnHost/SpawnHostCard/SpawnHostCard.stories.tsx @@ -1,5 +1,5 @@ -import { SpawnHostCard } from "pages/spawn/spawnHost/SpawnHostCard"; import { CustomStoryObj, CustomMeta } from "test_utils/types"; +import SpawnHostCard from "."; export default { title: "Pages/Spawn/Spawn Host Card", diff --git a/src/pages/spawn/spawnHost/SpawnHostCard/constants.ts b/src/pages/spawn/spawnHost/SpawnHostCard/constants.ts new file mode 100644 index 0000000000..a120ff8132 --- /dev/null +++ b/src/pages/spawn/spawnHost/SpawnHostCard/constants.ts @@ -0,0 +1,6 @@ +const workstationSupportedDistros = [ + "ubuntu1804-workstation", + "ubuntu1804-workstation-graviton", +]; + +export { workstationSupportedDistros }; diff --git a/src/pages/spawn/spawnHost/SpawnHostCard.tsx b/src/pages/spawn/spawnHost/SpawnHostCard/index.tsx similarity index 82% rename from src/pages/spawn/spawnHost/SpawnHostCard.tsx rename to src/pages/spawn/spawnHost/SpawnHostCard/index.tsx index 4a75eaeca3..2a204fdc52 100644 --- a/src/pages/spawn/spawnHost/SpawnHostCard.tsx +++ b/src/pages/spawn/spawnHost/SpawnHostCard/index.tsx @@ -1,5 +1,6 @@ import styled from "@emotion/styled"; import Badge from "@leafygreen-ui/badge"; +import { InfoSprinkle } from "@leafygreen-ui/info-sprinkle"; import { Analytics, useSpawnAnalytics, @@ -12,6 +13,7 @@ import { size } from "constants/tokens"; import { useDateFormat } from "hooks"; import { HostStatus } from "types/host"; import { MyHost } from "types/spawn"; +import { workstationSupportedDistros } from "./constants"; type SendEvent = Analytics["sendEvent"]; @@ -19,7 +21,7 @@ interface SpawnHostCardProps { host: MyHost; } -export const SpawnHostCard: React.FC = ({ host }) => { +const SpawnHostCard: React.FC = ({ host }) => { const { sendEvent } = useSpawnAnalytics(); return ( @@ -88,18 +90,29 @@ const spawnHostCardFieldMaps = (sendEvent: SendEvent) => ({ ), IDE: (host: MyHost) => host?.distro?.isVirtualWorkStation && - host?.status === HostStatus.Running ? ( - + host?.status === HostStatus.Running && + workstationSupportedDistros.includes(host?.distro?.id) ? ( + sendEvent({ name: "Opened IDE" })} > - Open IDE + Open IDE (Deprecated) - + + The Evergreen IDE is now deprecated and is no longer installed on + Workstations + + ) : undefined, }); +const IDEContainer = styled.div` + display: flex; + gap: ${size.xs}; +`; const PaddedBadge = styled(Badge)` margin-right: ${size.xs}; `; + +export default SpawnHostCard; diff --git a/src/pages/spawn/spawnHost/SpawnHostTable.tsx b/src/pages/spawn/spawnHost/SpawnHostTable.tsx index 125246acca..291987149f 100644 --- a/src/pages/spawn/spawnHost/SpawnHostTable.tsx +++ b/src/pages/spawn/spawnHost/SpawnHostTable.tsx @@ -10,7 +10,7 @@ import { BaseTable } from "components/Table/BaseTable"; import { size } from "constants/tokens"; import { useQueryParam } from "hooks/useQueryParam"; import { MyHost, QueryParams } from "types/spawn"; -import { SpawnHostCard } from "./SpawnHostCard"; +import SpawnHostCard from "./SpawnHostCard"; import { SpawnHostTableActions } from "./SpawnHostTableActions"; interface SpawnHostTableProps { diff --git a/src/pages/spawn/spawnHost/index.ts b/src/pages/spawn/spawnHost/index.ts index 3f8436265f..7d2e98bc8f 100644 --- a/src/pages/spawn/spawnHost/index.ts +++ b/src/pages/spawn/spawnHost/index.ts @@ -1,6 +1,5 @@ export { SpawnHostTable } from "./SpawnHostTable"; export { SpawnHostButton } from "./SpawnHostButton"; export { SpawnHostActionButton } from "./SpawnHostActionButton"; -export { SpawnHostCard } from "./SpawnHostCard"; export { EditSpawnHostModal } from "./EditSpawnHostModal"; export { EditSpawnHostButton } from "./EditSpawnHostButton";