Skip to content

Commit

Permalink
Merge pull request #2091 from sanger/Y24-190-use-v2-tag-layout-creati…
Browse files Browse the repository at this point in the history
…on-with-a-template

Y24-190: Use v2 tag layout creation with a template
  • Loading branch information
sdjmchattie authored Dec 2, 2024
2 parents a8c6598 + 8e763f9 commit d280982
Show file tree
Hide file tree
Showing 19 changed files with 209 additions and 111 deletions.
160 changes: 138 additions & 22 deletions app/frontend/javascript/shared/resources.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Auto-generated by Sequencescape on 2024-10-18 14:57:17 +0100"
* Using Y24-190-support-limber-with-bulk-transfers-on-v2-api@e78b99f
* Auto-generated by Sequencescape on 2024-11-27 14:32:34 +0000"
* Using Y24-190-v2-create-from-tag-layout-templates@ab257bc
* bundle exec rake devour:create_config"
*
*/
Expand Down Expand Up @@ -201,6 +201,10 @@ const resources = [
"jsonApi": "hasMany",
"type": "comment"
},
"qc_files": {
"jsonApi": "hasMany",
"type": "qc_file"
},
"receptacles": {
"jsonApi": "hasMany"
},
Expand Down Expand Up @@ -318,6 +322,61 @@ const resources = [
"options": {
}
},
{
"resource": "plate_conversion",
"attributes": {
"parent_uuid": "",
"purpose_uuid": "",
"target_uuid": "",
"user_uuid": "",
"uuid": "",
"parent": {
"jsonApi": "hasOne",
"type": "plate"
},
"purpose": {
"jsonApi": "hasOne",
"type": "plate_purpose"
},
"target": {
"jsonApi": "hasOne",
"type": "plate"
},
"user": {
"jsonApi": "hasOne",
"type": "user"
}
},
"options": {
}
},
{
"resource": "plate_creation",
"attributes": {
"child_purpose_uuid": "",
"parent_uuid": "",
"user_uuid": "",
"uuid": "",
"child": {
"jsonApi": "hasOne",
"type": "plate"
},
"child_purpose": {
"jsonApi": "hasOne",
"type": "plate_purpose"
},
"parent": {
"jsonApi": "hasOne",
"type": "plate"
},
"user": {
"jsonApi": "hasOne",
"type": "user"
}
},
"options": {
}
},
{
"resource": "plate_purpose",
"attributes": {
Expand Down Expand Up @@ -352,6 +411,7 @@ const resources = [
"number_of_rows": "",
"number_of_columns": "",
"size": "",
"pooling_metadata": "",
"purpose": {
"jsonApi": "hasOne",
"type": "purpose"
Expand All @@ -376,6 +436,10 @@ const resources = [
"jsonApi": "hasMany",
"type": "comment"
},
"qc_files": {
"jsonApi": "hasMany",
"type": "qc_file"
},
"receptacles": {
"jsonApi": "hasMany"
},
Expand Down Expand Up @@ -407,6 +471,14 @@ const resources = [
"jsonApi": "hasMany",
"type": "state_change"
},
"submission_pools": {
"jsonApi": "hasMany",
"type": "submission_pool"
},
"transfers_as_destination": {
"jsonApi": "hasMany",
"type": "transfer"
},
"wells": {
"jsonApi": "hasMany",
"type": "well"
Expand Down Expand Up @@ -502,6 +574,23 @@ const resources = [
"options": {
}
},
{
"resource": "qc_file",
"attributes": {
"content_type": "",
"contents": "",
"created_at": "",
"filename": "",
"size": "",
"uuid": "",
"labware": {
"jsonApi": "hasOne",
"type": "labware"
}
},
"options": {
}
},
{
"resource": "qc_result",
"attributes": {
Expand Down Expand Up @@ -815,6 +904,18 @@ const resources = [
"options": {
}
},
{
"resource": "submission_pool",
"attributes": {
"plates_in_submission": "",
"tag_layout_templates": {
"jsonApi": "hasMany",
"type": "tag_layout_template"
}
},
"options": {
}
},
{
"resource": "submission_template",
"attributes": {
Expand Down Expand Up @@ -887,11 +988,13 @@ const resources = [
"resource": "tag_layout",
"attributes": {
"direction": "",
"enforce_uniqueness": "",
"initial_tag": "",
"plate_uuid": "",
"substitutions": "",
"tag_group_uuid": "",
"tag2_group_uuid": "",
"tag_layout_template_uuid": "",
"tags_per_well": "",
"user_uuid": "",
"uuid": "",
Expand Down Expand Up @@ -919,8 +1022,8 @@ const resources = [
{
"resource": "tag",
"attributes": {
"oligo": "",
"map_id": "",
"oligo": "",
"tag_group": {
"jsonApi": "hasOne",
"type": "tag_group"
Expand Down Expand Up @@ -964,17 +1067,17 @@ const resources = [
"uuid": "",
"state": "",
"volume": "",
"target_asset": {
"jsonApi": "hasOne",
"type": "receptacle"
},
"source_asset": {
"jsonApi": "hasOne",
"type": "receptacle"
},
"submission": {
"jsonApi": "hasOne",
"type": "submission"
},
"target_asset": {
"jsonApi": "hasOne",
"type": "receptacle"
}
},
"options": {
Expand All @@ -999,6 +1102,14 @@ const resources = [
"transfer_type": "",
"user_uuid": "",
"uuid": "",
"destination": {
"jsonApi": "hasOne",
"type": "labware"
},
"source": {
"jsonApi": "hasOne",
"type": "labware"
},
"user": {
"jsonApi": "hasOne",
"type": "user"
Expand Down Expand Up @@ -1056,26 +1167,26 @@ const resources = [
{
"resource": "tube_rack",
"attributes": {
"uuid": "",
"created_at": "",
"updated_at": "",
"labware_barcode": "",
"size": "",
"number_of_rows": "",
"number_of_columns": "",
"name": "",
"number_of_columns": "",
"number_of_rows": "",
"size": "",
"tube_locations": "",
"racked_tubes": {
"jsonApi": "hasMany",
"type": "racked_tube"
},
"updated_at": "",
"uuid": "",
"comments": {
"jsonApi": "hasMany",
"type": "comment"
},
"purpose": {
"jsonApi": "hasOne",
"type": "purpose"
},
"racked_tubes": {
"jsonApi": "hasMany",
"type": "racked_tube"
}
},
"options": {
Expand All @@ -1090,6 +1201,7 @@ const resources = [
"state": "",
"created_at": "",
"updated_at": "",
"sibling_tubes": "",
"purpose": {
"jsonApi": "hasOne",
"type": "purpose"
Expand All @@ -1114,6 +1226,10 @@ const resources = [
"jsonApi": "hasMany",
"type": "comment"
},
"qc_files": {
"jsonApi": "hasMany",
"type": "qc_file"
},
"receptacles": {
"jsonApi": "hasMany"
},
Expand Down Expand Up @@ -1149,13 +1265,13 @@ const resources = [
"jsonApi": "hasMany",
"type": "aliquot"
},
"transfer_requests_as_target": {
"jsonApi": "hasMany",
"type": "transfer_request"
},
"receptacle": {
"jsonApi": "hasOne",
"type": "receptacle"
},
"transfer_requests_as_target": {
"jsonApi": "hasMany",
"type": "transfer_request"
}
},
"options": {
Expand Down Expand Up @@ -1271,11 +1387,11 @@ const resources = [
{
"resource": "work_order",
"attributes": {
"at_risk": "",
"options": "",
"order_type": "",
"quantity": "",
"state": "",
"options": "",
"at_risk": "",
"study": {
"jsonApi": "hasOne",
"type": "study"
Expand Down
14 changes: 6 additions & 8 deletions app/models/labware_creators/tagged_plate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,12 @@ def convert_tag_plate_to_new_purpose

def create_labware!
create_plate! do |plate_uuid|
# TODO: {Y24-190} Work out a way to call the `create!` method on TagLayoutTemplate model in Sequencescape
# using the V2 API. I think either we need to misuse the PATCH method with some kind of
# attributes telling Sequencescape to run the `create!` method, or we need to create a new
# endpoint associated with a TagLayoutTemplate that will run the `create!` method.
api
.tag_layout_template
.find(tag_plate.template_uuid)
.create!(plate: plate_uuid, user: user_uuid, enforce_uniqueness: requires_tag2?)
Sequencescape::Api::V2::TagLayout.create!(
enforce_uniqueness: requires_tag2?,
plate_uuid: plate_uuid,
tag_layout_template_uuid: tag_plate.template_uuid,
user_uuid: user_uuid
)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/labware/plates/_multi_pooled_plate.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h2>Source Plates</h2>
<% presenter.labware.creation_transfers.each_with_index do |transfer,i| %>
<% presenter.labware.transfers_as_destination.each_with_index do |transfer,i| %>
<h3><%= "#{@presenter.bed_prefix}#{i+1}: #{transfer.source.stock_plate.barcode.prefix}#{transfer.source.stock_plate.barcode.number} (#{transfer.source.barcode.prefix}#{transfer.source.barcode.number})" %></h3>
<%= render partial: "pooled_plate", locals: {plate_presenter: presenter, walker: presenter.walk_source, transfers: transfer.transfers} %>
<% end %>
Expand Down
1 change: 0 additions & 1 deletion spec/features/creating_a_plate_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'rails_helper'
require_relative '../support/shared_tagging_examples'

RSpec.feature 'Creating a plate', js: true, tag_plate: true do
has_a_working_api
Expand Down
Loading

0 comments on commit d280982

Please sign in to comment.