Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Platform]: Moving aotf playground to another component #363

Merged
merged 3 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ApiPlaygroundDrawer } from "ui";
import useAotfContext from "./hooks/useAotfContext";

function AotfApiPlayground() {
const {
id,
pagination,
searhFilter,
sorting,
enableIndirect,
dataSourcesWeights,
entity,
dataSourcesRequired,
query,
} = useAotfContext();

const aggregationFilters = dataSourcesRequired.map(({ id, ...obj }) => ({ ...obj }));

const variables = {
id,
index: pagination.pageIndex,
size: pagination.pageSize,
filter: searhFilter,
sortBy: sorting[0].id,
enableIndirect,
datasources: dataSourcesWeights,
entity,
aggregationFilters,
};

return <ApiPlaygroundDrawer query={query.loc.source.body} variables={variables} />;
}
export default AotfApiPlayground;
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,10 @@ import {
DataUploader,
} from "../../../components/AssociationsToolkit";
carcruz marked this conversation as resolved.
Show resolved Hide resolved
import DISEASE_ASSOCIATIONS_QUERY from "./DiseaseAssociationsQuery.gql";
import { ApiPlaygroundDrawer } from "ui";
import AotfApiPlayground from "../../../components/AssociationsToolkit/AotfApiPlayground";

function AssociationsWrapper() {
const {
initialLoading,
id,
pagination,
searhFilter,
sorting,
enableIndirect,
dataSourcesWeights,
entity,
dataSourcesRequired,
} = useAotfContext();

const aggregationFilters = dataSourcesRequired.map(({ id, ...obj }) => ({ ...obj }));

const variables = {
id,
index: pagination.pageIndex,
size: pagination.pageSize,
filter: searhFilter,
sortBy: sorting[0].id,
enableIndirect,
datasources: dataSourcesWeights,
entity,
aggregationFilters,
};
const { initialLoading, id } = useAotfContext();

if (initialLoading) return <AotFLoader />;

Expand All @@ -57,10 +33,7 @@ function AssociationsWrapper() {
</PrivateWrapper>
<Divider orientation="vertical" />
<DataDownloader fileStem={`OT-${id}-associated-targets`} />
<ApiPlaygroundDrawer
query={DISEASE_ASSOCIATIONS_QUERY.loc.source.body}
variables={variables}
/>
<AotfApiPlayground />
</OptionsControlls>
</Box>
<Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,10 @@ import {
DataUploader,
} from "../../../components/AssociationsToolkit";
import TARGET_ASSOCIATIONS_QUERY from "./TargetAssociationsQuery.gql";
import { ApiPlaygroundDrawer } from "ui";
import AotfApiPlayground from "../../../components/AssociationsToolkit/AotfApiPlayground";

function AssociationsWrapper() {
const {
initialLoading,
id,
pagination,
searhFilter,
sorting,
enableIndirect,
dataSourcesWeights,
entity,
dataSourcesRequired,
} = useContext(AssociationsContext);

const aggregationFilters = dataSourcesRequired.map(({ id, ...obj }) => ({ ...obj }));

const variables = {
id,
index: pagination.pageIndex,
size: pagination.pageSize,
filter: searhFilter,
sortBy: sorting[0].id,
enableIndirect,
datasources: dataSourcesWeights,
entity,
aggregationFilters,
};
const { initialLoading, id } = useContext(AssociationsContext);

if (initialLoading) return <AotFLoader />;

Expand All @@ -57,10 +33,7 @@ function AssociationsWrapper() {
</PrivateWrapper>
<Divider orientation="vertical" />
<DataDownloader fileStem={`OT-${id}-associated-diseases`} />
<ApiPlaygroundDrawer
query={TARGET_ASSOCIATIONS_QUERY.loc.source.body}
variables={variables}
/>
<AotfApiPlayground />
</OptionsControlls>
</Box>
<Box></Box>
Expand Down
Loading