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

GraphQL: Clone Samples and Transfer Samples mutations #814

Merged
merged 18 commits into from
Nov 1, 2024

Conversation

JeffreyThiessen
Copy link
Member

@JeffreyThiessen JeffreyThiessen commented Oct 10, 2024

What does this PR do and why?

Describe in detail what your merge request does and why.
Fixes #809
Fixes #810

Adds two new mutations for cloning and transfering samples

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other pull requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Sign into admin and go to localhost:3000/graphiql
  2. Get some info on projects you want to use
query getProject1{
  project(fullPath: "bacillus/bacillus-anthracis/outbreak-2022") {
    id
    name
    path
    samples{
      nodes{
        name
        id
      }
    }
  }
}

query getProject2{
  project(fullPath: "bacillus/bacillus-anthracis/outbreak-2023") {
    id
    name
    path
    samples{
      nodes{
        name
        id
      }
    }
  }
}
  1. Try transferring samples between projects. You can verify them with the project info queries above, or by navigating to them in the IRIDA Next web ui
mutation transfer_samps{
  transferSamples(input:{
    projectId: "gid://irida/Project/e0bba0d9-84e9-490a-ba84-e0c0c913cdaf",
    newProjectId: "gid://irida/Project/d86955eb-af27-4a43-a01d-e6c93bb7dc6f",
    sampleIds:[
      "gid://irida/Sample/d79bdb22-92c9-4b98-87df-b4e9f79cab4d", 
      "gid://irida/Sample/cc1aa061-03cd-48da-96d7-a21e93613d43"
    ]
  }){
    samples,
    errors{
      path
      message
    }
  }
}
  1. Try copying samples from one project to another. You can verify them with the project info queries above, or by navigating to them in the IRIDA Newx web ui
mutation copy_samples{
  copySamples(input:{
    projectId: "gid://irida/Project/e0bba0d9-84e9-490a-ba84-e0c0c913cdaf",
    newProjectId: "gid://irida/Project/d86955eb-af27-4a43-a01d-e6c93bb7dc6f",
    sampleIds:[
      "gid://irida/Sample/d79bdb22-92c9-4b98-87df-b4e9f79cab4d", 
      "gid://irida/Sample/cc1aa061-03cd-48da-96d7-a21e93613d43"
    ]
  }){
    samples,
    errors{
      path
      message
    }
  }
}

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

@JeffreyThiessen JeffreyThiessen self-assigned this Oct 10, 2024
@JeffreyThiessen JeffreyThiessen force-pushed the graphql/clone_and_transfer_samples_mutations branch from dc1c213 to 87b61dc Compare October 16, 2024 18:36

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@JeffreyThiessen JeffreyThiessen force-pushed the graphql/clone_and_transfer_samples_mutations branch from 4837d25 to af77a18 Compare October 18, 2024 23:16
@JeffreyThiessen JeffreyThiessen marked this pull request as ready for review October 21, 2024 22:38

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

@malchua malchua left a comment

Choose a reason for hiding this comment

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

Looks good to me. I just want to clarify the following.

test/graphql/clone_samples_mutation_test.rb Show resolved Hide resolved
ksierks
ksierks previously approved these changes Oct 25, 2024
Copy link
Contributor

@ksierks ksierks left a comment

Choose a reason for hiding this comment

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

Thanks for the change!

@JeffreyThiessen JeffreyThiessen force-pushed the graphql/clone_and_transfer_samples_mutations branch from 33f7d02 to e702217 Compare October 29, 2024 18:15

This comment has been minimized.

Copy link
Member

@ericenns ericenns left a comment

Choose a reason for hiding this comment

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

Just a few comments on a better way to extract the model_id from the global id.

app/graphql/mutations/clone_samples.rb Outdated Show resolved Hide resolved
app/graphql/mutations/transfer_samples.rb Outdated Show resolved Hide resolved
@JeffreyThiessen JeffreyThiessen force-pushed the graphql/clone_and_transfer_samples_mutations branch from e702217 to d2a78e7 Compare October 30, 2024 20:44

This comment has been minimized.

Copy link

Code Metrics Report

Coverage Test Execution Time
93.3% 8m44s

Code coverage of files in pull request scope (100.0%)

Files Coverage
app/graphql/mutations/clone_samples.rb 100.0%
app/graphql/mutations/transfer_samples.rb 100.0%
app/graphql/types/mutation_type.rb 100.0%
app/services/samples/clone_service.rb 100.0%

Reported by octocov

Copy link
Member

@ericenns ericenns left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@ericenns ericenns merged commit f9d747c into main Nov 1, 2024
3 checks passed
@ericenns ericenns deleted the graphql/clone_and_transfer_samples_mutations branch November 1, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GraphQL: transferSamples mutation GraphQL: cloneSamples mutation
4 participants