Parameter search & inline display for Past Runs and Run History pages (#3985)

This commit is contained in:
Celal Zamanoglu
2025-11-14 01:33:39 +03:00
committed by GitHub
parent f1e118ab2b
commit a95837783a
10 changed files with 797 additions and 257 deletions

View File

@@ -0,0 +1,48 @@
import { useCallback, useMemo, useState } from "react";
function toSet(ids: Iterable<string>): Set<string> {
return new Set(ids);
}
function useParameterExpansion() {
const [manuallyExpandedRows, setManuallyExpandedRows] = useState<Set<string>>(
new Set(),
);
const [autoExpandedRows, setAutoExpandedRows] = useState<Set<string>>(
new Set(),
);
const toggleExpanded = useCallback((id: string) => {
setManuallyExpandedRows((prev) => {
const next = new Set(prev);
if (next.has(id)) {
next.delete(id);
} else {
next.add(id);
}
return next;
});
}, []);
const expandedRows = useMemo(() => {
const combined = new Set(autoExpandedRows);
for (const id of manuallyExpandedRows) {
combined.add(id);
}
return combined;
}, [autoExpandedRows, manuallyExpandedRows]);
const updateAutoExpandedRows = useCallback((ids: Iterable<string>) => {
setAutoExpandedRows(toSet(ids));
}, []);
return {
expandedRows,
toggleExpanded,
setManuallyExpandedRows,
manuallyExpandedRows,
setAutoExpandedRows: updateAutoExpandedRows,
};
}
export { useParameterExpansion };