From 01311a938bc8008af58230501b428352561daa24 Mon Sep 17 00:00:00 2001 From: David Rojas Date: Fri, 8 Nov 2024 09:43:45 -0500 Subject: [PATCH 1/3] test for preview --- src/features/network/components/network-configs-table.tsx | 4 ++++ src/features/settings/components/settings.tsx | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/features/network/components/network-configs-table.tsx b/src/features/network/components/network-configs-table.tsx index 5a3cde24..e1ea5b26 100644 --- a/src/features/network/components/network-configs-table.tsx +++ b/src/features/network/components/network-configs-table.tsx @@ -104,6 +104,10 @@ const tableColumns: ColumnDef[] = [ ) }, }, + { + id: 'activate', + header: '', + }, ] type ButtonProps = { diff --git a/src/features/settings/components/settings.tsx b/src/features/settings/components/settings.tsx index 9e111f9d..f272fd45 100644 --- a/src/features/settings/components/settings.tsx +++ b/src/features/settings/components/settings.tsx @@ -1,11 +1,11 @@ -import { NetworkSelect } from '@/features/network/components/network-select' +// import { NetworkSelect } from '@/features/network/components/network-select' import { ClearCache } from './clear-cache' import { NetworkConfigsTable } from '@/features/network/components/network-configs-table' export function Settings() { return (
- + {/* */}
From b8342f8f4083105a535dd03717009229b7c09fd7 Mon Sep 17 00:00:00 2001 From: David Rojas Date: Fri, 8 Nov 2024 11:03:17 -0500 Subject: [PATCH 2/3] Added Activate btn network config table --- .../components/network-configs-table.tsx | 38 ++++++++++++++++--- src/features/settings/components/settings.tsx | 2 - 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/features/network/components/network-configs-table.tsx b/src/features/network/components/network-configs-table.tsx index e1ea5b26..0831cf5b 100644 --- a/src/features/network/components/network-configs-table.tsx +++ b/src/features/network/components/network-configs-table.tsx @@ -16,8 +16,9 @@ import { CreateNetworkConfigForm } from '@/features/network/components/create-ne import { ConfirmButton } from '@/features/common/components/confirm-button' import { toast } from 'react-toastify' import { NetworkConfigWithId } from '@/features/network/data/types' -import { Pencil, Plus, Trash, RotateCcw } from 'lucide-react' +import { Pencil, Plus, Trash, RotateCcw, Power, CircleCheck } from 'lucide-react' import { useRefreshDataProviderToken } from '@/features/common/data' +import { Tooltip, TooltipContent, TooltipTrigger } from '@/features/common/components/tooltip' export const networkConfigsTableLabel = 'Network Configs' export const createNetworkConfigDialogLabel = 'Create Network' @@ -61,6 +62,15 @@ export function NetworkConfigsTable() { } const tableColumns: ColumnDef[] = [ + { + id: 'activate', + header: '', + accessorFn: (item) => item, + cell: (cell) => { + const networkConfig = cell.getValue() + return + }, + }, { header: 'Name', accessorFn: (item) => item.name, @@ -104,10 +114,6 @@ const tableColumns: ColumnDef[] = [ ) }, }, - { - id: 'activate', - header: '', - }, ] type ButtonProps = { @@ -197,3 +203,25 @@ function ResetNetworkButton({ networkConfig, settingsHaveChanged }: ResetNetwork ) } + +function ActivateButton({ networkConfig }: ButtonProps) { + const [selectedNetwork, setSelectedNetwork] = useSelectedNetwork() + const isNetworkActive = selectedNetwork === networkConfig.id + + return ( + <> + {isNetworkActive ? ( + + + +