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

API v2 Milestone 3 #2099

Merged
merged 141 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
8617584
Change calls for transfer_request_collection over to API v2
sdjmchattie Sep 26, 2024
02d839b
Merge branch 'develop' into develop-Y24-190
sdjmchattie Sep 26, 2024
75ffcee
Merge branch 'develop-Y24-190' into Y24-190-3-use-api-v2-transfer-req…
sdjmchattie Sep 26, 2024
22e1aa6
Merge branch 'Y24-190-milestone-2' into develop-Y24-190
sdjmchattie Sep 26, 2024
498916d
Merge branch 'develop-Y24-190' into Y24-190-3-use-api-v2-transfer-req…
sdjmchattie Sep 26, 2024
52eaa6e
Use create! instead of create for QcAssay creation
sdjmchattie Sep 27, 2024
c5da594
Use symbols instead of strings
sdjmchattie Sep 27, 2024
b103e60
Fix some of the failing test files
sdjmchattie Sep 27, 2024
df2b795
Shorten comment line length
sdjmchattie Sep 27, 2024
c5f8ed3
Fix tests across four spec files
sdjmchattie Sep 30, 2024
2412520
Complete remaining test updates
sdjmchattie Sep 30, 2024
ad9621b
Tidy up API URL Helper for Rubocop
sdjmchattie Sep 30, 2024
5883373
Extract expectation method for transfer request collections
sdjmchattie Sep 30, 2024
e55dd78
Move expectation helper methods into a separate module
sdjmchattie Sep 30, 2024
09c602a
Extract expect_state_change_creation method
sdjmchattie Sep 30, 2024
2f1b35a
Extract methods for pooled plate creations
sdjmchattie Sep 30, 2024
0ee050a
Extract CustomMetadatumCollection creation expectation method
sdjmchattie Sep 30, 2024
70ede91
Fix naming of StateChange attributes
sdjmchattie Sep 30, 2024
cabfed8
Fix naming of PooledPlate attributes
sdjmchattie Sep 30, 2024
693cde6
Extract method for expecting specific tube creation
sdjmchattie Sep 30, 2024
8b0c755
Replace ad-hoc expectations for CustomMetadatumCollection posts
sdjmchattie Sep 30, 2024
72ecd5a
Use StateChange post request expectation helper method
sdjmchattie Sep 30, 2024
b395844
Replace ad-hoc expectation of POST for SpecificTubeCreation
sdjmchattie Sep 30, 2024
f22e07f
Change ad-hoc expectation of Transfers and TransferRequestCollection
sdjmchattie Sep 30, 2024
04aacf6
Unify shared examples with identical code
sdjmchattie Sep 30, 2024
058bac7
Satisfy Rubocop
sdjmchattie Sep 30, 2024
f3e5a98
Change to API v2 for TubeFromTubeCreation requests
sdjmchattie Oct 1, 2024
42ac395
Fix tests for pooling multiple tubes into one
sdjmchattie Oct 1, 2024
4dba38b
Remove unneeded fixtures for plates
sdjmchattie Oct 1, 2024
1692d0a
Remove some v1 references in tests
sdjmchattie Oct 1, 2024
de2b48a
Fix tests for pooled tubes from whole tubes
sdjmchattie Oct 2, 2024
7b656a6
Fix tests for tube_from_tube_spec
sdjmchattie Oct 2, 2024
2d7d349
Merge pull request #1962 from sanger/Y24-190-3-use-api-v2-transfer-re…
sdjmchattie Oct 14, 2024
f91e349
Use WellHelpers for list of well positions
sdjmchattie Oct 14, 2024
6e65eb3
Merge branch 'develop-Y24-190' into Y24-190-3-extract-spec-v2-expecta…
sdjmchattie Oct 14, 2024
2eb01f1
Merge pull request #1967 from sanger/Y24-190-3-extract-spec-v2-expect…
sdjmchattie Oct 14, 2024
83df50a
Merge pull request #1972 from sanger/Y24-190-3-use-api-v2-tube-from-t…
sdjmchattie Oct 16, 2024
3eb07ab
Merge branch 'develop' into develop-Y24-190
sdjmchattie Oct 16, 2024
3e056b3
Apply new linting rules
sdjmchattie Oct 16, 2024
265291d
Removing nesting of transfers endpoint
sdjmchattie Oct 18, 2024
9016d4d
Add a bulk transfers endpoint
sdjmchattie Oct 18, 2024
d28721d
Remove unused bulk_transfer_factory and tests
sdjmchattie Oct 18, 2024
852b164
Switch usage for BulkTransfer over to API v2
sdjmchattie Oct 18, 2024
abf6261
Update API v2 resources.js file
sdjmchattie Oct 18, 2024
43c77f6
Merge branch 'develop' into develop-Y24-190
sdjmchattie Oct 21, 2024
aa384b5
Use SS API v2 for PlateConversion call
sdjmchattie Oct 21, 2024
c529b43
Fix tests for V2 API usage of PlateConversion
sdjmchattie Oct 21, 2024
a5bfd48
Change API call to v2 for plate_creations
sdjmchattie Oct 22, 2024
5623435
Add API helper for plate creations
sdjmchattie Oct 22, 2024
6158c6a
Update tests for transition to API v2 for plate_creations
sdjmchattie Oct 22, 2024
f6407e5
Fix tests in quadrant_split_plate_spec
sdjmchattie Oct 22, 2024
702cf2f
Merge pull request #2009 from sanger/Y24-190-use-api-v2-bulk-transfers
sdjmchattie Oct 23, 2024
c9e6d80
Merge branch 'develop-Y24-190' into Y24-190-use-api-v2-plate-conversion
sdjmchattie Oct 23, 2024
554ed4b
Merge branch 'develop-Y24-190' into Y24-190-use-api-v2-plate-creation
sdjmchattie Oct 23, 2024
56e1636
Merge pull request #2010 from sanger/Y24-190-use-api-v2-plate-conversion
sdjmchattie Oct 23, 2024
559a90b
Merge branch 'develop-Y24-190' into Y24-190-use-api-v2-plate-creation
sdjmchattie Oct 23, 2024
9a6765e
Merge pull request #2013 from sanger/Y24-190-use-api-v2-plate-creation
sdjmchattie Oct 23, 2024
a868e2e
Merge branch 'develop' into develop-Y24-190
sdjmchattie Oct 24, 2024
8afbfb2
Merge branch 'develop' into develop-Y24-190
sdjmchattie Oct 29, 2024
27a1a09
Switch V1 Tube queries to V2 endpoint
sdjmchattie Oct 29, 2024
dcf0268
Don't turn nil barcode values into empty strings
sdjmchattie Oct 31, 2024
7acb942
Fix tests in labware_creators/final_tube_spec
sdjmchattie Nov 1, 2024
794823e
Fix tests for multi_stamp_tubes_using_tube_rack_scan
sdjmchattie Nov 1, 2024
7ea50f7
Make in_progress_submission_uuids be an empty array on tubes
sdjmchattie Nov 1, 2024
df86327
Add custom_query options to stubbed V2 tubes
sdjmchattie Nov 1, 2024
482c978
Remove unnecessary flat_mapping and safe navigation in has_requests
sdjmchattie Nov 1, 2024
d03c332
Make mocked tubes appear as persisted
sdjmchattie Nov 1, 2024
4acc988
Fix tests for work_completions_controller
sdjmchattie Nov 1, 2024
e61a9e2
Fix remaining v2 tube tests
sdjmchattie Nov 1, 2024
93eac5e
Use .filter_map instead of .map.compact
sdjmchattie Nov 1, 2024
ec581bd
Re-apply flat_map for request_in_progress
sdjmchattie Nov 1, 2024
db1fa71
Add optional parameter to in_progress_submission_uuids method
sdjmchattie Nov 1, 2024
eee659a
Ignore arguments instead of specifying the name
sdjmchattie Nov 1, 2024
bff2b48
Merge branch 'develop' into develop-Y24-190
sdjmchattie Nov 4, 2024
92241e8
Merge branch 'develop-Y24-190' into Y24-190-use-api-v2-tube-everywhere
sdjmchattie Nov 4, 2024
13a5eab
Add comments to `mark_as_persisted!` method calls
sdjmchattie Nov 7, 2024
0435869
Merge pull request #2034 from sanger/Y24-190-use-api-v2-tube-everywhere
sdjmchattie Nov 7, 2024
0d3e561
Change labware creators to finding plates on V2
sdjmchattie Nov 8, 2024
e893544
Assign pools to wells in V2 plates
sdjmchattie Nov 8, 2024
7970cb3
Expect submission_pools for v2 Plates
sdjmchattie Nov 8, 2024
353a7e3
Look for for_multiplexing in pooling_metadata rather than pools
sdjmchattie Nov 8, 2024
ae63869
Use API V2 Plate in state changers
sdjmchattie Nov 8, 2024
eba7921
Merge branch 'develop' into develop-Y24-190
sdjmchattie Nov 8, 2024
6ae7e09
Use correct V2 method for assigning pools to wells
sdjmchattie Nov 11, 2024
9bc69e7
Assign QcFiles to labware types and the inverse relationship
sdjmchattie Nov 13, 2024
729e98a
Create new QcFiles for tubes
sdjmchattie Nov 13, 2024
4623ae9
Access plate v2 purpose with the correct attribute
sdjmchattie Nov 14, 2024
ef679e6
Remove source_plate method
sdjmchattie Nov 14, 2024
fa8a553
Merge branch 'develop-Y24-190' into Y24-190-use-api-v2-plate-everywhere
sdjmchattie Nov 14, 2024
2426092
Include the expected - when splitting barcodes into prefix and number
sdjmchattie Nov 14, 2024
048faa1
Move other QcFile creation calls over to V2
sdjmchattie Nov 14, 2024
25b799d
Remove api v1 from ExtendedCsv
sdjmchattie Nov 14, 2024
b0ac0f2
Render QcFiles using v2 types
sdjmchattie Nov 14, 2024
2d6eeff
Remove all usage of v1 api from qc_files_controller
sdjmchattie Nov 14, 2024
4a13025
Make the hyphen in barcodes optional
sdjmchattie Nov 14, 2024
47af3d7
Use v1 pooling data for assigning pools to wells
sdjmchattie Nov 15, 2024
8128ce0
Prefer pluck method over a map extracting a value
sdjmchattie Nov 15, 2024
b6dbbca
Merge branch 'develop' into develop-Y24-190
sdjmchattie Nov 15, 2024
001bbc0
Merge branch 'develop-Y24-190' into Y24-190-use-api-v2-plate-everywhere
sdjmchattie Nov 15, 2024
3ef8b1c
Remove custom endpoint declaration
sdjmchattie Nov 15, 2024
bb45c63
Remove duplicate declaration for submission_pools on Plates
sdjmchattie Nov 15, 2024
8d5d0dc
Fix typo from prc_cycles to pcr_cycles
sdjmchattie Nov 20, 2024
5ff2da5
Fix tests for custom tagged plate
sdjmchattie Nov 20, 2024
7688246
Fix tests for tagged_plate_spec
sdjmchattie Nov 20, 2024
cbbd5ce
Fix tests for well_filtered_tagged_plate_creator
sdjmchattie Nov 20, 2024
2579330
Fix tests or cardinal_pools_plate
sdjmchattie Nov 20, 2024
a9d4cd3
Fix tests for custom_pooled_tubes
sdjmchattie Nov 20, 2024
0553883
Fix tests for final tube from plate
sdjmchattie Nov 20, 2024
18346d5
Use Array.new syntax for submission_pools
sdjmchattie Nov 20, 2024
02b2351
Fix tests for multi_stamp_tubes_usin_tube_rack_scan
sdjmchattie Nov 21, 2024
1200174
Fix tests for pcr_cycles_binned_plate_for_duplex_seq
sdjmchattie Nov 21, 2024
909da47
Fix tests for pcr_cycles_binned_plate_for_t_nano_seq
sdjmchattie Nov 21, 2024
02bf31d
Remove redundant JSON generation in already updated tests
sdjmchattie Nov 21, 2024
477cce3
Fix tests for plate_split_to_tube_racks
sdjmchattie Nov 21, 2024
d221566
Fix tests for pooled_tubes_by_submission_spec
sdjmchattie Nov 21, 2024
8146eef
Fix tests for state_changers
sdjmchattie Nov 21, 2024
0d122ef
Fix tests for plates_controller
sdjmchattie Nov 21, 2024
90c2ab8
Fix tests for qc_files_controller
sdjmchattie Nov 21, 2024
65e9b7a
Fix tests for cancelling_a_whole_plate
sdjmchattie Nov 21, 2024
e038a9d
Fix tests for failing_a_whole_plate
sdjmchattie Nov 21, 2024
5518806
Use the uuid trait on v2 factories
sdjmchattie Nov 21, 2024
05e0c4f
Assign submission_pools via cached_relationships
sdjmchattie Nov 21, 2024
ddd1f94
Fix tests for creating_a_tag_plate
sdjmchattie Nov 21, 2024
749ced6
Fix well_filtered_tagged_plate_creator once more
sdjmchattie Nov 21, 2024
247c670
Start clearing v1 mocks out of tests
sdjmchattie Nov 21, 2024
22c8e93
Tidy up v2 stubs in let! commands
sdjmchattie Nov 22, 2024
032850b
Remove all possible v1 test stubs
sdjmchattie Nov 22, 2024
a812785
Merge branch 'develop' into develop-Y24-190
sdjmchattie Nov 22, 2024
312c948
Merge branch 'develop-Y24-190' into Y24-190-use-api-v2-plate-everywhere
sdjmchattie Nov 22, 2024
4c51b8b
Merge pull request #2061 from sanger/Y24-190-use-api-v2-plate-everywhere
sdjmchattie Nov 27, 2024
abec0af
Merge pull request #2082 from sanger/Y24-190-clean-some-v1-out-of-tests
sdjmchattie Nov 27, 2024
a8c6598
Merge branch 'develop' into develop-Y24-190
sdjmchattie Nov 27, 2024
af57de4
Switch to v2 for creating TagLayouts from templates
sdjmchattie Nov 27, 2024
d626290
Update v2 resources in Javascript
sdjmchattie Nov 27, 2024
5adfe3b
Update tests to expect tag layout creations via API v2
sdjmchattie Nov 27, 2024
8e763f9
Change creation_transfers to transfers_as_destination
sdjmchattie Nov 27, 2024
d280982
Merge pull request #2091 from sanger/Y24-190-use-v2-tag-layout-creati…
sdjmchattie Dec 2, 2024
e0bd978
Merge branch 'develop' into develop-Y24-190
sdjmchattie Dec 2, 2024
2fb071a
Merge branch 'develop' into api-v2-milestone-3
sdjmchattie Dec 10, 2024
1e05aaf
Include ancestors when getting plates for presenters
sdjmchattie Dec 10, 2024
f2b18a1
Modify approach to avoiding multiple calls to the API for ancestors
sdjmchattie Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ FactoryBot.define do
transient { related_thing { create :v2_tag_group_with_tags } }

after(:build) do |record, factory|
record._cached_relationship(:related_thing) { factory.related_thing } if evaluator.related_thing
record._cached_relationship(:related_thing) { factory.related_thing } if factory.related_thing
end
end
end
Expand Down
7 changes: 1 addition & 6 deletions app/controllers/labware_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ def state_changer_for(purpose_uuid, labware_uuid)
end

def presenter_for(labware)
presenter = Presenters.lookup_for(labware).new(labware:)

# TODO: {Y24-190} - Remove this line when the API v1 is removed from Presenters::ExtendedCsv
presenter.api = api if presenter.respond_to?(:api=)

presenter
Presenters.lookup_for(labware).new(labware:)
end
end
19 changes: 13 additions & 6 deletions app/controllers/qc_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ class QcFilesController < ApplicationController
before_action :find_assets, only: %i[create index]

def index
respond_to { |format| format.json { render json: { 'qc_files' => asset.qc_files } } }
respond_to { |format| format.json { render json: { 'qc_files' => asset.qc_files.map { |q| qc_file_to_json(q) } } } }
end

def show
response = api.qc_file.find(params[:id]).retrieve
filename = /filename="([^"]*)"/.match(response['Content-Disposition'])[1] || 'unnamed_file'
send_data(response.body, filename: filename, type: 'sequencescape/qc_file')
qc_file = Sequencescape::Api::V2::QcFile.find(uuid: params[:id]).first
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way we can hide the long winded Sequencescape::Api::V2:: naming all over the codebase? for api 1 we seem to do the much shorter api naming

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could (in a separate piece of work) create an alias for the Sequencescape::Api::V2 module. Maybe something like SSAPIv2 so that these would become SSAPIv2::QcFile etc. I don't think we should name the real module differently, but an alias would be a reasonable approach.

send_data(qc_file.contents, filename: qc_file.filename, type: 'sequencescape/qc_file')
end

def create
asset.qc_files.create_from_file!(params['qc_file'], params['qc_file'].original_filename)
Sequencescape::Api::V2::QcFile.create_for_labware!(
contents: params['qc_file'].read,
filename: params['qc_file'].original_filename,
labware: asset
)
redirect_to(
asset_path,
notice: 'Your file has been uploaded and is available from the file tab' # rubocop:todo Rails/I18nLocaleTexts
Expand All @@ -30,12 +33,16 @@ def create

private

def qc_file_to_json(qc_file)
{ filename: qc_file.filename, size: qc_file.size, uuid: qc_file.uuid, created: qc_file.created_at.to_fs(:long) }
end

def find_assets
%w[plate tube multiplexed_library_tube tube_rack].each do |klass|
next if params["limber_#{klass}_id"].nil?

@asset_path = send(:"limber_#{klass}_path", params["limber_#{klass}_id"])
@asset = api.send(:"#{klass}").find(params["limber_#{klass}_id"])
@asset = Sequencescape::Api::V2::Labware.find(uuid: params["limber_#{klass}_id"]).first
return true
end
false
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/tubes/work_completions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class Tubes::WorkCompletionsController < ApplicationController
before_action :check_for_current_user!

def labware
@labware ||= api.tube.find(params[:limber_tube_id])
@labware ||= Sequencescape::Api::V2.tube_for_completion(params[:limber_tube_id])
end
end
Loading
Loading