diff --git a/flow/cmd/peer_data.go b/flow/cmd/peer_data.go index a0de4b665f..3fcdb179bb 100644 --- a/flow/cmd/peer_data.go +++ b/flow/cmd/peer_data.go @@ -40,7 +40,7 @@ func (h *FlowRequestHandler) GetSlotInfo( if err != nil { return &protos.PeerSlotResponse{SlotData: nil}, err } - + defer peerPool.Close() rows, err := peerPool.Query(ctx, "SELECT slot_name, redo_lsn::Text,restart_lsn::text,"+ "round((redo_lsn-restart_lsn) / 1024 / 1024 , 2) AS MB_Behind"+ " FROM pg_control_checkpoint(), pg_replication_slots;") @@ -79,7 +79,7 @@ func (h *FlowRequestHandler) GetStatInfo( if err != nil { return &protos.PeerStatResponse{StatData: nil}, err } - + defer peerPool.Close() rows, err := peerPool.Query(ctx, "SELECT pid, query, EXTRACT(epoch FROM(now()-query_start)) AS dur"+ " FROM pg_stat_activity WHERE query_start IS NOT NULL;") if err != nil { diff --git a/ui/app/peers/[peerName]/datatables.tsx b/ui/app/peers/[peerName]/datatables.tsx index 03df70f29c..96aff940b9 100644 --- a/ui/app/peers/[peerName]/datatables.tsx +++ b/ui/app/peers/[peerName]/datatables.tsx @@ -1,6 +1,5 @@ +import { CopyButton } from '@/components/CopyButton'; import { SlotInfo, StatInfo } from '@/grpc_generated/route'; -import { Button } from '@/lib/Button'; -import { Icon } from '@/lib/Icon'; import { Label } from '@/lib/Label'; import { Table, TableCell, TableRow } from '@/lib/Table'; import Link from 'next/link'; @@ -13,9 +12,11 @@ export const SlotTable = ({ data }: { data: SlotInfo[] }) => { return ''; }; return ( - <> -
Replication Slot Information
-
+
+
+ Replication Slot Information +
+
@@ -55,15 +56,17 @@ export const SlotTable = ({ data }: { data: SlotInfo[] }) => { })}
- +
); }; export const StatTable = ({ data }: { data: StatInfo[] }) => { return ( - <> -
Stat Activity Information
-
+
+
+ Stat Activity Information +
+
@@ -97,15 +100,13 @@ export const StatTable = ({ data }: { data: StatInfo[] }) => { }} > {query} - + ))}
- +
); }; diff --git a/ui/app/peers/[peerName]/page.tsx b/ui/app/peers/[peerName]/page.tsx index 2354b09393..e294f7e328 100644 --- a/ui/app/peers/[peerName]/page.tsx +++ b/ui/app/peers/[peerName]/page.tsx @@ -37,7 +37,6 @@ const PeerData = async ({ params: { peerName } }: DataConfigProps) => { display: 'flex', flexDirection: 'column', height: '80vh', - justifyContent: 'space-around', }} > diff --git a/ui/components/CopyButton.tsx b/ui/components/CopyButton.tsx new file mode 100644 index 0000000000..b5d10de1e1 --- /dev/null +++ b/ui/components/CopyButton.tsx @@ -0,0 +1,20 @@ +'use client'; +import { Button } from '@/lib/Button'; +import { Icon } from '@/lib/Icon'; +import { useState } from 'react'; + +export const CopyButton = ({ text }: { text: string }) => { + const [copied, setCopied] = useState(false); + const handleClick = () => { + navigator.clipboard.writeText(text); + setCopied(true); + }; + return ( + + ); +};