Skip to content

Commit

Permalink
select multiple traces from table
Browse files Browse the repository at this point in the history
  • Loading branch information
ashrafchowdury committed Dec 1, 2024
1 parent d37bb8d commit 753d6d4
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const ObservabilityDashboard = () => {
const [editColumns, setEditColumns] = useState<string[]>(["span_type", "key", "usage"])
const [isFilterColsDropdownOpen, setIsFilterColsDropdownOpen] = useState(false)
const [isTestsetDrawerOpen, setIsTestsetDrawerOpen] = useState(false)
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([])
const [columns, setColumns] = useState<ColumnsType<_AgentaRootsResponse>>([
{
title: "ID",
Expand Down Expand Up @@ -265,6 +266,12 @@ const ObservabilityDashboard = () => {
return () => clearInterval(interval)
}, [])

const rowSelection = {
onChange: (selectedRowKeys: React.Key[]) => {
setSelectedRowKeys(selectedRowKeys)
},
}

const selectedItem = useMemo(
() => (traces?.length ? getNodeById(traces, selected) : null),
[selected, traces],
Expand Down Expand Up @@ -541,7 +548,7 @@ const ObservabilityDashboard = () => {
<Button
onClick={() => setIsTestsetDrawerOpen(true)}
icon={<Database size={14} />}
disabled={traces.length === 0}
disabled={traces.length === 0 || selectedRowKeys.length === 0}
>
Add test set
</Button>
Expand All @@ -558,6 +565,12 @@ const ObservabilityDashboard = () => {

<div className="flex flex-col gap-2">
<Table
rowSelection={{
type: "checkbox",
columnWidth: 48,
selectedRowKeys,
...rowSelection,
}}
loading={isLoading}
columns={mergedColumns as TableColumnType<_AgentaRootsResponse>[]}
dataSource={traces}
Expand Down

0 comments on commit 753d6d4

Please sign in to comment.