Skip to content

Commit

Permalink
Merge pull request #567 from JamesGlover/issue560/gpl-712-as-a-user-w…
Browse files Browse the repository at this point in the history
…hen-the-destination-plate-is-ready-i-would-like-to-scan-the-barcode-into-the-limber-pipeline-and-decide-whether-it-will-be-processed-as-a-384-or-96-well-plate

issue560/gpl 712 as a user when the destination plate is ready i would like to scan the barcode into the limber pipeline and decide whether it will be processed as a 384 or 96 well plate
  • Loading branch information
JamesGlover authored Dec 2, 2020
2 parents 455aa58 + a00b05e commit c402b65
Show file tree
Hide file tree
Showing 89 changed files with 1,132 additions and 367 deletions.
103 changes: 16 additions & 87 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,98 +49,36 @@ Metrics/BlockLength:
Layout/LineLength:
Max: 161


Naming/VariableNumber:
CheckSymbols: false # Rubocop gets annoyed about our states. I'm disabling globally
# as I'm honestly not that bothered.
# Pending Cops
# For more information: https://docs.rubocop.org/en/latest/versioning/
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true
Layout/SpaceAroundMethodCallOperator:
Enabled: true
Lint/DeprecatedOpenSSLConstant:
Enabled: true
Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true
Style/ExponentialNotation:
Enabled: true
Style/HashEachMethods:
Enabled: true
Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true
Style/SlicingWithRange:
Enabled: true
Lint/BinaryOperatorWithIdenticalOperands: # (new in 0.89)
Enabled: true
Lint/DuplicateElsifCondition: # (new in 0.88)
Enabled: true
Lint/DuplicateRequire: # (new in 0.90)
Enabled: true
Lint/DuplicateRescueException: # (new in 0.89)
Enabled: true
Lint/EmptyConditionalBody: # (new in 0.89)
Enabled: true
Lint/EmptyFile: # (new in 0.90)
Enabled: true
Lint/FloatComparison: # (new in 0.89)
Enabled: true
Lint/MissingSuper: # (new in 0.89)
Enabled: true
Lint/MixedRegexpCaptureTypes: # (new in 0.85)
Lint/DuplicateBranch: # (new in 1.3)
Enabled: true
Lint/OutOfRangeRegexpRef: # (new in 0.89)
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
Enabled: true
Lint/SelfAssignment: # (new in 0.89)
Lint/EmptyBlock: # (new in 1.1)
Enabled: true
Lint/TopLevelReturnWithArgument: # (new in 0.89)
Lint/EmptyClass: # (new in 1.3)
Enabled: true
Lint/TrailingCommaInAttributeDeclaration: # (new in 0.90)
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
Enabled: true
Lint/UnreachableLoop: # (new in 0.89)
Lint/ToEnumArguments: # (new in 1.1)
Enabled: true
Lint/UselessMethodDefinition: # (new in 0.90)
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
Enabled: true
Style/AccessorGrouping: # (new in 0.87)
Style/ArgumentsForwarding: # (new in 1.1)
Enabled: true
Style/ArrayCoercion: # (new in 0.88)
Style/CollectionCompact: # (new in 1.2)
Enabled: true
Style/BisectedAttrAccessor: # (new in 0.87)
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
Enabled: true
Style/CaseLikeIf: # (new in 0.88)
Style/NegatedIfElseCondition: # (new in 1.2)
Enabled: true
Style/CombinableLoops: # (new in 0.90)
Style/NilLambda: # (new in 1.3)
Enabled: true
Style/ExplicitBlockArgument: # (new in 0.89)
Enabled: true
Style/GlobalStdStream: # (new in 0.89)
Enabled: true
Style/HashAsLastArrayItem: # (new in 0.88)
Enabled: true
Style/HashLikeCase: # (new in 0.88)
Enabled: true
Style/KeywordParametersOrder: # (new in 0.90)
Enabled: true
Style/OptionalBooleanParameter: # (new in 0.89)
Enabled: true
Style/RedundantAssignment: # (new in 0.87)
Enabled: true
Style/RedundantFetchBlock: # (new in 0.86)
Enabled: true
Style/RedundantFileExtensionInRequire: # (new in 0.88)
Enabled: true
Style/RedundantRegexpCharacterClass: # (new in 0.85)
Enabled: true
Style/RedundantRegexpEscape: # (new in 0.85)
Enabled: true
Style/RedundantSelfAssignment: # (new in 0.90)
Enabled: true
Style/SingleArgumentDig: # (new in 0.89)
Enabled: true
Style/SoleNestedConditional: # (new in 0.89)
Enabled: true
Style/StringConcatenation: # (new in 0.89)
Style/SwapValues: # (new in 1.1)
Enabled: true
Rails/ActiveRecordCallbacksOrder: # (new in 2.7)
Enabled: true
Expand Down Expand Up @@ -190,12 +128,3 @@ Performance/StringInclude: # (new in 1.7)
Enabled: true
Performance/Sum: # (new in 1.8)
Enabled: true
Layout/BeginEndAlignment: # (new in 0.91)
Enabled: true
Lint/ConstantDefinitionInBlock: # (new in 0.91)
Enabled: true
Lint/IdentityComparison: # (new in 0.91)
Enabled: true
Lint/UselessTimes: # (new in 0.91)
Enabled: true

4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ gem 'hashie'
gem 'json_api_client', github: 'sanger/json_api_client', branch: 'merge_upstream'

# Older Sequencescape API
gem 'sequencescape-client-api', require: 'sequencescape'
gem 'sequencescape-client-api', '~> 0.5.0.pre.rc1', require: 'sequencescape'
# Speed up json encoding/decoding with oj
gem 'oj'

gem 'pmb-client', '0.1.0', github: 'sanger/pmb-client'
gem 'sprint_client'
Expand Down
23 changes: 12 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
parallel (1.19.2)
parser (2.7.1.5)
oj (3.10.16)
parallel (1.20.0)
parser (2.7.2.0)
ast (~> 2.4.1)
popper_js (1.16.0)
pry (0.13.1)
Expand Down Expand Up @@ -250,7 +251,7 @@ GEM
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
regexp_parser (1.8.1)
regexp_parser (1.8.2)
rexml (3.2.4)
rspec (3.9.0)
rspec-core (~> 3.9.0)
Expand All @@ -274,16 +275,16 @@ GEM
rspec-mocks (~> 3.9)
rspec-support (~> 3.9)
rspec-support (3.9.3)
rubocop (0.92.0)
rubocop (1.3.0)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
regexp_parser (>= 1.8)
rexml
rubocop-ast (>= 0.5.0)
rubocop-ast (>= 1.1.1)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.7.1)
rubocop-ast (1.1.1)
parser (>= 2.7.1.5)
rubocop-performance (1.8.1)
rubocop (>= 0.87.0)
Expand All @@ -309,11 +310,11 @@ GEM
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
semantic_range (2.3.0)
sequencescape-client-api (0.4.3)
sequencescape-client-api (0.5.0.pre.rc1)
activemodel (>= 5.0.0)
activesupport (>= 5.0.0)
i18n
yajl-ruby (>= 1.4.1)
multi_json
shellany (0.0.1)
simplecov (0.19.1)
docile (~> 1.1)
Expand Down Expand Up @@ -374,7 +375,6 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
yajl-ruby (1.4.1)
yard (0.9.25)

PLATFORMS
Expand All @@ -395,6 +395,7 @@ DEPENDENCIES
jquery-ui-rails
json_api_client!
launchy
oj
pmb-client (= 0.1.0)!
pry
pry-byebug
Expand All @@ -411,7 +412,7 @@ DEPENDENCIES
sanger_barcode_format!
sass-rails
select2-rails
sequencescape-client-api
sequencescape-client-api (~> 0.5.0.pre.rc1)
simplecov
simplecov-json
sprint_client
Expand Down
2 changes: 1 addition & 1 deletion Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"

# Note: The cmd option is now required due to the increasing number of ways
# NOTE: The cmd option is now required due to the increasing number of ways
# rspec may be run, below are examples of the most common uses.
# * bundler: 'bundle exec rspec'
# * bundler binstubs: 'bin/rspec'
Expand Down
15 changes: 13 additions & 2 deletions app/assets/stylesheets/limber/screen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ header.limber-header {
}
}

.submission-list {
@extend .list-group;
@extend .list-group-flush;

li {
@extend .list-group-item;
@extend .justify-content-between;
@extend .d-flex;
}
}

button#btnGroupInboxes, button#btnGroupRobots {
@extend .btn;
@extend .btn-primary;
Expand Down Expand Up @@ -127,7 +138,7 @@ nav.inbox-list, nav.robots-list {
}
}

.work-completion-button, .robots-button, .create-plate-button, .create-tube-button, .csv-link {
.work-completion-button, .robots-button, .create-plate-button, .create-tube-button, .csv-link, .create-submission-button {
@extend .btn;
@extend .btn-lg;
@extend .btn-block;
Expand All @@ -138,7 +149,7 @@ nav.inbox-list, nav.robots-list {
.work-completion-button, .create-plate-button, .create-tube-button { @extend .btn-secondary;}
}
.suggested-actions {
.work-completion-button, .create-plate-button, .create-tube-button { @extend .btn-success;}
.work-completion-button, .create-plate-button, .create-tube-button, .create-submission-button { @extend .btn-success;}
}
.robots-button {
@extend .btn-primary;
Expand Down
25 changes: 25 additions & 0 deletions app/controllers/concerns/sequencescape_submission_behaviour.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

# Module SequencescapeSubmissionBehaviour provides the ability to
# generate submissions to controllers
#
# @author Genome Research Ltd.
#
module SequencescapeSubmissionBehaviour
# Builds a submission using the supplied params[:sequencescape_submission]
def create_submission
ss = SequencescapeSubmission.new(sequencescape_submission_parameters)
if ss.save
flash[:notice] ||= []
flash[:notice] << 'Your submissions have been made and should be built shortly.'
else
flash[:alert] = truncate_flash(ss.errors.full_messages)
end
end

def sequencescape_submission_parameters
params
.require(:sequencescape_submission).permit(:template_uuid, request_options: {}, assets: [], asset_groups: {})
.merge(api: api, user: current_user_uuid)
end
end
27 changes: 13 additions & 14 deletions app/controllers/concerns/work_completion_behaviour.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,31 @@
# @author Genome Research Ltd.
#
module WorkCompletionBehaviour
extend ActiveSupport::Concern

included do
include SequencescapeSubmissionBehaviour
end
# Create a work completion for the given limber_plate_id
# and redirect to the plate page.
# Work completions mark library creation requests as completed
# and hook them up to the correct wells.
# rubocop:todo Metrics/MethodLength
def create # rubocop:todo Metrics/AbcSize
messages = Hash.new { |message_store, category| message_store[category] = [] }
def create
api.work_completion.create!(
# Our pools keys are our submission uuids.
submissions: labware.in_progress_submission_uuids,
target: labware.uuid,
user: current_user_uuid
)
messages[:notice] << 'Requests have been passed'

if params[:sequencescape_submission]
ss = SequencescapeSubmission.new(sequencescape_submission_parameters)
if ss.save
messages[:notice] << 'Your submissions have been made and should be built shortly.'
else
messages[:alert] = truncate_flash(ss.errors.full_messages)
end
end
redirect_to labware, messages
# We assign the message in an array as create_submission may wish to add
# its own feedback.
flash[:notice] = ['Requests have been passed']

create_submission if params[:sequencescape_submission]

redirect_to labware
end
# rubocop:enable Metrics/MethodLength

def sequencescape_submission_parameters
params
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/exports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class ExportsController < ApplicationController
WELL_QC_SAMPLE_INCLUDES = 'wells.qc_results,wells.aliquots.sample.sample_metadata'
WELL_SRC_ASSET_INCLUDES = 'wells.transfer_requests_as_target.source_asset'

CSVDetail = Struct.new(:csv, :plate_includes, :workflow, :ancestor_purpose) do
end
CSVDetail = Struct.new(:csv, :plate_includes, :workflow, :ancestor_purpose)

CSV_DETAILS = {
'concentrations_ngul' =>
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/labware_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def show # rubocop:todo Metrics/AbcSize
render @presenter.csv
response.headers['Content-Disposition'] = "attachment; filename=#{@presenter.filename(params['offset'])}" if @presenter.filename
end
format.json {}
format.json
end
end

Expand Down
13 changes: 13 additions & 0 deletions app/controllers/sequencescape_submissions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

# Handles generation of submissions in Sequencescape
class SequencescapeSubmissionsController < ApplicationController
include SequencescapeSubmissionBehaviour

before_action :check_for_current_user!

def create
create_submission
redirect_back fallback_location: :root
end
end
3 changes: 1 addition & 2 deletions app/helpers/page_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ def state_badge(state)
# <span class="badge badge-primary">10</span>
def count_badge(count, badge_id = nil)
state = case count
when nil then 'secondary'
when 0 then 'secondary'
when nil, 0 then 'secondary'
else 'primary'
end
tag.span(count || '...', class: "badge badge-pill badge-#{state}", id: badge_id)
Expand Down
1 change: 1 addition & 0 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ require('custom-tagged-plate')
// Load simple javscripts
// Tag animations rotates the displayed tag Id in wells with multiple tags
require('plain-javascript/tag-animations')
require('plain-javascript/page-reloader')
Loading

0 comments on commit c402b65

Please sign in to comment.