Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -56,6 +56,19 @@ describe("Sample Collection Submission Overview", () => {
expect(screen.getAllByRole("group")[0]).toHaveAttribute("aria-disabled", "true");
});

it("should not enable 'edit pre-session information' button if session is locked", async () => {
server.use(
http.get(
"http://localhost/api/shipments/:shipmentId/preSession",
() => HttpResponse.json({ details: {}, isLocked: true }),
{ once: true },
),
);
renderWithProviders(await ShipmentHome(baseShipmentParams));

expect(screen.getAllByRole("group")[1]).toHaveAttribute("aria-disabled", "true");
});

it("should not enable 'print pre-session' button if no pre-session data is available", async () => {
server.use(
http.get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const ShipmentHome = async (props: { params: Promise<ShipmentParams> }) => {
Pre-Session Information
</Heading>
<Divider borderColor='gray.800' />
{shipmentData.preSessionInfo ? (
{shipmentData.preSessionInfo?.details ? (
<DynamicFormView
formType='preSession'
data={shipmentData.preSessionInfo.details}
Expand All @@ -156,7 +156,10 @@ const ShipmentHome = async (props: { params: Promise<ShipmentParams> }) => {
title={`${shipmentData.preSessionInfo ? "Edit" : "Set"} Pre-Session Information`}
as={NextLink}
href={`${params.shipmentId}/pre-session`}
isDisabled={!!shipmentData.dispatch.shipmentRequest}
isDisabled={
!shipmentData.preSessionInfo ||
!!shipmentData.preSessionInfo.isLocked
}
>
Set imaging conditions, grid/data acquisition parameters
</TwoLineLink>
Expand Down
5 changes: 5 additions & 0 deletions src/types/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,11 @@ export interface components {
PreSessionOut: {
/** Details */
details?: Record<string, never> | null;
/**
* Islocked
* @default false
*/
isLocked: boolean;
};
/** SampleIn */
SampleIn: {
Expand Down