Skip to content

Commit 955d5cd

Browse files
antgonzaElDeveloper
authored andcommitted
fix #858 (#2286)
1 parent 9e1c1b5 commit 955d5cd

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

qiita_pet/handlers/artifact_handlers/base_handlers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def artifact_summary_get_request(user, artifact_id):
8686
"""
8787
artifact_id = int(artifact_id)
8888
artifact = Artifact(artifact_id)
89+
artifact_type = artifact.artifact_type
8990

9091
check_artifact_access(user, artifact)
9192

@@ -113,7 +114,7 @@ def artifact_summary_get_request(user, artifact_id):
113114
summary = relpath(summary[1], qiita_config.base_data_dir)
114115
else:
115116
# Check if the summary is being generated
116-
command = Command.get_html_generator(artifact.artifact_type)
117+
command = Command.get_html_generator(artifact_type)
117118
all_jobs = set(artifact.jobs(cmd=command))
118119
jobs = [j for j in all_jobs if j.status in ['queued', 'running']]
119120
errored_jobs = [(j.id, j.log.msg)
@@ -192,8 +193,8 @@ def artifact_summary_get_request(user, artifact_id):
192193
# TODO: https://github.com/biocore/qiita/issues/1724 Remove this hardcoded
193194
# values to actually get the information from the database once it stores
194195
# the information
195-
if artifact.artifact_type in ['SFF', 'FASTQ', 'FASTA', 'FASTA_Sanger',
196-
'per_sample_FASTQ']:
196+
if artifact_type in ['SFF', 'FASTQ', 'FASTA', 'FASTA_Sanger',
197+
'per_sample_FASTQ']:
197198
# If the artifact is one of the "raw" types, only the owner of the
198199
# study and users that has been shared with can see the files
199200
if not artifact.study.has_access(user, no_public=True):
@@ -205,6 +206,7 @@ def artifact_summary_get_request(user, artifact_id):
205206

206207
return {'name': artifact.name,
207208
'artifact_id': artifact_id,
209+
'artifact_type': artifact_type,
208210
'visibility': visibility,
209211
'editable': editable,
210212
'buttons': ' '.join(buttons),

qiita_pet/handlers/artifact_handlers/tests/test_base_handlers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def test_artifact_summary_get_request(self):
9191
(2L, '1_s_G1_L001_sequences_barcodes.fastq.gz (raw barcodes)')]
9292
exp = {'name': 'Raw data 1',
9393
'artifact_id': 1,
94+
'artifact_type': 'FASTQ',
9495
'artifact_timestamp': '2012-10-01 09:10',
9596
'visibility': 'private',
9697
'editable': True,
@@ -120,6 +121,7 @@ def test_artifact_summary_get_request(self):
120121
obs = artifact_summary_get_request(user, 1)
121122
exp = {'name': 'Raw data 1',
122123
'artifact_id': 1,
124+
'artifact_type': 'FASTQ',
123125
'artifact_timestamp': '2012-10-01 09:10',
124126
'visibility': 'private',
125127
'editable': True,
@@ -156,6 +158,7 @@ def test_artifact_summary_get_request(self):
156158
obs = artifact_summary_get_request(user, 1)
157159
exp = {'name': 'Raw data 1',
158160
'artifact_id': 1,
161+
'artifact_type': 'FASTQ',
159162
'artifact_timestamp': '2012-10-01 09:10',
160163
'visibility': 'private',
161164
'editable': True,
@@ -186,6 +189,7 @@ def test_artifact_summary_get_request(self):
186189
obs = artifact_summary_get_request(demo_u, 1)
187190
exp = {'name': 'Raw data 1',
188191
'artifact_id': 1,
192+
'artifact_type': 'FASTQ',
189193
'artifact_timestamp': '2012-10-01 09:10',
190194
'visibility': 'public',
191195
'editable': False,
@@ -213,6 +217,7 @@ def test_artifact_summary_get_request(self):
213217
(5L, '1_seqs.demux (preprocessed demux)')]
214218
exp = {'name': 'Demultiplexed 1',
215219
'artifact_id': 2,
220+
'artifact_type': 'Demultiplexed',
216221
'artifact_timestamp': '2012-10-01 10:10',
217222
'visibility': 'private',
218223
'editable': True,
@@ -249,6 +254,7 @@ def test_artifact_summary_get_request(self):
249254
obs = artifact_summary_get_request(user, 8)
250255
exp = {'name': 'noname',
251256
'artifact_id': 8,
257+
'artifact_type': 'BIOM',
252258
# this value changes on build so copy from obs
253259
'artifact_timestamp': obs['artifact_timestamp'],
254260
'visibility': 'sandbox',

qiita_pet/templates/artifact_ajax/artifact_summary.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@
9696
$('#update-artifact-name').on('shown.bs.modal', function() {
9797
$('#new-artifact-name').focus();
9898
});
99+
100+
qiita_websocket.init(window.location.host + '{% raw qiita_config.portal_dir %}/study/list/socket/', error, error);
101+
qiita_websocket.add_callback('sel', show_alert);
99102
});
100103
</script>
101104
<div class='row'>
@@ -104,7 +107,11 @@ <h4>
104107
<i id='summary-title'>{{name}}</i><i> (ID: {{artifact_id}}) Visibility: {{visibility}}</i>
105108
{% if editable %}
106109
<a class="btn btn-default btn-sm" data-toggle="modal" data-target="#update-artifact-name"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
107-
<a class="btn btn-default btn-sm" onclick="load_process_artifact_ui({{artifact_id}});"><span class="glyphicon glyphicon-play"></span> Process</a>
110+
{% if artifact_type == 'BIOM' %}
111+
<a class="btn btn-default btn-sm" onclick="send_samples_to_analysis(this, [{{artifact_id}}]);"> Add to analysis</a>
112+
{% else %}
113+
<a class="btn btn-default btn-sm" onclick="load_process_artifact_ui({{artifact_id}});"><span class="glyphicon glyphicon-play"></span> Process</a>
114+
{% end %}
108115
<a class="btn btn-danger btn-sm" onclick="if (confirm('Are you sure you want to delete artifact {{artifact_id}}?')){ delete_artifact({{artifact_id}}) };"><span class="glyphicon glyphicon-trash"></span> Delete</a>
109116
{% raw buttons %}
110117
{% end %}

0 commit comments

Comments
 (0)