Skip to content

Commit

Permalink
fix(frontend): child node selection issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ashrafchowdury committed Dec 4, 2024
1 parent 8854ee0 commit b337746
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -499,15 +499,13 @@ const ObservabilityDashboard = () => {
const getTestsetTraceData = () => {
if (!traces?.length) return []

const extractData = traces.reduce<TestsetTraceData[]>((acc, trace, idx) => {
if (selectedRowKeys.includes(trace.key)) {
acc.push({data: trace.data as KeyValuePair, key: trace.key, id: idx + 1})
}
return acc
}, [])
const extractData = selectedRowKeys.map((key, idx) => {
const node = getNodeById(traces, key as string)
return {data: node?.data as KeyValuePair, key: node?.key, id: idx + 1}
})

if (extractData.length > 0) {
setTestsetDrawerData(extractData)
setTestsetDrawerData(extractData as TestsetTraceData[])
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,21 @@ const TestsetDrawer = ({onClose, data, ...props}: Props) => {
)

// predefind options
const customSelectOptions = useMemo(
() => [
const customSelectOptions = (divider = true) => {
return [
{value: "create", label: "Create New"},
{
value: "divider",
label: <Divider className="!my-1" />,
className: "!p-0 !m-0 !min-h-0.5 !cursor-default",
disabled: true,
},
],
[],
)
...(divider
? [
{
value: "divider",
label: <Divider className="!my-1" />,
className: "!p-0 !m-0 !min-h-0.5 !cursor-default",
disabled: true,
},
]
: []),
]
}

const onTestsetOptionChange = async (option: {label: string; value: string}) => {
const {value, label} = option
Expand Down Expand Up @@ -406,7 +409,7 @@ const TestsetDrawer = ({onClose, data, ...props}: Props) => {
}
onChange={onTestsetOptionChange}
options={[
...customSelectOptions,
...customSelectOptions(listOfTestsets.length > 0),
...listOfTestsets.map((item: testset) => ({
value: item._id,
label: item.name,
Expand Down Expand Up @@ -558,7 +561,9 @@ const TestsetDrawer = ({onClose, data, ...props}: Props) => {
}
options={[
...(testset.id
? customSelectOptions
? customSelectOptions(
columnOptions.length > 0,
)
: []),
...columnOptions?.map((column) => ({
value: column,
Expand Down

0 comments on commit b337746

Please sign in to comment.