-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: Move logic for banner image page
- Loading branch information
1 parent
b80dd42
commit 11e7b33
Showing
2 changed files
with
149 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <a target="_blank" rel="noopener noreferrer" href="mailto:[email protected]">[email protected].</a> | ||
`); | ||
} | ||
|
||
// 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(); | ||
|
||
|
Oops, something went wrong.