Events filtering. Closes #3356

This commit is contained in:
Mike Cao
2025-04-25 18:06:41 -07:00
parent b8a582c8da
commit d4b786380b
4 changed files with 59 additions and 21 deletions

View File

@@ -1,12 +1,28 @@
import MetricsTable, { MetricsTableProps } from './MetricsTable';
import { useMessages } from '@/components/hooks';
export function EventsTable(props: MetricsTableProps) {
export interface EventsTableProps extends MetricsTableProps {
onLabelClick?: (value: string) => void;
}
export function EventsTable({ onLabelClick, ...props }: EventsTableProps) {
const { formatMessage, labels } = useMessages();
function handleDataLoad(data: any) {
const handleDataLoad = (data: any) => {
props.onDataLoad?.(data);
}
};
const renderLabel = ({ x: label }) => {
if (onLabelClick) {
return (
<div onClick={() => onLabelClick(label)} style={{ cursor: 'pointer' }}>
{label}
</div>
);
}
return label;
};
return (
<MetricsTable
@@ -15,6 +31,7 @@ export function EventsTable(props: MetricsTableProps) {
type="event"
metric={formatMessage(labels.actions)}
onDataLoad={handleDataLoad}
renderLabel={renderLabel}
/>
);
}