diff --git a/apps/i15-1/src/components/ExperimentTable/ULIMSExperimentTable.test.tsx b/apps/i15-1/src/components/ExperimentTable/ULIMSExperimentTable.test.tsx index 6205417..9bd540e 100644 --- a/apps/i15-1/src/components/ExperimentTable/ULIMSExperimentTable.test.tsx +++ b/apps/i15-1/src/components/ExperimentTable/ULIMSExperimentTable.test.tsx @@ -36,51 +36,49 @@ beforeEach(() => { }); const mockExperiments = { - instrumentSession: { - experiments: { - edges: [ - { - node: { - name: "Exp 1", - sample: { - name: "Sample A", - data: { - density: 1.2, - composition: "H2O", - }, + experiments: { + edges: [ + { + node: { + name: "Exp 1", + sample: { + name: "Sample A", + data: { + density: 1.2, + composition: "H2O", }, - experimentDefinition: { - name: "Def 1", - data: { - beam_energy: 20, - time_per_pdf: 10, - focused_beam_size: 5, - }, + }, + experimentDefinition: { + name: "Def 1", + data: { + beam_energy: 20, + time_per_pdf: 10, + focused_beam_size: 5, }, }, }, - { - node: { - name: "Exp 2", - sample: { - name: "Sample B", - data: { - density: 1.2, - composition: "CO2", - }, + }, + { + node: { + name: "Exp 2", + sample: { + name: "Sample B", + data: { + density: 1.2, + composition: "CO2", }, - experimentDefinition: { - name: "Def 2", - data: { - beam_energy: 20, - time_per_pdf: 10, - focused_beam_size: 5, - }, + }, + experimentDefinition: { + name: "Def 2", + data: { + beam_energy: 20, + time_per_pdf: 10, + focused_beam_size: 5, }, }, }, - ], - }, + }, + ], }, }; diff --git a/apps/i15-1/src/components/ExperimentTable/ULIMSExperimentsTable.tsx b/apps/i15-1/src/components/ExperimentTable/ULIMSExperimentsTable.tsx index 45b2ef9..748eca3 100644 --- a/apps/i15-1/src/components/ExperimentTable/ULIMSExperimentsTable.tsx +++ b/apps/i15-1/src/components/ExperimentTable/ULIMSExperimentsTable.tsx @@ -82,7 +82,7 @@ export function ExperimentList() { context: { pathname: location.pathname }, }); - const experiments = data?.instrumentSession?.experiments.edges || []; + const experiments = data?.experiments?.edges || []; const typedExperiments = experiments as { node: ExperimentNode; diff --git a/apps/i15-1/src/graphql/getSessionPlaylistQuery.generated.ts b/apps/i15-1/src/graphql/getSessionPlaylistQuery.generated.ts index 1c58afe..1508df0 100644 --- a/apps/i15-1/src/graphql/getSessionPlaylistQuery.generated.ts +++ b/apps/i15-1/src/graphql/getSessionPlaylistQuery.generated.ts @@ -12,33 +12,30 @@ export type GetSessionPlaylistQueryVariables = Exact<{ }>; export type GetSessionPlaylistQuery = { - instrumentSession: { - __typename: "InstrumentSession"; - experiments: { - __typename: "ExperimentConnection"; - edges: Array<{ - __typename: "ExperimentEdge"; - node: { - __typename: "Experiment"; + experiments: { + __typename: "ExperimentConnection"; + edges: Array<{ + __typename: "ExperimentEdge"; + node: { + __typename: "Experiment"; + name: string; + sample: { + __typename: "Sample"; name: string; - sample: { - __typename: "Sample"; - name: string; - id: unknown; - data: unknown; - instrumentSessions: Array<{ - __typename: "InstrumentSession"; - instrumentSessionReference: string | null; - }>; - }; - experimentDefinition: { - __typename: "ExperimentDefinition"; - name: string; - id: unknown; - data: unknown; - }; + id: unknown; + data: unknown; + instrumentSessions: Array<{ + __typename: "InstrumentSession"; + instrumentSessionReference: string | null; + }>; }; - }>; - }; + experimentDefinition: { + __typename: "ExperimentDefinition"; + name: string; + id: unknown; + data: unknown; + }; + }; + }>; } | null; }; diff --git a/apps/i15-1/src/graphql/getSessionPlaylistQuery.ts b/apps/i15-1/src/graphql/getSessionPlaylistQuery.ts index 5cc1b3b..5ec3639 100644 --- a/apps/i15-1/src/graphql/getSessionPlaylistQuery.ts +++ b/apps/i15-1/src/graphql/getSessionPlaylistQuery.ts @@ -1,31 +1,31 @@ import { gql } from "@apollo/client"; export const getSessionPlaylistQuery = gql` - query GetSessionPlaylist($proposal: Int!, $session: Int!) { - instrumentSession( +query GetSessionPlaylist($proposal: Int!, $session: Int!) { + experiments( + instrumentSessions: { proposalNumber: $proposal instrumentSessionNumber: $session - ) { - experiments { - edges { - node { - name - sample { - name - id - instrumentSessions { - instrumentSessionReference - } - data - } - experimentDefinition { - name - id - data - } + } + ) { + edges { + node { + name + sample { + name + id + data + instrumentSessions { + instrumentSessionReference } } + experimentDefinition { + name + id + data + } } } } +} `; diff --git a/apps/i15-1/src/graphql/getSessionPlaylistQueryTyped.ts b/apps/i15-1/src/graphql/getSessionPlaylistQueryTyped.ts index 2e02684..3b07473 100644 --- a/apps/i15-1/src/graphql/getSessionPlaylistQueryTyped.ts +++ b/apps/i15-1/src/graphql/getSessionPlaylistQueryTyped.ts @@ -8,8 +8,8 @@ You can use the `ExperimentNode` type to enforce this. */ type GeneratedNode = NonNullable< - GetSessionPlaylistQuery["instrumentSession"] ->["experiments"]["edges"][number]["node"]; + GetSessionPlaylistQuery["experiments"] +>["edges"][number]["node"]; type WithTypedData< TNode extends { diff --git a/apps/i15-1/src/mocks/handlers.ts b/apps/i15-1/src/mocks/handlers.ts index c6ffe8d..f363d6b 100644 --- a/apps/i15-1/src/mocks/handlers.ts +++ b/apps/i15-1/src/mocks/handlers.ts @@ -8,73 +8,71 @@ const workerStatus = { status: "IDLE", duration: 0 }; const fakeExperiments = { data: { - instrumentSession: { - experiments: { - edges: [ - { - node: { - name: "Test experiment", - sample: { - name: "Test_8_1", - id: "a47cd8af-03f4-430b-9858-749c61f6e14c", - instrumentSessions: [ - { - instrumentSessionReference: "CM44163-3", - }, - ], - data: { - density: 56, - capillary: "bs1.5", - composition: "Stuff", - packing_fraction: 0.5, + experiments: { + edges: [ + { + node: { + name: "Test experiment", + sample: { + name: "Test_8_1", + id: "a47cd8af-03f4-430b-9858-749c61f6e14c", + instrumentSessions: [ + { + instrumentSessionReference: "CM44163-3", }, + ], + data: { + density: 56, + capillary: "bs1.5", + composition: "Stuff", + packing_fraction: 0.5, }, - experimentDefinition: { - name: "run_full_collection", - id: "62b75b2f-8401-4230-b7ef-a4e577af598a", - data: { - q_max: 67, - frames: 90, - beam_energy: 40, - time_per_pdf: 2, - focused_beam_size: 10, - }, + }, + experimentDefinition: { + name: "run_full_collection", + id: "62b75b2f-8401-4230-b7ef-a4e577af598a", + data: { + q_max: 67, + frames: 90, + beam_energy: 40, + time_per_pdf: 2, + focused_beam_size: 10, }, }, }, - { - node: { - name: "Test experiment 2", - sample: { - name: "Test_8_2", - id: "19ad91f0-a155-4c5c-b5ba-175bb6f7c057", - instrumentSessions: [ - { - instrumentSessionReference: "CM44163-3", - }, - ], - data: { - density: 56, - capillary: "bs1.5", - composition: "Stuff", - packing_fraction: 0.5, + }, + { + node: { + name: "Test experiment 2", + sample: { + name: "Test_8_2", + id: "19ad91f0-a155-4c5c-b5ba-175bb6f7c057", + instrumentSessions: [ + { + instrumentSessionReference: "CM44163-3", }, + ], + data: { + density: 56, + capillary: "bs1.5", + composition: "Stuff", + packing_fraction: 0.5, }, - experimentDefinition: { - name: "run_full_collection", - id: "b645e887-85b4-40d6-a8f0-500a436bc395", - data: { - q_max: 67, - frames: 100, - beam_energy: 40, - time_per_pdf: 2, - focused_beam_size: 3, - }, + }, + experimentDefinition: { + name: "run_full_collection", + id: "b645e887-85b4-40d6-a8f0-500a436bc395", + data: { + q_max: 67, + frames: 100, + beam_energy: 40, + time_per_pdf: 2, + focused_beam_size: 3, }, }, }, - ], - }, + }, + ], }, }, };