From 11e7b33d1e665a66c636feeeea68ccfda62582b0 Mon Sep 17 00:00:00 2001 From: JacobiClark Date: Mon, 16 Dec 2024 15:08:12 -0800 Subject: [PATCH] wip: Move logic for banner image page --- .../guided-mode/guided-curate-dataset.js | 29 +- .../guided_mode/guided_curate_dataset.html | 271 ++++++++---------- 2 files changed, 149 insertions(+), 151 deletions(-) diff --git a/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js b/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js index 42f3a4b31..61e3e9c79 100644 --- a/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js +++ b/src/renderer/src/scripts/guided-mode/guided-curate-dataset.js @@ -6205,6 +6205,16 @@ window.openPage = async (targetPageID) => { } if (targetPageID === "guided-banner-image-tab") { + // If the user does not have manage permissions, they cannot edit a banner image + if (window.sodaJSONObj?.["starting-point"]?.["type"] === "bf") { + const loggedInUsersRole = await api.getDatasetRole( + window.sodaJSONObj["digital-metadata"]["name"] + ); + console.log("logged in user role: ", loggedInUsersRole); + if (loggedInUsersRole === "editor") { + } + } + if (pageNeedsUpdateFromPennsieve("guided-banner-image-tab")) { // Show the loading page while the page's data is being fetched from Pennsieve setPageLoadingState(true); @@ -7982,11 +7992,18 @@ window.guidedResumeProgress = async (datasetNameToResume) => { If you would like to make changes to this dataset, please reach out to the SPARC curation team at curation@sparc.science. `); } - - // check if the user is an editor - let userDatasetRole = await api.getDatasetRole( - window.sodaJSONObj["digital-metadata"]["name"] - ); + let userDatasetRole; + try { + // check if the user is an editor + userDatasetRole = await api.getDatasetRole( + window.sodaJSONObj["digital-metadata"]["name"] + ); + } catch (error) { + console.error(error); + throw new Error( + `An error occurred while trying to check if you have the correct permissions to edit this dataset. Please try again later.` + ); + } if (userDatasetRole === "editor") { guidedSkipPage("guided-banner-image-tab"); @@ -8044,6 +8061,8 @@ window.guidedResumeProgress = async (datasetNameToResume) => { } } } + + console.log("here"); window.sodaJSONObj = datasetResumeJsonObj; attachGuidedMethodsToSodaJSONObj(); diff --git a/src/renderer/src/sections/guided_mode/guided_curate_dataset.html b/src/renderer/src/sections/guided_mode/guided_curate_dataset.html index 7ddb66020..89a752e28 100644 --- a/src/renderer/src/sections/guided_mode/guided_curate_dataset.html +++ b/src/renderer/src/sections/guided_mode/guided_curate_dataset.html @@ -4806,164 +4806,143 @@

Banner image

>
- - -