Skip to content

Commit

Permalink
Merge pull request voxel51#1808 from voxel51/patch-release
Browse files Browse the repository at this point in the history
Release v0.16.2
  • Loading branch information
brimoor authored Jun 2, 2022
2 parents 1c9bd86 + 6391adf commit 7305efc
Show file tree
Hide file tree
Showing 47 changed files with 877 additions and 732 deletions.
8 changes: 3 additions & 5 deletions app/packages/app/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ enum ColorBy {
type Dataset {
id: ID!
name: String!
createdAt: Date!
lastLoadedAt: DateTime!
createdAt: Date
lastLoadedAt: DateTime
persistent: Boolean!
mediaType: MediaType
maskTargets: [NamedTargets!]!
Expand All @@ -48,7 +48,7 @@ type Dataset {
brainMethods: [BrainRun!]!
evaluations: [EvaluationRun!]!
appSidebarGroups: [SidebarGroup!]
version: String!
version: String
viewCls: String
defaultSkeleton: KeypointSkeleton
skeletons: [NamedKeypointSkeleton!]!
Expand Down Expand Up @@ -85,8 +85,6 @@ type EvaluationRun implements Run {

type EvaluationRunConfig implements RunConfig {
cls: String!
classwise: Boolean!
errorLevel: Int!
gtField: String!
predField: String!
method: String!
Expand Down
5 changes: 4 additions & 1 deletion app/packages/app/src/Network.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
ErrorBoundary,
Loading,
RouterContext,
RouteRenderer,
Expand Down Expand Up @@ -28,7 +29,9 @@ const Network: React.FC<{
return (
<RelayEnvironmentProvider environment={environment}>
<RouterContext.Provider value={context}>
<Renderer />
<ErrorBoundary>
<Renderer />
</ErrorBoundary>
</RouterContext.Provider>
</RelayEnvironmentProvider>
);
Expand Down
23 changes: 13 additions & 10 deletions app/packages/app/src/Root/Datasets/Dataset.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { Route } from "@fiftyone/components";
import React, { useEffect } from "react";
import { Route, RouterContext } from "@fiftyone/components";
import React, { useContext, useEffect } from "react";
import { graphql, usePreloadedQuery } from "react-relay";

import DatasetComponent from "../../components/Dataset";
import { useSetDataset, useStateUpdate } from "../../utils/hooks";
import { useStateUpdate } from "../../utils/hooks";
import { DatasetQuery } from "./__generated__/DatasetQuery.graphql";
import { datasetName } from "../../recoil/selectors";
import { useRecoilValue } from "recoil";
import transformDataset from "./transformDataset";
import { filters } from "../../recoil/filters";
import { _activeFields } from "../../recoil/schema";
import { State } from "../../recoil/types";
import { similarityParameters } from "../../components/Actions/Similar";
import { toCamelCase } from "@fiftyone/utilities";

const Query = graphql`
query DatasetQuery($name: String!, $view: JSONArray) {
Expand Down Expand Up @@ -82,33 +84,34 @@ const Query = graphql`
edges
}
version
viewCls
}
}
`;

export const Dataset: Route<DatasetQuery> = ({ prepared }) => {
const { dataset } = usePreloadedQuery(Query, prepared);
const router = useContext(RouterContext);
const name = useRecoilValue(datasetName);
const setDataset = useSetDataset();

const update = useStateUpdate();

useEffect(() => {
if (!dataset) {
setDataset();
return;
}

update(({ reset }) => {
reset(filters);
reset(_activeFields({ modal: false }));
reset(similarityParameters);

return {
colorscale: router.state.colorscale,
config: router.state.config
? (toCamelCase(router.state.config) as State.Config)
: undefined,
dataset: transformDataset(dataset),
state: router.state.state,
};
});
}, [dataset]);
}, [dataset, prepared, router]);

if (!name) {
return null;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions app/packages/app/src/Root/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import React, {
Suspense,
useContext,
useEffect,
useMemo,
useState,
} from "react";
import React, { Suspense, useContext, useEffect, useMemo } from "react";
import ReactDOM from "react-dom";
import ReactGA from "react-ga";
import { motion, AnimatePresence } from "framer-motion";
Expand Down Expand Up @@ -41,10 +35,15 @@ import { RootConfig_query$key } from "./__generated__/RootConfig_query.graphql";
import { RootDatasets_query$key } from "./__generated__/RootDatasets_query.graphql";
import { RootGA_query$key } from "./__generated__/RootGA_query.graphql";
import { RootNav_query$key } from "./__generated__/RootNav_query.graphql";
import { useSetDataset, useStateUpdate } from "../utils/hooks";
import {
useSetDataset,
useStateUpdate,
useUnprocessedStateUpdate,
} from "../utils/hooks";
import { clone, isElectron } from "@fiftyone/utilities";
import { getDatasetName } from "../utils/generic";
import { RGB } from "@fiftyone/looker";
import { State } from "../recoil/types";

const rootQuery = graphql`
query RootQuery($search: String = "", $count: Int = 10, $cursor: String) {
Expand Down Expand Up @@ -182,7 +181,7 @@ const Nav: React.FC<{ prepared: PreloadedQuery<RootQuery> }> = ({
datasetSelectorProps={{
component: DatasetLink,
onSelect: (name) => {
setDataset(name);
name !== dataset && setDataset(name);
},
placeholder: "Select dataset",
useSearch,
Expand Down Expand Up @@ -231,7 +230,7 @@ const Nav: React.FC<{ prepared: PreloadedQuery<RootQuery> }> = ({

const Root: Route<RootQuery> = ({ children, prepared }) => {
const query = usePreloadedQuery<RootQuery>(rootQuery, prepared);
const { config, colorscale } = useFragment(
const data = useFragment(
graphql`
fragment RootConfig_query on Query {
config {
Expand All @@ -257,9 +256,10 @@ const Root: Route<RootQuery> = ({ children, prepared }) => {
const update = useStateUpdate();
useEffect(() => {
update({
state: { config: clone(config), colorscale: clone(colorscale) as RGB[] },
colorscale: clone(data.colorscale) as RGB[],
config: clone(data.config),
});
}, []);
}, [data]);

return (
<>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions app/packages/app/src/Root/__generated__/RootQuery.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

111 changes: 57 additions & 54 deletions app/packages/app/src/components/Actions/Tagger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,65 +354,68 @@ const useTagCallback = (modal, targetLabels, lookerRef = null) => {
);

return useRecoilCallback(
({ snapshot, set }) => async ({ changes }) => {
const activeLabels = await snapshot.getPromise(
schemaAtoms.labelPaths({ expanded: false })
);
const f = await snapshot.getPromise(modal ? modalFilters : filters);
const view = await snapshot.getPromise(viewAtoms.view);
const dataset = await snapshot.getPromise(selectors.datasetName);
const selectedLabels =
modal && targetLabels
? await snapshot.getPromise(atoms.selectedLabels)
: null;
const selectedSamples = await snapshot.getPromise(atoms.selectedSamples);
const hiddenLabels =
modal && targetLabels
? await snapshot.getPromise(selectors.hiddenLabelsArray)
: null;

const modalData = modal ? await snapshot.getPromise(atoms.modal) : null;

const { samples } = await getFetchFunction()("POST", "/tag", {
filters: f,
view,
dataset,
active_label_fields: activeLabels,
target_labels: targetLabels,
changes,
modal: modal ? modalData.sample._id : null,
sample_ids: modal
? null
: selectedSamples.size
? [...selectedSamples]
: null,
labels:
selectedLabels && selectedLabels.length
? toSnakeCase(selectedLabels)
({ snapshot, set }) =>
async ({ changes }) => {
const activeLabels = await snapshot.getPromise(
schemaAtoms.labelPaths({ expanded: false })
);
const f = await snapshot.getPromise(modal ? modalFilters : filters);
const view = await snapshot.getPromise(viewAtoms.view);
const dataset = await snapshot.getPromise(selectors.datasetName);
const selectedLabels =
modal && targetLabels
? await snapshot.getPromise(selectors.selectedLabelList)
: null;
const selectedSamples = await snapshot.getPromise(
atoms.selectedSamples
);
const hiddenLabels =
modal && targetLabels
? await snapshot.getPromise(selectors.hiddenLabelsArray)
: null;

const modalData = modal ? await snapshot.getPromise(atoms.modal) : null;

const { samples } = await getFetchFunction()("POST", "/tag", {
filters: f,
view,
dataset,
active_label_fields: activeLabels,
target_labels: targetLabels,
changes,
modal: modal ? modalData.sample._id : null,
sample_ids: modal
? null
: selectedSamples.size
? [...selectedSamples]
: null,
hidden_labels: hiddenLabels ? toSnakeCase(hiddenLabels) : null,
});

samples &&
samples.forEach((sample) => {
if (modalData.sample._id === sample._id) {
set(atoms.modal, { ...modalData, sample });
lookerRef.current.updateSample(sample);
}
labels:
selectedLabels && selectedLabels.length
? toSnakeCase(selectedLabels)
: null,
hidden_labels: hiddenLabels ? toSnakeCase(hiddenLabels) : null,
});

store.samples.set(sample._id, {
...store.samples.get(sample._id),
sample,
samples &&
samples.forEach((sample) => {
if (modalData.sample._id === sample._id) {
set(atoms.modal, { ...modalData, sample });
lookerRef.current.updateSample(sample);
}

store.samples.set(sample._id, {
...store.samples.get(sample._id),
sample,
});
store.lookers.has(sample._id) &&
store.lookers.get(sample._id).updateSample(sample);
});
store.lookers.has(sample._id) &&
store.lookers.get(sample._id).updateSample(sample);
});

set(selectors.anyTagging, false);
set(selectors.anyTagging, false);

refreshers.forEach((r) => r());
set(atoms.tagging({ modal, labels: targetLabels }), false);
},
refreshers.forEach((r) => r());
set(atoms.tagging({ modal, labels: targetLabels }), false);
},
[modal, targetLabels, lookerRef]
);
};
Expand Down
Loading

0 comments on commit 7305efc

Please sign in to comment.