pass selected keys on through

This commit is contained in:
Nate Kelley 2025-09-15 18:36:08 -06:00
parent e6ab103f52
commit e432afb92e
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
5 changed files with 23 additions and 34 deletions

View File

@ -34,7 +34,13 @@ const BusterListRowComponentSelectorInner = React.forwardRef(
if (row.rowSection) {
return (
<BusterListSectionComponent rowSection={row.rowSection} ref={ref} key={row.id} {...rest} />
<BusterListSectionComponent
rowSection={row.rowSection}
ref={ref}
key={row.id}
selectedRowKeys={selectedRowKeys}
{...rest}
/>
);
}

View File

@ -13,7 +13,7 @@ export const BusterListSectionComponent = React.memo(
rowSection: NonNullable<BusterListRowItem['rowSection']>;
onSelectSectionChange?: (v: boolean, id: string) => void;
id: string;
selectedRowKeys?: string[];
selectedRowKeys: string[] | undefined;
rows: BusterListRowItem[];
style?: React.CSSProperties;
rowClassName?: string;

View File

@ -138,6 +138,7 @@ export const ChatItemsContainer: React.FC<{
onSelectChange={onSelectChange}
selectedRowKeys={selectedRowKeys}
emptyState={useMemo(() => <EmptyState loading={loading} type={type} />, [loading, type])}
showSelectAll={false}
/>
<ChatSelectedOptionPopup

View File

@ -99,9 +99,9 @@ const CollectionList: React.FC<{
}> = React.memo(({ collectionsList, setOpenNewCollectionModal, loadedCollections }) => {
const [selectedRowKeys, setSelectedRowKeys] = useState<string[]>([]);
const createCollectionLinkItem = createListItem<BusterCollectionListItem>();
const collections: BusterListRowItem<BusterCollectionListItem>[] = useMemo(() => {
const createCollectionLinkItem = createListItem<BusterCollectionListItem>();
return collectionsList.map((collection) => {
return createCollectionLinkItem({
id: collection.id,

View File

@ -34,36 +34,18 @@ export const MetricItemsContainer: React.FC<{
const metricsByDate: BusterListRowItem<BusterMetricListItem>[] = useMemo(() => {
const createMetricLinkItem = createListItem<BusterMetricListItem>();
return Object.entries(logsRecord).flatMap<BusterListRowItem<BusterMetricListItem>>(
([key, metrics]) => {
const records = metrics.map((metric) =>
createMetricLinkItem({
id: metric.id,
data: metric,
link: {
to: '/app/metrics/$metricId',
params: {
metricId: metric.id,
},
},
})
) as BusterListRowItem<BusterMetricListItem>[];
const hasRecords = records.length > 0;
if (!hasRecords) {
return [];
}
return [
createMetricLinkItem({
id: key,
data: null,
rowSection: {
title: makeHumanReadble(key),
secondaryTitle: String(records.length),
},
}),
...records,
];
}
return metrics.map((metric) =>
createMetricLinkItem({
id: metric.id,
data: metric,
link: {
to: '/app/metrics/$metricId',
params: {
metricId: metric.id,
},
},
})
);
}, [logsRecord]);