diff --git a/qiita_pet/handlers/artifact_handlers/base_handlers.py b/qiita_pet/handlers/artifact_handlers/base_handlers.py index 2dcf0495f..0a5ef957c 100644 --- a/qiita_pet/handlers/artifact_handlers/base_handlers.py +++ b/qiita_pet/handlers/artifact_handlers/base_handlers.py @@ -86,6 +86,7 @@ def artifact_summary_get_request(user, artifact_id): """ artifact_id = int(artifact_id) artifact = Artifact(artifact_id) + artifact_type = artifact.artifact_type check_artifact_access(user, artifact) @@ -113,7 +114,7 @@ def artifact_summary_get_request(user, artifact_id): summary = relpath(summary[1], qiita_config.base_data_dir) else: # Check if the summary is being generated - command = Command.get_html_generator(artifact.artifact_type) + command = Command.get_html_generator(artifact_type) all_jobs = set(artifact.jobs(cmd=command)) jobs = [j for j in all_jobs if j.status in ['queued', 'running']] errored_jobs = [(j.id, j.log.msg) @@ -192,8 +193,8 @@ def artifact_summary_get_request(user, artifact_id): # TODO: https://github.com/biocore/qiita/issues/1724 Remove this hardcoded # values to actually get the information from the database once it stores # the information - if artifact.artifact_type in ['SFF', 'FASTQ', 'FASTA', 'FASTA_Sanger', - 'per_sample_FASTQ']: + if artifact_type in ['SFF', 'FASTQ', 'FASTA', 'FASTA_Sanger', + 'per_sample_FASTQ']: # If the artifact is one of the "raw" types, only the owner of the # study and users that has been shared with can see the files if not artifact.study.has_access(user, no_public=True): @@ -205,6 +206,7 @@ def artifact_summary_get_request(user, artifact_id): return {'name': artifact.name, 'artifact_id': artifact_id, + 'artifact_type': artifact_type, 'visibility': visibility, 'editable': editable, 'buttons': ' '.join(buttons), diff --git a/qiita_pet/handlers/artifact_handlers/tests/test_base_handlers.py b/qiita_pet/handlers/artifact_handlers/tests/test_base_handlers.py index c1e420201..826486f0b 100644 --- a/qiita_pet/handlers/artifact_handlers/tests/test_base_handlers.py +++ b/qiita_pet/handlers/artifact_handlers/tests/test_base_handlers.py @@ -91,6 +91,7 @@ def test_artifact_summary_get_request(self): (2L, '1_s_G1_L001_sequences_barcodes.fastq.gz (raw barcodes)')] exp = {'name': 'Raw data 1', 'artifact_id': 1, + 'artifact_type': 'FASTQ', 'artifact_timestamp': '2012-10-01 09:10', 'visibility': 'private', 'editable': True, @@ -120,6 +121,7 @@ def test_artifact_summary_get_request(self): obs = artifact_summary_get_request(user, 1) exp = {'name': 'Raw data 1', 'artifact_id': 1, + 'artifact_type': 'FASTQ', 'artifact_timestamp': '2012-10-01 09:10', 'visibility': 'private', 'editable': True, @@ -156,6 +158,7 @@ def test_artifact_summary_get_request(self): obs = artifact_summary_get_request(user, 1) exp = {'name': 'Raw data 1', 'artifact_id': 1, + 'artifact_type': 'FASTQ', 'artifact_timestamp': '2012-10-01 09:10', 'visibility': 'private', 'editable': True, @@ -186,6 +189,7 @@ def test_artifact_summary_get_request(self): obs = artifact_summary_get_request(demo_u, 1) exp = {'name': 'Raw data 1', 'artifact_id': 1, + 'artifact_type': 'FASTQ', 'artifact_timestamp': '2012-10-01 09:10', 'visibility': 'public', 'editable': False, @@ -213,6 +217,7 @@ def test_artifact_summary_get_request(self): (5L, '1_seqs.demux (preprocessed demux)')] exp = {'name': 'Demultiplexed 1', 'artifact_id': 2, + 'artifact_type': 'Demultiplexed', 'artifact_timestamp': '2012-10-01 10:10', 'visibility': 'private', 'editable': True, @@ -249,6 +254,7 @@ def test_artifact_summary_get_request(self): obs = artifact_summary_get_request(user, 8) exp = {'name': 'noname', 'artifact_id': 8, + 'artifact_type': 'BIOM', # this value changes on build so copy from obs 'artifact_timestamp': obs['artifact_timestamp'], 'visibility': 'sandbox', diff --git a/qiita_pet/templates/artifact_ajax/artifact_summary.html b/qiita_pet/templates/artifact_ajax/artifact_summary.html index 8d6cb655d..717a6726d 100644 --- a/qiita_pet/templates/artifact_ajax/artifact_summary.html +++ b/qiita_pet/templates/artifact_ajax/artifact_summary.html @@ -96,6 +96,9 @@ $('#update-artifact-name').on('shown.bs.modal', function() { $('#new-artifact-name').focus(); }); + + qiita_websocket.init(window.location.host + '{% raw qiita_config.portal_dir %}/study/list/socket/', error, error); + qiita_websocket.add_callback('sel', show_alert); });