Skip to content

Commit b4ad76e

Browse files
authored
[LIMS-1535] Lock out edits for pre session information 24h before session (#11)
* Update instructions for labels, improve button logic * Disable session information link if session is locked * Allow users to edit experimental parameters post shipping
1 parent 547724f commit b4ad76e

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/app/proposals/[proposalId]/sessions/[visitNumber]/shipments/[shipmentId]/(default)/page.test.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ describe("Sample Collection Submission Overview", () => {
5656
expect(screen.getAllByRole("group")[0]).toHaveAttribute("aria-disabled", "true");
5757
});
5858

59+
it("should not enable 'edit pre-session information' button if session is locked", async () => {
60+
server.use(
61+
http.get(
62+
"http://localhost/api/shipments/:shipmentId/preSession",
63+
() => HttpResponse.json({ details: {}, isLocked: true }),
64+
{ once: true },
65+
),
66+
);
67+
renderWithProviders(await ShipmentHome(baseShipmentParams));
68+
69+
expect(screen.getAllByRole("group")[1]).toHaveAttribute("aria-disabled", "true");
70+
});
71+
5972
it("should not enable 'print pre-session' button if no pre-session data is available", async () => {
6073
server.use(
6174
http.get(

src/app/proposals/[proposalId]/sessions/[visitNumber]/shipments/[shipmentId]/(default)/page.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const ShipmentHome = async (props: { params: Promise<ShipmentParams> }) => {
130130
Pre-Session Information
131131
</Heading>
132132
<Divider borderColor='gray.800' />
133-
{shipmentData.preSessionInfo ? (
133+
{shipmentData.preSessionInfo?.details ? (
134134
<DynamicFormView
135135
formType='preSession'
136136
data={shipmentData.preSessionInfo.details}
@@ -156,7 +156,10 @@ const ShipmentHome = async (props: { params: Promise<ShipmentParams> }) => {
156156
title={`${shipmentData.preSessionInfo ? "Edit" : "Set"} Pre-Session Information`}
157157
as={NextLink}
158158
href={`${params.shipmentId}/pre-session`}
159-
isDisabled={!!shipmentData.dispatch.shipmentRequest}
159+
isDisabled={
160+
!shipmentData.preSessionInfo ||
161+
!!shipmentData.preSessionInfo.isLocked
162+
}
160163
>
161164
Set imaging conditions, grid/data acquisition parameters
162165
</TwoLineLink>

src/types/schema.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,11 @@ export interface components {
789789
PreSessionOut: {
790790
/** Details */
791791
details?: Record<string, never> | null;
792+
/**
793+
* Islocked
794+
* @default false
795+
*/
796+
isLocked: boolean;
792797
};
793798
/** SampleIn */
794799
SampleIn: {

0 commit comments

Comments
 (0)