Commit 7b37473e authored by Ryan Herbert's avatar Ryan Herbert

add success messages to forms

This is in order to display which patients/sets/runs or sequence_files
were successfully created when the form returns an error on one or more
elements.
parent 2515867b
......@@ -222,6 +222,8 @@ def submit():
error = True
continue
f['message'] = []
file_data = dict(sampling_date=f['sampling_date'],
info=f['info'],
pre_process_id=pre_process,
......@@ -245,6 +247,8 @@ def submit():
action = "add"
mes = "file (%d) %s %sed" % (f["id"], f["filename"], action)
f['message'].append(mes)
f['message'].append("You must reselect the file for it to be uploaded")
for key in id_dict:
for sid in id_dict[key]:
group_id = get_set_group(sid)
......
......@@ -446,6 +446,8 @@ def submit():
error = True
continue
p['message'] = []
register = False
reset = False
......@@ -493,6 +495,7 @@ def submit():
error = True
mes = "%s (%s) %s %sed" % (set_type, id_sample_set, name, action)
p['message'].append(mes)
log.info(mes, extra={'user_id': auth.user.id, 'record_id': p['id'], 'table_name': 'patient'})
if register:
register_tags(db, set_type, p["id"], p["info"], group_id, reset=reset)
......
......@@ -3,6 +3,9 @@
{{ if file is not None and 'error' in file and len(file['error']) > 0: }}
<div class="error">error: {{=", ".join(file['error'])}}</div>
{{ pass }}
{{ if file is not None and 'message' in file and len(file['message']) > 0: }}
<div>{{=", ".join(file['message'])}}</div>
{{ pass }}
<div>
<input type="hidden" id="file_filename_{{=i}}" class="filename" name="file[{{=i}}][filename]" type="text" value="">
<input type="hidden" id="file_id_{{=i}}" name="file[{{=i}}][id]"
......
......@@ -5,6 +5,9 @@
{{ if set is not None and 'error' in set and len(set['error']) > 0: }}
<div class="error">error: {{=", ".join(set['error'])}}</div>
{{pass}}
{{ if set is not None and 'message' in set and len(set['message']) > 0: }}
<div>{{=", ".join(set['message'])}}</div>
{{ pass }}
<div class="field_div">
<input id="sample_set_name_{{=i}}" name="generic[{{=i}}][name]" type="text" class="string form-control"
value="{{if set is not None:}}{{=set['name']}}{{pass}}" required placeholder="Name">
......
......@@ -5,6 +5,9 @@
{{ if set is not None and 'error' in set and len(set['error']) > 0: }}
<div class="error">error: {{=", ".join(set['error'])}}</div>
{{ pass }}
{{ if set is not None and 'message' in set and len(set['message']) > 0: }}
<div>{{=", ".join(set['message'])}}</div>
{{ pass }}
<div class="field_div">
<input class="date form-control" id="patient_id_label_{{=i}}" name="patient[{{=i}}][id_label]" type="text"
value="{{if set is not None and set['id_label'] is not None:}}{{=set['id_label']}}{{pass}}" placeholder="Patient ID">
......
......@@ -5,6 +5,9 @@
{{ if set is not None and 'error' in set and len(set['error']) > 0: }}
<div class="error">error: {{=", ".join(set['error'])}}</div>
{{ pass }}
{{ if set is not None and 'message' in set and len(set['message']) > 0: }}
<div>{{=", ".join(set['message'])}}</div>
{{ pass }}
<div class="field_div">
<input class="date" id="run_id_label_{{=i}}" name="run[{{=i}}][id_label]" type="text"
value="{{if set is not None and set['id_label'] is not None:}}{{=set['id_label']}}{{pass}}" placeholder="Run ID"><span></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