Commit 44eb4c64 authored by Ryan Herbert's avatar Ryan Herbert

Merge branch 'hotfix-s/3213-edit-with-preprocess' into 'dev'

Resolve "Éditer un sample qui possède un pre-process empêche de relancer une analyse dessus"

Closes #3213

See merge request !216
parents db26a998 81dce337
Pipeline #30153 passed with stages
in 6 minutes and 6 seconds
......@@ -236,6 +236,10 @@ def submit():
reupload = True
fid = int(f["id"])
sequence_file = db.sequence_file[fid]
if f['filename'] == '':
# If we don't reupload a new file
db.sequence_file[fid] = file_data
#remove previous membership
db( db.sample_set_membership.sequence_file_id == fid).delete()
......@@ -298,6 +302,10 @@ def submit():
def form_response(data):
source_module_active = hasattr(defs, 'FILE_SOURCE') and hasattr(defs, 'FILE_TYPES')
network_source = source_module_active and (data['action'] != 'edit' \
or len(data['file']) == 0 \
or data['file'][0].network)
# should be true only when we want to use the network view
response.view = 'file/form.html'
upload_group_ids = [int(gid) for gid in get_upload_group_ids(auth)]
group_ids = get_involved_groups()
......@@ -309,6 +317,7 @@ def form_response(data):
sample_type = data['sample_type'],
errors = data['errors'],
source_module_active = source_module_active,
network_source = network_source,
group_ids = group_ids,
upload_group_ids = upload_group_ids,
isEditing = data['action']=='edit')
......@@ -7,22 +7,26 @@
<h3>Add samples</h3>
{{ pass }}
{{ required_files = 1 }}
{{ if source_module_active: }}
<span>file source: </span>
<label for="source_computer">my computer</label>
<input type="radio" id="source_computer" name="source" value="computer" onchange="db.toggle_file_source()"/>
<input type="radio" id="source_computer" name="source" value="computer" onchange="db.toggle_file_source()" {{ if not network_source: }} checked="checked" {{pass}}/>
<label for="source_nfs">network</label>
<input type="radio" id="source_nfs" name="source" value="nfs" onchange="db.toggle_file_source()" checked="checked" />
<input type="radio" id="source_nfs" name="source" value="nfs" onchange="db.toggle_file_source()" {{if network_source:}} checked="checked" {{pass}} />
<div {{if source_module_active:}} hidden {{pass}}>
<div {{if network_source:}} hidden {{pass}}>
<h3>Pre-process scenario</h3>
If you have two R1/R2 files per sample, please select an appropriate pre-process :
<select id="pre_process" name="pre_process" onChange="db.pre_process_onChange(this)" {{if source_module_active:}} disabled {{pass}}>
<select id="pre_process" name="pre_process" onChange="db.pre_process_onChange(this)" {{if network_source:}} disabled {{pass}}>
<option required_files="1" value="0">no pre-process (1 file per sample)</option>
{{for row in pre_process_list :}}
<option title="{{=row["info"]}}" required_files="{{=row["file"]}}" value="{{=row["id"]}}"
{{if 'file_id' in request.vars and row["id"]==files[0].pre_process_id :}}selected{{pass}}>
{{if 'file_id' in request.vars and row["id"]==files[0].pre_process_id :}}
{{ required_files=row["file"]}}
{{=row["id"]}} &ndash; {{=row["name"]}}
......@@ -15,18 +15,18 @@
<div class="field_div">
<div id="file_field_1_{{=i}}" class="field_div file_1" {{if source_module_active:}} style="display: none" {{pass}}>
<div id="file_field_1_{{=i}}" class="field_div file_1" {{if network_source:}} style="display: none" {{pass}}>
<input class="upload_field form-control" id="file_upload_1_{{=i}}" type="file"
{{if source_module_active:}}
{{if network_source:}}
onchange="db.upload_file_onChange('file_filename_{{=i}}', this.value)"
title="first file for this sample (.fa, .fastq, .fa.gz, .fastq.gz, .clntab)"
<div id="file_2_{{=i}}" class="field_div file_2" style="display: none">
<div id="file_2_{{=i}}" class="field_div file_2" {{if required_files < 2:}}style="display: none"{{pass}}>
<input class="upload_field form-control" id="file_upload_2_{{=i}}" type="file"
{{if source_module_active:}}
{{if network_source:}}
title="second file for this sample (.fa, .fastq, .fa.gz, .fastq.gz)"
......@@ -34,7 +34,7 @@
<div id="jstree_field_{{=i}}"
class="field_div jstree_field form-control"
{{if not source_module_active:}} style="display: none;" {{pass}}
{{if not network_source:}} hidden {{pass}}
<span class="button2">browse</span>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment