Enhanced error handling and route saving mechanism, improved UI modal behavior:

- **Frontend**: Updated `CalculationAssistant.vue` modal to disable backdrop closing via `:close-on-backdrop="false"`.
- **Backend**:
  - Adjusted error message processing in `CalculationExecutionService` to handle potential `null` values gracefully.
  - Improved route saving in `DestinationService` by correcting source node logic and refining `RouteIds` assignments.
This commit is contained in:
Jan 2025-10-28 21:35:30 +01:00
parent e1c1b2918f
commit 302967e645
3 changed files with 7 additions and 4 deletions

View file

@ -14,7 +14,7 @@
</li>
</ul>
<modal :state="showPartNumberModal" @close="closeModal('partNumber')">
<modal :state="showPartNumberModal" @close="closeModal('partNumber')" :close-on-backdrop="false">
<div class="part-number-modal-container">
<h3 class="sub-header">Drop part numbers here</h3>
<div class="part-number-drop-container">

View file

@ -106,7 +106,7 @@ public class DestinationService {
Node source = premise.getSupplierNodeId() == null ? userNodeRepository.getById(premise.getUserSupplierNodeId()).orElseThrow() : nodeRepository.getById(premise.getSupplierNodeId()).orElseThrow();
//noinspection SpringTransactionalMethodCallsInspection
saveRoute(routes.get(new RouteIds(premise.getSupplierNodeId(), destinationNodeId, premise.getSupplierNodeId() == null)), destination.getId());
saveRoute(routes.get(new RouteIds(source.getId(), destinationNodeId, premise.getSupplierNodeId() == null)), destination.getId());
destinations.add(destination);
}
@ -180,7 +180,7 @@ public class DestinationService {
for(var premise : premisses) {
for(var destinationId : destinationIds) {
boolean isUserSupplierNode = (premise.getSupplierNodeId() == null);
var ids = new RouteIds(premise.getSupplierNodeId(), destinationId, isUserSupplierNode);
var ids = new RouteIds(isUserSupplierNode ? premise.getUserSupplierNodeId() : premise.getSupplierNodeId(), destinationId, isUserSupplierNode);
if(routes.containsKey(ids)) continue;
if(!nodes.containsKey(destinationId)) {

View file

@ -100,7 +100,10 @@ public class CalculationExecutionService {
error.setType(SysErrorType.CALCULATION);
error.setCode(e.getClass().getSimpleName().substring(0, Math.min(e.getClass().getSimpleName().length(), 253)));
error.setTitle("Calculation operation execution " + calculationId + " failed");
error.setMessage(e.getMessage().substring(0, Math.min(e.getMessage().length(), 1000)));
var msg = e.getMessage() == null ? "" : e.getMessage();
error.setMessage(msg.substring(0, Math.min(e.getMessage().length(), 1000)));
error.setUserId(calc == null ? null : calc.getUserId());
error.setCalculationJobId(calculationId);
error.setTrace(Arrays.stream(e.getStackTrace()).map(sysErrorTransformer::toSysErrorTraceItem).toList());