+
@@ -552,10 +560,10 @@ const showFileContent = (base64String, type) => {
const jsonObject = JSON.parse(textContent); // Parse JSON
fileContent.value = JSON.stringify(jsonObject, null, 2); // Formatta JSON
} else {
- fileContent.value = 'Tipo di file non supportato.';
+ fileContent.value = 'Unsupported file type.';
}
} catch (error) {
- fileContent.value = 'Errore durante la decodifica o il parsing del file.';
+ fileContent.value = 'Errore while decoding or parsing file.';
console.error(error);
}
};
@@ -612,34 +620,6 @@ const getFileNames = (zipData) => {
return files;
};
-// const uploadSingleFile = async (file) => {
-// // Logica per caricare un singolo file utilizzando axios
-// try {
-// const formData = new FormData();
-// formData.append('MultiFileUpload', file);
-
-// const response = await axios.post(uploadUrl.value, formData, {
-// headers: {
-// 'Content-Type': 'multipart/form-data',
-// },
-// });
-
-// if (response.status === 200) {
-// toast.add({ severity: 'success', summary: 'Success', detail: `File "${file.name}" uploaded successfully.`, life: 3000 });
-// } else {
-// toast.add({ severity: 'error', summary: 'Error', detail: `Failed to upload file "${file.name}".`, life: 3000 });
-// }
-// } catch (error) {
-// toast.add({ severity: 'error', summary: 'Error', detail: `Error uploading file "${file.name}": ${error.message}`, life: 3000 });
-// console.error('Error uploading file:', error);
-// }
-// };
-
-// const removeFile = (file, index, callback) => {
-// // Logica per rimuovere un file dalla lista dei "pending"
-// console.log('Removing pending file:', file);
-// callback(file, index);
-// };
async function updateRating(newRating) {
ScenarioService.updateScenarioExecRating(exec_id.value, newRating.value)
.then((response) => {
@@ -735,54 +715,12 @@ const onRemove = (event, removeUploadedFileCallback, type) => {
}
};
-// const onRemove = (event) => {
-// // Metodo per gestire la rimozione dei file
-// console.log('Removing file:', folderName.value);
-
-// try {
-// axios.post(
-// `http://localhost:8081/deleteFile`,
-// { fileName: event.file.name, folderName: folderName.value}, // Invio nome del file come payload
-// {
-// headers: {
-// 'Content-Type': 'application/json',
-// },
-// }
-// ).then(response => {
-// if (response.status === 200) {
-// console.log('File removed successfully:', response.data);
-
-// toast.add({
-// severity: "success",
-// summary: "Successo",
-// detail: "File removed successfully!",
-// life: 3000,
-// });
-// } else {
-// console.error('Failed to remove file:', response.statusText);
-
-// toast.add({
-// severity: "error",
-// summary: "Errore",
-// detail: `Failed to remove file. Status: ${xhr.status}`,
-// life: 3000,
-// });
-// }
-
-// })
-
-// } catch (error) {
-// console.error('Error while removing file:', error);
-// }
-// }
-
const onUpload = (event, uploadType) => {
console.log('response upload ', event.xhr.response);
const { xhr } = event; // Estraggo l'oggetto XMLHttpRequest
if (xhr.status === 200) {
- // Risposta OK
if (uploadType === 'SingleFileUpload') {
//formData.value['SingleFileUpload'] = "OK";
@@ -792,6 +730,7 @@ const onUpload = (event, uploadType) => {
} else {
formData.value['SingleFileUpload'] = 'UnknownFile';
}
+ console.log("Length of uploaded files", event.files.length);
numberPrFiles.value += 1;
console.log('Number of PR files: ', numberPrFiles.value);
}
@@ -807,6 +746,7 @@ const onUpload = (event, uploadType) => {
detail: 'File uploaded successfully!',
life: 3000
});
+ console.log("Length of uploaded files", uploadedFiles.value.length);
} else {
// Errore durante l'upload
console.error("Error during upload. Status:", xhr.status, 'Response:', xhr.response);
@@ -846,7 +786,7 @@ const downloadZipFile = async (fileName) => {
function downloadFile() {
try {
// Converti la stringa base64 in un blob
- const base64String = this.scenario_output.value;
+ const base64String = scenario_output.value;
const byteCharacters = atob(base64String);
const byteNumbers = Array.from(byteCharacters, (char) => char.charCodeAt(0));
const byteArray = new Uint8Array(byteNumbers);
@@ -881,9 +821,11 @@ const formatSize = (bytes) => {
return `${truncatedSize} ${sizes[i]}`;
};
+