Skip to content

Commit

Permalink
refactor: submission upload local submission file
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronm-2112 committed Nov 25, 2023
1 parent cee844e commit 9129f88
Show file tree
Hide file tree
Showing 30 changed files with 531 additions and 505 deletions.
20 changes: 10 additions & 10 deletions scripts/guided-mode/guided-curate-dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ const savePageChanges = async (pageBeingLeftID) => {

if (pageBeingLeftID === "guided-create-submission-metadata-tab") {
const award = document.getElementById("guided-submission-sparc-award-manual").value;
const milestones = getTagsFromTagifyElement(guidedSubmissionTagsTagifyManual);
const milestones = window.getTagsFromTagifyElement(guidedSubmissionTagsTagifyManual);
const completionDate = document.getElementById(
"guided-submission-completion-date-manual"
).value;
Expand Down Expand Up @@ -5372,7 +5372,7 @@ const window.openPage = async (targetPageID) => {
sectionSubmissionMetadataInputs.classList.remove("hidden");

// Show the instructions for non-SPARC funded submissions
showElementsWithClass("guided-non-sparc-funding-consortium-instructions");
window.showElementsWithClass("guided-non-sparc-funding-consortium-instructions");
} else {
topLevelDDDInstructionsText.classList.remove("hidden");

Expand Down Expand Up @@ -5403,7 +5403,7 @@ const window.openPage = async (targetPageID) => {
}

// Hide the instructions for non-SPARC funded submissions
hideElementsWithClass("guided-non-sparc-funding-consortium-instructions");
window.hideElementsWithClass("guided-non-sparc-funding-consortium-instructions");
}
}

Expand Down Expand Up @@ -11315,7 +11315,7 @@ $("#guided-button-no-source-data").on("click", () => {
}
});

const getTagsFromTagifyElement = (tagifyElement) => {
const window.getTagsFromTagifyElement = (tagifyElement) => {
return Array.from(tagifyElement.getTagElms()).map((tag) => {
return tag.textContent;
});
Expand Down Expand Up @@ -15181,7 +15181,7 @@ const saveSubPageChanges = async (openSubPageID) => {
if (openSubPageID === "guided-submission-metadata-page") {
const award = $("#guided-submission-sparc-award").val();
const date = $("#guided-submission-completion-date").val();
const milestones = getTagsFromTagifyElement(guidedSubmissionTagsTagify);
const milestones = window.getTagsFromTagifyElement(guidedSubmissionTagsTagify);

if (award === "") {
errorArray.push({
Expand Down Expand Up @@ -15505,7 +15505,7 @@ const guidedSaveDescriptionDatasetInformation = () => {
const subtitle = sodaJSONObj["digital-metadata"]["subtitle"];
let studyType = sodaJSONObj["dataset-type"] || "";
//get the keywords from the keywords textarea
const keywordArray = getTagsFromTagifyElement(guidedDatasetKeywordsTagify);
const keywordArray = window.getTagsFromTagifyElement(guidedDatasetKeywordsTagify);
if (keywordArray.length < 3) {
throw "Please enter at least 3 keywords";
}
Expand Down Expand Up @@ -15533,9 +15533,9 @@ const guidedSaveDescriptionDatasetInformation = () => {
};

const guidedSaveDescriptionStudyInformation = () => {
const studyOrganSystemTags = getTagsFromTagifyElement(guidedStudyOrganSystemsTagify);
const studyApproachTags = getTagsFromTagifyElement(guidedStudyApproachTagify);
const studyTechniqueTags = getTagsFromTagifyElement(guidedStudyTechniquesTagify);
const studyOrganSystemTags = window.getTagsFromTagifyElement(guidedStudyOrganSystemsTagify);
const studyApproachTags = window.getTagsFromTagifyElement(guidedStudyApproachTagify);
const studyTechniqueTags = window.getTagsFromTagifyElement(guidedStudyTechniquesTagify);

const studyPurposeInput = document.getElementById("guided-ds-study-purpose");
const studyDataCollectionInput = document.getElementById("guided-ds-study-data-collection");
Expand Down Expand Up @@ -15598,7 +15598,7 @@ const guidedSaveDescriptionContributorInformation = () => {
const acknowledgements = acknowledgementsInput.value.trim();

// Get tags from other funding tagify
const otherFunding = getTagsFromTagifyElement(guidedOtherFundingsourcesTagify);
const otherFunding = window.getTagsFromTagifyElement(guidedOtherFundingsourcesTagify);

sodaJSONObj["dataset-metadata"]["description-metadata"]["contributor-information"] = {
funding: otherFunding,
Expand Down
16 changes: 8 additions & 8 deletions scripts/metadata-files/datasetDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -1556,9 +1556,9 @@ const checkBFImportDD = async () => {
loadDDFileToUI(res, "bf");

// log the import action success to analytics
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Success",
MetadataAnalyticsPrefix.DATASET_DESCRIPTION,
window.MetadataAnalyticsPrefix.DATASET_DESCRIPTION,
window.AnalyticsGranularity.ACTION_AND_ACTION_WITH_DESTINATION,
"Existing",
Destinations.PENNSIEVE
Expand All @@ -1573,9 +1573,9 @@ const checkBFImportDD = async () => {
text: error.response.data.message,
});

logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.DATASET_DESCRIPTION,
window.MetadataAnalyticsPrefix.DATASET_DESCRIPTION,
window.AnalyticsGranularity.ALL_LEVELS,
"Existing",
Destinations.PENNSIEVE
Expand All @@ -1596,9 +1596,9 @@ const loadDDfileDataframe = async (filePath) => {

loadDDFileToUI(ddFileData, "local");
// log the import action success to analytics
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Success",
MetadataAnalyticsPrefix.DATASET_DESCRIPTION,
window.MetadataAnalyticsPrefix.DATASET_DESCRIPTION,
window.AnalyticsGranularity.ACTION_AND_ACTION_WITH_DESTINATION,
"Existing",
Destinations.LOCAL
Expand All @@ -1615,9 +1615,9 @@ const loadDDfileDataframe = async (filePath) => {
});

// log the import action failure to analytics
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.DATASET_DESCRIPTION,
window.MetadataAnalyticsPrefix.DATASET_DESCRIPTION,
window.AnalyticsGranularity.ALL_LEVELS,
"Existing",
Destinations.LOCAL
Expand Down
58 changes: 29 additions & 29 deletions scripts/metadata-files/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -931,17 +931,17 @@ const generateManifest = async (action, type, manifestEditBoolean, ev) => {
icon: "warning",
showConfirmButton: "OK",
});
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.LOCAL
);

logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ACTION,
"Generate - Check Storage Space",
Destinations.LOCAL
Expand All @@ -951,9 +951,9 @@ const generateManifest = async (action, type, manifestEditBoolean, ev) => {
generateAfterEdits();
return;
}
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Success",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ACTION,
"Generate - Check Storage Space",
Destinations.LOCAL
Expand Down Expand Up @@ -990,9 +990,9 @@ const generateManifest = async (action, type, manifestEditBoolean, ev) => {
}).then((result) => {});

// log the error to analytics
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.LOCAL
Expand All @@ -1018,9 +1018,9 @@ const generateManifest = async (action, type, manifestEditBoolean, ev) => {
},
}).then((result) => {});
// log the error to analytics
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.LOCAL
Expand All @@ -1046,9 +1046,9 @@ const generateManifest = async (action, type, manifestEditBoolean, ev) => {
},
}).then((result) => {});
// log the error to analytics
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.LOCAL
Expand Down Expand Up @@ -1209,9 +1209,9 @@ const initiate_generate_manifest_local = async (manifestEditBoolean, originalDat
});
//////////// Tracking analytics /////////////
// log the manifest file creation to analytics
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Success",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.LOCAL
Expand Down Expand Up @@ -1303,9 +1303,9 @@ const initiate_generate_manifest_bf = async () => {
}

// log the error to analytics
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.PENNSIEVE
Expand Down Expand Up @@ -1344,9 +1344,9 @@ const initiate_generate_manifest_bf = async () => {
: kombuchaEnums.Origin.LOCAL;

// log the manifest file creation to analytics
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Success",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.PENNSIEVE
Expand All @@ -1356,7 +1356,7 @@ const initiate_generate_manifest_bf = async () => {
ipcRenderer.send(
"track-event",
"Success",
MetadataAnalyticsPrefix.MANIFEST + " - Generate - Number of Files ",
window.MetadataAnalyticsPrefix.MANIFEST + " - Generate - Number of Files ",
"Number of Files",
high_level_folder_num
);
Expand Down Expand Up @@ -1645,9 +1645,9 @@ const extractBFDatasetForManifestFile = async (editBoolean, bfaccount, bfdataset
$("#bf_dataset_create_manifest").text("None");
window.defaultBfDataset = "Select dataset";
// log the Generate action without the destination
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.PENNSIEVE
Expand Down Expand Up @@ -1697,9 +1697,9 @@ const extractBFDatasetForManifestFile = async (editBoolean, bfaccount, bfdataset
$("#Question-prepare-manifest-3").removeClass("prev");
$("#bf_dataset_create_manifest").text("None");
window.defaultBfDataset = "Select dataset";
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.PENNSIEVE
Expand Down Expand Up @@ -1739,9 +1739,9 @@ const extractBFDatasetForManifestFile = async (editBoolean, bfaccount, bfdataset
$("#Question-prepare-manifest-3").removeClass("prev");
$("#bf_dataset_create_manifest").text("None");
window.defaultBfDataset = "Select dataset";
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.PENNSIEVE
Expand Down Expand Up @@ -1773,9 +1773,9 @@ const extractBFDatasetForManifestFile = async (editBoolean, bfaccount, bfdataset

window.defaultBfDataset = "Select dataset";
// log the error to analytics
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.PENNSIEVE
Expand Down Expand Up @@ -2214,9 +2214,9 @@ const createManifestLocally = async (type, editBoolean, originalDataset) => {

//////////// Tracking analytics /////////////
// log the manifest file creation to analytics
logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Success",
MetadataAnalyticsPrefix.MANIFEST,
window.MetadataAnalyticsPrefix.MANIFEST,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.LOCAL
Expand Down
32 changes: 16 additions & 16 deletions scripts/metadata-files/readme-changes.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ $(document).ready(function () {
if (filepath !== null) {
document.getElementById("existing-changes-file-destination").placeholder = filepath[0];

logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Success",
MetadataAnalyticsPrefix.CHANGES,
window.MetadataAnalyticsPrefix.CHANGES,
window.AnalyticsGranularity.ACTION_AND_ACTION_WITH_DESTINATION,
"Existing",
Destinations.PENNSIEVE
Expand Down Expand Up @@ -264,9 +264,9 @@ $(document).ready(function () {
if (filepath !== null) {
document.getElementById("existing-readme-file-destination").placeholder = filepath[0];

logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Success",
MetadataAnalyticsPrefix.README,
window.MetadataAnalyticsPrefix.README,
window.AnalyticsGranularity.ACTION_AND_ACTION_WITH_DESTINATION,
"Existing",
Destinations.LOCAL
Expand Down Expand Up @@ -381,9 +381,9 @@ async function saveRCFile(type) {
},
});

logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
type === "changes" ? MetadataAnalyticsPrefix.CHANGES : MetadataAnalyticsPrefix.README,
type === "changes" ? window.MetadataAnalyticsPrefix.CHANGES : window.MetadataAnalyticsPrefix.README,
window.AnalyticsGranularity.ALL_LEVELS,
"Generate",
Destinations.LOCAL
Expand Down Expand Up @@ -568,9 +568,9 @@ const getRC = async (type) => {
});
let res = import_rc_file.data.text;

logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Success",
shortName === "changes" ? MetadataAnalyticsPrefix.CHANGES : MetadataAnalyticsPrefix.README,
shortName === "changes" ? window.MetadataAnalyticsPrefix.CHANGES : window.MetadataAnalyticsPrefix.README,
window.AnalyticsGranularity.ACTION_AND_ACTION_WITH_DESTINATION,
"Existing",
Destinations.PENNSIEVE
Expand Down Expand Up @@ -608,9 +608,9 @@ const getRC = async (type) => {
backdrop: "rgba(0,0,0, 0.4)",
});

logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
shortName === "changes" ? MetadataAnalyticsPrefix.CHANGES : MetadataAnalyticsPrefix.README,
shortName === "changes" ? window.MetadataAnalyticsPrefix.CHANGES : window.MetadataAnalyticsPrefix.README,
window.AnalyticsGranularity.ALL_LEVELS,
"Existing",
Destinations.PENNSIEVE
Expand All @@ -633,9 +633,9 @@ function importExistingRCFile(type) {
"error"
);

logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
type === "changes" ? MetadataAnalyticsPrefix.CHANGES : MetadataAnalyticsPrefix.README,
type === "changes" ? window.MetadataAnalyticsPrefix.CHANGES : window.MetadataAnalyticsPrefix.README,
window.AnalyticsGranularity.ALL_LEVELS,
"Existing",
Destinations.LOCAL
Expand All @@ -650,9 +650,9 @@ function importExistingRCFile(type) {
icon: "error",
});

logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Error",
type === "changes" ? MetadataAnalyticsPrefix.CHANGES : MetadataAnalyticsPrefix.README,
type === "changes" ? window.MetadataAnalyticsPrefix.CHANGES : window.MetadataAnalyticsPrefix.README,
window.AnalyticsGranularity.ALL_LEVELS,
"Existing",
Destinations.LOCAL
Expand Down Expand Up @@ -715,9 +715,9 @@ const loadExistingRCFile = (filepath, type) => {
},
});

logMetadataForAnalytics(
window.logMetadataForAnalytics(
"Success",
type === "changes" ? MetadataAnalyticsPrefix.CHANGES : MetadataAnalyticsPrefix.README,
type === "changes" ? window.MetadataAnalyticsPrefix.CHANGES : window.MetadataAnalyticsPrefix.README,
window.AnalyticsGranularity.ACTION_AND_ACTION_WITH_DESTINATION,
"Existing",
Destinations.LOCAL
Expand Down
Loading

0 comments on commit 9129f88

Please sign in to comment.