@topconsultnpm/sdkui-react-beta 6.10.57 → 6.10.58

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.
@@ -327,7 +327,7 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
327
327
  };
328
328
  const createDirectory = async (parentDirectory, name) => {
329
329
  if (parentDirectory.path === '' && parentDirectory.name === '') {
330
- throw new FileSystemError(5, parentDirectory, "Selezionare un'area di appoggio");
330
+ throw new FileSystemError(5, parentDirectory, SDKUI_Localizator.SelectSupportAreaMessage);
331
331
  }
332
332
  const ad = parentDirectory.dataItem.dataItem;
333
333
  const aid = ad.id;
@@ -351,11 +351,11 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
351
351
  const tms = props.tmSession ?? SDK_Globals.tmSession;
352
352
  if (itemSource.isDirectory) {
353
353
  subFolderSource = itemSource.path === adSource.name ? '' : itemSource.path.replace(adSource.name + '/', '');
354
- await tms?.NewAreaEngine().CopyFolderAsync(aidSource, subFolderSource, aidDest, subFolderDest, deleteSource, true).catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
354
+ await tms?.NewAreaEngine().CopyFolderAsync(aidSource, subFolderSource, aidDest, subFolderDest, deleteSource, true).catch((err) => { throw new FileSystemError(5, itemSource, err.message ?? SDKUI_Localizator.Error); });
355
355
  }
356
356
  else {
357
357
  subFolderSource = itemSource.parentPath === adSource.name ? '' : itemSource.parentPath.replace(adSource.name + '/', '');
358
- await tms?.NewAreaEngine().CopyFilesAsync(aidSource, subFolderSource, [itemSource.name], aidDest, subFolderDest, deleteSource, true).catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
358
+ await tms?.NewAreaEngine().CopyFilesAsync(aidSource, subFolderSource, [itemSource.name], aidDest, subFolderDest, deleteSource, true).catch((err) => { throw new FileSystemError(5, itemSource, err.message ?? SDKUI_Localizator.Error); });
359
359
  }
360
360
  };
361
361
  const deleteItem = async (item) => {
@@ -364,10 +364,10 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
364
364
  const subFolder = item.parentPath === ad.name ? '' : item.parentPath.replace(ad.name + '/', '');
365
365
  const tms = props.tmSession ?? SDK_Globals.tmSession;
366
366
  if (item.isDirectory) {
367
- await tms?.NewAreaEngine().DeleteFoldersAsync(aid, subFolder, [item.name]).catch((err) => TMExceptionBoxManager.show({ exception: err }));
367
+ await tms?.NewAreaEngine().DeleteFoldersAsync(aid, subFolder, [item.name]).catch((err) => { throw new FileSystemError(5, item, err.message ?? SDKUI_Localizator.GetFolderDeletionErrorMessage); });
368
368
  }
369
369
  else {
370
- await tms?.NewAreaEngine().DeleteFilesAsync(aid, subFolder, [item.name]).catch((err) => TMExceptionBoxManager.show({ exception: err }));
370
+ await tms?.NewAreaEngine().DeleteFilesAsync(aid, subFolder, [item.name]).catch((err) => { throw new FileSystemError(5, item, err.message ?? SDKUI_Localizator.GetFolderDeletionErrorMessage); });
371
371
  }
372
372
  };
373
373
  const downloadItems = async (items) => {
@@ -499,43 +499,67 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
499
499
  if (item.isDirectory) {
500
500
  const oldSubFolder = item.path === ad.name ? '' : item.path.replace(ad.name + '/', '');
501
501
  const newSubFolder = item.parentPath.replace(ad.name, '') + '/' + newName;
502
- await tms?.NewAreaEngine().RenameFolderAsync(aid, oldSubFolder, newSubFolder).then(() => ShowAlert({ message: `${msg}`, mode: 'info', title: SDKUI_Localizator.RenameFolder, duration: 3000 })).catch((err) => TMExceptionBoxManager.show({ exception: err }));
502
+ await tms?.NewAreaEngine().RenameFolderAsync(aid, oldSubFolder, newSubFolder).then(() => ShowAlert({ message: `${msg}`, mode: 'info', title: SDKUI_Localizator.RenameFolder, duration: 3000 })).catch((err) => { throw new FileSystemError(5, item, err.message ?? SDKUI_Localizator.Error); });
503
503
  }
504
504
  else {
505
505
  const subFolder = item.parentPath === ad.name ? '' : item.parentPath.replace(ad.name + '/', '');
506
- await tms?.NewAreaEngine().RenameFileAsync(aid, subFolder, item.name, newName).then(() => ShowAlert({ message: `${msg}`, mode: 'info', title: SDKUI_Localizator.RenameFile, duration: 3000 })).catch((err) => TMExceptionBoxManager.show({ exception: err }));
506
+ await tms?.NewAreaEngine().RenameFileAsync(aid, subFolder, item.name, newName).then(() => ShowAlert({ message: `${msg}`, mode: 'info', title: SDKUI_Localizator.RenameFile, duration: 3000 })).catch((err) => { throw new FileSystemError(5, item, err.message ?? SDKUI_Localizator.Error); });
507
507
  }
508
508
  };
509
- // aumentare chunk size
510
509
  const uploadFileChunk = async (file, uploadInfo, destinationDirectory) => {
511
510
  try {
511
+ // Retrieve the current TM session
512
512
  const tms = props.tmSession ?? SDK_Globals.tmSession;
513
+ // If there's no session, abort the function
513
514
  if (!tms)
514
515
  return;
516
+ // Create a new instance of UploadFileEngine, which handles the file upload
515
517
  const ufe = tms.NewUploadFileEngine();
518
+ // Generate a unique key based on the file properties (name, size, and last modified date)
516
519
  const key = `${file.name}_${file.size}_${file.lastModified}`;
520
+ // Check if an upload file ID already exists in the cache for this file
517
521
  let uploadFileId = _cacheUploadFileId.get(key);
522
+ // If it's the first chunk of the file (chunkIndex is 0), start the file upload
518
523
  if (uploadInfo.chunkIndex === 0) {
524
+ // Begin uploading the file
519
525
  uploadFileId = await ufe.UploadFileBegin(file.name, file.size, true);
526
+ // Store the upload file ID in cache
520
527
  _cacheUploadFileId.set(key, uploadFileId);
521
528
  }
522
- let fd = new FileDescriptor();
523
- fd.fileTransferMode = FileTransferModes.Base64;
524
- fd.base64Content = await blobToBase64Async(uploadInfo.chunkBlob);
525
- await ufe.UploadFileSendChunk(uploadFileId, fd);
529
+ // Create an array to store promises for chunk uploads
530
+ const chunkPromises = [];
531
+ // Iterate through the chunks and prepare the upload tasks
532
+ for (let chunkIndex = 0; chunkIndex < uploadInfo.chunkCount; chunkIndex++) {
533
+ const chunkBlob = uploadInfo.chunkIndex === chunkIndex ? uploadInfo.chunkBlob : null;
534
+ if (!chunkBlob)
535
+ continue;
536
+ let fd = new FileDescriptor();
537
+ fd.fileTransferMode = FileTransferModes.Base64;
538
+ fd.base64Content = await blobToBase64Async(chunkBlob);
539
+ // Add the chunk upload promise
540
+ chunkPromises.push(ufe.UploadFileSendChunk(uploadFileId, fd));
541
+ }
542
+ // Wait for all chunks to be uploaded concurrently
543
+ await Promise.all(chunkPromises);
544
+ // If it's the last chunk of the file (chunkIndex is equal to chunkCount - 1), finalize the upload
526
545
  if (uploadInfo.chunkIndex === uploadInfo.chunkCount - 1) {
546
+ // Retrieve the destination directory and associated area descriptor (area to upload to)
527
547
  const ad = destinationDirectory?.dataItem?.dataItem;
528
548
  const aid = ad.id;
549
+ // Determine the subfolder path if it's not the root folder
529
550
  const subFolder = destinationDirectory.path === ad.name ? '' : destinationDirectory.path.replace(ad.name + '/', '');
530
- fd = new FileDescriptor();
551
+ // Finalize the upload process and add the file to the server
552
+ let fd = new FileDescriptor();
531
553
  fd.uploadFileIDContent = uploadFileId;
532
554
  fd.fileTransferMode = FileTransferModes.UploadFileID;
533
555
  await tms?.NewAreaEngine().AddFileAsync(aid, subFolder, fd, true, abortController?.signal);
556
+ // Remove the upload file ID from cache after the upload is complete
534
557
  _cacheUploadFileId.delete(key);
535
558
  }
536
559
  }
537
- catch (err) {
538
- TMExceptionBoxManager.show({ exception: err });
560
+ catch (error) {
561
+ // console.error('Error uploading file:', error);
562
+ throw new FileSystemError(5, undefined, error.message ?? SDKUI_Localizator.Error);
539
563
  }
540
564
  };
541
565
  const onCurrentDirectoryChanged = (e) => {
@@ -122,6 +122,9 @@ export declare class SDKUI_Localizator {
122
122
  static get File_Downloading(): "Datei wird heruntergeladen" | "File is downloading..." | "El archivo se está descargando" | "Le fichier est en cours de téléchargement" | "O arquivo está sendo baixado" | "Il file è in fase di download";
123
123
  static get File_Size(): "Dateigröße" | "File size" | "Tamaño del archivo" | "Taille du fichier" | "Tamanho do arquivo" | "Dimensione del file";
124
124
  static get FromTime(): "wurde" | "from" | "par" | "dal";
125
+ static get GetFileDeletionErrorMessage(): "Fehler beim Löschen der Datei" | "Error deleting the file" | "Error al eliminar el archivo" | "Erreur lors de la suppression du fichier" | "Erro ao excluir o arquivo" | "Errore nell'eliminazione del file";
126
+ static get GetFileUploadErrorMessage(): "Fehler beim Hochladen" | "Error during upload" | "Error al subir el archivo" | "Erreur lors du téléchargement" | "Erro ao carregar o arquivo" | "Errore nel caricamento";
127
+ static get GetFolderDeletionErrorMessage(): "Fehler beim Löschen des Ordners" | "Error deleting the folder" | "Error al eliminar la carpeta" | "Erreur lors de la suppression du dossier" | "Erro ao excluir a pasta" | "Errore nell'eliminazione della cartella";
125
128
  static get Hide_CompleteName(): "Vollständigen Namen ausblenden" | "Hide full name" | "Ocultar nombre completo" | "Masquer le nom complet" | "Ocultar nome completo" | "Nascondi nome completo";
126
129
  static get HideSearch(): "Suche ausblenden" | "Hide search" | "Ocultar búsqueda" | "Masquer la recherche" | "Ocultar pesquisa" | "Nascondi ricerca";
127
130
  static get ID_Hide(): "Ausblenden ID" | "Hide ID" | "Ocultar ID" | "Masquer ID" | "Nascondi ID";
@@ -256,6 +259,7 @@ export declare class SDKUI_Localizator {
256
259
  static get SearchResult(): "Suchergebnis" | "Search result" | "Resultado búsqueda" | "Résultat de la recherche" | "Resultados da pesquisa" | "Risultato ricerca";
257
260
  static get Seconds(): "Sekunden" | "Seconds" | "Segundos" | "Secondes" | "Segundas" | "Secondi";
258
261
  static get Select(): "Wählen Sie Ihre" | "Select" | "Seleccionar" | "Sélectionne" | "Selecione" | "Seleziona";
262
+ static get SelectSupportAreaMessage(): "Wählen Sie einen Ablagebereich aus" | "Select a support area" | "Seleccione un área de apoyo" | "Sélectionnez une zone de support" | "Selecione uma área de apoio" | "Selezionare un'area di appoggio";
259
263
  static get Selected(): "Ausgewählt" | "Selected" | "Seleccionados" | "Sélectionné" | "Selecionado" | "Selezionati";
260
264
  static get SelectDesiredFilters(): "Wählen Sie die gewünschten Filter aus" | "Select the desired filters" | "Selecciona los filtros deseados" | "Sélectionnez les filtres souhaités" | "Selecione os filtros desejados" | "Seleziona i filtri desiderati";
261
265
  static get SelectedItems(): "Ausgewählte Artikel" | "Selected items" | "Artículos seleccionados" | "Articles sélectionnés" | "Itens selecionados" | "Elementi selezionati";
@@ -1180,6 +1180,36 @@ export class SDKUI_Localizator {
1180
1180
  default: return "dal";
1181
1181
  }
1182
1182
  }
1183
+ static get GetFileDeletionErrorMessage() {
1184
+ switch (this._cultureID) {
1185
+ case CultureIDs.De_DE: return "Fehler beim Löschen der Datei";
1186
+ case CultureIDs.En_US: return "Error deleting the file";
1187
+ case CultureIDs.Es_ES: return "Error al eliminar el archivo";
1188
+ case CultureIDs.Fr_FR: return "Erreur lors de la suppression du fichier";
1189
+ case CultureIDs.Pt_PT: return "Erro ao excluir o arquivo";
1190
+ default: return "Errore nell'eliminazione del file";
1191
+ }
1192
+ }
1193
+ static get GetFileUploadErrorMessage() {
1194
+ switch (this._cultureID) {
1195
+ case CultureIDs.De_DE: return "Fehler beim Hochladen";
1196
+ case CultureIDs.En_US: return "Error during upload";
1197
+ case CultureIDs.Es_ES: return "Error al subir el archivo";
1198
+ case CultureIDs.Fr_FR: return "Erreur lors du téléchargement";
1199
+ case CultureIDs.Pt_PT: return "Erro ao carregar o arquivo";
1200
+ default: return "Errore nel caricamento";
1201
+ }
1202
+ }
1203
+ static get GetFolderDeletionErrorMessage() {
1204
+ switch (this._cultureID) {
1205
+ case CultureIDs.De_DE: return "Fehler beim Löschen des Ordners";
1206
+ case CultureIDs.En_US: return "Error deleting the folder";
1207
+ case CultureIDs.Es_ES: return "Error al eliminar la carpeta";
1208
+ case CultureIDs.Fr_FR: return "Erreur lors de la suppression du dossier";
1209
+ case CultureIDs.Pt_PT: return "Erro ao excluir a pasta";
1210
+ default: return "Errore nell'eliminazione della cartella";
1211
+ }
1212
+ }
1183
1213
  static get Hide_CompleteName() {
1184
1214
  switch (this._cultureID) {
1185
1215
  case CultureIDs.De_DE: return "Vollständigen Namen ausblenden";
@@ -2518,6 +2548,16 @@ export class SDKUI_Localizator {
2518
2548
  default: return "Seleziona";
2519
2549
  }
2520
2550
  }
2551
+ static get SelectSupportAreaMessage() {
2552
+ switch (this._cultureID) {
2553
+ case CultureIDs.De_DE: return "Wählen Sie einen Ablagebereich aus";
2554
+ case CultureIDs.En_US: return "Select a support area";
2555
+ case CultureIDs.Es_ES: return "Seleccione un área de apoyo";
2556
+ case CultureIDs.Fr_FR: return "Sélectionnez une zone de support";
2557
+ case CultureIDs.Pt_PT: return "Selecione uma área de apoio";
2558
+ default: return "Selezionare un'area di appoggio";
2559
+ }
2560
+ }
2521
2561
  static get Selected() {
2522
2562
  switch (this._cultureID) {
2523
2563
  case CultureIDs.De_DE: return "Ausgewählt";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.10.57",
3
+ "version": "6.10.58",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",