From ba0e8a707c09bd98f67cf815a2956077b0f4623e Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Mon, 24 May 2021 10:42:58 -0700 Subject: [PATCH 01/55] Removed autoupdate --- src/main.js | 6 +++--- src/package.json | 2 +- src/scripts/renderer.js | 15 ++++----------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/main.js b/src/main.js index b5a8bfd4..c08ff2c3 100755 --- a/src/main.js +++ b/src/main.js @@ -14,7 +14,7 @@ const { fstat } = require("fs"); log.transports.console.level = false; log.transports.file.level = "debug"; -autoUpdater.channel = "latest"; +autoUpdater.channel = "alpha"; autoUpdater.logger = log; global.trackEvent = trackEvent; @@ -114,7 +114,7 @@ function initialize() { mainWindow.webContents.once("dom-ready", () => { if (updatechecked == false) { - autoUpdater.checkForUpdatesAndNotify(); + // autoUpdater.checkForUpdatesAndNotify(); } }); @@ -200,7 +200,7 @@ function initialize() { nodeStorage.setItem("firstlaunch", false); run_pre_flight_checks(); } - autoUpdater.checkForUpdatesAndNotify(); + // autoUpdater.checkForUpdatesAndNotify(); updatechecked = true; }, 6000); }); diff --git a/src/package.json b/src/package.json index 9232eaab..0a0a6548 100755 --- a/src/package.json +++ b/src/package.json @@ -1,7 +1,7 @@ { "name": "SODA", "productName": "SODA", - "version": "4.3.0", + "version": "4.3.0-alpha", "description": "Keep Calm and Curate", "main": "main.js", "scripts": { diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 5a01af53..ea2007a5 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -70,14 +70,6 @@ client.invoke("echo", "server ready", (error, res) => { // App launch actions ////////////////////////////////// -// $(window).load(function () { -// run_pre_flight_checks(); -// }); - -// $(document).ready(function () { -// run_pre_flight_checks()d -// }); - // Log file settings // log.transports.console.level = false; log.transports.file.maxSize = 1024 * 1024 * 10; @@ -299,7 +291,7 @@ const run_pre_flight_checks = async (check_update = true) => { } if (result.isDismissed) { if (check_update) { - checkNewAppVersion(); + // checkNewAppVersion(); } await wait(500); notyf.open({ @@ -311,7 +303,7 @@ const run_pre_flight_checks = async (check_update = true) => { }); } else { if (check_update) { - checkNewAppVersion(); + // checkNewAppVersion(); } await wait(500); notyf.open({ @@ -323,7 +315,7 @@ const run_pre_flight_checks = async (check_update = true) => { } } else { if (check_update) { - checkNewAppVersion(); + // checkNewAppVersion(); } // If there is no API key pair, show the warning and let them add a key. Messages are dissmisable. Swal.fire({ @@ -3082,6 +3074,7 @@ bfRenameDatasetBtn.addEventListener("click", () => { // Submit dataset to bf // bfSubmitDatasetBtn.addEventListener("click", async () => { + // Check that all let supplementary_checks = await run_pre_flight_checks(false); if (!supplementary_checks) { return; From 719fd7f0d201f4678d1320f6802e816bd39a99c2 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Mon, 24 May 2021 10:56:16 -0700 Subject: [PATCH 02/55] Changed airtable links for testing --- src/scripts/disseminate-and-metadata.js | 4 ++-- src/scripts/renderer.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/scripts/disseminate-and-metadata.js b/src/scripts/disseminate-and-metadata.js index ddb13ec7..5ab1c271 100644 --- a/src/scripts/disseminate-and-metadata.js +++ b/src/scripts/disseminate-and-metadata.js @@ -601,8 +601,8 @@ function checkAirtableStatus() { endpointUrl: "https://" + airtableHostname, apiKey: airKeyInput, }); - var base = Airtable.base("appiYd1Tz9Sv857GZ"); - base("sparc_members") + var base = Airtable.base("appW7lVO177HpnrP2"); + base("soda_sparc_members") .select({ view: "All members (ungrouped)", }) diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index ea2007a5..9d9db18c 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -1493,8 +1493,8 @@ function loadAwardData() { endpointUrl: "https://" + airtableHostname, apiKey: airKeyInput, }); - var base = Airtable.base("appiYd1Tz9Sv857GZ"); - base("sparc_members") + var base = Airtable.base("appW7lVO177HpnrP2"); + base("soda_sparc_members") .select({ view: "All members (ungrouped)", }) @@ -1668,8 +1668,8 @@ function changeAwardInputDsDescription() { endpointUrl: "https://" + airtableHostname, apiKey: airKeyInput, }); - var base = Airtable.base("appiYd1Tz9Sv857GZ"); - base("sparc_members") + var base = Airtable.base("appW7lVO177HpnrP2"); + base("soda_sparc_members") .select({ filterByFormula: `({SPARC_Award_#} = "${awardVal}")`, }) @@ -1821,8 +1821,8 @@ function loadContributorInfo(no, lastName, firstName) { endpointUrl: "https://" + airtableHostname, apiKey: airKeyInput, }); - var base = Airtable.base("appiYd1Tz9Sv857GZ"); - base("sparc_members") + var base = Airtable.base("appW7lVO177HpnrP2"); + base("soda_sparc_members") .select({ filterByFormula: `AND({First_name} = "${firstName}", {Last_name} = "${lastName}")`, }) @@ -5586,7 +5586,7 @@ var bfaddaccountTitle = `

Please specify a key name // const optionsSparcTable = { // hostname: airtableHostname, // port: 443, -// path: "/v0/appiYd1Tz9Sv857GZ/sparc_members", +// path: "/v0/appW7lVO177HpnrP2/soda_sparc_members", // headers: { Authorization: `Bearer ${key}` }, // }; // var sparcTableSuccess; @@ -8464,7 +8464,7 @@ function addAirtableAccountInsideSweetalert() { const optionsSparcTable = { hostname: airtableHostname, port: 443, - path: "/v0/appiYd1Tz9Sv857GZ/sparc_members", + path: "/v0/appW7lVO177HpnrP2/soda_sparc_members", headers: { Authorization: `Bearer ${key}` }, }; var sparcTableSuccess; From da19c09cc1efea002cfbbb51c254a538c7e8844b Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Fri, 28 May 2021 10:04:36 -0700 Subject: [PATCH 03/55] adjusted desc --- src/scripts/renderer.js | 155 +++++++++++++++------ tools/anaconda-env/environment-Windows.yml | 2 +- tools/analytics/custom_ga.ipynb | 155 ++++++++++++++++++--- 3 files changed, 248 insertions(+), 64 deletions(-) diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 9d9db18c..1ba71610 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -2502,7 +2502,7 @@ const tuiInstance = new Editor({ previewStyle: "vertical", height: "400px", hideModeSwitch: true, - placeholder: "Add your description here", + placeholder: "Add a description here: ", toolbarItems: [ "heading", "bold", @@ -3074,7 +3074,7 @@ bfRenameDatasetBtn.addEventListener("click", () => { // Submit dataset to bf // bfSubmitDatasetBtn.addEventListener("click", async () => { - // Check that all + // Check that all let supplementary_checks = await run_pre_flight_checks(false); if (!supplementary_checks) { return; @@ -3523,6 +3523,33 @@ bfAddSubtitleBtn.addEventListener("click", () => { }, delayAnimation); }); +const validateDescription = (description) => { + description = description.trim(); + + if ( + description.search("**Study Purpose**") != -1 || + description.search("**Study Purpose:**") != -1 || + description.search("**Study Purpose :**") != -1 + ) { + return false; + } + if ( + description.search("**Data Collection**") != -1 || + description.search("**Data Collection:**") != -1 || + description.search("**Data Collection :**") != -1 + ) { + return false; + } + if ( + description.search("**Primary Conclusion**") != -1 || + description.search("**Primary Conclusion:**") != -1 || + description.search("**Primary Conclusion :**") != -1 + ) { + return false; + } + return true; +}; + // Add description // bfAddDescriptionBtn.addEventListener("click", () => { setTimeout(() => { @@ -3534,46 +3561,90 @@ bfAddDescriptionBtn.addEventListener("click", () => { var selectedBfDataset = defaultBfDataset; var markdownDescription = tuiInstance.getMarkdown(); - client.invoke( - "api_bf_add_description", - selectedBfAccount, - selectedBfDataset, - markdownDescription, - (error, res) => { - if (error) { - log.error(error); - console.error(error); - var emessage = userError(error); - $("#bf-add-description-dataset-spinner").hide(); - datasetDescriptionStatus.innerHTML = - " " + emessage + ""; - // bfCurrentMetadataProgress.style.display = "none"; - $(".synced-progress").css("display", "none"); - ipcRenderer.send( - "track-event", - "Error", - "Manage Dataset - Add/Edit Description", - selectedBfDataset - ); - } else { - $("#bf-add-description-dataset-spinner").hide(); - datasetDescriptionStatus.innerHTML = res; - // bfCurrentMetadataProgress.style.display = "none"; - $(".synced-progress").css("display", "none"); - showDatasetDescription(); - changeDatasetUnderDD(); - ipcRenderer.send( - "track-event", - "Success", - "Manage Dataset - Add/Edit Description", - selectedBfDataset - ); - } - } - ); + let response = validateDescription(markdownDescription); + + if (!response) { + Swal.fire({ + icon: "warning", + html: `This description does not seem to follow the SPARC guidelines. + Your descriptions should looke like this: +
+ Study Purpose:
+ Data Collection:
+ Primary Conclusion:
+
+ Are you sure you want to continue?`, + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", + showCancelButton: true, + focusCancel: true, + confirmButtonText: "Continue", + cancelButtonText: "I want to edit my description", + reverseButtons: true, + showClass: { + popup: "animate__animated animate__zoomIn animate__faster", + }, + hideClass: { + popup: "animate__animated animate__zoomOut animate__faster", + }, + }).then(() => { + addDescription( + selectedBfAccount, + selectedBfDataset, + markdownDescription + ); + }); + } else { + addDescription(selectedBfAccount, selectedBfDataset, markdownDescription); + } }, delayAnimation); }); +const addDescription = ( + selectedBfAccount, + selectedBfDataset, + markdownDescription +) => { + return; + client.invoke( + "api_bf_add_description", + selectedBfAccount, + selectedBfDataset, + markdownDescription, + (error, res) => { + if (error) { + log.error(error); + console.error(error); + var emessage = userError(error); + $("#bf-add-description-dataset-spinner").hide(); + datasetDescriptionStatus.innerHTML = + " " + emessage + ""; + // bfCurrentMetadataProgress.style.display = "none"; + $(".synced-progress").css("display", "none"); + ipcRenderer.send( + "track-event", + "Error", + "Manage Dataset - Add/Edit Description", + selectedBfDataset + ); + } else { + $("#bf-add-description-dataset-spinner").hide(); + datasetDescriptionStatus.innerHTML = res; + // bfCurrentMetadataProgress.style.display = "none"; + $(".synced-progress").css("display", "none"); + showDatasetDescription(); + changeDatasetUnderDD(); + ipcRenderer.send( + "track-event", + "Success", + "Manage Dataset - Add/Edit Description", + selectedBfDataset + ); + } + } + ); +}; + // upload banner image // const Cropper = require("cropperjs"); const { default: Swal } = require("sweetalert2"); @@ -4460,12 +4531,14 @@ function showCurrentDescription() { log.error(error); console.error(error); } else { - tuiInstance.setMarkdown(res); - if ((res = "")) { + if (res == "") { + res = `**Study Purpose:**   \n \n **Data Collection:**   \n \n **Primary Conclusion:**   `; + tuiInstance.setMarkdown(res); $("#button-add-description > .btn_animated-inside").html( "Add description" ); } else { + tuiInstance.setMarkdown(res); $("#button-add-description > .btn_animated-inside").html( "Edit description" ); diff --git a/tools/anaconda-env/environment-Windows.yml b/tools/anaconda-env/environment-Windows.yml index cccf3719..467a239f 100644 --- a/tools/anaconda-env/environment-Windows.yml +++ b/tools/anaconda-env/environment-Windows.yml @@ -13,7 +13,7 @@ dependencies: - pandas == 0.25.2 - openpyxl == 3.0.0 - zerorpc == 0.6.3 - - pennsieve == 6.1.1 + - pennsieve == 6.1.2 - configparser == 4.0.2 - python-docx == 0.8.10 - xlrd == 1.2.0 diff --git a/tools/analytics/custom_ga.ipynb b/tools/analytics/custom_ga.ipynb index c58dd306..33612090 100644 --- a/tools/analytics/custom_ga.ipynb +++ b/tools/analytics/custom_ga.ipynb @@ -232,7 +232,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "0ae2806ec6ab489da5be8bdd0269f1c5", + "model_id": "dbe5b688bad14bbab3a800f03f5dd331", "version_major": 2, "version_minor": 0 }, @@ -246,7 +246,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "c04240afe9b5401b88218a427936ec7d", + "model_id": "78e6006a9d4a4d0295bed9ee09963a1e", "version_major": 2, "version_minor": 0 }, @@ -260,7 +260,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "90d3266a81a0487a8282e81c9c67417a", + "model_id": "d29cf21cc1d045a5bc9f5145ae31415d", "version_major": 2, "version_minor": 0 }, @@ -274,7 +274,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "bbccaa1b9ccb4c288603a9745e28d702", + "model_id": "ee701b0e42044fd9a32503a973634553", "version_major": 2, "version_minor": 0 }, @@ -665,18 +665,22 @@ }, { "cell_type": "code", - "execution_count": null, - "id": "ebf19849", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "e3896226", "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "AttributeError", + "evalue": "'str' object has no attribute 'value'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# Using the dropdown values here\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mdt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstart_date\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mend_date\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mAttributeError\u001b[0m: 'str' object has no attribute 'value'" + ] + } + ], "source": [ "# Using the dropdown values here\n", "dt = start_date.value\n", @@ -685,7 +689,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 6, "id": "8a113266", "metadata": {}, "outputs": [], @@ -695,12 +699,12 @@ "# start_date = \"50daysAgo\"\n", "# end_date = \"today\"\n", "# end_date = \"yesterday\"\n", - "start_date = \"2021-01-23\"\n", - "end_date = \"2021-04-23\"\n", + "start_date = \"2021-04-01\"\n", + "end_date = \"2021-04-30\"\n", "\n", "# Comment this out to use the regular format dates above \n", - "start_date = dt.strftime('%Y-%m-%d')\n", - "end_date = ds.strftime('%Y-%m-%d')" + "# start_date = dt.strftime('%Y-%m-%d')\n", + "# end_date = ds.strftime('%Y-%m-%d')" ] }, { @@ -713,7 +717,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 7, "id": "74a75e66", "metadata": {}, "outputs": [], @@ -817,7 +821,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 8, "id": "1d290189", "metadata": {}, "outputs": [], @@ -848,6 +852,113 @@ "df.to_csv(result_path, encoding='utf-8', index=False)" ] }, + { + "cell_type": "code", + "execution_count": 19, + "id": "aeaa8ee1-dd5d-43d9-a7e0-e048ce9125e4", + "metadata": {}, + "outputs": [], + "source": [ + "all_actions = ['Manage Dataset - Create Empty Dataset', \n", + " 'Manage Dataset - Change PI owner', \n", + " 'Manage Dataset - Add User Permission',\n", + " 'Manage Dataset - Add/Edit Subtitle',\n", + " 'Manage Dataset - Add/Edit Description', \n", + " 'Manage Dataset - Upload Banner Image', \n", + " 'Manage Dataset - Assign License',\n", + " 'Manage Dataset - Upload Local Dataset', \n", + " 'Manage Dataset - Change Dataset Status',\n", + " 'Prepare Metadata - Add Airtable account',\n", + " 'Prepare Metadata - Add DDD',\n", + " 'Prepare Metadata - Create Submission',\n", + " 'Prepare Metadata - Create dataset_description',\n", + " 'Generate Dataset - Local',\n", + " 'Generate Dataset - Blackfynn',\n", + " 'Generate Dataset - Pennsieve', \n", + " 'Manifest Files Created - Blackfynn', \n", + " 'Disseminate Dataset - Share with Curation Team', \n", + " 'Disseminate Dataset - Share with Consortium',\n", + " 'Disseminate Dataset - Pre-publishing Review',\n", + " 'Download Template - submission.xlsx', \n", + " 'Download Template - subjects.xlsx', \n", + " 'Download Template - samples.xlsx', \n", + " 'Download Template - dataset_description.xlsx',\n", + " 'Upload Local Dataset - Number of Folders',\n", + " 'Upload Local Dataset - Number of Files',\n", + " 'Prepare Metadata - Add Airtable account',\n", + " 'Manifest Files Created - Local',\n", + " 'Generate Dataset - Local - Size',\n", + " 'Prepare Metadata - Add DDD',\n", + " 'Manifest Files Created -', \n", + " 'Generate Dataset - - Size','Generate Dataset - - Number of Files', 'Generate Dataset -', 'Manifest Files Created',\n", + " 'Generate Dataset - Size', 'Generate Dataset - Number of Files', 'Generate Dataset', \n", + " ]\n", + "\n", + "start_date = \"2021-05-01\"\n", + "end_date = \"2021-05-30\"" + ] + }, + { + "cell_type": "raw", + "id": "49f2d2b8-500d-4c58-a779-65496848246d", + "metadata": {}, + "source": [ + "dataset_list = []\n", + "def datasets_and_actions(start_date, end_date, category, action):\n", + " query = {\n", + " 'reportRequests': [\n", + " {\n", + " 'viewId': VIEW_ID,\n", + " 'dateRanges': [{'startDate': start_date, 'endDate': end_date}],\n", + " 'metrics': [{'expression': 'ga:totalEvents'}],\n", + " 'dimensions': [{'name': 'ga:eventCategory'}, {'name': 'ga:eventAction'}, {'name': 'ga:eventLabel'}]\n", + " }]\n", + " }\n", + " response = get_report(analytics, query)\n", + " response_rows = response[\"reports\"][0][\"data\"][\"rows\"]\n", + " data = []\n", + "\n", + " for res in response_rows:\n", + " if res[\"dimensions\"][0] == category:\n", + " if res[\"dimensions\"][1] == action:\n", + " cell_data = [res[\"dimensions\"][2], res[\"metrics\"][0][\"values\"][0]]\n", + " val = res[\"dimensions\"][2]\n", + " if val not in dataset_list:\n", + " dataset_list.append(val)\n", + "# data.append(cell_data)\n", + "\n", + " \n", + " folder_path = os.path.join(\"result_csv\", \"custom\")\n", + " Path(folder_path).mkdir(parents=True, exist_ok=True)\n", + "\n", + "# df = pd.DataFrame(data, columns = ['Dataset_name', 'Values']\n", + "# result_path = os.path.join(folder_path, action + \"-\" + start_date + \"_\" + end_date + \".csv\")\n", + "# df.to_csv(result_path, encoding='utf-8', index=False)\n", + " return\n", + "\n", + "for i in trange(len(all_actions)):\n", + " action = all_actions[i]\n", + " datasets_and_actions(start_date, end_date, \"Success\", action) \n", + " \n", + "print(dataset_list)\n", + "\n", + "## useful for getting the names of datasets where an action is applicable\n", + "## all responses go to the custom folder\n", + "# number_of_actions(start_date, end_date, , )\n", + "# datasets_and_actions(start_date, end_date, \"Success\", \"Manage Dataset - Create Empty Dataset\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "fdbc5a1f-3a51-4241-9142-d12a28d98eb3", + "metadata": {}, + "outputs": [], + "source": [ + "start_date = \"2021-04-01\"\n", + "end_date = \"2021-04-30\"" + ] + }, { "cell_type": "markdown", "id": "35b236a0", @@ -858,7 +969,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 9, "id": "9b00a7e1", "metadata": {}, "outputs": [], From 46737198bf1e80c1713dff6a165106c3dae0a190 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Fri, 28 May 2021 11:48:24 -0700 Subject: [PATCH 04/55] Added datset description validator --- src/scripts/renderer.js | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 1ba71610..5a809614 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -3527,23 +3527,23 @@ const validateDescription = (description) => { description = description.trim(); if ( - description.search("**Study Purpose**") != -1 || - description.search("**Study Purpose:**") != -1 || - description.search("**Study Purpose :**") != -1 + description.search("[*][*]Study Purpose[*][*]") == -1 && + description.search("[*][*]Study Purpose:[*][*]") == -1 && + description.search("[*][*]Study Purpose :[*][*]") == -1 ) { return false; } if ( - description.search("**Data Collection**") != -1 || - description.search("**Data Collection:**") != -1 || - description.search("**Data Collection :**") != -1 + description.search("[*][*]Data Collection[*][*]") == -1 && + description.search("[*][*]Data Collection:[*][*]") == -1 && + description.search("[*][*]Data Collection :[*][*]") == -1 ) { return false; } if ( - description.search("**Primary Conclusion**") != -1 || - description.search("**Primary Conclusion:**") != -1 || - description.search("**Primary Conclusion :**") != -1 + description.search("[*][*]Primary Conclusion[*][*]") == -1 && + description.search("[*][*]Primary Conclusion:[*][*]") == -1 && + description.search("[*][*]Primary Conclusion :[*][*]") == -1 ) { return false; } @@ -3568,18 +3568,20 @@ bfAddDescriptionBtn.addEventListener("click", () => { icon: "warning", html: `This description does not seem to follow the SPARC guidelines. Your descriptions should looke like this: -
+

+

Study Purpose:
Data Collection:
- Primary Conclusion:
-
+ Primary Conclusion: +

+

Are you sure you want to continue?`, heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", showCancelButton: true, focusCancel: true, confirmButtonText: "Continue", - cancelButtonText: "I want to edit my description", + cancelButtonText: "No, I want to edit my description", reverseButtons: true, showClass: { popup: "animate__animated animate__zoomIn animate__faster", @@ -3605,7 +3607,6 @@ const addDescription = ( selectedBfDataset, markdownDescription ) => { - return; client.invoke( "api_bf_add_description", selectedBfAccount, @@ -8342,9 +8343,21 @@ ipcRenderer.on("selected-manifest-folder", (event, result) => { var emessage = userError(error); log.error(error); console.error(error); + ipcRenderer.send( + "track-event", + "Error", + "Retreive Dataset - Pennsieve", + sodaJSONObj["bf-dataset-selected"]["dataset-name"] + ); $("body").removeClass("waiting"); } else { $("body").removeClass("waiting"); + ipcRenderer.send( + "track-event", + "Success", + "Retreive Dataset - Pennsieve", + sodaJSONObj["bf-dataset-selected"]["dataset-name"] + ); } } ); From 37dda60e645da172237d942893be19613c33b8ac Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Fri, 6 Aug 2021 12:56:03 -0700 Subject: [PATCH 05/55] Linked dataset subtitle --- src/scripts/renderer.js | 2 ++ src/scripts/subjects-samples.js | 1 + src/sections/prepare_metadata/prepare_metadata.html | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 42bc823c..f9ed5684 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -3982,6 +3982,7 @@ bfAddSubtitleBtn.addEventListener("click", () => { " " + emessage + ""; // bfCurrentMetadataProgress.style.display = "none"; $(".synced-progress").css("display", "none"); + $("#ds-description").val(""); ipcRenderer.send( "track-event", "Error", @@ -3991,6 +3992,7 @@ bfAddSubtitleBtn.addEventListener("click", () => { } else { log.info("Added subtitle to dataset"); $("#bf-add-subtitle-dataset-spinner").hide(); + $("#ds-description").val(inputSubtitle); datasetSubtitleStatus.innerHTML = res; // bfCurrentMetadataProgress.style.display = "none"; $(".synced-progress").css("display", "none"); diff --git a/src/scripts/subjects-samples.js b/src/scripts/subjects-samples.js index 7ae8f1b0..62a6afde 100644 --- a/src/scripts/subjects-samples.js +++ b/src/scripts/subjects-samples.js @@ -1926,6 +1926,7 @@ function protocolAccountQuestion(type, changeAccountBoolean) { text: " For help with creating and sharing a protocol with SPARC, please visit this dedicated webpage.", heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", + showCancelButton: true, confirmButtonText: "Add", cancelButtonText: "Cancel", allowEscapeKey: false, diff --git a/src/sections/prepare_metadata/prepare_metadata.html b/src/sections/prepare_metadata/prepare_metadata.html index bdecea64..504e3a05 100644 --- a/src/sections/prepare_metadata/prepare_metadata.html +++ b/src/sections/prepare_metadata/prepare_metadata.html @@ -2493,7 +2493,7 @@

Index - Contributor (First, Last) + Contributor (Last, First) Contact person From 678f419352b6e94bb5c3cdcb18c3a06159bb5ed2 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Tue, 10 Aug 2021 13:50:33 -0700 Subject: [PATCH 06/55] Added Tippy and soda config save options --- src/index.html | 2 + src/package.json | 1 + src/scripts/renderer.js | 85 ++++++++++++++++++- src/scripts/subjects-samples.js | 20 ++++- src/sections/help/help.html | 16 ++++ .../prepare_metadata/prepare_metadata.html | 2 + 6 files changed, 121 insertions(+), 5 deletions(-) diff --git a/src/index.html b/src/index.html index a2e647b1..5caa1ab3 100755 --- a/src/index.html +++ b/src/index.html @@ -55,6 +55,8 @@ rel="stylesheet" href="node_modules/jstree/dist/themes/default/style.min.css" /> + + diff --git a/src/package.json b/src/package.json index ae7d64a7..0125ea45 100755 --- a/src/package.json +++ b/src/package.json @@ -99,6 +99,7 @@ "remove-markdown": "^0.3.0", "spur-template": "^1.1.0", "sweetalert2": "^10.16.9", + "tippy.js": "^6.3.1", "universal-analytics": "^0.4.23", "uuid": "^8.3.1", "v8-compile-cache": "^2.3.0", diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index db2b8964..40d33c29 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -27,6 +27,9 @@ const excelToJson = require("convert-excel-to-json"); const csvToJson = require("convert-csv-to-json"); const Jimp = require("jimp"); const { JSONStorage } = require("node-localstorage"); +const tippy = require("tippy.js").default; + +// import "tippy.js/dist/tippy.css"; // optional for styling // const prevent_sleep_id = ""; const electron_app = electron.app; @@ -8685,7 +8688,7 @@ function addBFAccountInsideSweetalert(myBootboxDialog) { } function showAddAirtableAccountSweetalert(keyword) { - var htmlTitle = `

Please specify a key name and enter your Airtable API key below:

`; + var htmlTitle = `

Please specify a key name and enter your Airtable API key below:

`; var bootb = Swal.fire({ title: htmlTitle, @@ -8705,7 +8708,13 @@ function showAddAirtableAccountSweetalert(keyword) { popup: "animate__animated animate__fadeOutUp animate__faster", }, didOpen: () => { - $(".swal-popover").popover(); + // $(".swal-popover").popover(); + tippy("[data-tippy-content]", { + allowHTML: true, + interactive: true, + placement: "right", + theme: "light", + }); }, }).then((result) => { if (result.isConfirmed) { @@ -8851,3 +8860,75 @@ function addAirtableAccountInsideSweetalert(keyword) { }); } } + +$("#resetSODASettings").on("click", () => { + let currentPath = path.join(homeDirectory, ".pennsieve"); + let newPath = path.join(homeDirectory, ".pennsieve2"); + + if (fs.existsSync(currentPath)) { + fs.rename(currentPath, newPath, function (err) { + if (err) { + console.log(err); + } + }); + } + + currentPath = path.join(homeDirectory, "SODA"); + newPath = path.join(homeDirectory, "SODA2"); + + if (fs.existsSync(currentPath)) { + fs.rename(currentPath, newPath, function (err) { + if (err) { + Swal.fire({ + icon: "error", + text: `Reset failed! - ${err}`, + heightAuto: false, + backdrop: "rgba(0,0,0,0.4)", + }); + } else { + Swal.fire({ + icon: "success", + text: "Reset successful!", + heightAuto: false, + backdrop: "rgba(0,0,0,0.4)", + }); + } + }); + } +}); + +$("#restoreSODASettings").on("click", () => { + let currentPath = path.join(homeDirectory, ".pennsieve2"); + let newPath = path.join(homeDirectory, ".pennsieve"); + + if (fs.existsSync(currentPath)) { + fs.rename(currentPath, newPath, function (err) { + if (err) { + console.log(err); + } + }); + } + + currentPath = path.join(homeDirectory, "SODA2"); + newPath = path.join(homeDirectory, "SODA"); + + if (fs.existsSync(currentPath)) { + fs.rename(currentPath, newPath, function (err) { + if (err) { + Swal.fire({ + icon: "error", + text: `Restore failed! - ${err}`, + heightAuto: false, + backdrop: "rgba(0,0,0,0.4)", + }); + } else { + Swal.fire({ + icon: "success", + text: "Restore successful!", + heightAuto: false, + backdrop: "rgba(0,0,0,0.4)", + }); + } + }); + } +}); diff --git a/src/scripts/subjects-samples.js b/src/scripts/subjects-samples.js index 381620f7..d95588c6 100644 --- a/src/scripts/subjects-samples.js +++ b/src/scripts/subjects-samples.js @@ -1303,7 +1303,7 @@ function importPrimaryFolderSamples(folderPath) { samplesFileData.push(""); } samplesTableData[j] = samplesFileData; - j += 1 + j += 1; } } } @@ -2503,10 +2503,10 @@ function addContributortoTableDD(name, contactStatus) { } var contributorElement = - '
Affiliation
Role
'; + '
Affiliation
Role
'; var contributorElementRaw = - '
Affiliation
Role
'; + '
Affiliation
Role
'; var contributorObject = []; @@ -2541,6 +2541,13 @@ function showContributorSweetalert(key) { footer: footer, didOpen: () => { $(".swal-popover").popover(); + tippy("[data-tippy-content]", { + allowHTML: true, + interactive: true, + placement: "right", + theme: "light", + interactiveBorder: 30, + }); // first destroy old tagify $($("#input-con-affiliation").siblings()[0]).remove(); $($("#input-con-role").siblings()[0]).remove(); @@ -2722,6 +2729,13 @@ function edit_current_con_id(ev) { allowOutsideClick: false, didOpen: () => { $(".swal-popover").popover(); + tippy("[data-tippy-content]", { + allowHTML: true, + interactive: true, + placement: "right", + theme: "light", + interactiveBorder: 30, + }); // disable first and last names (cannot edit these fields) // first destroy old tagify $($("#input-con-affiliation").siblings()[0]).remove(); diff --git a/src/sections/help/help.html b/src/sections/help/help.html index 6678a23c..462d3265 100644 --- a/src/sections/help/help.html +++ b/src/sections/help/help.html @@ -170,5 +170,21 @@

Please consult the sections below for help.

+ +
+
+ +
+ + +
+
+
diff --git a/src/sections/prepare_metadata/prepare_metadata.html b/src/sections/prepare_metadata/prepare_metadata.html index 504e3a05..d09a6393 100644 --- a/src/sections/prepare_metadata/prepare_metadata.html +++ b/src/sections/prepare_metadata/prepare_metadata.html @@ -7308,4 +7308,6 @@

+ + From 34a726c97262d82eac9ce8d18a61efa546d5cd43 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Tue, 10 Aug 2021 15:45:32 -0700 Subject: [PATCH 07/55] Fix for details panel and config restore --- src/assets/css/main.css | 4 ++-- src/package.json | 1 + src/scripts/renderer.js | 10 ++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/assets/css/main.css b/src/assets/css/main.css index f0e02b21..bb347222 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -229,7 +229,7 @@ button[data-id="bf_list_users_pi"] { padding: 8px 10px !important; text-align: center; vertical-align: middle; - margin-top:; + margin-top: ; } .modal-footer { @@ -1128,7 +1128,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 350px; height: auto; - margin-top: 50px; + /* margin-top: 50px; */ /* margin-right: 20px; */ right: 0; border-radius: 10px 0 0 10px; diff --git a/src/package.json b/src/package.json index 0125ea45..37bca945 100755 --- a/src/package.json +++ b/src/package.json @@ -86,6 +86,7 @@ "electron-shortcut-normalizer": "^1.0.0", "electron-updater": "^4.3.9", "fomantic-ui": "^2.8.8", + "fs-extra": "^10.0.0", "glob": "^7.1.7", "html2canvas": "^1.0.0-rc.5", "image-data-uri": "^2.0.1", diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 40d33c29..0ad8a058 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -3,7 +3,7 @@ ////////////////////////////////// const zerorpc = require("zerorpc"); -const fs = require("fs"); +const fs = require("fs-extra"); const os = require("os"); const path = require("path"); const { ipcRenderer } = require("electron"); @@ -8897,11 +8897,14 @@ $("#resetSODASettings").on("click", () => { } }); -$("#restoreSODASettings").on("click", () => { +$("#restoreSODASettings").on("click", async () => { let currentPath = path.join(homeDirectory, ".pennsieve2"); let newPath = path.join(homeDirectory, ".pennsieve"); if (fs.existsSync(currentPath)) { + if (fs.existsSync(newPath)) { + await fs.removeSync(newPath); + } fs.rename(currentPath, newPath, function (err) { if (err) { console.log(err); @@ -8913,6 +8916,9 @@ $("#restoreSODASettings").on("click", () => { newPath = path.join(homeDirectory, "SODA"); if (fs.existsSync(currentPath)) { + if (fs.existsSync(newPath)) { + await fs.removeSync(newPath); + } fs.rename(currentPath, newPath, function (err) { if (err) { Swal.fire({ From 989d1026e17065931d473f4fe8145de939190c36 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Fri, 13 Aug 2021 16:26:58 -0700 Subject: [PATCH 08/55] Added onboarding --- src/assets/css/main.css | 27 ++++++++++---------- src/index.html | 4 +++ src/package.json | 1 + src/scripts/organizeDS.js | 5 +++- src/scripts/renderer.js | 11 +++++--- src/scripts/subjects-samples.js | 7 +++-- src/scripts/tab-effects.js | 45 +++++++++++++++++++++++++++++++++ 7 files changed, 78 insertions(+), 22 deletions(-) diff --git a/src/assets/css/main.css b/src/assets/css/main.css index bb347222..b83f0c6c 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -702,7 +702,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.doc:before { background: url("../img/doc-file.png"); @@ -711,7 +711,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.docx:before { background: url("../img/doc-file.png"); @@ -720,7 +720,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.png:before { background: url("../img/png-file.png"); @@ -729,7 +729,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.PNG:before { background: url("../img/png-file.png"); @@ -738,7 +738,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.jpg:before { background: url("../img/jpeg-file.png"); @@ -747,7 +747,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.jpeg:before { background: url("../img/jpeg-file.png"); @@ -756,7 +756,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.JPEG:before { background: url("../img/jpeg-file.png"); @@ -765,7 +765,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.pdf:before { background: url("../img/pdf-file.png"); @@ -774,7 +774,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.txt:before { background: url("../img/txt-file.png"); @@ -783,7 +783,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.xlsx:before { background: url("../img/excel-file.png"); @@ -792,7 +792,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.xls:before { @@ -802,7 +802,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.other:before { @@ -812,7 +812,7 @@ button[data-id="bf_list_users_pi"] { position: absolute; width: 55px; height: 55px; - margin-left: 10px; + margin-left: 5px; } .myFile.deleted_file:before { @@ -1131,6 +1131,7 @@ button[data-id="bf_list_users_pi"] { /* margin-top: 50px; */ /* margin-right: 20px; */ right: 0; + bottom: 70px; border-radius: 10px 0 0 10px; border: 1px solid #f0f0f0; background: #f5f5f5; diff --git a/src/index.html b/src/index.html index 5caa1ab3..246134de 100755 --- a/src/index.html +++ b/src/index.html @@ -57,6 +57,10 @@ /> + diff --git a/src/package.json b/src/package.json index 37bca945..2e0badfe 100755 --- a/src/package.json +++ b/src/package.json @@ -90,6 +90,7 @@ "glob": "^7.1.7", "html2canvas": "^1.0.0-rc.5", "image-data-uri": "^2.0.1", + "intro.js": "^4.1.0", "jimp": "^0.16.1", "jquery": "^3.6.0", "jstree": "^3.3.11", diff --git a/src/scripts/organizeDS.js b/src/scripts/organizeDS.js index b0c6154d..991106a4 100644 --- a/src/scripts/organizeDS.js +++ b/src/scripts/organizeDS.js @@ -808,7 +808,7 @@ function addFilesfunction( ].push("renamed"); } var appendString = - '

' + + '

' + regularFiles[element]["basename"] + "
"; $(uiItem).html(appendString); @@ -841,6 +841,8 @@ function addFilesfunction( } } + + ///// function to load details to show in display once ///// users click Show details function loadDetailsContextMenu( @@ -882,6 +884,7 @@ function loadDetailsContextMenu( //path_label = document.querySelector("#organize-dataset-tab > div > div > div > div.div-display-details.file > div:nth-child(2) > label"); + function triggerManageDetailsPrompts( ev, fileName, diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 0ad8a058..8d9cca81 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -28,8 +28,7 @@ const csvToJson = require("convert-csv-to-json"); const Jimp = require("jimp"); const { JSONStorage } = require("node-localstorage"); const tippy = require("tippy.js").default; - -// import "tippy.js/dist/tippy.css"; // optional for styling +const introJs = require("intro.js"); // const prevent_sleep_id = ""; const electron_app = electron.app; @@ -47,6 +46,10 @@ var datasetStructureJSONObj = { type: "", }; +let introStatus = { + organizeStep3: false +} + ////////////////////////////////// // Connect to Python back-end ////////////////////////////////// @@ -6483,7 +6486,7 @@ async function drop(ev) { ); } var appendString = - '

' + + '

' + importedFiles[element]["basename"] + "
"; $(appendString).appendTo(ev.target); @@ -7064,7 +7067,7 @@ function listItems(jsonObj, uiItem) { appendString + '

' + item + diff --git a/src/scripts/subjects-samples.js b/src/scripts/subjects-samples.js index d95588c6..ecb439ff 100644 --- a/src/scripts/subjects-samples.js +++ b/src/scripts/subjects-samples.js @@ -2247,9 +2247,7 @@ function readXMLScicrunch(xml, type) { async function addProtocol() { const { value: values } = await Swal.fire({ title: "Add a protocol", - html: - '' + - '', + html: '', focusConfirm: false, confirmButtonText: "Add", cancelButtonText: "Cancel", @@ -2266,7 +2264,8 @@ async function addProtocol() { } return [ $("#DD-protocol-link").val(), - $("#DD-protocol-description").val(), + " ", + // $("#DD-protocol-description").val(), ]; }, }); diff --git a/src/scripts/tab-effects.js b/src/scripts/tab-effects.js index 3df2c62c..9b4707e9 100644 --- a/src/scripts/tab-effects.js +++ b/src/scripts/tab-effects.js @@ -103,6 +103,51 @@ const showParentTab = (tabNow, nextOrPrev) => { } } + if (tabNow == 2) { + if (!introStatus.organizeStep3) { + introJs() + .setOptions({ + steps: [ + { + title: "Welcome", + intro: + "This is where you will organize your dataset for curation", + }, + { + title: "Expand folders", + element: document.querySelector(".div-organize-items"), + intro: "Double click on any of the folders to expand them.", + }, + { + title: "More options", + element: document.querySelector(".single-item"), + intro: + "You can rename, delete and move folders and files by right clicking here.", + }, + { + title: "Manifest info", + element: document.querySelector(".single-item"), + intro: + "You can also add descriptions to your manifest file by clicking the 'More details' options after right click.", + }, + { + title: "Adding metadata", + element: document.querySelector("#nextBtn"), + intro: + "Click here after you are done organizing to add your metadata files to this dataset.", + }, + ], + exitOnEsc: false, + exitOnOverlayClick: false, + disableInteraction: false, + }) + .onbeforeexit(function () { + introStatus.organizeStep3 = true; + }) + .start(); + } + } + if (tabNow == x.length - 1) { // If in step 6, show the generate button and the preview tab $("#nextBtn").css("display", "none"); From 307e193b7c0b222bb939739181c9eae56b9b0535 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Fri, 13 Aug 2021 17:31:39 -0700 Subject: [PATCH 09/55] edited samples --- src/scripts/subjects-samples.js | 139 +++++++++++++++++--------------- 1 file changed, 74 insertions(+), 65 deletions(-) diff --git a/src/scripts/subjects-samples.js b/src/scripts/subjects-samples.js index f6ea2021..62253b62 100644 --- a/src/scripts/subjects-samples.js +++ b/src/scripts/subjects-samples.js @@ -566,7 +566,7 @@ async function edit_current_protocol_id(ev) { heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", preConfirm: () => { - return document.getElementById("DD-protocol-link").value + return document.getElementById("DD-protocol-link").value; }, }); if (value) { @@ -580,10 +580,10 @@ async function edit_current_additional_link_id(ev) { var linkType = $(currentRow)[0].cells[1].innerText; // check which link type is being edited to hide/show the link description if (linkType === "Originating Article DOI") { - var display = "none" - var desc = "" + var display = "none"; + var desc = ""; } else { - var display = "block" + var display = "block"; var desc = $(currentRow)[0].cells[3].innerText; } var link = $(currentRow)[0].cells[2].innerText; @@ -594,7 +594,9 @@ async function edit_current_additional_link_id(ev) { '' + - '", focusConfirm: false, @@ -1712,11 +1714,15 @@ $(document).ready(function () { defaultBfAccount ); } else { - document.getElementById("existing-subjects-file-destination").placeholder = "Browse here" + document.getElementById( + "existing-subjects-file-destination" + ).placeholder = "Browse here"; $("#div-confirm-existing-subjects-import").hide(); } } else { - document.getElementById("existing-subjects-file-destination").placeholder = "Browse here" + document.getElementById( + "existing-subjects-file-destination" + ).placeholder = "Browse here"; $("#div-confirm-existing-subjects-import").hide(); } if ( @@ -1744,11 +1750,14 @@ $(document).ready(function () { defaultBfAccount ); } else { - document.getElementById("existing-samples-file-destination").placeholder = "Browse here" + document.getElementById( + "existing-samples-file-destination" + ).placeholder = "Browse here"; $("#div-confirm-existing-samples-import").hide(); } } else { - document.getElementById("existing-samples-file-destination").placeholder = "Browse here" + document.getElementById("existing-samples-file-destination").placeholder = + "Browse here"; $("#div-confirm-existing-samples-import").hide(); } if ( @@ -1765,7 +1774,10 @@ $(document).ready(function () { }); function showExistingSubjectsFile() { - if ($("#existing-subjects-file-destination").prop("placeholder") !== "Browse here") { + if ( + $("#existing-subjects-file-destination").prop("placeholder") !== + "Browse here" + ) { Swal.fire({ title: "Are you sure you want to import a different subjects file?", text: "This will delete all of your previous work on this file.", @@ -1781,44 +1793,51 @@ function showExistingSubjectsFile() { }).then((boolean) => { if (boolean.isConfirmed) { ipcRenderer.send("open-file-dialog-existing-subjects"); - document.getElementById("existing-subjects-file-destination").placeholder = "Browse here" + document.getElementById( + "existing-subjects-file-destination" + ).placeholder = "Browse here"; $("#div-confirm-existing-subjects-import").hide(); $($("#div-confirm-existing-subjects-import button")[0]).hide(); - $("#Question-prepare-subjects-3").removeClass("show") + $("#Question-prepare-subjects-3").removeClass("show"); } - }) + }); } else { ipcRenderer.send("open-file-dialog-existing-subjects"); } } function showExistingSamplesFile() { - if ($("#existing-samples-file-destination").prop("placeholder") !== "Browse here") { - Swal.fire({ - title: "Are you sure you want to import a different samples file?", - text: "This will delete all of your previous work on this file.", - showCancelButton: true, - heightAuto: false, - backdrop: "rgba(0,0,0, 0.4)", - cancelButtonText: `No!`, - cancelButtonColor: "#f44336", - confirmButtonColor: "#3085d6", - confirmButtonText: "Yes", - icon: "warning", - reverseButtons: reverseSwalButtons, - }).then((boolean) => { - if (boolean.isConfirmed) { - ipcRenderer.send("open-file-dialog-existing-samples"); - document.getElementById("existing-samples-file-destination").placeholder = "Browse here" - $("#div-confirm-existing-samples-import").hide(); - $($("#div-confirm-existing-samples-import button")[0]).hide(); - $("#Question-prepare-samples-3").removeClass("show") - } - }) - } else { - ipcRenderer.send("open-file-dialog-existing-samples"); - } - } + if ( + $("#existing-samples-file-destination").prop("placeholder") !== + "Browse here" + ) { + Swal.fire({ + title: "Are you sure you want to import a different samples file?", + text: "This will delete all of your previous work on this file.", + showCancelButton: true, + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", + cancelButtonText: `No!`, + cancelButtonColor: "#f44336", + confirmButtonColor: "#3085d6", + confirmButtonText: "Yes", + icon: "warning", + reverseButtons: reverseSwalButtons, + }).then((boolean) => { + if (boolean.isConfirmed) { + ipcRenderer.send("open-file-dialog-existing-samples"); + document.getElementById( + "existing-samples-file-destination" + ).placeholder = "Browse here"; + $("#div-confirm-existing-samples-import").hide(); + $($("#div-confirm-existing-samples-import button")[0]).hide(); + $("#Question-prepare-samples-3").removeClass("show"); + } + }); + } else { + ipcRenderer.send("open-file-dialog-existing-samples"); + } +} function importExistingSubjectsFile() { var filePath = $("#existing-subjects-file-destination").prop("placeholder"); @@ -1992,15 +2011,16 @@ function protocolAccountQuestion(type, changeAccountBoolean) { cancelButtonText: "Cancel", allowEscapeKey: false, allowOutsideClick: false, - html: - '', + html: '', focusConfirm: false, preConfirm: () => { var link = document.getElementById("DD-protocol-link").value; if (checkDuplicateLink(link, "protocol-link-table-dd")) { - Swal.showValidationMessage("The link provided is already added to the table. Please provide a different protocol.") + Swal.showValidationMessage( + "The link provided is already added to the table. Please provide a different protocol." + ); } - return link + return link; }, }); if (formValue) { @@ -2155,13 +2175,13 @@ async function showProtocolCredentials(email, filetype) { if (value) { if (filetype === "DD") { if (checkDuplicateLink(value, "protocol-link-table-dd")) { - return "The link provided is already added to the table. Please provide a different protocol." + return "The link provided is already added to the table. Please provide a different protocol."; } } } else { - return warningText + return warningText; } - } + }, }); if (protocol) { if (filetype === "subjects") { @@ -2236,8 +2256,8 @@ async function addAdditionalLink() { } function hideDescriptionForDOIs() { - $("#DD-additional-link-description").val("") - $("#DD-additional-link").val("") + $("#DD-additional-link-description").val(""); + $("#DD-additional-link").val(""); if ($("#DD-additional-link-type").val() === "Originating Article DOI") { $("#DD-additional-link-description").css("display", "none"); $("#label-additional-link-description").css("display", "none"); @@ -2305,12 +2325,7 @@ function readXMLScicrunch(xml, type) { async function addProtocol() { const { value: values } = await Swal.fire({ title: "Add a protocol", -<<<<<<< HEAD html: '', -======= - html: - '', ->>>>>>> master focusConfirm: false, confirmButtonText: "Add", cancelButtonText: "Cancel", @@ -2327,16 +2342,11 @@ async function addProtocol() { Swal.showValidationMessage(`Please enter a link!`); } if (checkDuplicateLink(link, "protocol-link-table-dd")) { - Swal.showValidationMessage("The link provided is already added to the table. Please provide a different protocol.") + Swal.showValidationMessage( + "The link provided is already added to the table. Please provide a different protocol." + ); } - return [ - $("#DD-protocol-link").val(), -<<<<<<< HEAD - " ", - // $("#DD-protocol-description").val(), -======= ->>>>>>> master - ]; + return [$("#DD-protocol-link").val()]; }, }); if (values) { @@ -3048,7 +3058,6 @@ function checkDuplicateLink(link, table) { return duplicate; } - ///// Functions to grab each piece of info to generate the dd file // dataset info @@ -3100,9 +3109,9 @@ function grabAdditionalLinkSection() { var additionalLinkArray = []; for (i = 1; i < rowcountLink; i++) { var linkType = table.rows[i].cells[1].innerText; - var link = table.rows[i].cells[2].innerText + var link = table.rows[i].cells[2].innerText; if (linkType === "Originating Article DOI") { - originatingDOIArray.push(link) + originatingDOIArray.push(link); } else if (linkType === "Additional Link") { var linkObject = { link: link, From b895ac48e1c85a89ee00b641fd56c531f741efaf Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Fri, 13 Aug 2021 17:40:48 -0700 Subject: [PATCH 10/55] Release prep --- src/main.js | 2 +- src/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 3e8c53bc..1fe67d83 100755 --- a/src/main.js +++ b/src/main.js @@ -14,7 +14,7 @@ const { fstat } = require("fs"); log.transports.console.level = false; log.transports.file.level = "debug"; -autoUpdater.channel = "alpha"; +autoUpdater.channel = "beta"; autoUpdater.logger = log; global.trackEvent = trackEvent; diff --git a/src/package.json b/src/package.json index 29d617bd..d7779c99 100755 --- a/src/package.json +++ b/src/package.json @@ -1,7 +1,7 @@ { "name": "SODA", "productName": "SODA", - "version": "4.6.2-alpha", + "version": "4.6.2-beta", "description": "Keep Calm and Curate ", "main": "main.js", "scripts": { From 521fd415e32db0d6164b1e9baf535c5c6a3d09d7 Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Mon, 16 Aug 2021 12:28:01 -0700 Subject: [PATCH 11/55] Added changeAward loading bar & enforcewhitelist contributor roles --- src/scripts/subjects-samples.js | 26 ++++++++++++---------- src/scripts/tab-effects.js | 38 ++++++++++++++++----------------- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/scripts/subjects-samples.js b/src/scripts/subjects-samples.js index 62253b62..1c9afa44 100644 --- a/src/scripts/subjects-samples.js +++ b/src/scripts/subjects-samples.js @@ -2460,13 +2460,10 @@ async function helpSPARCAward(filetype) { confirmButtonText: "Yes", }).then((boolean) => { if (boolean.isConfirmed) { - // var awardValue = $("#select-SPARC-award").val() - // $("#ds-description-award-input").val(awardValue) changeAward(award); } }); } else { - // var awardValue = $("#select-SPARC-award").val() changeAward(award); } } @@ -2509,6 +2506,19 @@ function populateSelectSPARCAward(object) { } function changeAward(award) { + Swal.fire({ + title: "Loading your award and contributor information.", + html: "Please wait...", + timer: 3000, + allowEscapeKey: false, + allowOutsideClick: false, + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", + timerProgressBar: false, + didOpen: () => { + Swal.showLoading(); + }, + }).then((result) => {}); $("#ds-description-award-input").val(award); globalContributorNameObject = {}; currentContributorsLastNames = []; @@ -2535,14 +2545,6 @@ function changeAward(award) { currentContributorsLastNames.push(lastName); }), fetchNextPage(); - // var currentRowLeftID = $( - // $($("#table-current-contributors").find("tr")[1].cells[0]).find( - // "select" - // )[0] - // ).prop("id"); - // if (currentRowLeftID) { - // cloneConNamesSelect(currentRowLeftID); - // } }); function done(err) { if (err) { @@ -2659,6 +2661,7 @@ function showContributorSweetalert(key) { maxItems: 25, closeOnSelect: true, // keep the dropdown open after selecting a suggestion }, + enforceWhitelist: true, duplicates: false, } ); @@ -2848,6 +2851,7 @@ function edit_current_con_id(ev) { maxItems: 25, closeOnSelect: true, // keep the dropdown open after selecting a suggestion }, + enforceWhitelist: true, duplicates: false, } ); diff --git a/src/scripts/tab-effects.js b/src/scripts/tab-effects.js index 9b4707e9..171d5952 100644 --- a/src/scripts/tab-effects.js +++ b/src/scripts/tab-effects.js @@ -2962,6 +2962,25 @@ $("input:radio[name=main_tabs]").click(function () { }); $(document).ready(() => { + // Enable the popover content for the main-tab buttons + $(".content-button").popover(); + $(".option-card-disseminate-dataset").each(function () { + var $this = $(this); + $this.popover({ + trigger: "hover", + container: $this, + }); + }); + $(".coming-soon-div").popover(); + $("#button-submit-dataset").popover(); + $(".popover-tooltip").each(function () { + var $this = $(this); + $this.popover({ + trigger: "hover", + container: $this, + }); + }); + $(".ui.accordion").accordion(); $(".content-button").click(function () { let section = $(this).data("section"); @@ -3182,25 +3201,6 @@ $("#edit_banner_image_button").click(async () => { } }); -// Enable the popover content for the main-tab buttons -$(".content-button").popover(); -$(".option-card-disseminate-dataset").each(function () { - var $this = $(this); - $this.popover({ - trigger: "hover", - container: $this, - }); -}); -$(".coming-soon-div").popover(); -$("#button-submit-dataset").popover(); -$(".popover-tooltip").each(function () { - var $this = $(this); - $this.popover({ - trigger: "hover", - container: $this, - }); -}); - initRipple = function (buttonEle) { var inside = document.createElement("div"); inside.classList.add("btn_animated-inside"); From 23f5aeabb5fff7a6d797986c765eb24ac08b937c Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Mon, 16 Aug 2021 14:18:03 -0700 Subject: [PATCH 12/55] Fixed samples edit subject id bug --- src/scripts/subjects-samples.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/scripts/subjects-samples.js b/src/scripts/subjects-samples.js index 1c9afa44..9fcc15c7 100644 --- a/src/scripts/subjects-samples.js +++ b/src/scripts/subjects-samples.js @@ -872,6 +872,8 @@ function editSample(ev, sampleID) { break; } } + // $(currentRow)[0].cells[2].innerText = newID; + $(currentRow)[0].cells[1].innerText = samplesFileData[0]; hideSamplesForm(); } else { var table = document.getElementById("table-samples"); @@ -896,6 +898,7 @@ function editSample(ev, sampleID) { } } $(currentRow)[0].cells[2].innerText = newID; + $(currentRow)[0].cells[1].innerText = samplesFileData[0]; hideSamplesForm(); } } @@ -1050,6 +1053,9 @@ async function copy_current_sample_id(ev) { '' + '', focusConfirm: false, + showCancelButton: true, + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", preConfirm: () => { return [ document.getElementById("new-subject").value, From e5d11d07d3932806a3befe889719aabc72963db6 Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Mon, 16 Aug 2021 14:20:30 -0700 Subject: [PATCH 13/55] Enforced whitelist contributor roles --- src/scripts/subjects-samples.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/scripts/subjects-samples.js b/src/scripts/subjects-samples.js index 684de163..5650a997 100644 --- a/src/scripts/subjects-samples.js +++ b/src/scripts/subjects-samples.js @@ -870,6 +870,7 @@ function editSample(ev, sampleID) { break; } } + $(currentRow)[0].cells[1].innerText = samplesFileData[0]; hideSamplesForm(); } else { var table = document.getElementById("table-samples"); @@ -894,6 +895,7 @@ function editSample(ev, sampleID) { } } $(currentRow)[0].cells[2].innerText = newID; + $(currentRow)[0].cells[1].innerText = samplesFileData[0]; hideSamplesForm(); } } @@ -2632,6 +2634,7 @@ function showContributorSweetalert(key) { maxItems: 25, closeOnSelect: true, // keep the dropdown open after selecting a suggestion }, + enforceWhitelist: true, duplicates: false, } ); @@ -2814,6 +2817,7 @@ function edit_current_con_id(ev) { maxItems: 25, closeOnSelect: true, // keep the dropdown open after selecting a suggestion }, + enforceWhitelist: true, duplicates: false, } ); From 24e482bd497dead29c1019745f0d162277fb7c96 Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Mon, 16 Aug 2021 15:43:56 -0700 Subject: [PATCH 14/55] Change frontend submission --- .../prepare_metadata/prepare_metadata.html | 441 +++++++++++------- 1 file changed, 282 insertions(+), 159 deletions(-) diff --git a/src/sections/prepare_metadata/prepare_metadata.html b/src/sections/prepare_metadata/prepare_metadata.html index 614421ab..6dc143bf 100644 --- a/src/sections/prepare_metadata/prepare_metadata.html +++ b/src/sections/prepare_metadata/prepare_metadata.html @@ -986,152 +986,313 @@

Prepare Metadata - Create submission.xlsx

margin-left: -70px; " > +
- - +
- You are not connected to Airtable.
We recommend you to create an Airtable account, get access to - the SPARC Airtable spreadsheet, and connect your Airtable - account with SODA so SODA can auto-populate information for - your metadata files at your convenience. Would you like to - connect your Airtable account? -

+
+
+ + +
+
+
+ +

+ I want to continue working on an existing + submission.xlsx file +

+
+
+
- +
+
+ + +
+
+
+ +
+ + Award and milestone information +
+
-
-
-
- Airtable account: -
-
+
+
- Loading... -
+
+ + SPARC Award number: + + +
+
+
+
+ +
+
- -
-
-
-
- User's award(s): -
-
- None -
-
- +
+
+
+
+ + Enter the milestone(s): + +
+
+
+
+ +
+
+
+
+
+
+
+ Completion date: + + +
+
+
+
+ +
+
+
+
-
" > -
- -
- -
+ +
-
> Generate -
+ -->

{ - // if (index === 0) { - // var account = $("#current-bf-account").text(); - // var dataset = $(".bf-dataset-span") - // .html() - // .replace(/^\s+|\s+$/g, ""); - // disseminateCurationTeam(account, dataset); - // } else { - // $("#share-curation-team-spinner").hide(); - // } - // } - // ); - - // ipcRenderer.on("warning-share-with-consortium-selection", (event, index) => { - // if (index === 0) { - // var account = $("#current-bf-account").text(); - // var dataset = $(".bf-dataset-span") - // .html() - // .replace(/^\s+|\s+$/g, ""); - // disseminateConsortium(account, dataset); - // } else { - // $("#share-with-sparc-consortium-spinner").show(); - // } - // }); - checkAirtableStatus(""); ipcRenderer.on("selected-metadata-submission", (event, dirpath, filename) => { @@ -185,7 +158,6 @@ $(document).ready(function () { text: `${emessage}`, title: "Metadata file already exists", }); - // $("#generate-submission-spinner").hide(); } else { Swal.fire({ title: "Generating the submission.xlsx file", @@ -200,9 +172,10 @@ $(document).ready(function () { Swal.showLoading(); }, }).then((result) => {}); - var awardRes = $("#submission-SPARC-award-span").text(); - var dateRes = $("#submission-completion-date-span").text(); - var milestonesRes = $("#submission-milestones-span").text(); + var awardRes = $("#submission-sparc-award").val(); + var dateRes = $("#submission-completion-date").val(); + var milestonesRes = $("#selected-milestone-1").val(); + // TODO: convert this milestonesRes tagify into array of values var milestoneValue = milestonesRes.split(", \n"); var json_arr = []; json_arr.push({ @@ -235,25 +208,13 @@ $(document).ready(function () { emessage, "warning" ); - // document.getElementById( - // "para-save-submission-status" - // ).innerHTML = - // " " + emessage + ""; ipcRenderer.send( "track-event", "Error", "Prepare Metadata - Create Submission", defaultBfDataset ); - // $("#generate-submission-spinner").hide(); } else { - // document.getElementById( - // "para-save-submission-status" - // ).innerHTML = - // "" + - // "Done!" + - // smileyCan + - // ""; Swal.fire({ title: "The submission.xlsx file has been successfully generated at the specified location.", @@ -267,7 +228,6 @@ $(document).ready(function () { "Prepare Metadata - Create Submission", defaultBfDataset ); - // $("#generate-submission-spinner").hide(); } } ); @@ -1563,3 +1523,40 @@ function resetDD() { } }); } + +function helpMilestoneSubmission() { + var filepath = "" + var award = $("#submission-sparc-award").val(); + // read from milestonePath to see if associated milestones exist or not + var informationJson = {}; + informationJson = parseJson(milestonePath); + if (Object.keys(informationJson).includes(award)) { + informationJson[award] = milestoneObj; + } else { + Swal.fire({ + title: "Do you have the Data Deliverables document ready to import?", + showCancelButton: true, + showConfirmButton: true, + confirmButtonText: "Yes, let's import it", + cancelButtonText: "No", + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", + }).then((result) => { + if (result.isConfirmed) { + Swal.fire({ + title: "Importing the Data Deliverables document", + html: `

`, + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", + preConfirm: () => { + if ($("#milestone-upload-text").attr("placeholder") === "") { + Swal.showValidationMessage("Please select a file") + } else { + filepath = $("#milestone-upload-text").attr("placeholder") + } + }, + }) + } + }) + } +} diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 06c3fe83..6ea4e8bc 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -1716,7 +1716,6 @@ const specimenType = [ "whole mount", ]; function createSpecimenTypeAutocomplete(id) { - // var listID = "autocomplete" + id; var autoCompleteJS3 = new autoComplete({ selector: "#" + id, data: { diff --git a/src/scripts/subjects-samples.js b/src/scripts/subjects-samples.js index 5650a997..4916b499 100644 --- a/src/scripts/subjects-samples.js +++ b/src/scripts/subjects-samples.js @@ -2408,8 +2408,6 @@ async function helpSPARCAward(filetype) { class="search-select-box">`; const { value: awardVal } = await Swal.fire({ html: htmlEle, - // input: 'select', - // inputOptions: awardObj, heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", inputPlaceholder: "Select an award", @@ -2417,8 +2415,9 @@ async function helpSPARCAward(filetype) { confirmButtonText: "Confirm", didOpen: () => { $("#select-sparc-award-dd-spinner").css("display", "none"); - populateSelectSPARCAward(awardObj); + populateSelectSPARCAward(awardObj, "select-SPARC-award"); $("#select-SPARC-award").selectpicker(); + $("#bf_list_users_pi").selectpicker("refresh"); }, preConfirm: () => { if ($("#select-SPARC-award").val() === "Select") { @@ -2442,13 +2441,10 @@ async function helpSPARCAward(filetype) { confirmButtonText: "Yes", }).then((boolean) => { if (boolean.isConfirmed) { - // var awardValue = $("#select-SPARC-award").val() - // $("#ds-description-award-input").val(awardValue) changeAward(award); } }); } else { - // var awardValue = $("#select-SPARC-award").val() changeAward(award); } } @@ -2471,19 +2467,89 @@ async function helpSPARCAward(filetype) { }); $("#select-sparc-award-dd-spinner").css("display", "none"); } + } else { + var res = airtableRes; + $("#select-sparc-award-submission-spinner").css("display", "block"); + if (res[0]) { + var keyname = res[1]; + var htmlEle = `

Airtable information:

Airtable keyname: ${keyname}Change

Select your award:

`; + const { value: awardVal } = await Swal.fire({ + html: htmlEle, + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", + inputPlaceholder: "Select an award", + showCancelButton: true, + confirmButtonText: "Confirm", + didOpen: () => { + $("#select-sparc-award-submission-spinner").css("display", "none"); + populateSelectSPARCAward(awardObj, "select-SPARC-award-submission"); + $("#select-SPARC-award-submission").selectpicker(); + $("#bf_list_users_pi").selectpicker("refresh"); + }, + preConfirm: () => { + if ($("#select-SPARC-award-submission").val() === "Select") { + Swal.showValidationMessage("Please select an award."); + } else { + award = $("#select-SPARC-award-submission").val(); + } + }, + }); + if (awardVal) { + if ($("#selected-milestone-1").val() !== "") { + Swal.fire({ + title: + "Are you sure you want to delete all of the previous milestone information?", + showCancelButton: true, + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", + cancelButtonText: `No!`, + cancelButtonColor: "#f44336", + confirmButtonColor: "#3085d6", + confirmButtonText: "Yes", + }).then((boolean) => { + if (boolean.isConfirmed) { + milestoneTagify1.removeAllTags(); + $("#submission-sparc-award").val(award) + } + }); + } else { + milestoneTagify1.removeAllTags(); + $("#submission-sparc-award").val(award) + } + } + } else { + Swal.fire({ + title: + "At this moment, SODA is not connected with your Airtable account.", + text: "Would you like to connect your Airtable account with SODA?", + showCancelButton: true, + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", + cancelButtonText: `No!`, + cancelButtonColor: "#f44336", + confirmButtonColor: "#3085d6", + confirmButtonText: "Yes", + }).then((boolean) => { + if (boolean.isConfirmed) { + showAddAirtableAccountSweetalert("dd"); + } + }); + $("#select-sparc-award-submission-spinner").css("display", "none"); + } } } -function populateSelectSPARCAward(object) { - removeOptions(document.getElementById("select-SPARC-award")); +function populateSelectSPARCAward(object, id) { + removeOptions(document.getElementById(id)); addOption( - document.getElementById("select-SPARC-award"), + document.getElementById(id), "Select an award", "Select" ); for (var award of Object.keys(object)) { addOption( - document.getElementById("select-SPARC-award"), + document.getElementById(id), object[award], award ); diff --git a/src/sections/prepare_metadata/prepare_metadata.html b/src/sections/prepare_metadata/prepare_metadata.html index 6dc143bf..e3b696ab 100644 --- a/src/sections/prepare_metadata/prepare_metadata.html +++ b/src/sections/prepare_metadata/prepare_metadata.html @@ -1170,7 +1170,7 @@

display: flex; justify-content: center; margin: 0 auto; - text-decoration: underline; + text-decoration: none; text-align: center; font-size: 14px; margin-top: 10px; @@ -1178,12 +1178,12 @@

" > Help me select my SPARC awardHelp me select my SPARC award from Airtable @@ -1222,8 +1222,9 @@

>
@@ -1263,6 +1264,7 @@

@@ -1275,14 +1277,14 @@

text-decoration: underline; text-align: center; font-size: 14px; - margin-top: 10px; + margin-top: 25px; padding-bottom: 20px; " > Help me with my milestone informationHelp me with import milestones from my Data Deliverables document
From 623433373f57943e955cf3e96e74228ad1509262 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Tue, 17 Aug 2021 18:04:20 -0700 Subject: [PATCH 16/55] Changed submission and awards bug fix --- src/assets/css/individualtab.css | 64 +- src/assets/css/nativize.css | 20 +- src/scripts/disseminate-and-metadata.js | 222 ++- src/scripts/renderer.js | 114 +- src/scripts/subjects-samples.js | 70 +- src/sections/curate/curate.html | 3 +- src/sections/main_tabs/main_tabs.html | 394 +++-- .../prepare_metadata/prepare_metadata.html | 1512 ++++++++--------- 8 files changed, 1299 insertions(+), 1100 deletions(-) diff --git a/src/assets/css/individualtab.css b/src/assets/css/individualtab.css index 810dad6b..e61b7603 100644 --- a/src/assets/css/individualtab.css +++ b/src/assets/css/individualtab.css @@ -765,23 +765,23 @@ @keyframes shakingeffect { 0% { - transform: translateY(0px) rotate(0deg); + transform: translateY(0px) rotate(0deg); } 20% { - transform: translateY(-2px) rotate(-4deg); + transform: translateY(-2px) rotate(-4deg); } 40% { - transform: translateY(-2px) rotate(-2deg); + transform: translateY(-2px) rotate(-2deg); } 60% { - transform: translateY(2px) rotate(4deg); + transform: translateY(2px) rotate(4deg); } 80% { - transform: translateY(2px) rotate(2deg); + transform: translateY(2px) rotate(2deg); } 100% { - transform: translateY(0px) rotate(0deg); - } + transform: translateY(0px) rotate(0deg); + } } .ui.positive.button.active { @@ -953,29 +953,30 @@ text-align: center; } -.ui.input.modified>input { - border-bottom: 1px solid rgba(34,36,38,.15) !important; +.ui.input.modified > input { + border-bottom: 1px solid rgba(34, 36, 38, 0.15) !important; border-left: none !important; border-right: none !important; border-top: none !important; border-radius: 0 !important; } -.ui.input.modified>input:focus { +.ui.input.modified > input:focus { border-bottom: 1px solid var(--color-light-green) !important; } .ui.styled.accordion .title { - background: #fff !important + background: #fff !important; } .ui.styled.accordion .title.active { background: #e7f1ff !important; - color: #0c63e4 !important + color: #0c63e4 !important; } -.ui.styled.accordion .accordion .title, .ui.styled.accordion .title { - color: rgba(0,0,0,.8) !important +.ui.styled.accordion .accordion .title, +.ui.styled.accordion .title { + color: rgba(0, 0, 0, 0.8) !important; } .invalid { @@ -1316,7 +1317,7 @@ color: #363636 !important; font-weight: 400 !important; /* width: 140px !important; */ - /* font-size: 14px !important; +/* font-size: 14px !important; padding: 8px 10px !important; background: #fff !important; } */ @@ -1349,7 +1350,7 @@ body.swal2-shown > [aria-hidden="true"] { } .swal2-footer a { - text-decoration: underline !important; + text-decoration: underline; /* color: var(--color-light-green) !important; */ } @@ -1591,17 +1592,17 @@ body.swal2-shown > [aria-hidden="true"] { } .popover-tooltip.subjects-form { - padding: 0; - font-size: 16px; + padding: 0; + font-size: 16px; } -.popover-tooltip.subjects-form div{ - min-width:180px +.popover-tooltip.subjects-form div { + min-width: 180px; } -.no_results_species{ +.no_results_species { line-height: 1.5; padding: 3px 5px; background: pink; - cursor: pointer + cursor: pointer; } .confirm-disabled { @@ -1614,7 +1615,7 @@ body.swal2-shown > [aria-hidden="true"] { } .contributor-popup { - max-width: 90% + max-width: 90%; } .swal-content-additional-link #swal2-content { @@ -1623,11 +1624,11 @@ body.swal2-shown > [aria-hidden="true"] { } .swal-content-additional-link #swal2-content label { - font-weight: 600 + font-weight: 600; } .tagify.form-container-input-bf { - overflow-x: hidden + overflow-x: hidden; } #contributor-popup { @@ -1646,19 +1647,20 @@ body.swal2-shown > [aria-hidden="true"] { #contributor-popup select { margin-bottom: 20px; margin-top: 15px; - height: 45px + height: 45px; } #contributor-popup label { - font-weight: 600 + font-weight: 600; } -.autoComplete_wrapper > ul > li mark, .mark { - padding: 0 !important +.autoComplete_wrapper > ul > li mark, +.mark { + padding: 0 !important; } .autoComplete_wrapper { - width: 100% !important + width: 100% !important; } .autoComplete_wrapper > input { @@ -1666,7 +1668,7 @@ body.swal2-shown > [aria-hidden="true"] { font-size: inherit !important; min-height: 2.71428571em !important; border: none !important; - border-bottom: 1px solid rgba(34,36,38,.15) !important; + border-bottom: 1px solid rgba(34, 36, 38, 0.15) !important; border-radius: 0 !important; color: inherit !important; } diff --git a/src/assets/css/nativize.css b/src/assets/css/nativize.css index f6fb1f87..64229402 100755 --- a/src/assets/css/nativize.css +++ b/src/assets/css/nativize.css @@ -14,7 +14,6 @@ body { margin: 0; /* remove default margin */ } - /* enable text selection */ .is-selectable, @@ -24,10 +23,9 @@ code { cursor: auto; } - /* Buttons and links */ -button{ +button { cursor: default; } @@ -35,27 +33,28 @@ button{ a { cursor: pointer; text-decoration: none; - border-bottom: 1px dashed; outline: none; } /* New window (target) + external links */ a[target], a[href^="https://"], -a[href^="http://"] { +a[href^="http://"] +{ border-bottom: 1px solid; } /* For YouTube Video links */ -a[href^="https://www.youtube.com"] { +a[href^="https://www.youtube.com"] +{ border-bottom: 0px solid; } -.github-wiki-link{ +.github-wiki-link { text-decoration: none; - border:0px !important; - outline:none; + border: 0px !important; + outline: none; border-width: 0px; - outline-width:0px; + outline-width: 0px; border-bottom: none; } @@ -64,7 +63,6 @@ a:focus { border-bottom: none; } - /* Images */ img { diff --git a/src/scripts/disseminate-and-metadata.js b/src/scripts/disseminate-and-metadata.js index 88a10e94..8b796d2b 100644 --- a/src/scripts/disseminate-and-metadata.js +++ b/src/scripts/disseminate-and-metadata.js @@ -175,13 +175,25 @@ $(document).ready(function () { var awardRes = $("#submission-sparc-award").val(); var dateRes = $("#submission-completion-date").val(); var milestonesRes = $("#selected-milestone-1").val(); + if (awardRes == "" || dateRes == "" || milestonesRes == "") { + Swal.hideLoading(); + Swal.fire({ + backdrop: "rgba(0,0,0, 0.4)", + heightAuto: false, + icon: "error", + text: `Please fill in all fields before generating the submission.xlsx file`, + title: "Required fields incomplete", + }); + return; + } // TODO: convert this milestonesRes tagify into array of values - var milestoneValue = milestonesRes.split(", \n"); + let milestoneValue = JSON.parse(milestonesRes); + // var milestoneValue = milestonesRes.split(", \n"); var json_arr = []; json_arr.push({ award: awardRes, date: dateRes, - milestone: milestoneValue[0], + milestone: milestoneValue[0].value, }); if (milestoneValue.length > 0) { for (var index = 1; index < milestoneValue.length; index++) { @@ -254,6 +266,56 @@ $(document).ready(function () { }); }); +$("#submission-completion-date").change(function () { + const text = $("#submission-completion-date").val(); + console.log(text); + if (text == "Enter my own date") { + Swal.fire({ + allowOutsideClick: false, + backdrop: "rgba(0,0,0, 0.4)", + cancelButtonText: "Cancel", + confirmButtonText: "Confirm", + showCloseButton: true, + focusConfirm: true, + heightAuto: false, + reverseButtons: reverseSwalButtons, + showCancelButton: false, + title: ` Enter your Milestone completion date `, + html: ``, + showClass: { + popup: "animate__animated animate__fadeInDown animate__faster", + }, + hideClass: { + popup: "animate__animated animate__fadeOutUp animate__faster", + }, + didOpen: () => { + document.getElementById("milestone_date_picker").valueAsDate = + new Date(); + }, + preConfirm: async () => { + const input_date = document.getElementById( + "milestone_date_picker" + ).value; + return { + date: input_date, + }; + }, + }).then((result) => { + if (result.isConfirmed) { + const input_date = result.value.date; + $("#submission-completion-date").append( + $("

Create dataset_
description.xlsx

Dataset-specific metadata files

-
- -
-
+ +

Create subjects.xlsx

+ + + -
+ + +

Create samples.xlsx

+ +
Prepare Metadata - Create submission.xlsx

margin-left: -70px; " > -
Prepare Metadata - Create submission.xlsx class="option-card radio-button" data-next="Question-prepare-submission-2" onclick="transitionFreeFormMode(this, 'Question-prepare-submission-1', 'create_submission-tab', '', 'individual-question prepare-submission')" - style="max-width: 180px; - height: 220px !important; - width: 180px !important;" + style=" + max-width: 180px; + height: 220px !important; + width: 180px !important; + " >
@@ -1080,8 +1081,8 @@

I want to start a new submission.xlsx file

style="color: var(--color-subtle)" >

- I want to continue working on an existing - submission.xlsx file + I want to continue working on an existing submission.xlsx + file

@@ -1096,36 +1097,135 @@

id="Question-prepare-submission-2" style="margin-top: 20px" > -
-
- -
-
- - Award and milestone information -
-
+
+
+ +
-
+ + Award and milestone information +
+
+
+
+
+
+
+ + SPARC Award number: + + +
+
+
+
+ +
+
+
+ +
+
+
+ + Enter the milestone(s): + +
+
+
+
+ +
+
+
+
- - SPARC Award number: + Completion date:
- + +
@@ -1170,127 +1275,17 @@

display: flex; justify-content: center; margin: 0 auto; - text-decoration: none; + text-decoration: underline; text-align: center; font-size: 14px; - margin-top: 10px; + margin-top: 25px; padding-bottom: 20px; " > - Help me select my SPARC award from Airtable - + + Import milestones from my Data Deliverables document +

-
-
-
- - Enter the milestone(s): - -
-
-
-
- -
-
-
-
-
-
-
- Completion date: - - -
-
-
-
- -
-
-
-
@@ -1313,95 +1308,325 @@

+
-
- -
-
-
- +
+
+
+ -
- -
- + + Confirm +
+
-
-
-
-
+ +
+
+
+ +
+ + +
+
+
+ + + +

+

+
+
+ + +
+
+ +
+
+
+
+ +
+
+
+ +
- +
- My award(s) is not listed aboveI want to re-upload my Data Deliverables Document
justify-content: center; margin: 10px auto; " - id="div-confirm-select-SPARC-awards" + class="div-confirm-enter-milestone" > @@ -1429,13 +1653,12 @@

-
-
+
+
- -

-
+
+ - -
-
+
+
+ -
+ Confirm +
+
-
-
-
- - -
- -
- -
+ +
+
+ -
+ Confirm +
+
-
-
-
- -
-
-
- - -
-

-

-
-
-
- -
-
+
+
+ +
+ +
+
+
+ +
+ +
+
-
-
-
- - -
- -
-
+
+
+ +
+ +
+ + Confirm +
+
-
-
-
- -
- -
-
- -
- +
+
+
+ +
- -
-
-
-
- -
-
-
- -
- -
- +
+
- Confirm - -
-
-
-
- -
-
-
- -
+
+
Milestone(s):
+
+ +
+
+
-
-
-
SPARC Award:
-
- -
-
-
-
-
-
Milestone(s):
-
- -
-
-
-
-
-
Completion date:
-
- -
-
+
+
Completion date:
+
+ +
- -

-
- -
@@ -7430,6 +7408,4 @@

- - From b3e6967e61602c7dd6893d6c22cc18352538433b Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Wed, 18 Aug 2021 10:08:47 -0700 Subject: [PATCH 17/55] Selectpicker fix --- src/scripts/curate-functions.js | 37 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/scripts/curate-functions.js b/src/scripts/curate-functions.js index 2cdaa62a..ae61c4fe 100644 --- a/src/scripts/curate-functions.js +++ b/src/scripts/curate-functions.js @@ -146,8 +146,12 @@ function dropHandler(ev, paraElement, metadataFile) { } else { document.getElementById(paraElement).innerHTML = "Your SPARC metadata file must be named and formatted exactly as listed above!"; - $($("#"+paraElement).parents()[1]).find(".div-metadata-confirm").css("display", "none"); - $($("#"+paraElement).parents()[1]).find(".div-metadata-go-back").css("display", "flex"); + $($("#" + paraElement).parents()[1]) + .find(".div-metadata-confirm") + .css("display", "none"); + $($("#" + paraElement).parents()[1]) + .find(".div-metadata-go-back") + .css("display", "flex"); } } else { document.getElementById(paraElement).innerHTML = @@ -596,22 +600,6 @@ const importOrganizeProgressPrompt = () => { } }; -$(document).ready(function () { - // confirm_click_function() - - importOrganizeProgressPrompt(); - $("#bf_list_users_pi").selectpicker(); - $("#bf_list_users_pi").selectpicker("refresh"); - $("#bf_list_users").selectpicker(); - $("#bf_list_users").selectpicker("refresh"); - $("#bf_list_roles").selectpicker(); - $("#bf_list_roles").selectpicker("refresh"); - $("#bf_list_teams").selectpicker(); - $("#bf_list_teams").selectpicker("refresh"); - $("#bf_list_roles_team").selectpicker(); - $("#bf_list_roles_team").selectpicker("refresh"); -}); - $(document).ready(function () { var accountDetails = $("#para-account-detail-curate"); //Observe the paragraph @@ -638,6 +626,19 @@ $(document).ready(function () { characterData: true, childList: true, }); + + importOrganizeProgressPrompt(); + + $("#bf_list_users_pi").selectpicker(); + $("#bf_list_users_pi").selectpicker("refresh"); + $("#bf_list_users").selectpicker(); + $("#bf_list_users").selectpicker("refresh"); + $("#bf_list_roles").selectpicker(); + $("#bf_list_roles").selectpicker("refresh"); + $("#bf_list_teams").selectpicker(); + $("#bf_list_teams").selectpicker("refresh"); + $("#bf_list_roles_team").selectpicker(); + $("#bf_list_roles_team").selectpicker("refresh"); }); const get_api_key = async (login, password, key_name) => { From 47d529dc1f55ff5a8e2eb3b9ee71dc28839ed69b Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Wed, 18 Aug 2021 11:10:45 -0700 Subject: [PATCH 18/55] Changed ds_description wording --- src/sections/prepare_metadata/prepare_metadata.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sections/prepare_metadata/prepare_metadata.html b/src/sections/prepare_metadata/prepare_metadata.html index a9846f1b..80ac84c0 100644 --- a/src/sections/prepare_metadata/prepare_metadata.html +++ b/src/sections/prepare_metadata/prepare_metadata.html @@ -2372,12 +2372,11 @@

>
- Brief description of your dataset: + Brief description/subtitle of your dataset: Date: Thu, 19 Aug 2021 14:51:54 -0700 Subject: [PATCH 19/55] Changed select picker import --- src/scripts/renderer.js | 1 + src/sections/curate/curate.html | 2 +- src/sections/main_tabs/main_tabs.html | 2 +- src/sections/prepare_metadata/prepare_metadata.html | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 31bc3204..7b58febc 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -29,6 +29,7 @@ const Jimp = require("jimp"); const { JSONStorage } = require("node-localstorage"); const tippy = require("tippy.js").default; const introJs = require("intro.js"); +const selectpicker = require("bootstrap-select"); // const prevent_sleep_id = ""; const electron_app = electron.app; diff --git a/src/sections/curate/curate.html b/src/sections/curate/curate.html index f1fb154d..f432c955 100644 --- a/src/sections/curate/curate.html +++ b/src/sections/curate/curate.html @@ -4341,7 +4341,7 @@

- + diff --git a/src/sections/main_tabs/main_tabs.html b/src/sections/main_tabs/main_tabs.html index 149cfae5..e2aa9e16 100644 --- a/src/sections/main_tabs/main_tabs.html +++ b/src/sections/main_tabs/main_tabs.html @@ -1423,5 +1423,5 @@

Submit for pre-publishing review

- + diff --git a/src/sections/prepare_metadata/prepare_metadata.html b/src/sections/prepare_metadata/prepare_metadata.html index 80ac84c0..e38108f0 100644 --- a/src/sections/prepare_metadata/prepare_metadata.html +++ b/src/sections/prepare_metadata/prepare_metadata.html @@ -7397,7 +7397,7 @@

- + - - - From 7090e56e799a066f7c07dbcb5fdb45ba94762c8c Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Mon, 30 Aug 2021 10:37:07 -0700 Subject: [PATCH 39/55] Fixed submission file bug from the merge --- src/scripts/disseminate-and-metadata.js | 10 +--- src/scripts/renderer.js | 58 ++++++++++++++++++- .../prepare_metadata/prepare_metadata.html | 15 ----- 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/src/scripts/disseminate-and-metadata.js b/src/scripts/disseminate-and-metadata.js index dfd9c608..66effa4e 100644 --- a/src/scripts/disseminate-and-metadata.js +++ b/src/scripts/disseminate-and-metadata.js @@ -1270,7 +1270,6 @@ function resetSubmission() { for (var field of textAreaFields) { $(field).val(""); } - milestoneTagify2.removeAllTags(); milestoneTagify1.removeAllTags(); for (var field of selectFields) { $(field).val("Select"); @@ -1373,7 +1372,7 @@ function helpMilestoneSubmission() { if (result.isConfirmed) { Swal.fire({ title: "Importing the Data Deliverables document", - html: `
`, + html: `
`, heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", preConfirm: () => { @@ -1392,9 +1391,7 @@ function helpMilestoneSubmission() { Swal.close(); const filepath = result.value.filepath; - var award = - presavedAwardArray1.options[presavedAwardArray1.selectedIndex] - .value; + var award = $("#submission-sparc-award"); client.invoke( "api_extract_milestone_info", filepath, @@ -1430,8 +1427,7 @@ function helpMilestoneSubmission() { removeOptions(descriptionDateInput); milestoneTagify1.removeAllTags(); milestoneTagify1.settings.whitelist = []; - milestoneTagify2.settings.whitelist = []; - changeAwardInput(); + changeAwardInput() } } ); diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 4df12b76..18a4ea1b 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -1772,6 +1772,62 @@ function loadAwardData() { ///////////////// //////////////// //////////////// //////////////// ///////////////////////Submission file //////////////// //////////////// +function changeAwardInput() { + var ddBolean; + document.getElementById("input-milestone-date").value = ""; + actionEnterNewDate("none"); + milestoneTagify1.removeAllTags(); + milestoneTagify1.settings.whitelist = []; + removeOptions(descriptionDateInput); + addOption(descriptionDateInput, "Select an option", "Select"); + + award = $("#submission-sparc-award"); + var informationJson = parseJson(milestonePath); + + var completionDateArray = []; + var milestoneValueArray = []; + completionDateArray.push("Enter my own date"); + + /// when DD is provided + if (award in informationJson) { + ddBolean = true; + var milestoneObj = informationJson[award]; + // Load milestone values once users choose an award number + var milestoneKey = Object.keys(milestoneObj); + + /// add milestones to Tagify suggestion tag list and options to completion date dropdown + for (var i = 0; i < milestoneKey.length; i++) { + milestoneValueArray.push(milestoneKey[i]); + for (var j = 0; j < milestoneObj[milestoneKey[i]].length; j++) { + completionDateArray.push( + milestoneObj[milestoneKey[i]][j]["Expected date of completion"] + ); + } + } + milestoneValueArray.push("Not specified in the Data Deliverables document"); + } else { + ddBolean = false; + } + milestoneTagify1.settings.whitelist = milestoneValueArray; + for (var i = 0; i < completionDateArray.length; i++) { + addOption( + descriptionDateInput, + completionDateArray[i], + completionDateArray[i] + ); + } + return ddBolean; +} + +function actionEnterNewDate(action) { + document.getElementById( + "div-submission-enter-different-date-1" + ).style.display = action; + document.getElementById( + "div-submission-enter-different-date-3" + ).style.display = action; +} + const submissionDateInput = document.getElementById("input-milestone-date"); //////////////// Dataset description file /////////////////////// @@ -1835,7 +1891,7 @@ function changeAwardInputDsDescription() { ).prop("disabled", true); } - var awardVal = dsAwardArray.options[dsAwardArray.selectedIndex].value; + var awardVal = $("#ds-description-award-input"); var airKeyContent = parseJson(airtableConfigPath); if (Object.keys(airKeyContent).length !== 0) { var airKeyInput = airKeyContent["api-key"]; diff --git a/src/sections/prepare_metadata/prepare_metadata.html b/src/sections/prepare_metadata/prepare_metadata.html index 0ac00450..0ecc9034 100644 --- a/src/sections/prepare_metadata/prepare_metadata.html +++ b/src/sections/prepare_metadata/prepare_metadata.html @@ -1493,21 +1493,6 @@

id="div-upload-DDD" >
-
Date: Mon, 30 Aug 2021 10:45:26 -0700 Subject: [PATCH 40/55] Added consistent font for submission file generation --- src/pysoda/prepare_metadata.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pysoda/prepare_metadata.py b/src/pysoda/prepare_metadata.py index 52329d36..52f2ff0e 100644 --- a/src/pysoda/prepare_metadata.py +++ b/src/pysoda/prepare_metadata.py @@ -97,6 +97,9 @@ def extract_milestone_info(datalist): ### Prepare submission file def save_submission_file(filepath, json_str): + + font_submission = Font(name='Calibri', size=14, bold=False) + source = join(TEMPLATE_PATH, "submission.xlsx") destination = filepath shutil.copyfile(source, destination) @@ -112,6 +115,10 @@ def save_submission_file(filepath, json_str): ws1[column+"2"] = arr['award'] ws1[column+"3"] = arr['milestone'] ws1[column+"4"] = arr['date'] + + ws1[column+"2"].font = font_submission + ws1[column+"3"].font = font_submission + ws1[column+"4"].font = font_submission rename_headers(ws1, len(val_arr), 2) From 79baf60f003fd263bb5b92558bc40d1119b9f949 Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Mon, 30 Aug 2021 11:41:51 -0700 Subject: [PATCH 41/55] Cleared curate error message --- src/scripts/renderer.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 18a4ea1b..6d549c09 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -7117,6 +7117,12 @@ document .addEventListener("click", async function () { // setTimeout(function () { $($($(this).parent()[0]).parents()[0]).removeClass("tab-active"); + document.getElementById( + "para-new-curate-progress-bar-error-status" + ).innerHTML = ""; + document.getElementById( + "para-please-wait-new-curate" + ).innerHTML = ""; document.getElementById("prevBtn").style.display = "none"; document.getElementById("start-over-btn").style.display = "none"; document.getElementById("div-vertical-progress-bar").style.display = "none"; From 0cd3bebe6b2813cf75e2afddf4e0df0db158c493 Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Mon, 30 Aug 2021 15:11:22 -0700 Subject: [PATCH 42/55] Added nonallowed chars for Rename/Create new folder --- src/scripts/curate-functions.js | 1 + src/scripts/organizeDS.js | 24 +++++++----------------- src/scripts/renderer.js | 10 +++++++--- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/scripts/curate-functions.js b/src/scripts/curate-functions.js index aad2567c..b68c28ae 100644 --- a/src/scripts/curate-functions.js +++ b/src/scripts/curate-functions.js @@ -1,5 +1,6 @@ var metadataFile = ""; var jstreePreview = document.getElementById("div-dataset-tree-preview"); +const nonAllowedCharacters = '<>:";/|?*\\' // Function to clear the confirm options in the curate feature const confirm_click_account_function = () => { diff --git a/src/scripts/organizeDS.js b/src/scripts/organizeDS.js index 991106a4..f0fb1253 100644 --- a/src/scripts/organizeDS.js +++ b/src/scripts/organizeDS.js @@ -414,14 +414,6 @@ function checkValidRenameInput( } } if (duplicate) { - // $(myBootboxDialog).find(".modal-footer span").remove(); - // myBootboxDialog - // .find(".modal-footer") - // .prepend( - // "The file name: " + - // newName + - // " already exists, please rename to a different name!" - // ); Swal.fire({ icon: "error", text: `The file name: ${newName} already exists, please rename to a different name!`, @@ -441,14 +433,6 @@ function checkValidRenameInput( } } if (duplicate) { - // $(myBootboxDialog).find(".modal-footer span").remove(); - // myBootboxDialog - // .find(".modal-footer") - // .prepend( - // "The folder name: " + - // input.trim() + - // " already exists, please rename to a different name!" - // ); Swal.fire({ icon: "error", text: `The folder name: ${newName} already exists, please rename to a different name!`, @@ -554,6 +538,13 @@ function renameFolder( hideClass: { popup: "animate__animated animate__fadeOutUp animate__faster", }, + preConfirm: (value) => { + for (var char of nonAllowedCharacters) { + if (value.includes(char)) { + Swal.showValidationMessage(`The folder name cannot contains the following characters /|\:;*?"<>, please rename to a different name!`) + } + } + } }).then((result) => { if (result.isConfirmed) { var returnedName = checkValidRenameInput( @@ -566,7 +557,6 @@ function renameFolder( // myBootboxDialog ); if (returnedName !== "") { - // myBootboxDialog.modal("hide"); Swal.fire({ icon: "success", text: "Successfully renamed!.", diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 6d549c09..9f11edee 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -5412,6 +5412,13 @@ organizeDSaddNewFolder.addEventListener("click", function (event) { hideClass: { popup: "animate__animated animate__fadeOutUp animate__faster", }, + preConfirm: (value) => { + for (var char of nonAllowedCharacters) { + if (value.includes(char)) { + Swal.showValidationMessage(`The folder name cannot contains the following characters /|\:;*?"<>, please enter a different name!`) + } + } + } }).then((result) => { if (result.value) { if (result.value !== null && result.value !== "") { @@ -7115,7 +7122,6 @@ const generateProgressBar = document.getElementById("progress-bar-new-curate"); document .getElementById("button-generate") .addEventListener("click", async function () { - // setTimeout(function () { $($($(this).parent()[0]).parents()[0]).removeClass("tab-active"); document.getElementById( "para-new-curate-progress-bar-error-status" @@ -7131,8 +7137,6 @@ document "flex"; $("#sidebarCollapse").prop("disabled", true); - // forceActionSidebar("hide"); - // updateJSON structure after Generate dataset tab updateJSONStructureGenerate(); if (sodaJSONObj["starting-point"]["type"] === "local") { From 550a7e759fba52f7d3457366acc6516b9bc789a8 Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Mon, 30 Aug 2021 16:57:51 -0700 Subject: [PATCH 43/55] Added illegal characters handle for Import folders --- src/scripts/curate-functions.js | 2 +- src/scripts/renderer.js | 124 ++++++++++++++++++++++++++++---- 2 files changed, 111 insertions(+), 15 deletions(-) diff --git a/src/scripts/curate-functions.js b/src/scripts/curate-functions.js index b68c28ae..2213331f 100644 --- a/src/scripts/curate-functions.js +++ b/src/scripts/curate-functions.js @@ -1,6 +1,6 @@ var metadataFile = ""; var jstreePreview = document.getElementById("div-dataset-tree-preview"); -const nonAllowedCharacters = '<>:";/|?*\\' +const nonAllowedCharacters = '<>:";[]{}()/|?*!%&+#\\' // Function to clear the confirm options in the curate feature const confirm_click_account_function = () => { diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 9f11edee..6fc8f0c0 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -5889,13 +5889,39 @@ organizeDSaddFolders.addEventListener("click", function () { ipcRenderer.send("open-folders-organize-datasets-dialog"); }); -ipcRenderer.on("selected-folders-organize-datasets", (event, path) => { +ipcRenderer.on("selected-folders-organize-datasets", (event, pathElement) => { var filtered = getGlobalPath(organizeDSglobalPath); var myPath = getRecursivePath(filtered.slice(1), datasetStructureJSONObj); - addFoldersfunction(path, myPath); + for (var ele of pathElement) { + detectIrregularFolders(path.basename(ele), ele) + } + if (irregularFolderArray.length > 0) { + Swal.fire({ + title: 'The following folders contain non-allowed characters in their name. How should we handle them?', + html: "
"+irregularFolderArray.join(", ")+"
", + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", + showDenyButton: true, + showCancelButton: true, + confirmButtonText: "Replace characters with (-)", + denyButtonText: "Remove characters", + cancelButtonText: "Don't import those folders", + }).then((result) => { + /* Read more about isConfirmed, isDenied below */ + if (result.isConfirmed) { + addFoldersfunction("replace", irregularFolderArray, pathElement, myPath); + } else if (result.isDenied) { + addFoldersfunction("remove", irregularFolderArray, pathElement, myPath); + } else { + addFoldersfunction("ignore", irregularFolderArray, pathElement, myPath); + } + }) + } else { + addFoldersfunction("", pathElement, myPath); + } }); -function addFoldersfunction(folderArray, currentLocation) { +function addFoldersfunction(action, nonallowedFolderArray, folderArray, currentLocation) { var uiFolders = {}; var importedFolders = {}; @@ -5914,23 +5940,41 @@ function addFoldersfunction(folderArray, currentLocation) { backdrop: "rgba(0,0,0, 0.4)", }); } else { + // if non-allowed characters are detected, do the action + // AND // check for duplicates/folders with the same name for (var i = 0; i < folderArray.length; i++) { var j = 1; var originalFolderName = path.basename(folderArray[i]); var renamedFolderName = originalFolderName; - while ( - renamedFolderName in uiFolders || - renamedFolderName in importedFolders - ) { - renamedFolderName = `${originalFolderName} (${j})`; - j++; - } - importedFolders[renamedFolderName] = { - path: folderArray[i], - "original-basename": originalFolderName, - }; + + if (nonallowedFolderArray.includes(folderArray[i])) { + if (action !== "ignore") { + if (action === "remove") { + renamedFolderName = removeIrregularFolders(folderArray[i]); + } else if (action === "replace") { + renamedFolderName = replaceIrregularFolders(folderArray[i]) + } + importedFolders[renamedFolderName] = { + path: folderArray[i], + "original-basename": originalFolderName, + }; + } + } else { + while ( + renamedFolderName in uiFolders || + renamedFolderName in importedFolders + ) { + renamedFolderName = `${originalFolderName} (${j})`; + j++; + } + importedFolders[renamedFolderName] = { + path: folderArray[i], + "original-basename": originalFolderName, + }; + } } + if (Object.keys(importedFolders).length > 0) { for (var element in importedFolders) { currentLocation["folders"][element] = { @@ -6187,6 +6231,58 @@ async function drop(ev) { $("body").removeClass("waiting"); } + +var irregularFolderArray = [] +function detectIrregularFolders(folderName, pathEle) { + if (checkIrregularNameBoolean(folderName)) { + irregularFolderArray.push(pathEle) + } + if (fs.lstatSync(pathEle).isDirectory()) { + fs.readdirSync(pathEle).forEach(function(folder) { + var stat = fs.statSync(path.join(pathEle, folder)); + if (stat && stat.isDirectory()) { + detectIrregularFolders(folder, path.join(pathEle, folder)) + } + return irregularFolderArray + }); + } +} + +function checkIrregularNameBoolean(folderName) { + for (var char of nonAllowedCharacters) { + if (folderName.includes(char)) { + return true + } + } + return false +} + +/* The following functions aim at ignore folders with irregular characters, or replace the characters with (-), + or remove the characters from the names. + All return an object in the form {"type": empty for now, will be confirmed once users click an option at the popup, + "paths": array of all the paths with special characters detected} +*/ + +function replaceIrregularFolders(pathElement) { + var str = path.basename(pathElement) + for (var char of nonAllowedCharacters) { + if (str.includes(char)) { + str = str.replace(char, "-"); + } + } + return str +} + +function removeIrregularFolders(pathElement) { + var str = path.basename(pathElement) + for (var char of nonAllowedCharacters) { + if (str.includes(char)) { + str = str.replace(char, ""); + } + } + return str +} + // SAVE FILE ORG ipcRenderer.on("save-file-organization-dialog", (event) => { const options = { From a89b60bcb3c4e05b877477300406fe2c2b5139b7 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Tue, 31 Aug 2021 11:51:03 -0700 Subject: [PATCH 44/55] Fix issue with mainwindow show for macos --- src/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index b6a01a8a..1a626b98 100755 --- a/src/main.js +++ b/src/main.js @@ -212,7 +212,7 @@ function initialize() { window_reloaded == false ) { } - run_pre_flight_checks(); + // run_pre_flight_checks(); }); }); From 728982a2db430af482e0a75ec6e9b9623a81ad98 Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Tue, 31 Aug 2021 12:41:03 -0700 Subject: [PATCH 45/55] Added illegal characters handler for Import --- src/scripts/curate-functions.js | 2 +- src/scripts/renderer.js | 151 ++++++++++++++++++++++++-------- 2 files changed, 114 insertions(+), 39 deletions(-) diff --git a/src/scripts/curate-functions.js b/src/scripts/curate-functions.js index 2213331f..7ada0253 100644 --- a/src/scripts/curate-functions.js +++ b/src/scripts/curate-functions.js @@ -1,6 +1,6 @@ var metadataFile = ""; var jstreePreview = document.getElementById("div-dataset-tree-preview"); -const nonAllowedCharacters = '<>:";[]{}()/|?*!%&+#\\' +const nonAllowedCharacters = '<>:";[]{}()@/|?*!%&+#\\' // Function to clear the confirm options in the curate feature const confirm_click_account_function = () => { diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 6fc8f0c0..a25b1b38 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -5503,27 +5503,47 @@ organizeDSaddNewFolder.addEventListener("click", function (event) { // /////////////////////////////////////////////////////////////////////////// // recursively populate json object -function populateJSONObjFolder(jsonObject, folderPath) { +function populateJSONObjFolder(action, jsonObject, folderPath) { var myitems = fs.readdirSync(folderPath); myitems.forEach((element) => { var statsObj = fs.statSync(path.join(folderPath, element)); var addedElement = path.join(folderPath, element); if (statsObj.isDirectory() && !/(^|\/)\.[^\/\.]/g.test(element)) { - jsonObject["folders"][element] = { - type: "local", - folders: {}, - files: {}, - action: ["new"], - }; - populateJSONObjFolder(jsonObject["folders"][element], addedElement); + if (irregularFolderArray.includes(addedElement)) { + var renamedFolderName = "" + if (action !== "ignore" && action !== "") { + if (action === "remove") { + renamedFolderName = removeIrregularFolders(element); + } else if (action === "replace") { + renamedFolderName = replaceIrregularFolders(element) + } + jsonObject["folders"][renamedFolderName] = { + type: "local", + folders: {}, + files: {}, + path: addedElement, + action: ["new", "renamed"], + }; + element = renamedFolderName + } + } else { + jsonObject["folders"][element] = { + type: "local", + folders: {}, + files: {}, + path: addedElement, + action: ["new"], + }; + } + populateJSONObjFolder(action, jsonObject["folders"][element], addedElement); } else if (statsObj.isFile() && !/(^|\/)\.[^\/\.]/g.test(element)) { - jsonObject["files"][element] = { - path: addedElement, - description: "", - "additional-metadata": "", - type: "local", - action: ["new"], - }; + jsonObject["files"][element] = { + path: addedElement, + description: "", + "additional-metadata": "", + type: "local", + action: ["new"], + }; } }); } @@ -5890,6 +5910,7 @@ organizeDSaddFolders.addEventListener("click", function () { }); ipcRenderer.on("selected-folders-organize-datasets", (event, pathElement) => { + irregularFolderArray = [] var filtered = getGlobalPath(organizeDSglobalPath); var myPath = getRecursivePath(filtered.slice(1), datasetStructureJSONObj); for (var ele of pathElement) { @@ -5912,12 +5933,12 @@ ipcRenderer.on("selected-folders-organize-datasets", (event, pathElement) => { addFoldersfunction("replace", irregularFolderArray, pathElement, myPath); } else if (result.isDenied) { addFoldersfunction("remove", irregularFolderArray, pathElement, myPath); - } else { + } else if (result.isDismissed) { addFoldersfunction("ignore", irregularFolderArray, pathElement, myPath); } }) } else { - addFoldersfunction("", pathElement, myPath); + addFoldersfunction("", irregularFolderArray, pathElement, myPath); } }); @@ -5949,7 +5970,7 @@ function addFoldersfunction(action, nonallowedFolderArray, folderArray, currentL var renamedFolderName = originalFolderName; if (nonallowedFolderArray.includes(folderArray[i])) { - if (action !== "ignore") { + if (action !== "ignore" && action !== "") { if (action === "remove") { renamedFolderName = removeIrregularFolders(folderArray[i]); } else if (action === "replace") { @@ -5985,6 +6006,7 @@ function addFoldersfunction(action, nonallowedFolderArray, folderArray, currentL action: ["new"], }; populateJSONObjFolder( + action, currentLocation["folders"][element], importedFolders[element]["path"] ); @@ -6021,9 +6043,14 @@ function allowDrop(ev) { ev.preventDefault(); } -async function drop(ev) { +var filesElement; +var targetElement; +function drop(ev) { + irregularFolderArray = []; + var action = ""; + filesElement = ev.dataTransfer.files; + targetElement = ev.target; // get global path - var currentPath = organizeDSglobalPath.value; var jsonPathArray = currentPath.split("/"); var filtered = jsonPathArray.slice(1).filter(function (el) { @@ -6044,16 +6071,47 @@ async function drop(ev) { for (var folder in myPath["folders"]) { uiFolders[path.parse(folder).name] = 1; } - for (var i = 0; i < ev.dataTransfer.files.length; i++) { + var ele = ev.dataTransfer.files[i].path + detectIrregularFolders(path.basename(ele), ele) + } + if (irregularFolderArray.length > 0) { + Swal.fire({ + title: 'The following folders contain non-allowed characters in their name. How should we handle them?', + html: "
"+irregularFolderArray.join(",
")+"
", + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", + showDenyButton: true, + showCancelButton: true, + confirmButtonText: "Replace characters with (-)", + denyButtonText: "Remove characters", + cancelButtonText: "Don't import those folders", + }).then((result) => { + /* Read more about isConfirmed, isDenied below */ + if (result.isConfirmed) { + action = "replace" + } else if (result.isDenied) { + action = "remove" + } else if (result.isDismissed){ + action = "ignore" + } + dropHelper(filesElement, targetElement, action, myPath, importedFiles, importedFolders, nonAllowedDuplicateFiles, uiFiles, uiFolders) + }) + } else { + dropHelper(filesElement, targetElement, "", myPath, importedFiles, importedFolders, nonAllowedDuplicateFiles, uiFiles, uiFolders) + } +} + +function dropHelper(ev1, ev2, action, myPath, importedFiles, importedFolders, nonAllowedDuplicateFiles, uiFiles, uiFolders) { + for (var i = 0; i < ev1.length; i++) { /// Get all the file information - var itemPath = ev.dataTransfer.files[i].path; + var itemPath = ev1[i].path; var itemName = path.parse(itemPath).base; var duplicate = false; var statsObj = fs.statSync(itemPath); // check for duplicate or files with the same name - for (var j = 0; j < ev.target.children.length; j++) { - if (itemName === ev.target.children[j].innerText) { + for (var j = 0; j < ev2.children.length; j++) { + if (itemName === ev2.children[j].innerText) { duplicate = true; break; } @@ -6120,17 +6178,32 @@ async function drop(ev) { var j = 1; var originalFolderName = itemName; var renamedFolderName = originalFolderName; - while ( - renamedFolderName in uiFolders || - renamedFolderName in importedFolders - ) { - renamedFolderName = `${originalFolderName} (${j})`; - j++; - } - importedFolders[renamedFolderName] = { - path: itemPath, - "original-basename": originalFolderName, - }; + + if (irregularFolderArray.includes(itemPath)) { + if (action !== "ignore" && action !== "") { + if (action === "remove") { + renamedFolderName = removeIrregularFolders(itemName); + } else if (action === "replace") { + renamedFolderName = replaceIrregularFolders(itemName) + } + importedFolders[renamedFolderName] = { + path: itemPath, + "original-basename": originalFolderName, + }; + } + } else { + while ( + renamedFolderName in uiFolders || + renamedFolderName in importedFolders + ) { + renamedFolderName = `${originalFolderName} (${j})`; + j++; + } + importedFolders[renamedFolderName] = { + path: itemPath, + "original-basename": originalFolderName, + }; + } } } } @@ -6202,12 +6275,14 @@ async function drop(ev) { '

Loading ' + element + "...
"; - $(placeholderString).appendTo(ev.target); - await listItems(myPath, "#items"); + $(placeholderString).appendTo(ev2); + // await listItems(myPath, "#items"); + listItems(myPath, "#items"); if (element !== originalName) { myPath["folders"][element]["action"].push("renamed"); } populateJSONObjFolder( + action, myPath["folders"][element], importedFolders[element]["path"] ); @@ -6216,7 +6291,7 @@ async function drop(ev) { element + "
"; $("#placeholder_element").remove(); - $(appendString).appendTo(ev.target); + $(appendString).appendTo(ev2); listItems(myPath, "#items"); getInFolder( ".single-item", From d99f0428328791eec688ca9d83c08dcad53d6d4d Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Tue, 31 Aug 2021 13:58:45 -0700 Subject: [PATCH 46/55] Added irregular char handler for Import local dataset --- src/scripts/renderer.js | 63 +++++++++++++++++++++++++++++--------- src/scripts/tab-effects.js | 39 +++++++++++++++++------ 2 files changed, 78 insertions(+), 24 deletions(-) diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index a25b1b38..c13b5ae8 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -5919,7 +5919,7 @@ ipcRenderer.on("selected-folders-organize-datasets", (event, pathElement) => { if (irregularFolderArray.length > 0) { Swal.fire({ title: 'The following folders contain non-allowed characters in their name. How should we handle them?', - html: "
"+irregularFolderArray.join(", ")+"
", + html: "
"+irregularFolderArray.join(",
")+"
", heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", showDenyButton: true, @@ -7128,7 +7128,7 @@ document $("#para-continue-location-dataset-getting-started").text(""); document.getElementById("nextBtn").disabled = true; ipcRenderer.send("open-file-dialog-local-destination-curate"); - }); +}); ipcRenderer.on( "selected-local-destination-datasetCurate", @@ -7147,16 +7147,53 @@ ipcRenderer.on( document.getElementById("input-destination-getting-started-locally") .placeholder ); - sodaJSONObj["starting-point"]["local-path"] = filepath[0]; - create_json_object(sodaJSONObj); - datasetStructureJSONObj = sodaJSONObj["dataset-structure"]; - populate_existing_folders(datasetStructureJSONObj); - populate_existing_metadata(sodaJSONObj); if (valid_dataset == true) { - $("#para-continue-location-dataset-getting-started").text( - "Please continue below." - ); - $("#nextBtn").prop("disabled", false); + var action = ""; + irregularFolderArray = [] + detectIrregularFolders(path.basename(filepath[0]), filepath[0]) + + if (irregularFolderArray.length > 0) { + Swal.fire({ + title: 'The following folders contain non-allowed characters in their name. How should we handle them?', + html: "
"+irregularFolderArray.join(",
")+"
", + heightAuto: false, + backdrop: "rgba(0,0,0, 0.4)", + showDenyButton: true, + showCancelButton: true, + confirmButtonText: "Replace characters with (-)", + denyButtonText: "Remove characters", + cancelButtonText: "Don't import those folders", + }).then((result) => { + /* Read more about isConfirmed, isDenied below */ + if (result.isConfirmed) { + action = "replace" + } else if (result.isDenied) { + action = "remove" + } else if (result.isDismissed) { + action = "ignore" + } + sodaJSONObj["starting-point"]["local-path"] = filepath[0]; + create_json_object(action, sodaJSONObj); + datasetStructureJSONObj = sodaJSONObj["dataset-structure"]; + populate_existing_folders(datasetStructureJSONObj); + populate_existing_metadata(sodaJSONObj); + $("#para-continue-location-dataset-getting-started").text( + "Please continue below." + ); + $("#nextBtn").prop("disabled", false); + }) + } else { + action = "" + sodaJSONObj["starting-point"]["local-path"] = filepath[0]; + create_json_object(action, sodaJSONObj); + datasetStructureJSONObj = sodaJSONObj["dataset-structure"]; + populate_existing_folders(datasetStructureJSONObj); + populate_existing_metadata(sodaJSONObj); + $("#para-continue-location-dataset-getting-started").text( + "Please continue below." + ); + $("#nextBtn").prop("disabled", false); + } } else { Swal.fire({ icon: "warning", @@ -7178,10 +7215,6 @@ ipcRenderer.on( }, }).then((result) => { if (result.isConfirmed) { - $("#nextBtn").prop("disabled", false); - $("#para-continue-location-dataset-getting-started").text( - "Please continue below." - ); } else { document.getElementById( "input-destination-getting-started-locally" diff --git a/src/scripts/tab-effects.js b/src/scripts/tab-effects.js index 3346dd01..b1f0ebff 100644 --- a/src/scripts/tab-effects.js +++ b/src/scripts/tab-effects.js @@ -1167,7 +1167,7 @@ async function transitionSubQuestions( } // Create the dataset structure for sodaJSONObj -const create_json_object = (sodaJSONObj) => { +const create_json_object = (action, sodaJSONObj) => { high_level_metadata_sparc = [ "submission.xlsx", "submission.csv", @@ -1218,7 +1218,6 @@ const create_json_object = (sodaJSONObj) => { } } }); - // go through each individual high level folder and create the structure // If a manifest file exists, read information from the manifest file into a json object for (folder in sodaJSONObj["dataset-structure"]["folders"]) { @@ -1238,6 +1237,7 @@ const create_json_object = (sodaJSONObj) => { .getJsonFromCsv(sodaJSONObj["starting-point"][folder]["path"]); } recursive_structure_create( + action, sodaJSONObj["dataset-structure"]["folders"][folder], folder, path.join(root_folder_path, folder) @@ -1273,6 +1273,7 @@ const check_file_name_for_pennsieve_duplicate = (dataset_folder, filepath) => { // Create the dataset structure for each high level folder. // If a manifest file exists, read the file to get any additional metadata from the file. const recursive_structure_create = ( + action, dataset_folder, high_level_folder, root_folder_path @@ -1400,17 +1401,37 @@ const recursive_structure_create = ( } } if (stats.isDirectory() && !/(^|\/)\.[^\/\.]/g.test(file)) { - dataset_folder["folders"][file] = { - folders: {}, - files: {}, - path: current_file_path, - type: "local", - action: ["existing"], - }; + if (irregularFolderArray.includes(current_file_path)) { + var renamedFolderName = "" + if (action !== "ignore" && action !== "") { + if (action === "remove") { + renamedFolderName = removeIrregularFolders(file); + } else if (action === "replace") { + renamedFolderName = replaceIrregularFolders(file) + } + dataset_folder["folders"][renamedFolderName] = { + folders: {}, + files: {}, + path: current_file_path, + type: "local", + action: ["existing"], + }; + // file = renamedFolderName + } + } else { + dataset_folder["folders"][file] = { + folders: {}, + files: {}, + path: current_file_path, + type: "local", + action: ["existing"], + }; + } } }); for (folder in dataset_folder["folders"]) { recursive_structure_create( + action, dataset_folder["folders"][folder], high_level_folder, root_folder_path From 6fec72c96907a1cffa71ed3a60121bb0993727ca Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Tue, 31 Aug 2021 16:02:01 -0700 Subject: [PATCH 47/55] Reverted ignore to cancel --- src/scripts/renderer.js | 51 ++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index c13b5ae8..7e118421 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -5910,6 +5910,8 @@ organizeDSaddFolders.addEventListener("click", function () { }); ipcRenderer.on("selected-folders-organize-datasets", (event, pathElement) => { + var footer = + `What characters are not allowed?`; irregularFolderArray = [] var filtered = getGlobalPath(organizeDSglobalPath); var myPath = getRecursivePath(filtered.slice(1), datasetStructureJSONObj); @@ -5918,23 +5920,25 @@ ipcRenderer.on("selected-folders-organize-datasets", (event, pathElement) => { } if (irregularFolderArray.length > 0) { Swal.fire({ - title: 'The following folders contain non-allowed characters in their name. How should we handle them?', - html: "
"+irregularFolderArray.join(",
")+"
", + title: 'The following folders contain non-allowed characters in their names. How should we handle them?', + html: "
"+irregularFolderArray.join("
")+"
", heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", showDenyButton: true, showCancelButton: true, confirmButtonText: "Replace characters with (-)", denyButtonText: "Remove characters", - cancelButtonText: "Don't import those folders", + cancelButtonText: "Cancel", + didOpen: () => { + $(".swal-popover").popover(); + }, + footer: footer, }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { addFoldersfunction("replace", irregularFolderArray, pathElement, myPath); } else if (result.isDenied) { addFoldersfunction("remove", irregularFolderArray, pathElement, myPath); - } else if (result.isDismissed) { - addFoldersfunction("ignore", irregularFolderArray, pathElement, myPath); } }) } else { @@ -6075,25 +6079,31 @@ function drop(ev) { var ele = ev.dataTransfer.files[i].path detectIrregularFolders(path.basename(ele), ele) } + var footer = + `What characters are not allowed?`; if (irregularFolderArray.length > 0) { Swal.fire({ - title: 'The following folders contain non-allowed characters in their name. How should we handle them?', - html: "
"+irregularFolderArray.join(",
")+"
", + title: 'The following folders contain non-allowed characters in their names. How should we handle them?', + html: "
"+irregularFolderArray.join("
")+"
", heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", showDenyButton: true, showCancelButton: true, confirmButtonText: "Replace characters with (-)", denyButtonText: "Remove characters", - cancelButtonText: "Don't import those folders", + cancelButtonText: "Cancel", + footer: footer, + didOpen: () => { + $(".swal-popover").popover(); + } }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { action = "replace" } else if (result.isDenied) { action = "remove" - } else if (result.isDismissed){ - action = "ignore" + } else { + return } dropHelper(filesElement, targetElement, action, myPath, importedFiles, importedFolders, nonAllowedDuplicateFiles, uiFiles, uiFolders) }) @@ -7151,26 +7161,35 @@ ipcRenderer.on( var action = ""; irregularFolderArray = [] detectIrregularFolders(path.basename(filepath[0]), filepath[0]) - + var footer = + `What characters are not allowed?`; if (irregularFolderArray.length > 0) { Swal.fire({ - title: 'The following folders contain non-allowed characters in their name. How should we handle them?', - html: "
"+irregularFolderArray.join(",
")+"
", + title: 'The following folders contain non-allowed characters in their names. How should we handle them?', + html: "
"+irregularFolderArray.join("
")+"
", heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", showDenyButton: true, showCancelButton: true, confirmButtonText: "Replace characters with (-)", denyButtonText: "Remove characters", - cancelButtonText: "Don't import those folders", + cancelButtonText: "Cancel", + didOpen: () => { + $(".swal-popover").popover(); + } }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { action = "replace" } else if (result.isDenied) { action = "remove" - } else if (result.isDismissed) { - action = "ignore" + } else { + document.getElementById( + "input-destination-getting-started-locally" + ).placeholder = "Browse here"; + sodaJSONObj["starting-point"]["local-path"] = ""; + $("#para-continue-location-dataset-getting-started").text(""); + return } sodaJSONObj["starting-point"]["local-path"] = filepath[0]; create_json_object(action, sodaJSONObj); From 485b91165e9c11aff2be6604fadebfe57c52b56b Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Tue, 31 Aug 2021 16:16:13 -0700 Subject: [PATCH 48/55] Changed sub/sam tooltip to text --- .../prepare_metadata/prepare_metadata.html | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/sections/prepare_metadata/prepare_metadata.html b/src/sections/prepare_metadata/prepare_metadata.html index 0ecc9034..cd1cd1ad 100644 --- a/src/sections/prepare_metadata/prepare_metadata.html +++ b/src/sections/prepare_metadata/prepare_metadata.html @@ -3337,8 +3337,8 @@

style=" text-align: center; display: none; - max-width: 750px; - with: 90%; + width: auto; + min-width: 550px; margin: 10px auto; " id="table-subjects" @@ -3359,16 +3359,17 @@

Index - subject_id - - subject_id + + Edit | Copy | Delete + @@ -4732,8 +4733,8 @@

style=" text-align: center; display: none; - max-width: 750px; - with: 90%; + width: auto; + min-width: 550px; margin: 10px auto; " id="table-samples" @@ -4754,17 +4755,18 @@

Index - subject_id - sample_id - - subject_id + sample_id + + Edit | Copy | Delete + From 36bf75593e844a2c13219289f30dfcd62ce54626 Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Tue, 31 Aug 2021 16:21:37 -0700 Subject: [PATCH 49/55] Added more chars to warning --- src/scripts/organizeDS.js | 2 +- src/scripts/renderer.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/organizeDS.js b/src/scripts/organizeDS.js index f0fb1253..1fc92703 100644 --- a/src/scripts/organizeDS.js +++ b/src/scripts/organizeDS.js @@ -541,7 +541,7 @@ function renameFolder( preConfirm: (value) => { for (var char of nonAllowedCharacters) { if (value.includes(char)) { - Swal.showValidationMessage(`The folder name cannot contains the following characters /|\:;*?"<>, please rename to a different name!`) + Swal.showValidationMessage(`The folder name cannot contains the following characters ${nonAllowedCharacters}, please rename to a different name!`) } } } diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 7e118421..6930ec56 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -5415,7 +5415,7 @@ organizeDSaddNewFolder.addEventListener("click", function (event) { preConfirm: (value) => { for (var char of nonAllowedCharacters) { if (value.includes(char)) { - Swal.showValidationMessage(`The folder name cannot contains the following characters /|\:;*?"<>, please enter a different name!`) + Swal.showValidationMessage(`The folder name cannot contains the following characters ${nonAllowedCharacters}, please enter a different name!`) } } } From eebee33082d35b623d2d04daddb515c3adebe2c7 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Tue, 31 Aug 2021 16:39:20 -0700 Subject: [PATCH 50/55] Updated changelog --- CHANGELOG.md | 21 +++++++++++++++++++++ src/main.js | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d547b89..22a79db0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,26 @@ All notable changes to SODA will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v4.7.0 - 2021-08-31 + +### Feature additions: + +- Changed user interface for `Prepare metadata - Create submission.xlsx file`. This user interface was changed to be even more user-friendly and consistent with the user interface of `Prepare metadata - Create dataset_description.xlsx file`. +- Added user oonboarding tutorials to help first time users of the app understand Step 3 of Organizing datasets better. +- Changed strain and species retrieval under Create subjects.xlsx and Create samples.xlsx from input search to button clicks. +- Changed all of the remaining status elements into Sweetalert popups for consistency in the app. +- Added an option to replace metadata files when generating if one already exists at the destination folder. +- Added restrictions to the folder creation user interface to be more in line with the requirements from Pennsieve. + +### Bug fixes: + +- Switched popover libraries to ensure that hyperlinks are clickable when required. +- Changed table tooltip (Edit/Copy/Delete a subject or sample) in the features: Create subjects.xlsx and Create samples.xlsx to be text-based for clearer instructions for users. +- Fixed a bug with samples file generation where copying fields would cause an error when generating the final file. +- Fixed an issue where libraries were being loaded out of order leading to errors when opening SODA for the first time. +- When uploading a dataset, we have now locked the sidebar to prevent accidental clicks that would take you out of the UI. +- Fixed a bug where loading an award from Airtable would require two attempts. + ## v4.6.2 - 2021-08-13 ### Bug fixes: @@ -74,6 +94,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## v4.4.0 - 2021-06-03 ### Feature additions: + - Added support for more stringent file check with regards to metadata files. This should prevent you from importing files that are not valid. - Added a button to paste your API keys into the application more easily. - Added better warnings for when a backend module fails. This should give tou more information about the status of SODA and if a restart of the app maybe neccessary. diff --git a/src/main.js b/src/main.js index 1a626b98..ac969282 100755 --- a/src/main.js +++ b/src/main.js @@ -14,7 +14,7 @@ const { fstat } = require("fs"); log.transports.console.level = false; log.transports.file.level = "debug"; -autoUpdater.channel = "beta"; +autoUpdater.channel = "latest"; autoUpdater.logger = log; global.trackEvent = trackEvent; From 190a9ae35dde56e34fffbb10ba4c52a2553c12d4 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Tue, 31 Aug 2021 16:45:47 -0700 Subject: [PATCH 51/55] mac os pre-check bug fix --- src/main.js | 2 + src/package.json | 2 +- src/scripts/renderer.js | 321 ++++++++++++++++++++++++---------------- 3 files changed, 199 insertions(+), 126 deletions(-) diff --git a/src/main.js b/src/main.js index ac969282..ebd3dac3 100755 --- a/src/main.js +++ b/src/main.js @@ -200,6 +200,7 @@ function initialize() { nodeStorage.setItem("firstlaunch", false); run_pre_flight_checks(); } + run_pre_flight_checks(); autoUpdater.checkForUpdatesAndNotify(); updatechecked = true; }, 6000); @@ -239,6 +240,7 @@ function initialize() { } function run_pre_flight_checks() { + console.log("Running pre-checks"); mainWindow.webContents.send("run_pre_flight_checks"); } diff --git a/src/package.json b/src/package.json index 66cc80e8..93141f5b 100755 --- a/src/package.json +++ b/src/package.json @@ -1,7 +1,7 @@ { "name": "SODA", "productName": "SODA", - "version": "4.6.5-beta", + "version": "4.7.0", "description": "Keep Calm and Curate ", "main": "main.js", "scripts": { diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 6930ec56..ef264c46 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -48,7 +48,7 @@ var datasetStructureJSONObj = { }; let introStatus = { - organizeStep3: false, + organizeStep3: true, }; ////////////////////////////////// @@ -1091,7 +1091,11 @@ ipcRenderer.on( var destinationPath = path.join(dirpath[0], filename); if (fs.existsSync(destinationPath)) { var emessage = - "File '" + filename + "' already exists in " + dirpath[0] + ". Do you want to replace it?"; + "File '" + + filename + + "' already exists in " + + dirpath[0] + + ". Do you want to replace it?"; Swal.fire({ icon: "warning", title: "Metadata file already exists", @@ -1116,9 +1120,9 @@ ipcRenderer.on( Swal.showLoading(); }, }).then((result) => {}); - generateSubjectsFileHelper(destinationPath) + generateSubjectsFileHelper(destinationPath); } - });; + }); } else { Swal.fire({ title: "Generating the subjects.xlsx file", @@ -1132,7 +1136,7 @@ ipcRenderer.on( Swal.showLoading(); }, }).then((result) => {}); - generateSubjectsFileHelper(destinationPath) + generateSubjectsFileHelper(destinationPath); } } } @@ -1192,7 +1196,11 @@ ipcRenderer.on( var destinationPath = path.join(dirpath[0], filename); if (fs.existsSync(destinationPath)) { var emessage = - "File '" + filename + "' already exists in " + dirpath[0] + ". Do you want to replace it?"; + "File '" + + filename + + "' already exists in " + + dirpath[0] + + ". Do you want to replace it?"; Swal.fire({ icon: "warning", title: "Metadata file already exists", @@ -1217,9 +1225,9 @@ ipcRenderer.on( Swal.showLoading(); }, }).then((result) => {}); - generateSamplesFileHelper(destinationPath) + generateSamplesFileHelper(destinationPath); } - });; + }); } else { Swal.fire({ title: "Generating the samples.xlsx file", @@ -1233,7 +1241,7 @@ ipcRenderer.on( Swal.showLoading(); }, }).then((result) => {}); - generateSamplesFileHelper(destinationPath) + generateSamplesFileHelper(destinationPath); } } } @@ -1651,7 +1659,7 @@ function createStrain(id, type) { var feedback = event.detail; var selection = feedback.selection.value; document.querySelector("#" + id).value = selection; - var strain = $("#sweetalert-"+type+"-strain").val(); + var strain = $("#sweetalert-" + type + "-strain").val(); if (strain !== "") { populateRRID(strain, type); } @@ -1693,14 +1701,18 @@ async function loadTaxonomySpecies(commonName, destinationInput) { $("#bootbox-subject-species").css("display", "none"); } // set the Edit species button back to "+ Add species" - $("#button-add-species-subject").html(`Add species`) + $("#button-add-species-subject").html( + `Add species` + ); } if (destinationInput.includes("sample")) { if ($("#bootbox-sample-species").val() === "") { $("#bootbox-sample-species").css("display", "none"); } // set the Edit species button back to "+ Add species" - $("#button-add-species-sample").html(`Add species`) + $("#button-add-species-sample").html( + `Add species` + ); } } else { $("#" + destinationInput).val(res[commonName]["ScientificName"]); @@ -2554,7 +2566,11 @@ ipcRenderer.on( var destinationPath = path.join(dirpath[0], filename); if (fs.existsSync(destinationPath)) { var emessage = - "File '" + filename + "' already exists in " + dirpath[0] + ". Do you want to replace it?"; + "File '" + + filename + + "' already exists in " + + dirpath[0] + + ". Do you want to replace it?"; Swal.fire({ icon: "warning", title: "Metadata file already exists", @@ -2567,7 +2583,7 @@ ipcRenderer.on( confirmButtonText: "Yes", }).then((result) => { if (result.isConfirmed) { - generateDDFile(dirpath, destinationPath) + generateDDFile(dirpath, destinationPath); } }); } else { @@ -2583,7 +2599,7 @@ ipcRenderer.on( Swal.showLoading(); }, }).then((result) => {}); - generateDDFile(dirpath, destinationPath) + generateDDFile(dirpath, destinationPath); } } } @@ -3189,7 +3205,7 @@ bfRenameDatasetBtn.addEventListener("click", () => { emessage = "Please select a valid dataset"; Swal.fire({ title: "Failed to rename dataset", - text:emessage, + text: emessage, icon: "error", showConfirmButton: true, heightAuto: false, @@ -3232,14 +3248,15 @@ bfRenameDatasetBtn.addEventListener("click", () => { renameDatasetName.value = renamedDatasetName; Swal.fire({ title: "Renamed successfully!", - text: "Renamed dataset" + - " '" + - currentDatasetName + - "'" + - " to" + - " '" + - renamedDatasetName + - "'. ", + text: + "Renamed dataset" + + " '" + + currentDatasetName + + "'" + + " to" + + " '" + + renamedDatasetName + + "'. ", icon: "success", showConfirmButton: true, heightAuto: false, @@ -4354,7 +4371,6 @@ bfAddPermissionPIBtn.addEventListener("click", () => { }); }); - // Add permission for user // bfAddPermissionBtn.addEventListener("click", () => { setTimeout(function () { @@ -4812,12 +4828,13 @@ function showCurrentLicense() { $("#assign-a-license-header").hide(); if ($("#add_license-section").hasClass("is-shown")) { Swal.fire({ - title: "You are all set. This dataset already has the correct license assigned.", + title: + "You are all set. This dataset already has the correct license assigned.", backdrop: "rgba(0,0,0, 0.4)", heightAuto: false, showConfirmButton: true, icon: "success", - }) + }); } } else { $("#button-add-license").show(); @@ -5415,10 +5432,12 @@ organizeDSaddNewFolder.addEventListener("click", function (event) { preConfirm: (value) => { for (var char of nonAllowedCharacters) { if (value.includes(char)) { - Swal.showValidationMessage(`The folder name cannot contains the following characters ${nonAllowedCharacters}, please enter a different name!`) + Swal.showValidationMessage( + `The folder name cannot contains the following characters ${nonAllowedCharacters}, please enter a different name!` + ); } } - } + }, }).then((result) => { if (result.value) { if (result.value !== null && result.value !== "") { @@ -5510,12 +5529,12 @@ function populateJSONObjFolder(action, jsonObject, folderPath) { var addedElement = path.join(folderPath, element); if (statsObj.isDirectory() && !/(^|\/)\.[^\/\.]/g.test(element)) { if (irregularFolderArray.includes(addedElement)) { - var renamedFolderName = "" + var renamedFolderName = ""; if (action !== "ignore" && action !== "") { if (action === "remove") { renamedFolderName = removeIrregularFolders(element); } else if (action === "replace") { - renamedFolderName = replaceIrregularFolders(element) + renamedFolderName = replaceIrregularFolders(element); } jsonObject["folders"][renamedFolderName] = { type: "local", @@ -5524,7 +5543,7 @@ function populateJSONObjFolder(action, jsonObject, folderPath) { path: addedElement, action: ["new", "renamed"], }; - element = renamedFolderName + element = renamedFolderName; } } else { jsonObject["folders"][element] = { @@ -5535,15 +5554,19 @@ function populateJSONObjFolder(action, jsonObject, folderPath) { action: ["new"], }; } - populateJSONObjFolder(action, jsonObject["folders"][element], addedElement); + populateJSONObjFolder( + action, + jsonObject["folders"][element], + addedElement + ); } else if (statsObj.isFile() && !/(^|\/)\.[^\/\.]/g.test(element)) { - jsonObject["files"][element] = { - path: addedElement, - description: "", - "additional-metadata": "", - type: "local", - action: ["new"], - }; + jsonObject["files"][element] = { + path: addedElement, + description: "", + "additional-metadata": "", + type: "local", + action: ["new"], + }; } }); } @@ -5910,18 +5933,21 @@ organizeDSaddFolders.addEventListener("click", function () { }); ipcRenderer.on("selected-folders-organize-datasets", (event, pathElement) => { - var footer = - `What characters are not allowed?`; - irregularFolderArray = [] + var footer = `What characters are not allowed?`; + irregularFolderArray = []; var filtered = getGlobalPath(organizeDSglobalPath); var myPath = getRecursivePath(filtered.slice(1), datasetStructureJSONObj); for (var ele of pathElement) { - detectIrregularFolders(path.basename(ele), ele) + detectIrregularFolders(path.basename(ele), ele); } if (irregularFolderArray.length > 0) { Swal.fire({ - title: 'The following folders contain non-allowed characters in their names. How should we handle them?', - html: "
"+irregularFolderArray.join("
")+"
", + title: + "The following folders contain non-allowed characters in their names. How should we handle them?", + html: + "
" + + irregularFolderArray.join("
") + + "
", heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", showDenyButton: true, @@ -5936,17 +5962,27 @@ ipcRenderer.on("selected-folders-organize-datasets", (event, pathElement) => { }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { - addFoldersfunction("replace", irregularFolderArray, pathElement, myPath); + addFoldersfunction( + "replace", + irregularFolderArray, + pathElement, + myPath + ); } else if (result.isDenied) { addFoldersfunction("remove", irregularFolderArray, pathElement, myPath); } - }) + }); } else { addFoldersfunction("", irregularFolderArray, pathElement, myPath); } }); -function addFoldersfunction(action, nonallowedFolderArray, folderArray, currentLocation) { +function addFoldersfunction( + action, + nonallowedFolderArray, + folderArray, + currentLocation +) { var uiFolders = {}; var importedFolders = {}; @@ -5978,7 +6014,7 @@ function addFoldersfunction(action, nonallowedFolderArray, folderArray, currentL if (action === "remove") { renamedFolderName = removeIrregularFolders(folderArray[i]); } else if (action === "replace") { - renamedFolderName = replaceIrregularFolders(folderArray[i]) + renamedFolderName = replaceIrregularFolders(folderArray[i]); } importedFolders[renamedFolderName] = { path: folderArray[i], @@ -5986,18 +6022,18 @@ function addFoldersfunction(action, nonallowedFolderArray, folderArray, currentL }; } } else { - while ( - renamedFolderName in uiFolders || - renamedFolderName in importedFolders - ) { - renamedFolderName = `${originalFolderName} (${j})`; - j++; - } - importedFolders[renamedFolderName] = { - path: folderArray[i], - "original-basename": originalFolderName, - }; - } + while ( + renamedFolderName in uiFolders || + renamedFolderName in importedFolders + ) { + renamedFolderName = `${originalFolderName} (${j})`; + j++; + } + importedFolders[renamedFolderName] = { + path: folderArray[i], + "original-basename": originalFolderName, + }; + } } if (Object.keys(importedFolders).length > 0) { @@ -6076,15 +6112,18 @@ function drop(ev) { uiFolders[path.parse(folder).name] = 1; } for (var i = 0; i < ev.dataTransfer.files.length; i++) { - var ele = ev.dataTransfer.files[i].path - detectIrregularFolders(path.basename(ele), ele) + var ele = ev.dataTransfer.files[i].path; + detectIrregularFolders(path.basename(ele), ele); } - var footer = - `What characters are not allowed?`; + var footer = `What characters are not allowed?`; if (irregularFolderArray.length > 0) { Swal.fire({ - title: 'The following folders contain non-allowed characters in their names. How should we handle them?', - html: "
"+irregularFolderArray.join("
")+"
", + title: + "The following folders contain non-allowed characters in their names. How should we handle them?", + html: + "
" + + irregularFolderArray.join("
") + + "
", heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", showDenyButton: true, @@ -6095,24 +6134,54 @@ function drop(ev) { footer: footer, didOpen: () => { $(".swal-popover").popover(); - } + }, }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { - action = "replace" + action = "replace"; } else if (result.isDenied) { - action = "remove" + action = "remove"; } else { - return + return; } - dropHelper(filesElement, targetElement, action, myPath, importedFiles, importedFolders, nonAllowedDuplicateFiles, uiFiles, uiFolders) - }) + dropHelper( + filesElement, + targetElement, + action, + myPath, + importedFiles, + importedFolders, + nonAllowedDuplicateFiles, + uiFiles, + uiFolders + ); + }); } else { - dropHelper(filesElement, targetElement, "", myPath, importedFiles, importedFolders, nonAllowedDuplicateFiles, uiFiles, uiFolders) + dropHelper( + filesElement, + targetElement, + "", + myPath, + importedFiles, + importedFolders, + nonAllowedDuplicateFiles, + uiFiles, + uiFolders + ); } } -function dropHelper(ev1, ev2, action, myPath, importedFiles, importedFolders, nonAllowedDuplicateFiles, uiFiles, uiFolders) { +function dropHelper( + ev1, + ev2, + action, + myPath, + importedFiles, + importedFolders, + nonAllowedDuplicateFiles, + uiFiles, + uiFolders +) { for (var i = 0; i < ev1.length; i++) { /// Get all the file information var itemPath = ev1[i].path; @@ -6194,7 +6263,7 @@ function dropHelper(ev1, ev2, action, myPath, importedFiles, importedFolders, no if (action === "remove") { renamedFolderName = removeIrregularFolders(itemName); } else if (action === "replace") { - renamedFolderName = replaceIrregularFolders(itemName) + renamedFolderName = replaceIrregularFolders(itemName); } importedFolders[renamedFolderName] = { path: itemPath, @@ -6202,18 +6271,18 @@ function dropHelper(ev1, ev2, action, myPath, importedFiles, importedFolders, no }; } } else { - while ( - renamedFolderName in uiFolders || - renamedFolderName in importedFolders - ) { - renamedFolderName = `${originalFolderName} (${j})`; - j++; - } - importedFolders[renamedFolderName] = { - path: itemPath, - "original-basename": originalFolderName, - }; - } + while ( + renamedFolderName in uiFolders || + renamedFolderName in importedFolders + ) { + renamedFolderName = `${originalFolderName} (${j})`; + j++; + } + importedFolders[renamedFolderName] = { + path: itemPath, + "original-basename": originalFolderName, + }; + } } } } @@ -6316,19 +6385,18 @@ function dropHelper(ev1, ev2, action, myPath, importedFiles, importedFolders, no $("body").removeClass("waiting"); } - -var irregularFolderArray = [] +var irregularFolderArray = []; function detectIrregularFolders(folderName, pathEle) { if (checkIrregularNameBoolean(folderName)) { - irregularFolderArray.push(pathEle) + irregularFolderArray.push(pathEle); } if (fs.lstatSync(pathEle).isDirectory()) { - fs.readdirSync(pathEle).forEach(function(folder) { - var stat = fs.statSync(path.join(pathEle, folder)); - if (stat && stat.isDirectory()) { - detectIrregularFolders(folder, path.join(pathEle, folder)) - } - return irregularFolderArray + fs.readdirSync(pathEle).forEach(function (folder) { + var stat = fs.statSync(path.join(pathEle, folder)); + if (stat && stat.isDirectory()) { + detectIrregularFolders(folder, path.join(pathEle, folder)); + } + return irregularFolderArray; }); } } @@ -6336,10 +6404,10 @@ function detectIrregularFolders(folderName, pathEle) { function checkIrregularNameBoolean(folderName) { for (var char of nonAllowedCharacters) { if (folderName.includes(char)) { - return true + return true; } } - return false + return false; } /* The following functions aim at ignore folders with irregular characters, or replace the characters with (-), @@ -6349,23 +6417,23 @@ function checkIrregularNameBoolean(folderName) { */ function replaceIrregularFolders(pathElement) { - var str = path.basename(pathElement) + var str = path.basename(pathElement); for (var char of nonAllowedCharacters) { if (str.includes(char)) { str = str.replace(char, "-"); } } - return str + return str; } function removeIrregularFolders(pathElement) { - var str = path.basename(pathElement) + var str = path.basename(pathElement); for (var char of nonAllowedCharacters) { if (str.includes(char)) { str = str.replace(char, ""); } } - return str + return str; } // SAVE FILE ORG @@ -7041,11 +7109,12 @@ $("#bf-rename-dataset-name").keyup(function () { if (newName !== "") { if (check_forbidden_characters_bf(newName)) { Swal.fire({ - title: "A Pennsieve dataset name cannot contain any of the following characters: /:*?'<>.", + title: + "A Pennsieve dataset name cannot contain any of the following characters: /:*?'<>.", backdrop: "rgba(0,0,0, 0.4)", heightAuto: false, icon: "error", - }) + }); $("#button-rename-dataset").hide(); } else { $("#button-rename-dataset").show(); @@ -7061,11 +7130,12 @@ $("#bf-new-dataset-name").keyup(function () { if (newName !== "") { if (check_forbidden_characters_bf(newName)) { Swal.fire({ - title: "A Pennsieve dataset name cannot contain any of the following characters: /:*?'<>.", + title: + "A Pennsieve dataset name cannot contain any of the following characters: /:*?'<>.", icon: "error", backdrop: "rgba(0,0,0, 0.4)", heightAuto: false, - }) + }); $("#button-create-bf-new-dataset").hide(); } else { $("#button-create-bf-new-dataset").show(); @@ -7138,7 +7208,7 @@ document $("#para-continue-location-dataset-getting-started").text(""); document.getElementById("nextBtn").disabled = true; ipcRenderer.send("open-file-dialog-local-destination-curate"); -}); + }); ipcRenderer.on( "selected-local-destination-datasetCurate", @@ -7159,14 +7229,17 @@ ipcRenderer.on( ); if (valid_dataset == true) { var action = ""; - irregularFolderArray = [] - detectIrregularFolders(path.basename(filepath[0]), filepath[0]) - var footer = - `What characters are not allowed?`; + irregularFolderArray = []; + detectIrregularFolders(path.basename(filepath[0]), filepath[0]); + var footer = `What characters are not allowed?`; if (irregularFolderArray.length > 0) { Swal.fire({ - title: 'The following folders contain non-allowed characters in their names. How should we handle them?', - html: "
"+irregularFolderArray.join("
")+"
", + title: + "The following folders contain non-allowed characters in their names. How should we handle them?", + html: + "
" + + irregularFolderArray.join("
") + + "
", heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", showDenyButton: true, @@ -7176,20 +7249,20 @@ ipcRenderer.on( cancelButtonText: "Cancel", didOpen: () => { $(".swal-popover").popover(); - } + }, }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { - action = "replace" + action = "replace"; } else if (result.isDenied) { - action = "remove" + action = "remove"; } else { document.getElementById( "input-destination-getting-started-locally" ).placeholder = "Browse here"; sodaJSONObj["starting-point"]["local-path"] = ""; $("#para-continue-location-dataset-getting-started").text(""); - return + return; } sodaJSONObj["starting-point"]["local-path"] = filepath[0]; create_json_object(action, sodaJSONObj); @@ -7200,9 +7273,9 @@ ipcRenderer.on( "Please continue below." ); $("#nextBtn").prop("disabled", false); - }) + }); } else { - action = "" + action = ""; sodaJSONObj["starting-point"]["local-path"] = filepath[0]; create_json_object(action, sodaJSONObj); datasetStructureJSONObj = sodaJSONObj["dataset-structure"]; @@ -7349,9 +7422,7 @@ document document.getElementById( "para-new-curate-progress-bar-error-status" ).innerHTML = ""; - document.getElementById( - "para-please-wait-new-curate" - ).innerHTML = ""; + document.getElementById("para-please-wait-new-curate").innerHTML = ""; document.getElementById("prevBtn").style.display = "none"; document.getElementById("start-over-btn").style.display = "none"; document.getElementById("div-vertical-progress-bar").style.display = "none"; @@ -8734,7 +8805,7 @@ function addAirtableAccountInsideSweetalert(keyword) { // console.log(err); // } // }); - // } +// } // currentPath = path.join(homeDirectory, "SODA2"); // newPath = path.join(homeDirectory, "SODA"); From 597b038257dae0720ff2ff6a68152286c4095207 Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Tue, 31 Aug 2021 16:46:33 -0700 Subject: [PATCH 52/55] Updated Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22a79db0..3f389adf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue where libraries were being loaded out of order leading to errors when opening SODA for the first time. - When uploading a dataset, we have now locked the sidebar to prevent accidental clicks that would take you out of the UI. - Fixed a bug where loading an award from Airtable would require two attempts. +- Fixed a bug where macOS version of SODA would run the pre-check message everytime the app lost focus. ## v4.6.2 - 2021-08-13 From a5fb32f91584d9998554e5014f0223ae1e6d0011 Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Tue, 31 Aug 2021 16:51:42 -0700 Subject: [PATCH 53/55] Added illegal char footer for importing local datasets --- src/scripts/renderer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 6930ec56..e30b1ebe 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -7176,7 +7176,8 @@ ipcRenderer.on( cancelButtonText: "Cancel", didOpen: () => { $(".swal-popover").popover(); - } + }, + footer: footer }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { From e3e186639c15ca8c2882bbbe0cdc62229053516a Mon Sep 17 00:00:00 2001 From: Sanjay Soundarajan Date: Tue, 31 Aug 2021 16:58:48 -0700 Subject: [PATCH 54/55] Formatting fix --- src/scripts/disseminate-and-metadata.js | 20 +-- src/scripts/organizeDS.js | 9 +- src/scripts/renderer.js | 2 +- src/scripts/subjects-samples.js | 123 ++++++++------- src/scripts/tab-effects.js | 4 +- .../manage_datasets/manage_datasets.html | 13 +- .../prepare_metadata/prepare_metadata.html | 140 ++++++++++-------- 7 files changed, 177 insertions(+), 134 deletions(-) diff --git a/src/scripts/disseminate-and-metadata.js b/src/scripts/disseminate-and-metadata.js index 66effa4e..75def389 100644 --- a/src/scripts/disseminate-and-metadata.js +++ b/src/scripts/disseminate-and-metadata.js @@ -140,7 +140,11 @@ $(document).ready(function () { var destinationPath = path.join(dirpath[0], filename); if (fs.existsSync(destinationPath)) { var emessage = - "File '" + filename + "' already exists in " + dirpath[0] + ". Do you want to replace it?"; + "File '" + + filename + + "' already exists in " + + dirpath[0] + + ". Do you want to replace it?"; Swal.fire({ icon: "warning", title: "Metadata file already exists", @@ -153,7 +157,7 @@ $(document).ready(function () { confirmButtonText: "Yes", }).then((result) => { if (result.isConfirmed) { - generateSubmissionHelper(dirpath, destinationPath) + generateSubmissionHelper(dirpath, destinationPath); } }); } else { @@ -168,10 +172,10 @@ $(document).ready(function () { backdrop: "rgba(0,0,0, 0.4)", timerProgressBar: false, didOpen: () => { - Swal.showLoading() - } + Swal.showLoading(); + }, }).then((result) => {}); - generateSubmissionHelper(dirpath, destinationPath) + generateSubmissionHelper(dirpath, destinationPath); } } }); @@ -380,7 +384,6 @@ const disseminateCurationTeam = (account, dataset, share_status = "") => { ); $(".spinner.post-curation").hide(); } else { - $("#share-curation-team-spinner").hide(); if (share_status === "unshare") { @@ -672,7 +675,7 @@ function checkAirtableStatus(keyword) { // var base = new Airtable({ // apiKey: airKeyInput, // }).base("appSDqnnxSuM1s2F7"); - var base = Airtable.base("appiYd1Tz9Sv857GZ") + var base = Airtable.base("appiYd1Tz9Sv857GZ"); base("sparc_members") .select({ view: "All members (ungrouped)", @@ -1427,7 +1430,7 @@ function helpMilestoneSubmission() { removeOptions(descriptionDateInput); milestoneTagify1.removeAllTags(); milestoneTagify1.settings.whitelist = []; - changeAwardInput() + changeAwardInput(); } } ); @@ -1438,7 +1441,6 @@ function helpMilestoneSubmission() { } function openDDDimport() { - const dialog = require("electron").remote.dialog; const BrowserWindow = require("electron").remote.BrowserWindow; diff --git a/src/scripts/organizeDS.js b/src/scripts/organizeDS.js index 1fc92703..f0900d40 100644 --- a/src/scripts/organizeDS.js +++ b/src/scripts/organizeDS.js @@ -541,10 +541,12 @@ function renameFolder( preConfirm: (value) => { for (var char of nonAllowedCharacters) { if (value.includes(char)) { - Swal.showValidationMessage(`The folder name cannot contains the following characters ${nonAllowedCharacters}, please rename to a different name!`) + Swal.showValidationMessage( + `The folder name cannot contains the following characters ${nonAllowedCharacters}, please rename to a different name!` + ); } } - } + }, }).then((result) => { if (result.isConfirmed) { var returnedName = checkValidRenameInput( @@ -831,8 +833,6 @@ function addFilesfunction( } } - - ///// function to load details to show in display once ///// users click Show details function loadDetailsContextMenu( @@ -874,7 +874,6 @@ function loadDetailsContextMenu( //path_label = document.querySelector("#organize-dataset-tab > div > div > div > div.div-display-details.file > div:nth-child(2) > label"); - function triggerManageDetailsPrompts( ev, fileName, diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index ae1240b2..4338fcd1 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -7250,7 +7250,7 @@ ipcRenderer.on( didOpen: () => { $(".swal-popover").popover(); }, - footer: footer + footer: footer, }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { diff --git a/src/scripts/subjects-samples.js b/src/scripts/subjects-samples.js index cda6ba89..eedf01b9 100644 --- a/src/scripts/subjects-samples.js +++ b/src/scripts/subjects-samples.js @@ -375,7 +375,7 @@ function addSubjectIDToJSON(subjectID) { /// function to add Species - subjects + samples async function addSpecies(ev, type) { - $("#bootbox-"+type+"-species").val("") + $("#bootbox-" + type + "-species").val(""); const { value: value } = await Swal.fire({ title: "Add/Edit a species", html: ``, @@ -388,36 +388,42 @@ async function addSpecies(ev, type) { }, didOpen: () => { $(".swal2-confirm").attr("id", "btn-confirm-species"); - createSpeciesAutocomplete("sweetalert-"+type+"-species") + createSpeciesAutocomplete("sweetalert-" + type + "-species"); }, preConfirm: () => { - if (document.getElementById("sweetalert-"+type+"-species").value === "") { - Swal.showValidationMessage("Please enter a species.") + if ( + document.getElementById("sweetalert-" + type + "-species").value === "" + ) { + Swal.showValidationMessage("Please enter a species."); } - return document.getElementById("sweetalert-"+type+"-species").value; + return document.getElementById("sweetalert-" + type + "-species").value; }, }); if (value) { if (value !== "") { - $("#bootbox-"+type+"-species").val(value) - $("#bootbox-"+type+"-species").css("display", "block"); - $("#bootbox-"+type+"-species").attr("readonly", true); - $("#bootbox-"+type+"-species").css("background", "#f5f5f5"); - $(ev).html("Edit") + $("#bootbox-" + type + "-species").val(value); + $("#bootbox-" + type + "-species").css("display", "block"); + $("#bootbox-" + type + "-species").attr("readonly", true); + $("#bootbox-" + type + "-species").css("background", "#f5f5f5"); + $(ev).html("Edit"); } } else { - $("#bootbox-"+type+"-species").css("display", "none"); - $("#bootbox-"+type+"-species").val("") + $("#bootbox-" + type + "-species").css("display", "none"); + $("#bootbox-" + type + "-species").val(""); if (type.includes("subject")) { - $("#button-add-species-subject").html(`Add strain`) + $("#button-add-species-subject").html( + `Add strain` + ); } else { - $("#button-add-species-sample").html(`Add strain`) + $("#button-add-species-sample").html( + `Add strain` + ); } } } async function addStrain(ev, type) { - $("#bootbox-"+type+"-strain").val("") + $("#bootbox-" + type + "-strain").val(""); const { value: value } = await Swal.fire({ title: "Add/Edit a strain", html: ``, @@ -430,35 +436,40 @@ async function addStrain(ev, type) { }, didOpen: () => { $(".swal2-confirm").attr("id", "btn-confirm-strain"); - createStrain("sweetalert-"+type+"-strain", type); + createStrain("sweetalert-" + type + "-strain", type); }, preConfirm: () => { - if (document.getElementById("sweetalert-"+type+"-strain").value === "") { - Swal.showValidationMessage("Please enter a strain.") + if ( + document.getElementById("sweetalert-" + type + "-strain").value === "" + ) { + Swal.showValidationMessage("Please enter a strain."); } - return document.getElementById("sweetalert-"+type+"-strain").value; + return document.getElementById("sweetalert-" + type + "-strain").value; }, }); if (value) { if (value !== "") { - $("#bootbox-"+type+"-strain").val(value) - $("#bootbox-"+type+"-strain").css("display", "block"); - $("#bootbox-"+type+"-strain").attr("readonly", true); - $("#bootbox-"+type+"-strain").css("background", "#f5f5f5"); - $(ev).html("Edit") + $("#bootbox-" + type + "-strain").val(value); + $("#bootbox-" + type + "-strain").css("display", "block"); + $("#bootbox-" + type + "-strain").attr("readonly", true); + $("#bootbox-" + type + "-strain").css("background", "#f5f5f5"); + $(ev).html("Edit"); } } else { - $("#bootbox-"+type+"-strain").css("display", "none"); - $("#bootbox-"+type+"-strain-RRID").val("") + $("#bootbox-" + type + "-strain").css("display", "none"); + $("#bootbox-" + type + "-strain-RRID").val(""); if (type.includes("subject")) { - $("#button-add-strain-subject").html(`Add strain`) + $("#button-add-strain-subject").html( + `Add strain` + ); } else { - $("#button-add-strain-sample").html(`Add strain`) + $("#button-add-strain-sample").html( + `Add strain` + ); } } } - // populate RRID function populateRRID(strain, type) { var rridHostname = "scicrunch.org"; @@ -499,24 +510,30 @@ function populateRRID(strain, type) { heightAuto: false, backdrop: "rgba(0,0,0, 0.4)", }); - $("#bootbox-"+type+"-strain").val(""); - $("#bootbox-"+type+"-strain-RRID").val(""); - $("#bootbox-"+type+"-strain").css("display", "none"); + $("#bootbox-" + type + "-strain").val(""); + $("#bootbox-" + type + "-strain-RRID").val(""); + $("#bootbox-" + type + "-strain").css("display", "none"); if (type.includes("subject")) { - $("#button-add-strain-subject").html(`Add strain`) + $("#button-add-strain-subject").html( + `Add strain` + ); } else { - $("#button-add-strain-sample").html(`Add strain`) + $("#button-add-strain-sample").html( + `Add strain` + ); } } else { - $("#bootbox-"+type+"-strain").val(strain); + $("#bootbox-" + type + "-strain").val(strain); $("#btn-confirm-strain").removeClass("confirm-disabled"); - $("#bootbox-"+type+"-strain").css("display", "block") - $("#bootbox-"+type+"-strain").attr("readonly", true); - $("#bootbox-"+type+"-strain").css("background", "#f5f5f5"); + $("#bootbox-" + type + "-strain").css("display", "block"); + $("#bootbox-" + type + "-strain").attr("readonly", true); + $("#bootbox-" + type + "-strain").css("background", "#f5f5f5"); if (type.includes("subject")) { - $("#button-add-strain-subject").html("Edit") + $("#button-add-strain-subject").html( + "Edit" + ); } else { - $("#button-add-strain-sample").html("Edit") + $("#button-add-strain-sample").html("Edit"); } Swal.fire( `Successfully retrieved the RRID for "${strain}".`, @@ -526,8 +543,8 @@ function populateRRID(strain, type) { } }); } else { - $("#bootbox-"+type+"-strain").val(""); - $("#bootbox-"+type+"-strain-RRID").val(""); + $("#bootbox-" + type + "-strain").val(""); + $("#bootbox-" + type + "-strain-RRID").val(""); Swal.fire({ title: `Failed to retrieve the RRID for "${strain}" from Scicrunch.org.`, text: "Please check your Internet Connection or contact us at sodasparc@gmail.com", @@ -1228,7 +1245,7 @@ function updateOrderIDTable(table, json, type) { j = 1; } for (var index = 1; index < length; index++) { - var id = table.rows[index].cells[j+1].innerText; + var id = table.rows[index].cells[j + 1].innerText; for (var ind of json.slice(1)) { if (ind[j] === id) { orderedTableData[i] = ind; @@ -2411,13 +2428,13 @@ function readXMLScicrunch(xml, type) { break; } } - if (rrid !== "") { - $("#bootbox-"+type+"-strain-RRID").val(rrid); - res = true; - } else { - $("#bootbox-"+type+"-strain-RRID").val(""); - res = false; - } + if (rrid !== "") { + $("#bootbox-" + type + "-strain-RRID").val(rrid); + res = true; + } else { + $("#bootbox-" + type + "-strain-RRID").val(""); + res = false; + } return res; } @@ -2630,14 +2647,14 @@ async function helpSPARCAward(filetype) { milestoneTagify1.removeAllTags(); $("#submission-sparc-award").val(award); $("#ds-description-award-input").val(award); - loadContributorInfofromAirtable(award) + loadContributorInfofromAirtable(award); } }); } else { milestoneTagify1.removeAllTags(); $("#submission-sparc-award").val(award); $("#ds-description-award-input").val(award); - loadContributorInfofromAirtable(award) + loadContributorInfofromAirtable(award); } } } else { @@ -2686,7 +2703,7 @@ function changeAward(award) { }).then((result) => {}); $("#ds-description-award-input").val(award); $("#submission-sparc-award").val(award); - loadContributorInfofromAirtable(award) + loadContributorInfofromAirtable(award); } function loadContributorInfofromAirtable(award) { diff --git a/src/scripts/tab-effects.js b/src/scripts/tab-effects.js index b1f0ebff..b40e21b9 100644 --- a/src/scripts/tab-effects.js +++ b/src/scripts/tab-effects.js @@ -1402,12 +1402,12 @@ const recursive_structure_create = ( } if (stats.isDirectory() && !/(^|\/)\.[^\/\.]/g.test(file)) { if (irregularFolderArray.includes(current_file_path)) { - var renamedFolderName = "" + var renamedFolderName = ""; if (action !== "ignore" && action !== "") { if (action === "remove") { renamedFolderName = removeIrregularFolders(file); } else if (action === "replace") { - renamedFolderName = replaceIrregularFolders(file) + renamedFolderName = replaceIrregularFolders(file); } dataset_folder["folders"][renamedFolderName] = { folders: {}, diff --git a/src/sections/manage_datasets/manage_datasets.html b/src/sections/manage_datasets/manage_datasets.html index 0d16ebdd..35b52e76 100644 --- a/src/sections/manage_datasets/manage_datasets.html +++ b/src/sections/manage_datasets/manage_datasets.html @@ -501,7 +501,12 @@
None

- +
Add/edit team permissions

>
-
+
Progress

- +
id="bootbox-subject-species" name="Species" class="subjects-form-entry" - style="font-size: 14px;display: none" + style="font-size: 14px; display: none" /> - + + + + Add species +
@@ -3848,23 +3853,28 @@

id="bootbox-subject-strain" name="Strain" class="subjects-form-entry" - style="font-size: 13px; display:none" + style="font-size: 13px; display: none" /> - + + + + Add strain +

@@ -5328,23 +5338,28 @@

id="bootbox-sample-species" name="Species" class="samples-form-entry" - style="display:none" + style="display: none" /> - + + + + Add species +

@@ -5377,23 +5392,28 @@

id="bootbox-sample-strain" name="Strain" class="samples-form-entry" - style="display:none" + style="display: none" /> - + + + + Add strain +

From 6dfa0e110b93ac8b03166ebea0ebda447762594a Mon Sep 17 00:00:00 2001 From: Tram Ngo Date: Tue, 31 Aug 2021 16:59:13 -0700 Subject: [PATCH 55/55] Fixed ev bug --- src/scripts/renderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index ae1240b2..e5824e12 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -6327,7 +6327,7 @@ function dropHelper( '

' + importedFiles[element]["basename"] + "
"; - $(appendString).appendTo(ev.target); + $(appendString).appendTo(ev2); listItems(myPath, "#items"); getInFolder( ".single-item",