From 7a7377db4586f08f14afb63b04c852a1051b3801 Mon Sep 17 00:00:00 2001 From: James Glover Date: Fri, 20 May 2016 14:32:00 +0100 Subject: [PATCH 1/2] Enable user serach --- app/controllers/search_controller.rb | 13 +++++++++++++ config/environments/development.rb | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index ef2b34a..a74cf70 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -27,6 +27,19 @@ def stock_plates(search='Find Illumina-C stock plates') ) end + def my_plates(search = 'Find Illumina-C plates for user') + plate_search = api.search.find(Settings.searches[search]) + states = [ 'pending', 'started', 'passed', 'started_fx', 'started_mj', 'qc_complete', 'nx_in_progress'] + + @search_results = plate_search.all( + IlluminaC::Plate, + :state => states, + :user_uuid => current_user_uuid + ) + + render :my_plates + end + def create_or_find params['show-my-plates'] == 'true' ? my_plates : create diff --git a/config/environments/development.rb b/config/environments/development.rb index be11ab1..2d39647 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -26,7 +26,7 @@ config.api_connection_options = ActiveSupport::OrderedOptions.new config.api_connection_options.namespace = 'IlluminaC' config.api_connection_options.url = 'http://localhost:3000/api/1/' - config.api_connection_options.authorisation = 'development' + config.api_connection_options.authorisation = ENV.fetch('AUTHORISATION_TOKEN','development') # Email settings... From 4a1207109c6ab39217a12be0c5ec0cb7436053bf Mon Sep 17 00:00:00 2001 From: James Glover Date: Mon, 23 May 2016 10:40:45 +0100 Subject: [PATCH 2/2] ss459 - Add links back to SS --- app/helpers/application_helper.rb | 9 +++++++++ app/views/plates/_plate_information.html.erb | 2 ++ config/application.rb | 2 ++ config/environments/development.rb | 5 ++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3d8f6e5..ca66450 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -35,4 +35,13 @@ def custom_theme yield 'nonproduction' unless Rails.env == 'production' end + def details_path(labware) + IlluminaCPipeline::Application.config.details_root+labware.uuid + end + + def summary_path(labware) + stock_barcode = labware.stock_plate.barcode.prefix + labware.stock_plate.barcode.number + IlluminaCPipeline::Application.config.summary_root+stock_barcode + end + end diff --git a/app/views/plates/_plate_information.html.erb b/app/views/plates/_plate_information.html.erb index 8f7fba6..0c5c60b 100644 --- a/app/views/plates/_plate_information.html.erb +++ b/app/views/plates/_plate_information.html.erb @@ -10,4 +10,6 @@
  • Input plate barcode <%= useful_barcode(plate.stock_plate.barcode) %>
  • <% end %>
  • Created on <%= plate.created_at.to_formatted_s(:date_created) %> +
  • More details <%= link_to "Details", details_path(plate) %>
  • +
  • Summary <%= link_to "Summary", summary_path(plate) %>
  • diff --git a/config/application.rb b/config/application.rb index 415b0ea..93aab02 100644 --- a/config/application.rb +++ b/config/application.rb @@ -45,6 +45,8 @@ class Application < Rails::Application config.study_uuid = nil config.project_uuid = nil + config.details_root = '#' + config.summary_root = '#' # Allow state_machine to override methods like Object#fail in models StateMachine::Machine.ignore_method_conflicts = true diff --git a/config/environments/development.rb b/config/environments/development.rb index 2d39647..dbc5ffe 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -25,9 +25,12 @@ config.api_connection_options = ActiveSupport::OrderedOptions.new config.api_connection_options.namespace = 'IlluminaC' - config.api_connection_options.url = 'http://localhost:3000/api/1/' + config.api_connection_options.url = ENV.fetch('API_URL','http://localhost:3000/api/1/') config.api_connection_options.authorisation = ENV.fetch('AUTHORISATION_TOKEN','development') + config.details_root = ENV.fetch('DETAILS_ROOT','http://localhost:3000/uuids/') + config.summary_root = ENV.fetch('SUMMARY_ROOT','http://localhost:3000/plate_summaries/') + # Email settings... config.action_mailer.raise_delivery_errors = true