From d1ce2128f32a4965e55611c24b606937cb92e0e1 Mon Sep 17 00:00:00 2001 From: Sean Edmunds Date: Tue, 30 Dec 2025 10:41:01 -0600 Subject: [PATCH] Updates to guac clients --- .../homepage/components/Search/Search.tsx | 38 ++++++-- .../components/RecommendedBookmarks.tsx | 2 +- .../Search/components/RecommendedClients.tsx | 91 +++++++++++++++++++ .../DebouncedGuacamoleClient.tsx | 18 +++- .../GuacamoleClientSettingsItem.tsx | 7 +- .../GuacamoleClients/GuacamoleClients.tsx | 8 +- 6 files changed, 149 insertions(+), 15 deletions(-) create mode 100644 src/pages/homepage/components/Search/components/RecommendedClients.tsx diff --git a/src/pages/homepage/components/Search/Search.tsx b/src/pages/homepage/components/Search/Search.tsx index 380d173..71919f6 100644 --- a/src/pages/homepage/components/Search/Search.tsx +++ b/src/pages/homepage/components/Search/Search.tsx @@ -27,6 +27,7 @@ import type { } from 'types'; import RecommendedApplications from './components/RecommendedApplications'; import RecommendedBookmarks from './components/RecommendedBookmarks'; +import RecommendedClients from './components/RecommendedClients'; import SearchSelectItem from './components/SearchSelectItem'; export default function Search({ @@ -71,6 +72,9 @@ export default function Search({ const [providers, setProviders] = useState([]); const [guacamoleHost, setGuacamoleHost] = useState(''); const [guacamoleClients, setGuacamoleClients] = useState([]); + const [filteredGuacamoleClients, setFilteredGuacamoleClients] = useState< + GuacamoleClient[] + >([]); const [applications, setApplications] = useState([]); const [filteredApplications, setFilteredApplications] = useState([]); const [bookmarks, setBookmarks] = useState([]); @@ -395,7 +399,11 @@ export default function Search({ : (providers.find((p: Provider) => p.prefix === item.option.prefix)?.icon ?? '') ] - : allIcons.FaComputer; + : item.option.type === 'SSH' + ? allIcons.FaTerminal + : item.option.type === 'RDP' + ? allIcons.FaComputer + : allIcons.FaDesktop; return (searchValue as string).startsWith('!') ? ( { + if (guacamoleClients) { + setFilteredGuacamoleClients( + guacamoleClients.filter((client: GuacamoleClient) => + client.clientName.toLowerCase().includes((searchValue as string).toLowerCase()), + ), + ); + } + }, [guacamoleClients, searchValue]); + useEffect(() => { if (applicationData && !isApplicationDataFetching) { setApplications(applicationData); @@ -697,11 +715,19 @@ export default function Search({ Recommended items: - + + + + void; +}) { + return ( + 0 ? 1 : 0, + }} + > + + + Guacamole Clients + + + + {filteredGuacamoleClients + .map((client: GuacamoleClient) => ( + handleGuacamoleClientLaunchItem({ option: client })} + > + {client.type === 'SSH' && } + {client.type === 'RDP' && } + {client.type === 'VNC' && } + + {client.clientName} + + + )) + .toSorted((a: any, b: any) => (a.name > b.name ? 1 : -1)) + .slice(0, 5)} + + + + ); +} diff --git a/src/pages/settings/components/GuacamoleClients/DebouncedGuacamoleClient.tsx b/src/pages/settings/components/GuacamoleClients/DebouncedGuacamoleClient.tsx index 0def843..84079bf 100644 --- a/src/pages/settings/components/GuacamoleClients/DebouncedGuacamoleClient.tsx +++ b/src/pages/settings/components/GuacamoleClients/DebouncedGuacamoleClient.tsx @@ -1,6 +1,8 @@ import { ActionIcon, Card, + type ComboboxItem, + type ComboboxLikeRenderOptionInput, Group, Select, Stack, @@ -12,6 +14,8 @@ import { useDebouncedValue, useDisclosure } from '@mantine/hooks'; import { DeleteItemModal } from 'components'; import { useCommonHooks, useMutationAPI } from 'hooks'; import { useEffect, useState } from 'react'; +import { FaDesktop, FaTerminal } from 'react-icons/fa'; +import { FaComputer } from 'react-icons/fa6'; import { FiTrash } from 'react-icons/fi'; import { cardClasses, @@ -90,7 +94,7 @@ function DebouncedGuacamoleClient({ - + { w={'45%'} mt={'.75rem'} limit={100} - placeholder='Search for an icon...' + placeholder='Client Type' data={types.map((type) => { return { label: type,