-
Notifications
You must be signed in to change notification settings - Fork 6
919 Add DOI support #1160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ddey2
wants to merge
16
commits into
main
Choose a base branch
from
919-doi-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
919 Add DOI support #1160
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3f54f55
Initial backend implementation of doi
ddey2 349b236
fix
ddey2 6d362e8
working backend and added testcase for minting doi for dataset
ddey2 466d082
making work with frontend function
ddey2 97f9e6d
Add frontend changes for publishing DOI.
sandeep-ps f9e896b
adding link for doi
ddey2 1e0fc72
Do code formatting.
sandeep-ps 5fc4b42
Merge branch '919-doi-support' of https://github.com/clowder-framewor…
sandeep-ps 887e478
Update dataset release documentation.
sandeep-ps c0de34e
Use configuration setting to hide/display the DOI minting feature.
sandeep-ps 1d105aa
Remove test related to DOI.
sandeep-ps b714895
Update documentation related to configuration details.
sandeep-ps 6c628e6
adding resourType to DOI API request body
ddey2 a4a7904
added publish attribute to doi metadata
ddey2 aae8d46
Update documentation and comments in backend config.
sandeep-ps f987fb6
Merge branch 'main' into 919-doi-support
sandeep-ps File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import os | ||
|
|
||
| import requests | ||
| from requests.auth import HTTPBasicAuth | ||
|
|
||
|
|
||
| class DataCiteClient: | ||
| def __init__(self, test_mode=False): | ||
| self.auth = HTTPBasicAuth( | ||
| os.getenv("DATACITE_USERNAME"), os.getenv("DATACITE_PASSWORD") | ||
| ) | ||
| self.headers = {"Content-Type": "application/vnd.api+json"} | ||
| self.base_url = ( | ||
| "https://api.test.datacite.org/" | ||
| if test_mode | ||
| else "https://api.datacite.org/" | ||
| ) | ||
|
|
||
| def create_doi(self, metadata): | ||
| url = f"{self.base_url}dois" | ||
| response = requests.post( | ||
| url, auth=self.auth, headers=self.headers, json=metadata | ||
| ) | ||
| return response.json() | ||
|
|
||
| def get_all_dois(self): | ||
| url = f"{self.base_url}dois" | ||
| response = requests.get(url, auth=self.auth, headers=self.headers) | ||
| return response.json() | ||
|
|
||
| def get_doi(self, doi): | ||
| url = f"{self.base_url}dois/{doi}" | ||
| response = requests.get(url, auth=self.auth, headers=self.headers) | ||
| return response.json() | ||
|
|
||
| def update_doi(self, doi, metadata): | ||
| url = f"{self.base_url}dois/{doi}" | ||
| response = requests.put( | ||
| url, auth=self.auth, headers=self.headers, json=metadata | ||
| ) | ||
| return response.json() | ||
|
|
||
| def delete_doi(self, doi): | ||
| url = f"{self.base_url}dois/{doi}" | ||
| response = requests.delete(url, auth=self.auth, headers=self.headers) | ||
| return response.status_code == 204 | ||
|
|
||
| def get_doi_activity_status(self, doi): | ||
| url = f"{self.base_url}events?doi={doi}" | ||
| response = requests.get(url, auth=self.auth, headers=self.headers) | ||
| return response.json() |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
82 changes: 82 additions & 0 deletions
82
frontend/src/components/dialog/ActionModalWithCheckbox.tsx
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import React from "react"; | ||
| import { | ||
| Button, | ||
| Checkbox, | ||
| Dialog, | ||
| DialogActions, | ||
| DialogContent, | ||
| DialogContentText, | ||
| DialogTitle, | ||
| FormControlLabel, | ||
| } from "@mui/material"; | ||
|
|
||
| type ActionLevel = "error" | "warning" | "info"; | ||
|
|
||
| type ActionModalProps = { | ||
| actionOpen: boolean; | ||
| actionTitle: string; | ||
| actionText: string; | ||
| checkboxLabel: string; | ||
| checkboxSelected: boolean; | ||
| publishDOI: boolean; | ||
| setCheckboxSelected: (value: boolean) => void; | ||
| actionBtnName: string; | ||
| handleActionBtnClick: () => void; | ||
| handleActionCancel: () => void; | ||
| actionLevel?: ActionLevel; | ||
| }; | ||
|
|
||
| export const ActionModalWithCheckbox: React.FC<ActionModalProps> = ( | ||
| props: ActionModalProps | ||
| ) => { | ||
| const { | ||
| actionOpen, | ||
| actionTitle, | ||
| actionText, | ||
| checkboxLabel, | ||
| checkboxSelected, | ||
| setCheckboxSelected, | ||
| actionBtnName, | ||
| handleActionBtnClick, | ||
| handleActionCancel, | ||
| actionLevel, | ||
| } = props; | ||
|
|
||
| return ( | ||
| <Dialog open={actionOpen} onClose={handleActionCancel} maxWidth={"sm"}> | ||
| <DialogTitle id="confirmation-dialog-title">{actionTitle}</DialogTitle> | ||
| <DialogContent> | ||
| <DialogContentText>{actionText}</DialogContentText> | ||
| <br /> | ||
| <FormControlLabel | ||
| value={"end"} | ||
| control={ | ||
| <Checkbox | ||
| defaultChecked={checkboxSelected} | ||
| onChange={() => { | ||
| setCheckboxSelected(!checkboxSelected); | ||
| }} | ||
| /> | ||
| } | ||
| label={checkboxLabel} | ||
| /> | ||
| </DialogContent> | ||
| <DialogActions> | ||
| <Button | ||
| variant="outlined" | ||
| onClick={handleActionCancel} | ||
| color={actionLevel ?? "primary"} | ||
| > | ||
| Cancel | ||
| </Button> | ||
| <Button | ||
| variant="contained" | ||
| onClick={handleActionBtnClick} | ||
| color={actionLevel ?? "primary"} | ||
| > | ||
| {actionBtnName} | ||
| </Button> | ||
| </DialogActions> | ||
| </Dialog> | ||
| ); | ||
| }; |
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.