Skip to content

fix #858 #2286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions qiita_pet/handlers/artifact_handlers/base_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand All @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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',
Expand Down
9 changes: 8 additions & 1 deletion qiita_pet/templates/artifact_ajax/artifact_summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
</script>
<div class='row'>
Expand All @@ -104,7 +107,11 @@ <h4>
<i id='summary-title'>{{name}}</i><i> (ID: {{artifact_id}}) Visibility: {{visibility}}</i>
{% if editable %}
<a class="btn btn-default btn-sm" data-toggle="modal" data-target="#update-artifact-name"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
<a class="btn btn-default btn-sm" onclick="load_process_artifact_ui({{artifact_id}});"><span class="glyphicon glyphicon-play"></span> Process</a>
{% if artifact_type == 'BIOM' %}
<a class="btn btn-default btn-sm" onclick="send_samples_to_analysis(this, [{{artifact_id}}]);"> Add to analysis</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this display any indicator that the samples have been added to a study, like in the study list page?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it uses the same code so it looks exactly the same!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

{% else %}
<a class="btn btn-default btn-sm" onclick="load_process_artifact_ui({{artifact_id}});"><span class="glyphicon glyphicon-play"></span> Process</a>
{% end %}
<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>
{% raw buttons %}
{% end %}
Expand Down