Skip to content

Fixing network labels #2376

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 2 commits into from
Oct 26, 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
2 changes: 1 addition & 1 deletion qiita_pet/handlers/analysis_handlers/base_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def analyisis_graph_handler_get_request(analysis_id, user):
# graph
continue
else:
name = '%s - %s' % (obj.name, obj.artifact_type)
name = '%s\n(%s)' % (obj.name, obj.artifact_type)
nodes.add((obj_type, obj.id, name))

edges.update({(s[1].id, t[1].id) for s, t in g.edges()})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def test_analyisis_graph_handler_get_request(self):
job_id = Analysis(1).artifacts[0].jobs()[0].id
exp = {'edges': [(8, job_id), (job_id, 9)],
'nodes': [('job', job_id, 'Single Rarefaction'),
('artifact', 9, 'noname - BIOM'),
('artifact', 8, 'noname - BIOM')]}
('artifact', 9, 'noname\n(BIOM)'),
('artifact', 8, 'noname\n(BIOM)')]}
self.assertItemsEqual(obs, exp)
self.assertItemsEqual(obs['edges'], exp['edges'])
self.assertItemsEqual(obs['nodes'], exp['nodes'])
Expand Down Expand Up @@ -126,8 +126,8 @@ def test_get_analysis_graph_handler(self):
obs = loads(response.body)
exp = {'edges': [[8, job_id], [job_id, 9]],
'nodes': [['job', job_id, 'Single Rarefaction'],
['artifact', 9, 'noname - BIOM'],
['artifact', 8, 'noname - BIOM']]}
['artifact', 9, 'noname\n(BIOM)'],
['artifact', 8, 'noname\n(BIOM)']]}
self.assertItemsEqual(obs, exp)
self.assertItemsEqual(obs['edges'], exp['edges'])
self.assertItemsEqual(obs['nodes'], exp['nodes'])
Expand Down
2 changes: 1 addition & 1 deletion qiita_pet/handlers/api_proxy/prep_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def prep_template_graph_get_req(prep_id, user_id):
name = n[1].command.name
elif n[0] == 'artifact':
if full_access or n[1].visibility == 'public':
name = '%s - %s' % (n[1].name, n[1].artifact_type)
name = '%s\n(%s)' % (n[1].name, n[1].artifact_type)
else:
continue
node_labels.append((n[0], n[1].id, name))
Expand Down
18 changes: 9 additions & 9 deletions qiita_pet/handlers/api_proxy/tests/test_prep_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,17 @@ def test_prep_template_graph_get_req(self):
self.assertEqual(obs['message'], '')
self.assertEqual(obs['status'], 'success')
self.assertEqual(11, len(obs['node_labels']))
self.assertIn(('artifact', 1, 'Raw data 1 - FASTQ'),
self.assertIn(('artifact', 1, 'Raw data 1\n(FASTQ)'),
obs['node_labels'])
self.assertIn(('artifact', 2, 'Demultiplexed 1 - Demultiplexed'),
self.assertIn(('artifact', 2, 'Demultiplexed 1\n(Demultiplexed)'),
obs['node_labels'])
self.assertIn(('artifact', 3, 'Demultiplexed 2 - Demultiplexed'),
self.assertIn(('artifact', 3, 'Demultiplexed 2\n(Demultiplexed)'),
obs['node_labels'])
self.assertIn(('artifact', 4, 'BIOM - BIOM'),
self.assertIn(('artifact', 4, 'BIOM\n(BIOM)'),
obs['node_labels'])
self.assertIn(('artifact', 5, 'BIOM - BIOM'),
self.assertIn(('artifact', 5, 'BIOM\n(BIOM)'),
obs['node_labels'])
self.assertIn(('artifact', 6, 'BIOM - BIOM'),
self.assertIn(('artifact', 6, 'BIOM\n(BIOM)'),
obs['node_labels'])
self.assertEqual(3, len([n for dt, _, n in obs['node_labels']
if n == 'Pick closed-reference OTUs' and
Expand All @@ -332,11 +332,11 @@ def test_prep_template_graph_get_req(self):
self.assertEqual(obs['message'], '')
self.assertEqual(obs['status'], 'success')
self.assertEqual(11, len(obs['node_labels']))
self.assertIn(('artifact', 1, 'Raw data 1 - FASTQ'),
self.assertIn(('artifact', 1, 'Raw data 1\n(FASTQ)'),
obs['node_labels'])
self.assertIn(('artifact', 2, 'Demultiplexed 1 - Demultiplexed'),
self.assertIn(('artifact', 2, 'Demultiplexed 1\n(Demultiplexed)'),
obs['node_labels'])
self.assertIn(('artifact', 4, 'BIOM - BIOM'), obs['node_labels'])
self.assertIn(('artifact', 4, 'BIOM\n(BIOM)'), obs['node_labels'])
self.assertEqual(3, len([n for dt, _, n in obs['node_labels']
if n == 'Pick closed-reference OTUs' and
dt == 'job']))
Expand Down
12 changes: 6 additions & 6 deletions qiita_pet/handlers/study_handlers/tests/test_prep_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ def test_get(self):
self.assertEqual(obs['status'], 'success')

self.assertEqual(11, len(obs['node_labels']))
self.assertIn(['artifact', 1, 'Raw data 1 - FASTQ'],
self.assertIn(['artifact', 1, 'Raw data 1\n(FASTQ)'],
obs['node_labels'])
self.assertIn(['artifact', 2, 'Demultiplexed 1 - Demultiplexed'],
self.assertIn(['artifact', 2, 'Demultiplexed 1\n(Demultiplexed)'],
obs['node_labels'])
self.assertIn(['artifact', 3, 'Demultiplexed 2 - Demultiplexed'],
self.assertIn(['artifact', 3, 'Demultiplexed 2\n(Demultiplexed)'],
obs['node_labels'])
self.assertIn(['artifact', 4, 'BIOM - BIOM'],
self.assertIn(['artifact', 4, 'BIOM\n(BIOM)'],
obs['node_labels'])
self.assertIn(['artifact', 5, 'BIOM - BIOM'],
self.assertIn(['artifact', 5, 'BIOM\n(BIOM)'],
obs['node_labels'])
self.assertIn(['artifact', 6, 'BIOM - BIOM'],
self.assertIn(['artifact', 6, 'BIOM\n(BIOM)'],
obs['node_labels'])
self.assertEqual(3, len([n for dt, _, n in obs['node_labels']
if n == 'Pick closed-reference OTUs' and
Expand Down
4 changes: 2 additions & 2 deletions qiita_pet/templates/artifact_ajax/processing_artifact.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<script type="text/javascript">
var processing_network;
var nodes = new vis.DataSet([{id: {{artifact_id}}, label: "{{name}} - ({{type}})", group: "type", name: "{{name}}", type: "{{type}}"}]);
var nodes = new vis.DataSet([{id: {{artifact_id}}, label: "{{name}}\n({{type}})", group: "type", name: "{{name}}", type: "{{type}}"}]);
var edges = new vis.DataSet();

/*
Expand Down Expand Up @@ -87,7 +87,7 @@
var out_type = this[1];
var n_id = job_info.id + ":" + out_name;
edges.add({id: edges.length + 1, from: job_info.id, to: n_id });
nodes.add({id: n_id, label: out_name + " - (" + out_type + ")", group: "type", name: out_name, type: out_type});
nodes.add({id: n_id, label: out_name + "\n(" + out_type + ")", group: "type", name: out_name, type: out_type});
});
processing_network.redraw();
}
Expand Down