Skip to content

Commit

Permalink
fix some older arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHuynh333 committed Jan 6, 2025
1 parent 0962c31 commit e7e565b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 12 deletions.
6 changes: 4 additions & 2 deletions app/components/nextflow/samplesheet/column_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ module Nextflow
module Samplesheet
# Renders a column in the sample sheet table
class ColumnComponent < Component
attr_reader :header, :property, :samples, :workflow_params
attr_reader :namespace_id, :header, :property, :samples, :workflow_params

# rubocop:disable Metrics/ParameterLists
def initialize(header:, property:, samples:, metadata_fields:, required_properties:, workflow_params:)
def initialize(namespace_id:, header:, property:, samples:, metadata_fields:, required_properties:,
workflow_params:)
@namespace_id = namespace_id
@header = header
@property = property
@samples = samples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
value= <%= @selected[:global_id]%>
>
<% end %>
<%= @selected.empty? ? t(".select_attachment") : @selected[:filename] %>
<%= @selected.empty? ? t(".select_file") : @selected[:filename] %>
</div>
<% end %>
1 change: 1 addition & 0 deletions app/components/nextflow/samplesheet_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
>
<% properties.each do |header, property| %>
<%= render Nextflow::Samplesheet::ColumnComponent.new(
namespace_id:,
header:,
property:,
samples: @samples,
Expand Down
2 changes: 1 addition & 1 deletion app/components/nextflow/samplesheet_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Nextflow
# Render the contents of a Nextflow samplesheet to a table
class SamplesheetComponent < Component
attr_reader :properties, :samples, :required_properties, :metadata_fields, :workflow_params
attr_reader :properties, :samples, :required_properties, :metadata_fields, :namespace_id, :workflow_params

FILE_CELL_TYPES = %w[fastq_cell file_cell].freeze

Expand Down
7 changes: 5 additions & 2 deletions app/controllers/file_selector_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def create

def file_selector_params
params.require(:file_selector).permit(
:attachable, :index, :property, :selected_id, :file_type, required_properties: [], file_selector_arguments: [:pattern, workflow_params: [:name, :version]]
:attachable, :index, :property, :selected_id, :file_type, required_properties: [],
file_selector_arguments: [:pattern, workflow_params: [:name, :version]]

Check warning on line 28 in app/controllers/file_selector_controller.rb

View workflow job for this annotation

GitHub Actions / runner / rubocop

[rubocop] reported by reviewdog 🐶 Align the keys of a hash literal if they span more than one line. Raw Output: app/controllers/file_selector_controller.rb:28:7: C: Layout/HashAlignment: Align the keys of a hash literal if they span more than one line.

Check warning on line 28 in app/controllers/file_selector_controller.rb

View workflow job for this annotation

GitHub Actions / runner / rubocop

[rubocop] reported by reviewdog 🐶 Wrap hash in `{` and `}`. Raw Output: app/controllers/file_selector_controller.rb:28:43: C: Style/HashAsLastArrayItem: Wrap hash in `{` and `}`.
)
end

Expand All @@ -49,14 +50,16 @@ def attachable
def attachments
@attachment_params = {}
return if params[:attachment_id] == 'no_attachment'

attachment = Attachment.find(params[:attachment_id])
@attachment_params = { filename: attachment.file.filename.to_s,
global_id: attachment.to_global_id,
id: attachment.id,
byte_size: attachment.byte_size,
created_at: attachment.created_at
}
return unless attachment.associated_attachment && (file_selector_params["property"] == 'fastq_1' || file_selector_params["property"] == 'fastq_2')
return unless attachment.associated_attachment &&
(file_selector_params["property"] == 'fastq_1' || file_selector_params["property"] == 'fastq_2')

assign_associated_attachment_params(attachment)
end
Expand Down
3 changes: 1 addition & 2 deletions app/models/sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ def sort_files

def samplesheet_fastq_files(property, workflow_params)
direction = get_fastq_direction(property)
pattern = Irida::Pipelines.instance.find_pipeline_by(workflow_params[:name], workflow_params[:version])
.property_pattern(property)
pattern = Irida::Pipelines.instance.find_pipeline_by(workflow_params[:name], workflow_params[:version]).property_pattern(property)
singles = filter_files_by_pattern(sorted_files[:singles] || [],
pattern || "/^\S+.f(ast)?q(.gz)?$/")
files = []
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ en:
default: "%{label} (default)"
required: Required
file_cell_component:
select_attachment: Select Attachment
select_file: Select File
samplesheet_component:
attachments_error: The highlighted file cells below require a selection.
label: Samples
Expand Down
2 changes: 2 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,8 @@ fr:
column_component:
default: "%{label} (default)"
required: Required
file_cell_component:
select_file: Select File
samplesheet_component:
attachments_error: The highlighted file cells below require a selection.
label: Samples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
schema:
JSON.parse(
File.read(
Rails.root.join("test", "fixtures", "files", "nextflow", schema_file)
)
Rails.root.join("test", "fixtures", "files", "nextflow", schema_file),
),
),
samples:,
fields:,
namespace_id: "SDFSDFSDF"
namespace_id: "SDFSDFSDF",
workflow_params: {
name: "workflow-name",
version: "workflow-version",
},
) %>

0 comments on commit e7e565b

Please sign in to comment.