Skip to content
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

Add import endpoint for history contents from library #18960

Closed
wants to merge 2 commits into from

Conversation

arash77
Copy link
Collaborator

@arash77 arash77 commented Oct 9, 2024

Implemented a new API endpoint (/api/histories/{history_id}/contents/import) to batch create items in a specified history from library datasets and folders. This enhances flexibility for users by allowing multiple datasets to be imported simultaneously, improving efficiency when updating their histories.
The changes include new payload definitions and refined service methods to support the import process.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

return rval

for ld in traverse(folder):
hda = ld.library_dataset_dataset_association.to_history_dataset_association(history, add_to_history=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're committing once per added item here, that's what I meant when I said batch import could use some improvements.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rval.extend(traverse(subfolder))
for ld in folder.datasets:
if not admin:
can_access = security_agent.can_access_dataset(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a can_access_datasets function that should be more efficient.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, ok!

Copy link
Collaborator Author

@arash77 arash77 Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mvdbeek This function only returns True or False and what will happen if we have a mixed library folder that some have access to and some don't?

@arash77 arash77 closed this Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants