Update package-lock.json with latest dependency versions

Upgraded multiple dependencies across Babel, Emotion, ESLint, and DevExpress packages in `package-lock.json` to their latest versions. These updates ensure compatibility, fix minor issues, and improve overall performance and security.
This commit is contained in:
GotthardG 2025-01-17 15:35:29 +01:00
parent 9739b8cfe9
commit 6825421f20
5 changed files with 658 additions and 629 deletions

View File

@ -94,10 +94,9 @@ async def create_or_update_dewar(
if puck_event_exists:
raise HTTPException(
status_code=400,
detail=f"Puck {puck.id} "
f"associated with Dewar {existing_dewar.id}"
f" has events. "
f"Update not allowed.",
detail=f"Puck '{puck.puck_name}'"
f" (ID: {puck.id}) has associated "
f"events and cannot be deleted or replaced.",
)
# Check for associated sample events within each puck
@ -110,11 +109,10 @@ async def create_or_update_dewar(
if sample_event_exists:
raise HTTPException(
status_code=400,
detail=f"Sample {sample.id} "
f"associated with Puck "
f"{puck.id} in Dewar "
f"{existing_dewar.id} "
f"has events. Update not allowed.",
detail=f"Sample '{sample.sample_name}'"
f" (ID: {sample.id})"
f" within Puck '{puck.puck_name}'"
f" has associated events. Update forbidden.",
)
# Delete associated pucks and samples if no events are found

File diff suppressed because it is too large Load Diff

View File

@ -118,8 +118,8 @@ const SampleSpreadsheet: React.FC<SampleSpreadsheetProps> = ({ dewarId }) => {
{ field: "spacegroupnumber", headerName: "Space Group Number", width: 200, editable: true },
{ field: "cellparameters", headerName: "Cell Parameters", width: 300, editable: true },
{ field: "rescutkey", headerName: "ResCut Key", width: 150, editable: true },
{ field: "rescutvalue", headerName: "ResCut Value", width: 150, editable: true, editable: true },
{ field: "userresolution", headerName: "User Resolution", width: 150, editable: true, editable: true },
{ field: "rescutvalue", headerName: "ResCut Value", width: 150, editable: true },
{ field: "userresolution", headerName: "User Resolution", width: 150, editable: true },
{ field: "pdbid", headerName: "PDB ID", width: 150, editable: true },
{ field: "autoprocfull", headerName: "AutoProc Full", width: 200, editable: true },
{ field: "procfull", headerName: "Proc Full", width: 200, editable: true },

View File

@ -40,6 +40,8 @@ const SpreadsheetTable = ({
const [dewarsToReplace, setDewarsToReplace] = useState([]);
const [dewarsToCreate, setDewarsToCreate] = useState(new Map());
const [correctionMetadata, setCorrectionMetadata] = useState(addinfo || []); // Store addinfo
const [errorDialogOpen, setErrorDialogOpen] = useState(false); // Controls dialog visibility
const [errorMessages, setErrorMessages] = useState<string[]>([]); // Error messages from the server
const enhancedRawData = raw_data.map((row) => {
const metadata = correctionMetadata.find((info) => info.row_num === row.row_num) || {};
@ -407,11 +409,20 @@ const SpreadsheetTable = ({
try {
const dewarsArray = Array.from(dewarsToCreate.values());
await handleDewarCreation(dewarsArray); // Updated logic handles replacement
console.log('Dewars replaced successfully');
} catch (error) {
console.error('Error replacing dewars:', error);
// Perform the creation/update operation
await handleDewarCreation(dewarsArray);
console.log("Dewars replaced successfully");
} catch (error: any) {
console.error("Error replacing dewars:", error);
let errorMessage = error?.message || "Unexpected error occurred while replacing dewars.";
setErrorMessages((prevMessages) => [...prevMessages, errorMessage]);
setErrorDialogOpen(true);
}
// Reset controls after either success or failure
setShowUpdateDialog(false);
setDewarsToReplace([]);
setDewarsToCreate(new Map());
@ -424,19 +435,54 @@ const SpreadsheetTable = ({
};
const handleDewarCreation = async (dewarsArray: any[]) => {
const errorMessages: string[] = []; // Collect error messages for display
for (const dewar of dewarsArray) {
try {
// Prepare payload and exclude number_of_pucks before sending
const { number_of_pucks, number_of_samples, ...payload } = dewar;
// Call the backend to create or update dewars
// Attempt to create or update a dewar
await DewarsService.createOrUpdateDewarDewarsPost(selectedShipment.id, payload);
console.log(`Dewar "${dewar.dewar_name}" processed successfully.`);
} catch (error) {
console.error("Error creating/updating dewar:", error);
console.log(`Dewar "${dewar.dewar_name}" created/updated successfully.`);
} catch (error: any) {
// Log the full error object for debugging purposes
console.error("Full error object:", error);
let backendReason = "Unexpected error occurred."; // Default fallback message
if (error instanceof ApiError && error.body) {
// API error response (similar to delete route)
console.error("API error body:", error.body);
backendReason = error.body.detail || backendReason;
} else if (error?.response?.data?.detail) {
// Fallback for Axios-like errors
backendReason = error.response.data.detail;
} else if (error?.response) {
// Unexpected HTTP response (no error detail)
backendReason = `Unknown error occurred (Status: ${error.response.status}).`;
console.error("Error Response Data:", error.response.data);
} else if (error?.message) {
// Client-side error (e.g., network issues)
backendReason = error.message;
}
// Append the detailed error message to the list
errorMessages.push(`Dewar "${dewar.dewar_name}": ${backendReason}`);
}
}
// Notify the user if there are error messages
if (errorMessages.length > 0) {
setErrorMessages(errorMessages); // Set state to render an error dialog
setErrorDialogOpen(true); // Open the error dialog
// Re-throw the error to let the parent function (e.g., handleConfirmUpdate) know something went wrong
throw new Error("Error(s) occurred while creating/updating dewars.");
} else {
console.log("All dewars processed successfully.");
alert("All dewars created successfully!"); // Show success message
}
};
const handleSubmit = async () => {
@ -607,7 +653,33 @@ const SpreadsheetTable = ({
</Button>
</DialogActions>
</Dialog>
<Dialog
open={errorDialogOpen}
onClose={() => setErrorDialogOpen(false)}
aria-labelledby="error-dialog-title"
aria-describedby="error-dialog-description"
>
<DialogTitle>Error Creating/Updating Dewars</DialogTitle>
<DialogContent>
<DialogContentText>
The following errors occurred while processing dewars:
<ul>
{errorMessages.map((message, index) => (
<li key={index}>{message}</li>
))}
</ul>
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={() => setErrorDialogOpen(false)} color="primary">
Close
</Button>
</DialogActions>
</Dialog>
</TableContainer>
);
};

View File

@ -6,8 +6,8 @@
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2025-01-16T19:48:49.601896Z",
"start_time": "2025-01-16T19:48:49.599534Z"
"end_time": "2025-01-17T14:03:52.460891Z",
"start_time": "2025-01-17T14:03:52.454842Z"
}
},
"source": [
@ -41,13 +41,13 @@
]
}
],
"execution_count": 11
"execution_count": 40
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-01-16T21:02:44.756830Z",
"start_time": "2025-01-16T21:02:44.640622Z"
"end_time": "2025-01-17T14:13:16.559702Z",
"start_time": "2025-01-17T14:13:16.446021Z"
}
},
"cell_type": "code",
@ -90,7 +90,7 @@
"output_type": "stream",
"text": [
"Shipment ID: 2, Shipment Name: Shipment from Mordor\n",
" Dewar ID: 1, Dewar Name: Dewar One, Dewar Unique ID: bd3cb1a303be0fc9 \n",
" Dewar ID: 1, Dewar Name: Dewar One, Dewar Unique ID: 83041c3f8844ff39 \n",
" Puck ID: 1, Puck Name: PUCK-001\n",
" Puck ID: 2, Puck Name: PUCK002\n",
" Puck ID: 3, Puck Name: PUCK003\n",
@ -98,7 +98,7 @@
" Puck ID: 5, Puck Name: PUCK005\n",
" Puck ID: 6, Puck Name: PUCK006\n",
" Puck ID: 7, Puck Name: PUCK007\n",
" Dewar ID: 2, Dewar Name: Dewar Two, Dewar Unique ID: 6d23d26250394f38 \n",
" Dewar ID: 2, Dewar Name: Dewar Two, Dewar Unique ID: 62baccecdd37c033 \n",
" Puck ID: 8, Puck Name: PK001\n",
" Puck ID: 9, Puck Name: PK002\n",
" Puck ID: 10, Puck Name: PK003\n",
@ -122,19 +122,19 @@
" Puck ID: 25, Puck Name: PC006\n",
" Puck ID: 26, Puck Name: PC007\n",
"Shipment ID: 1, Shipment Name: Shipment from Mordor\n",
" Dewar ID: 5, Dewar Name: Dewar Five, Dewar Unique ID: None \n",
" Dewar ID: 5, Dewar Name: Dewar Five, Dewar Unique ID: 15e3dbe05e78ee83 \n",
" Puck ID: 27, Puck Name: PKK004\n",
" Puck ID: 28, Puck Name: PKK005\n",
" Puck ID: 29, Puck Name: PKK006\n",
" Puck ID: 30, Puck Name: PKK007\n",
" Dewar ID: 23, Dewar Name: tutu, Dewar Unique ID: None \n",
" No pucks found in this dewar.\n",
" Dewar ID: 24, Dewar Name: Dewar_test, Dewar Unique ID: 84b5630f4e933b4d \n",
" Puck ID: 178, Puck Name: CPS-4093\n",
" Puck ID: 179, Puck Name: CPS-4178\n",
" Puck ID: 180, Puck Name: PSIMX-122\n",
" Puck ID: 181, Puck Name: E-07\n",
" Puck ID: 182, Puck Name: CPS-6597\n"
"Shipment ID: 4, Shipment Name: testship\n",
" Dewar ID: 6, Dewar Name: Dewar_test, Dewar Unique ID: f352529444d64dd5 \n",
" Puck ID: 43, Puck Name: CPS-4093\n",
" Puck ID: 44, Puck Name: CPS-4178\n",
" Puck ID: 45, Puck Name: PSIMX-122\n",
" Puck ID: 46, Puck Name: CPS-6597\n",
" Puck ID: 47, Puck Name: PSIMX-078\n",
" Puck ID: 48, Puck Name: 1002\n"
]
},
{
@ -146,13 +146,13 @@
]
}
],
"execution_count": 25
"execution_count": 44
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-01-16T21:27:00.520915Z",
"start_time": "2025-01-16T21:27:00.501009Z"
"end_time": "2025-01-17T14:14:30.201369Z",
"start_time": "2025-01-17T14:14:30.175577Z"
}
},
"cell_type": "code",
@ -164,46 +164,46 @@
"with aareDBclient.ApiClient(configuration) as api_client:\n",
" api_instance = aareDBclient.LogisticsApi(api_client)\n",
"\n",
" #try:\n",
" # # Create payload using the required model\n",
" # logistics_event_create = LogisticsEventCreate(\n",
" # dewar_qr_code='84b5630f4e933b4d',\n",
" # location_qr_code='A1-X06SA',\n",
" # transaction_type='incoming',\n",
" # timestamp=date.today() # Adjust if the API expects datetime\n",
" # )\n",
" #\n",
" # # Pass the payload to the API function\n",
" # api_response = api_instance.scan_dewar_logistics_dewar_scan_post(\n",
" # logistics_event_create=logistics_event_create # Pass as an object\n",
" # )\n",
" # print(\"API Response:\", api_response)\n",
" #\n",
" #except ApiException as e:\n",
" # print(f\"Exception when calling LogisticsApi->scan_dewar_logistics_dewar_scan_post: {e}\")\n",
" #\n",
" #try:\n",
" # # Create payload using the required model\n",
" # logistics_event_create = LogisticsEventCreate(\n",
" # dewar_qr_code='84b5630f4e933b4d',\n",
" # location_qr_code='A1-X06SA',\n",
" # transaction_type='refill',\n",
" # timestamp=date.today() # Adjust if the API expects datetime\n",
" # )\n",
" #\n",
" # # Pass the payload to the API function\n",
" # api_response = api_instance.scan_dewar_logistics_dewar_scan_post(\n",
" # logistics_event_create=logistics_event_create # Pass as an object\n",
" # )\n",
" # print(\"API Response:\", api_response)\n",
" #\n",
" #except ApiException as e:\n",
" # print(f\"Exception when calling LogisticsApi->scan_dewar_logistics_dewar_scan_post: {e}\")\n",
" #\n",
" try:\n",
" # Create payload using the required model\n",
" logistics_event_create = LogisticsEventCreate(\n",
" dewar_qr_code='84b5630f4e933b4d',\n",
" dewar_qr_code='15e3dbe05e78ee83',\n",
" location_qr_code='A2-X06SA',\n",
" transaction_type='incoming',\n",
" timestamp=date.today() # Adjust if the API expects datetime\n",
" )\n",
"\n",
" # Pass the payload to the API function\n",
" api_response = api_instance.scan_dewar_logistics_dewar_scan_post(\n",
" logistics_event_create=logistics_event_create # Pass as an object\n",
" )\n",
" print(\"API Response:\", api_response)\n",
"\n",
" except ApiException as e:\n",
" print(f\"Exception when calling LogisticsApi->scan_dewar_logistics_dewar_scan_post: {e}\")\n",
"\n",
" try:\n",
" # Create payload using the required model\n",
" logistics_event_create = LogisticsEventCreate(\n",
" dewar_qr_code='15e3dbe05e78ee83',\n",
" location_qr_code='A2-X06SA',\n",
" transaction_type='refill',\n",
" timestamp=date.today() # Adjust if the API expects datetime\n",
" )\n",
"\n",
" # Pass the payload to the API function\n",
" api_response = api_instance.scan_dewar_logistics_dewar_scan_post(\n",
" logistics_event_create=logistics_event_create # Pass as an object\n",
" )\n",
" print(\"API Response:\", api_response)\n",
"\n",
" except ApiException as e:\n",
" print(f\"Exception when calling LogisticsApi->scan_dewar_logistics_dewar_scan_post: {e}\")\n",
"\n",
" try:\n",
" # Create payload using the required model\n",
" logistics_event_create = LogisticsEventCreate(\n",
" dewar_qr_code='15e3dbe05e78ee83',\n",
" location_qr_code='X06DA-Beamline',\n",
" transaction_type='beamline',\n",
" timestamp=date.today() # Adjust if the API expects datetime\n",
@ -224,6 +224,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"API Response: {'message': 'Status updated successfully'}\n",
"API Response: {'message': 'Status updated successfully'}\n",
"API Response: {'message': 'Status updated successfully'}\n"
]
},
@ -231,18 +233,22 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
" warnings.warn(\n",
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
" warnings.warn(\n",
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
" warnings.warn(\n"
]
}
],
"execution_count": 37
"execution_count": 45
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-01-16T21:35:54.798099Z",
"start_time": "2025-01-16T21:35:54.775893Z"
"end_time": "2025-01-17T14:07:51.580993Z",
"start_time": "2025-01-17T14:07:51.565128Z"
}
},
"cell_type": "code",
@ -271,13 +277,12 @@
"text": [
"The response of PucksApi->get_pucks_by_slot_pucks_slot_slot_identifier_get:\n",
"\n",
"[PuckWithTellPosition(id=188, puck_name='CPS-4093', puck_type='unipuck', puck_location_in_dewar=1, dewar_id=24, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None),\n",
" PuckWithTellPosition(id=189, puck_name='CPS-4178', puck_type='unipuck', puck_location_in_dewar=2, dewar_id=24, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None),\n",
" PuckWithTellPosition(id=190, puck_name='PSIMX-122', puck_type='unipuck', puck_location_in_dewar=3, dewar_id=24, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None),\n",
" PuckWithTellPosition(id=191, puck_name='E-07', puck_type='unipuck', puck_location_in_dewar=4, dewar_id=24, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None),\n",
" PuckWithTellPosition(id=192, puck_name='CPS-6597', puck_type='unipuck', puck_location_in_dewar=5, dewar_id=24, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None),\n",
" PuckWithTellPosition(id=193, puck_name='PSIMX-078', puck_type='unipuck', puck_location_in_dewar=6, dewar_id=24, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None),\n",
" PuckWithTellPosition(id=194, puck_name='1002', puck_type='unipuck', puck_location_in_dewar=7, dewar_id=24, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None)]\n"
"[PuckWithTellPosition(id=43, puck_name='CPS-4093', puck_type='unipuck', puck_location_in_dewar=1, dewar_id=6, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None),\n",
" PuckWithTellPosition(id=44, puck_name='CPS-4178', puck_type='unipuck', puck_location_in_dewar=2, dewar_id=6, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None),\n",
" PuckWithTellPosition(id=45, puck_name='PSIMX-122', puck_type='unipuck', puck_location_in_dewar=3, dewar_id=6, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None),\n",
" PuckWithTellPosition(id=46, puck_name='CPS-6597', puck_type='unipuck', puck_location_in_dewar=4, dewar_id=6, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None),\n",
" PuckWithTellPosition(id=47, puck_name='PSIMX-078', puck_type='unipuck', puck_location_in_dewar=5, dewar_id=6, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None),\n",
" PuckWithTellPosition(id=48, puck_name='1002', puck_type='unipuck', puck_location_in_dewar=6, dewar_id=6, dewar_name='Dewar_test', user='e16371', samples=None, tell_position=None)]\n"
]
},
{
@ -289,13 +294,13 @@
]
}
],
"execution_count": 38
"execution_count": 42
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-01-16T21:39:16.947946Z",
"start_time": "2025-01-16T21:39:16.918422Z"
"end_time": "2025-01-17T14:09:55.141237Z",
"start_time": "2025-01-17T14:09:55.117843Z"
}
},
"cell_type": "code",
@ -310,7 +315,7 @@
" # This part is commented but will be used to attribute a puck to a position of the TELL\n",
" # Define the puck ID and payload\n",
"\n",
" payload = [SetTellPosition(puck_name='CPS-4178', segment='A', puck_in_segment=2),SetTellPosition(puck_name='CPS-4178', segment='C', puck_in_segment=3)]\n",
" payload = [SetTellPosition(puck_name='CPS-4178', segment='A', puck_in_segment=2),SetTellPosition(puck_name='PSIMX122', segment='C', puck_in_segment=3)]\n",
" #payload = []\n",
"\n",
" try:\n",
@ -338,7 +343,7 @@
" {'message': 'The tell_position was updated successfully.',\n",
" 'new_position': 'C3',\n",
" 'previous_position': None,\n",
" 'puck_name': 'CPS-4178',\n",
" 'puck_name': 'PSIMX-122',\n",
" 'status': 'updated'}]\n"
]
},
@ -351,7 +356,7 @@
]
}
],
"execution_count": 39
"execution_count": 43
},
{
"metadata": {