Skip to content

Commit

Permalink
chore: remove unused vards validation
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronm-2112 committed Feb 4, 2025
1 parent dd14cc8 commit 85f1f36
Showing 1 changed file with 1 addition and 62 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Purpose: Logic for Organize Dataset Step 7: Validate Dataset
import { v4 as uuid } from "uuid";
import api from "../others/api/api";
import Swal from "sweetalert2";
import { clientError, userErrorMessage } from "../others/http-error-handler/error-handler";
import { clientError } from "../others/http-error-handler/error-handler";
import kombuchaEnums from "../analytics/analytics-enums";

while (!window.baseHtmlLoaded) {
Expand Down Expand Up @@ -93,7 +92,6 @@ window.validateOrganizedDataset = async () => {

// get the number of files and folders in the dataset that have been added in the virutal organizer
let file_counter = 0;
let folder_counter = 0;
window.get_num_files_and_folders(sodaJSONObjCopy["dataset-structure"]);

// check if the virutal files will be merged with a Pennsieve dataset
Expand Down Expand Up @@ -207,7 +205,6 @@ window.validateOrganizedDataset = async () => {
}

file_counter = 0;
folder_counter = 0;
window.get_num_files_and_folders(window.sodaJSONObj["dataset-structure"]);
// log successful validation run to analytics
window.electron.ipcRenderer.send(
Expand Down Expand Up @@ -242,7 +239,6 @@ window.validateOrganizedDataset = async () => {
window.fs.writeFileSync(validationReportPath, fullReport);

file_counter = 0;
folder_counter = 0;
window.get_num_files_and_folders(window.sodaJSONObj["dataset-structure"]);
// log successful validation run to analytics
window.electron.ipcRenderer.send(
Expand Down Expand Up @@ -347,63 +343,6 @@ window.validateOrganizedDataset = async () => {
});
});

const displayValidationReportErrors = (validationReport, tableBody, validationErrorsContainer) => {
// this works because the returned validation results are in an Object Literal. If the returned object is changed this will break (e.g., an array will have a length property as well)
let hasValidationErrors = Object.getOwnPropertyNames(validationReport).length >= 1;

Swal.fire({
title: hasValidationErrors ? "Dataset is Invalid" : `Dataset is Valid`,
text: hasValidationErrors
? `Please fix the errors listed in the table below then re-run validation to check that your dataset conforms to the SDS.`
: `Your dataset conforms to the SPARC Dataset Structure.`,
allowEscapeKey: true,
allowOutsideClick: true,
heightAuto: false,
backdrop: "rgba(0,0,0, 0.4)",
timerProgressBar: false,
showConfirmButton: true,
icon: hasValidationErrors ? "error" : "success",
});

// check if there are validation errors
if (!window.validationErrorsOccurred(validationReport)) {
return;
}

// display errors onto the page
window.displayValidationErrors(validationReport, tableBody);

// show the validation errors to the user
validationErrorsContainer.style.visibility = "visible";
};

// {
// if (dataset_destination == "Pennsieve" && "bf" === sodaJSONObjCopy["starting-point"]["type"]) {
// }

// let errorMessage = await checkEmptyFilesAndFolders(sodaJSONObjCopy);

// if (errorMessage) {
// Swal.fire({
// icon: "error",
// title: "Empty Files or Folders Detected",
// text: "Cannot validate a dataset with empty files or folders.",
// confirmButtonText: "Ok",
// backdrop: "rgba(0,0,0, 0.4)",
// reverseButtons: window.reverseSwalButtons,
// heightAuto: false,
// showClass: {
// popup: "animate__animated animate__zoomIn animate__faster",
// },
// hideClass: {
// popup: "animate__animated animate__zoomOut animate__faster",
// },
// });
// }

// return sodaJSONObjCopy;
// }

/**
* @param {Object} sodaJSONObj - The global soda json object or a copy of it
*
Expand Down

0 comments on commit 85f1f36

Please sign in to comment.