-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Expandable Records (not communities) and pagination on both rec…
…ords and communities (#39) * developed clickable records that displays authors and files * added styling for hovering over rows * shrunk data size to 25 * added pagination * pulled old yarn.lock * attempted fix at adding package * attempted fix * added end case to search
- Loading branch information
Showing
6 changed files
with
184 additions
and
28 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
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
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
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
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
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 |
---|---|---|
@@ -1,21 +1,29 @@ | ||
from eossr.api.zenodo import search_records, search_communities | ||
from eossr.api.zenodo import search_records, search_communities, get_record | ||
|
||
async def searchRecords(search_field, page): | ||
try: | ||
records = search_records(search=search_field, size= 50, page = page) | ||
records = search_records(search=search_field, size= 25, page = page) | ||
response = [] | ||
for record in records: | ||
response.append({'id': record.id, 'title': record.title, 'date': record.metadata['publication_date'], 'resource_type': record.metadata['resource_type']['title']}) | ||
return response | ||
except: | ||
return ["failed"] | ||
|
||
async def searchCommunities(search_field): | ||
async def searchCommunities(search_field, page): | ||
try: | ||
communities = search_communities(search=search_field, size= 50) | ||
communities = search_communities(search=search_field, size= 25, page=page) | ||
response = [] | ||
for community in communities: | ||
response.append({'id': community['id'], 'title': community['metadata']['title'], 'date': community['created'].split('T')[0]}) | ||
return response | ||
except: | ||
return ["failed"] | ||
return ["failed"] | ||
|
||
async def recordInformation(recordID): | ||
try: | ||
response = get_record(recordID) | ||
record = {'authors': response.metadata['creators'], 'filelist': response.filelist} | ||
return record | ||
except: | ||
return {'status': 'failed'} |