Commit c9f96cb1 authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature-sc/3907-require-files' into 'dev'

Files are required to submit new samples

Closes #3907

See merge request !613
parents 37b8182e 6b6cda6e
Pipeline #126384 passed with stages
in 9 minutes and 46 seconds
......@@ -372,8 +372,17 @@ Database.prototype = {
if ($option.attr('required_files') == "1"){
$(".file_2").hide();
$(".upload_file").val("");
$(".upload_field").each(function() {
$(this).prop("required", false);
});
}else{
$(".file_2").show();
if ($(".is_editing").length == 0) {
// Not editing a sample, but creating new ones
$(".upload_field").each(function() {
$(this).prop("required", true);
});
}
}
},
......
......@@ -351,6 +351,8 @@ FileFormBuilder.prototype.build_file_field = function(id, hidden) {
var i = this.build_input('upload_' + id, 'upload_field', 'file'+id, 'file', 'file');
if (this.source) {
i.disabled = true;
} else {
i.required = true;
}
i.title = "(.fa, .fastq, .fa.gz, .fastq.gz, .clntab)";
d.appendChild(i);
......
......@@ -12,6 +12,9 @@
value="{{if 'id' in file:}}{{=file['id']}}{{pass}}" >
<input type="hidden" id="sample_set_id" name="sample_set_id" value="{{if "sample_set_id" in request.vars:}}{{=request.vars["sample_set_id"]}}{{pass}}" >
<input type="hidden" id="sample_type" name="sample_type" value="{{=sample_type}}" />
{{if isEditing:}}
<input type="hidden" id="is_editing" name="is_editing" value="1" />
{{pass}}
</div>
<div class="field_div">
......@@ -19,6 +22,8 @@
<input class="upload_field form-control" id="file_upload_1_{{=i}}" type="file"
{{if network_source:}}
disabled
{{elif not isEditing:}}
required
{{pass}}
onchange="db.upload_file_onChange('file_filename_{{=i}}', this.value)"
title="first file for this sample (.fa, .fastq, .fa.gz, .fastq.gz, .clntab)"
......@@ -28,6 +33,8 @@
<input class="upload_field form-control" id="file_upload_2_{{=i}}" type="file"
{{if network_source:}}
disabled
{{elif not isEditing:}}
required
{{pass}}
title="second file for this sample (.fa, .fastq, .fa.gz, .fastq.gz)"
>
......
......@@ -94,6 +94,7 @@
display: inline-block;" title="running pre_processs"></i>{{pass}}
{{if row.sequence_file.pre_process_flag == "WAIT" :}}[queued]{{pass}}
{{if row.sequence_file.pre_process_flag == "FAILED" :}}[failed] <span class="button" onclick="db.call('file/restart_pre_process', {sequence_file_id: {{=row.sequence_file.id}}})">try again</span>{{pass}}
{{ if has_pre_process and row.sequence_file.pre_process_flag is None and row.sequence_file.data_file2 is None: }}<span title="All the files have not been properly received. Please edit the sample to reupload them.">[missing file]</span>{{pass}}
{{if row.sequence_file.pre_process_id != None :}} {{=pre_process_list[row.sequence_file.pre_process_id]}} {{pass}}
</td>
{{if auth.is_admin():}}
......@@ -136,7 +137,7 @@
<td></td><td></td><td></td><td></td>
{{pass}}
<td>
{{if row.sequence_file.data_file != None and ( row.results_file.id == None or ( status != "RUNNING" and status != "QUEUED" and status != "ASSIGNED") ):}}
{{if row.sequence_file.data_file != None and ( row.results_file.id == None or ( status != "RUNNING" and status != "QUEUED" and status != "ASSIGNED") ) and (not has_pre_process or row.sequence_file.pre_process_flag in ("COMPLETED", "FAILED")) :}}
{{if auth.can_process_sample_set(request.vars['id']) and (config_id > 0 and auth.can_use_config(config_id)) :}}
<span class="pointer" onclick="db.call('default/run_request', { 'sequence_file_id' : '{{=row.sequence_file.id}}', 'sample_set_id' : {{=request.vars["id"]}}, 'config_id' : {{=config_id}} } )"><i class="icon-cog-2" title="Run the selected configuration for this file"></i></span>
{{pass}}
......
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