diff --git a/app/packages/core/src/components/Sidebar/Entries/EntryCounts.tsx b/app/packages/core/src/components/Sidebar/Entries/EntryCounts.tsx index d21b60b8bd..296e79d7bd 100644 --- a/app/packages/core/src/components/Sidebar/Entries/EntryCounts.tsx +++ b/app/packages/core/src/components/Sidebar/Entries/EntryCounts.tsx @@ -41,7 +41,7 @@ export const PathEntryCounts = ({ modal, path }: PathEntryCountsProps) => { [modal, path] ); const hasFilters = useRecoilValue(fos.fieldIsFiltered({ modal, path })); - const queryPerformance = useRecoilValue(fos.queryPerformance); + const queryPerformance = useRecoilValue(fos.queryPerformance) && !modal; const shown = useRecoilValue(showEntryCounts({ modal, path })); // empty path means we are showing grid sample count which is always allowed diff --git a/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx b/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx index 94572b64f2..12b6101c14 100644 --- a/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx +++ b/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx @@ -40,7 +40,7 @@ const Lightning = ({ }; const IconWrapper = ({ modal, path }: { modal: boolean; path: string }) => { - const disabled = useRecoilValue(fos.isDisabledFilterPath(path)); + const disabled = useRecoilValue(fos.isDisabledFilterPath(path)) && !modal; const expandedPath = useRecoilValue(fos.expandPath(path)); const frameFilteringDisabled = useRecoilValue(fos.isDisabledFrameFilterPath(path)) && !modal; diff --git a/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/useTitleTemplate.tsx b/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/useTitleTemplate.tsx index c884b50dd8..b2a55fc62e 100644 --- a/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/useTitleTemplate.tsx +++ b/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/useTitleTemplate.tsx @@ -78,7 +78,7 @@ const useTitleTemplate = ({ path: string; }) => { return function useTitleTemplate({ hoverHandlers, hoverTarget, container }) { - const disabled = useRecoilValue(fos.isDisabledFilterPath(path)); + const enabled = !useRecoilValue(fos.isDisabledCheckboxPath(path)); const isFilterMode = useRecoilValue(fos.isSidebarFilterMode); const expandedPath = useRecoilValue(fos.expandPath(path)); @@ -97,10 +97,10 @@ const useTitleTemplate = ({ )} - {!disabled && isFilterMode && ( + {enabled && isFilterMode && ( )} - {!disabled && } + {enabled && } ); }; diff --git a/app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx b/app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx index dd7bd71b38..b75c4991f6 100644 --- a/app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx +++ b/app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx @@ -18,7 +18,7 @@ const DEFAULT_MAX_INLINE = 1; export default function ActionsMenu(props: ActionsPropsType) { const { actions, maxInline = DEFAULT_MAX_INLINE, size } = props; - if (actions.length === maxInline) { + if (actions.length <= maxInline) { return ( {actions.map((action) => ( diff --git a/app/packages/core/src/plugins/SchemaIO/components/TableView.tsx b/app/packages/core/src/plugins/SchemaIO/components/TableView.tsx index a1ae0d369e..7deb8e852e 100644 --- a/app/packages/core/src/plugins/SchemaIO/components/TableView.tsx +++ b/app/packages/core/src/plugins/SchemaIO/components/TableView.tsx @@ -33,6 +33,7 @@ export default function TableView(props: ViewPropsType) { selected_color, size = "small", variant = "filled", + max_inline_actions = 1, } = view; const { rows, selectedCells, selectedRows, selectedColumns } = getTableData(props); @@ -198,6 +199,7 @@ export default function TableView(props: ViewPropsType) { )} diff --git a/fiftyone/server/lightning.py b/fiftyone/server/lightning.py index 4992c27dd4..83db940973 100644 --- a/fiftyone/server/lightning.py +++ b/fiftyone/server/lightning.py @@ -394,8 +394,15 @@ def _first( if sort: pipeline.append({"$match": {path: {"$ne": None}}}) + pipeline.append({"$sort": {path: sort}}) + return pipeline + [ - {"$group": {"_id": {"$min" if sort == 1 else "$max": f"${path}"}}} + { + "$group": { + "_id": None, + "value": {"$min" if sort == 1 else "$max": f"${path}"}, + } + } ] @@ -458,7 +465,11 @@ def _match_arrays(dataset: fo.Dataset, path: str, is_frame_field: bool): def _parse_result(data): if data and data[0]: - return data[0].get("_id", None) + value = data[0] + if value.get("value", None) is not None: + return value["value"] + + return value.get("_id", None) return None @@ -468,13 +479,13 @@ def _unwind(dataset: fo.Dataset, path: str, is_frame_field: bool): path = None pipeline = [] + prefix = "" if is_frame_field: - path = keys[0] - keys = keys[1:] + prefix = "frames." for key in keys: path = ".".join([path, key]) if path else key - field = dataset.get_field(path) + field = dataset.get_field(f"{prefix}{path}") while isinstance(field, fof.ListField): pipeline.append({"$unwind": f"${path}"}) field = field.field diff --git a/tests/unittests/lightning_tests.py b/tests/unittests/lightning_tests.py index cca08a7b0a..319315f89b 100644 --- a/tests/unittests/lightning_tests.py +++ b/tests/unittests/lightning_tests.py @@ -488,13 +488,13 @@ async def test_floats(self, dataset: fo.Dataset): dataset, dict( float=-1.0, - float_list=[-1.0], + float_list=[0.0, -1.0], inf=-1.0, - inf_list=[-1.0], + inf_list=[0.0, -1.0], nan=-1.0, - nan_list=[-1.0], + nan_list=[0.0, -1.0], ninf=-1.0, - ninf_list=[-1.0], + ninf_list=[0.0, -1.0], ), dict( float=0.0, @@ -508,13 +508,13 @@ async def test_floats(self, dataset: fo.Dataset): ), dict( float=1.0, - float_list=[1.0], + float_list=[0.0, 1.0], inf=1.0, inf_list=[1.0], nan=1.0, - nan_list=[1.0], + nan_list=[0.0, 1.0], ninf=1.0, - ninf_list=[1.0], + ninf_list=[0.0, 1.0], ), )