@topconsultnpm/sdkui-react 6.22.0-dev4.5 → 6.22.0-dev4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -121,6 +121,8 @@ export const useDcmtOperations = () => {
121
121
  if (waitPanelRef.current === panel)
122
122
  waitPanelRef.current = null;
123
123
  };
124
+ /** Messaggio per il popover delle pill del pannello: il DID dice a quale documento si riferisce. */
125
+ const panelMessage = (dcmt, message) => `DID ${dcmt.DID}: ${message}`;
124
126
  // Il pannello vive fuori dall'albero del chiamante: allo smontaggio va chiuso a mano.
125
127
  useEffect(() => () => { waitPanelRef.current?.close(); waitPanelRef.current = null; }, []);
126
128
  const { OpenFileDialog } = useFileDialog();
@@ -362,8 +364,9 @@ export const useDcmtOperations = () => {
362
364
  // continuare a scaricare dietro al dialogo.
363
365
  await panel.waitWhilePaused();
364
366
  if (abortController.signal.aborted) {
365
- results.push({ rowIndex: i, id1: dcmts[i].TID, id2: dcmts[i].DID, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborati ${completed} documenti` });
366
- panel.warning();
367
+ const description = SDKUI_Localizator.OperationDcmtsInterrupted.replaceParams(completed);
368
+ results.push({ rowIndex: i, id1: dcmts[i].TID, id2: dcmts[i].DID, resultType: ResultTypes.WARNING, description });
369
+ panel.warning(1, description);
367
370
  break;
368
371
  }
369
372
  try {
@@ -371,8 +374,9 @@ export const useDcmtOperations = () => {
371
374
  panel.ok();
372
375
  }
373
376
  catch (ex) {
374
- results.push({ rowIndex: i, id1: dcmts[i].TID, id2: dcmts[i].DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(ex) });
375
- panel.error();
377
+ const description = getExceptionMessage(ex);
378
+ results.push({ rowIndex: i, id1: dcmts[i].TID, id2: dcmts[i].DID, resultType: ResultTypes.ERROR, description });
379
+ panel.error(1, panelMessage(dcmts[i], description));
376
380
  const err = ex;
377
381
  if (err.name === 'CanceledError') {
378
382
  ShowAlert({ message: err.message, mode: 'warning', duration: 3000, title: 'Abort' });
@@ -421,7 +425,7 @@ export const useDcmtOperations = () => {
421
425
  // Download the selected files
422
426
  for (let i = 0; i < selectedFiles.length; i++) {
423
427
  if (abortController.signal.aborted) {
424
- result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborati ${i + 1} documenti` });
428
+ result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description: SDKUI_Localizator.OperationItemsInterrupted.replaceParams(i) });
425
429
  break;
426
430
  }
427
431
  let fd = files.find(f => f.name === selectedFiles[i]);
@@ -538,8 +542,9 @@ export const useDcmtOperations = () => {
538
542
  for (let i = 0; i < inputDcmts.length; i++) {
539
543
  await panel.waitWhilePaused();
540
544
  if (abortController.signal.aborted) {
541
- result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborati ${i + 1} documenti` });
542
- panel.warning();
545
+ const description = SDKUI_Localizator.OperationDcmtsInterrupted.replaceParams(i);
546
+ result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description });
547
+ panel.warning(1, description);
543
548
  break;
544
549
  }
545
550
  try {
@@ -566,8 +571,9 @@ export const useDcmtOperations = () => {
566
571
  panel.ok();
567
572
  }
568
573
  catch (ex) {
569
- result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.ERROR, description: getExceptionMessage(ex) });
570
- panel.error();
574
+ const description = getExceptionMessage(ex);
575
+ result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.ERROR, description });
576
+ panel.error(1, panelMessage(inputDcmts[i], description));
571
577
  const err = ex;
572
578
  if (err.name === 'CanceledError') {
573
579
  ShowAlert({ message: err.message, mode: 'warning', duration: 3000, title: 'Abort' });
@@ -684,8 +690,9 @@ export const useDcmtOperations = () => {
684
690
  for (let i = 0; i < inputDcmts.length; i++) {
685
691
  await panel.waitWhilePaused();
686
692
  if (abortController.signal.aborted) {
687
- result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborati ${i + 1} documenti` });
688
- panel.warning();
693
+ const description = SDKUI_Localizator.OperationDcmtsInterrupted.replaceParams(i);
694
+ result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description });
695
+ panel.warning(1, description);
689
696
  break;
690
697
  }
691
698
  panel.setSubtitle(`Documento ${i + 1} di ${inputDcmts.length}`);
@@ -793,6 +800,7 @@ export const useDcmtOperations = () => {
793
800
  const importWarnings = await importCertificatesAsync(inputDcmts[i], i, fetchRemoteCertificates, abortController.signal);
794
801
  if (importWarnings) {
795
802
  result.push(...importWarnings);
803
+ importWarnings.forEach(w => panel.warning(1, panelMessage(inputDcmts[i], w.description ?? '')));
796
804
  }
797
805
  break;
798
806
  }
@@ -803,12 +811,13 @@ export const useDcmtOperations = () => {
803
811
  catch (ex) {
804
812
  let msg = getExceptionMessage(ex);
805
813
  if (msg.startsWith('WARNING#')) {
806
- result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description: msg.replace('WARNING#', '') });
807
- panel.warning();
814
+ const description = msg.replace('WARNING#', '');
815
+ result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.WARNING, description });
816
+ panel.warning(1, panelMessage(inputDcmts[i], description));
808
817
  }
809
818
  else {
810
819
  result.push({ rowIndex: i, id1: inputDcmts[i].TID, id2: inputDcmts[i].DID, resultType: ResultTypes.ERROR, description: msg });
811
- panel.error();
820
+ panel.error(1, panelMessage(inputDcmts[i], msg));
812
821
  }
813
822
  const err = ex;
814
823
  if (err.name === 'CanceledError') {
@@ -634,8 +634,9 @@ export const useMultiMasterDetailDcmts = ({ dtd, masterDcmt, onClose, canNavigat
634
634
  // Con la conferma di interruzione aperta il loop resta in pausa qui
635
635
  await waitPanel.waitWhilePaused();
636
636
  if (waitPanel.aborted) {
637
- result.push({ rowIndex: i, id1: detailTID, id2: undefined, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborati ${i} documenti` });
638
- waitPanel.warning();
637
+ const description = SDKUI_Localizator.OperationDcmtsInterrupted.replaceParams(i);
638
+ result.push({ rowIndex: i, id1: detailTID, id2: undefined, resultType: ResultTypes.WARNING, description });
639
+ waitPanel.warning(1, description);
639
640
  break;
640
641
  }
641
642
  if (isBatch)
@@ -651,12 +652,15 @@ export const useMultiMasterDetailDcmts = ({ dtd, masterDcmt, onClose, canNavigat
651
652
  const err = error;
652
653
  // Annullamento richiesto dall'utente: interrompe senza mostrare l'errore
653
654
  if (err?.name === 'CanceledError' || waitPanel.aborted) {
654
- result.push({ rowIndex: i, id1: detailTID, id2: undefined, resultType: ResultTypes.WARNING, description: `Operazione interrotta. Elaborati ${i} documenti` });
655
- waitPanel.warning();
655
+ const description = SDKUI_Localizator.OperationDcmtsInterrupted.replaceParams(i);
656
+ result.push({ rowIndex: i, id1: detailTID, id2: undefined, resultType: ResultTypes.WARNING, description });
657
+ waitPanel.warning(1, description);
656
658
  break;
657
659
  }
658
- result.push({ rowIndex: i, id1: detailTID, id2: undefined, resultType: ResultTypes.ERROR, description: getExceptionMessage(error) });
659
- waitPanel.error();
660
+ const description = getExceptionMessage(error);
661
+ result.push({ rowIndex: i, id1: detailTID, id2: undefined, resultType: ResultTypes.ERROR, description });
662
+ // La riga non ha ancora un DID: la si indica con la sua posizione.
663
+ waitPanel.error(1, `${SDKUI_Localizator.RowNumber.replaceParams(i + 1)}: ${description}`);
660
664
  if (stopOnFirstError)
661
665
  break;
662
666
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.22.0-dev4.5",
3
+ "version": "6.22.0-dev4.7",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" \u0026\u0026 exit 1",