Skip to content

Commit

Permalink
Added query performance misses (#5074)
Browse files Browse the repository at this point in the history
* parody with teams

* add missing panel change
  • Loading branch information
CamronStaley authored Nov 8, 2024
1 parent b19e44f commit c2d05fb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/packages/operators/src/CustomPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export function defineCustomPanel({
on_change_selected_labels,
on_change_extended_selection,
on_change_group_slice,
on_change_query_performance,
on_change_spaces,
panel_name,
panel_label,
Expand All @@ -139,6 +140,7 @@ export function defineCustomPanel({
onChangeSelectedLabels={on_change_selected_labels}
onChangeExtendedSelection={on_change_extended_selection}
onChangeGroupSlice={on_change_group_slice}
on_change_query_performance={on_change_query_performance}
onChangeSpaces={on_change_spaces}
dimensions={dimensions}
panelName={panel_name}
Expand Down
2 changes: 1 addition & 1 deletion app/packages/operators/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const globalContextSelector = selector({
const viewName = get(fos.viewName);
const extendedSelection = get(fos.extendedSelection);
const groupSlice = get(fos.groupSlice);
const queryPerformance = typeof get(fos.queryPerformance) === "number";
const queryPerformance = get(fos.queryPerformance);
const spaces = get(fos.sessionSpaces);
const workspaceName = spaces?._name;

Expand Down
7 changes: 7 additions & 0 deletions app/packages/operators/src/useCustomPanelHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface CustomPanelProps {
onChangeSelectedLabels?: string;
onChangeExtendedSelection?: string;
onChangeGroupSlice?: string;
onChangeQueryPerformance?: boolean;
onChangeSpaces?: string;
onChangeWorkspace?: string;
dimensions: DimensionsType | null;
Expand Down Expand Up @@ -139,6 +140,12 @@ export function useCustomPanelHooks(props: CustomPanelProps): CustomPanelHooks {
ctx.groupSlice,
props.onChangeGroupSlice
);
useCtxChangePanelEvent(
isLoaded,
panelId,
ctx.queryPerformance,
props.onChangeQueryPerformance
);
useCtxChangePanelEvent(isLoaded, panelId, ctx.spaces, props.onChangeSpaces);
useCtxChangePanelEvent(
isLoaded,
Expand Down
2 changes: 1 addition & 1 deletion app/packages/state/src/recoil/queryPerformance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const queryPerformanceStore = atomFamily<boolean, string>({
],
});

export const queryPerformance = selector({
export const queryPerformance = selector<boolean>({
key: "queryPerformance",
get: ({ get }) => {
if (get(view).length) {
Expand Down
4 changes: 4 additions & 0 deletions fiftyone/operators/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def register_panel(
on_change_selected_labels=None,
on_change_extended_selection=None,
on_change_group_slice=None,
on_change_query_performance=None,
allow_duplicates=False,
priority=None,
_builtin=False,
Expand Down Expand Up @@ -364,6 +365,8 @@ def register_panel(
current extended selection changes
on_change_group_slice (None): an operator to invoke when the group
slice changes
on_change_query_performance (None): an operator to invoke when the
query performance changes
allow_duplicates (False): whether to allow multiple instances of
the panel to the opened
priority (None): the priority of the panel, used for sort order
Expand Down Expand Up @@ -392,6 +395,7 @@ def register_panel(
"on_change_selected_labels": on_change_selected_labels,
"on_change_extended_selection": on_change_extended_selection,
"on_change_group_slice": on_change_group_slice,
"on_change_query_performance": on_change_query_performance,
"allow_duplicates": allow_duplicates,
"priority": priority,
"_builtin": _builtin,
Expand Down
1 change: 1 addition & 0 deletions fiftyone/operators/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def on_startup(self, ctx):
"on_change_selected_labels",
"on_change_extended_selection",
"on_change_group_slice",
"on_change_query_performance",
]
for method in methods + ctx_change_events:
if hasattr(self, method) and callable(getattr(self, method)):
Expand Down

0 comments on commit c2d05fb

Please sign in to comment.