mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-06 06:56:54 +08:00
Merge pull request #65 from ZmagoD/zd_SCI_329
Adds single tasks to the experiment img [fixes SCI-329]
This commit is contained in:
commit
052279a459
1 changed files with 23 additions and 10 deletions
|
@ -210,7 +210,7 @@ class Experiment < ActiveRecord::Base
|
||||||
type: :digraph,
|
type: :digraph,
|
||||||
use: :neato)
|
use: :neato)
|
||||||
|
|
||||||
graph[:size] = '5,3'
|
graph[:size] = '4,4'
|
||||||
graph.node[color: '#d2d2d2',
|
graph.node[color: '#d2d2d2',
|
||||||
style: :filled,
|
style: :filled,
|
||||||
fontcolor: '#555555',
|
fontcolor: '#555555',
|
||||||
|
@ -220,8 +220,21 @@ class Experiment < ActiveRecord::Base
|
||||||
|
|
||||||
graph.edge[color: '#d2d2d2']
|
graph.edge[color: '#d2d2d2']
|
||||||
|
|
||||||
label = 'T'
|
label = ''
|
||||||
subg = {}
|
subg = {}
|
||||||
|
|
||||||
|
# Draw orphan modules
|
||||||
|
if modules_without_group
|
||||||
|
modules_without_group.each do |my_module|
|
||||||
|
graph
|
||||||
|
.subgraph(rank: 'same')
|
||||||
|
.add_nodes("Orphan-#{my_module.id}",
|
||||||
|
label: label,
|
||||||
|
pos: "#{my_module.x / 10},-#{my_module.y / 10}!")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Draw grouped modules
|
||||||
if my_module_groups.many?
|
if my_module_groups.many?
|
||||||
my_module_groups.each_with_index do |group, gindex|
|
my_module_groups.each_with_index do |group, gindex|
|
||||||
subgraph_name = "cluster-#{gindex}"
|
subgraph_name = "cluster-#{gindex}"
|
||||||
|
@ -231,14 +244,14 @@ class Experiment < ActiveRecord::Base
|
||||||
parent = subg[subgraph_name]
|
parent = subg[subgraph_name]
|
||||||
.add_nodes("#{subgraph_name}-#{index}",
|
.add_nodes("#{subgraph_name}-#{index}",
|
||||||
label: label,
|
label: label,
|
||||||
pos: "#{my_module.x},-#{my_module.y}!")
|
pos: "#{my_module.x / 10},-#{my_module.y / 10}!")
|
||||||
|
|
||||||
my_module.outputs.each_with_index do |output, i|
|
my_module.outputs.each_with_index do |output, i|
|
||||||
child_mod = MyModule.find_by_id(output.input_id)
|
child_mod = MyModule.find_by_id(output.input_id)
|
||||||
child_node = subg[subgraph_name]
|
child_node = subg[subgraph_name]
|
||||||
.add_nodes("#{subgraph_name}-O#{child_mod.id}-#{i}",
|
.add_nodes("#{subgraph_name}-O#{child_mod.id}-#{i}",
|
||||||
label: label,
|
label: label,
|
||||||
pos: "#{child_mod.x},-#{child_mod.y}!")
|
pos: "#{child_mod.x / 10},-#{child_mod.y / 10}!")
|
||||||
|
|
||||||
subg[subgraph_name].add_edges(parent, child_node)
|
subg[subgraph_name].add_edges(parent, child_node)
|
||||||
end
|
end
|
||||||
|
@ -246,14 +259,14 @@ class Experiment < ActiveRecord::Base
|
||||||
parent = subg[subgraph_name]
|
parent = subg[subgraph_name]
|
||||||
.add_nodes("#{subgraph_name}-#{index}",
|
.add_nodes("#{subgraph_name}-#{index}",
|
||||||
label: label,
|
label: label,
|
||||||
pos: "#{my_module.x},-#{my_module.y}!")
|
pos: "#{my_module.x / 10},-#{my_module.y / 10}!")
|
||||||
|
|
||||||
my_module.inputs.each_with_index do |input, i|
|
my_module.inputs.each_with_index do |input, i|
|
||||||
child_mod = MyModule.find_by_id(input.output_id)
|
child_mod = MyModule.find_by_id(input.output_id)
|
||||||
child_node = subg[subgraph_name]
|
child_node = subg[subgraph_name]
|
||||||
.add_nodes("#{subgraph_name}-I#{child_mod.id}-#{i}",
|
.add_nodes("#{subgraph_name}-I#{child_mod.id}-#{i}",
|
||||||
label: label,
|
label: label,
|
||||||
pos: "#{child_mod.x},-#{child_mod.y}!")
|
pos: "#{child_mod.x / 10},-#{child_mod.y / 10}!")
|
||||||
|
|
||||||
subg[subgraph_name].add_edges(child_node, parent)
|
subg[subgraph_name].add_edges(child_node, parent)
|
||||||
end
|
end
|
||||||
|
@ -266,26 +279,26 @@ class Experiment < ActiveRecord::Base
|
||||||
if my_module.outputs.any?
|
if my_module.outputs.any?
|
||||||
parent = graph.add_nodes("N-#{index}",
|
parent = graph.add_nodes("N-#{index}",
|
||||||
label: label,
|
label: label,
|
||||||
pos: "#{my_module.x},-#{my_module.y}!")
|
pos: "#{my_module.x / 10},-#{ my_module.y / 10}!")
|
||||||
|
|
||||||
my_module.outputs.each_with_index do |output, i|
|
my_module.outputs.each_with_index do |output, i|
|
||||||
child_mod = MyModule.find_by_id(output.input_id)
|
child_mod = MyModule.find_by_id(output.input_id)
|
||||||
child_node = graph
|
child_node = graph
|
||||||
.add_nodes("N-O#{child_mod.id}-#{i}",
|
.add_nodes("N-O#{child_mod.id}-#{i}",
|
||||||
label: label,
|
label: label,
|
||||||
pos: "#{child_mod.x},-#{child_mod.y}!")
|
pos: "#{child_mod.x / 10},-#{child_mod.y / 10}!")
|
||||||
graph.add_edges(parent, child_node)
|
graph.add_edges(parent, child_node)
|
||||||
end
|
end
|
||||||
elsif my_module.inputs.any?
|
elsif my_module.inputs.any?
|
||||||
parent = graph.add_nodes("N-#{index}",
|
parent = graph.add_nodes("N-#{index}",
|
||||||
label: label,
|
label: label,
|
||||||
pos: "#{my_module.x},-#{my_module.y}!")
|
pos: "#{my_module.x / 10},-#{my_module.y / 10}!")
|
||||||
my_module.inputs.each_with_index do |input, i|
|
my_module.inputs.each_with_index do |input, i|
|
||||||
child_mod = MyModule.find_by_id(input.output_id)
|
child_mod = MyModule.find_by_id(input.output_id)
|
||||||
child_node = graph
|
child_node = graph
|
||||||
.add_nodes("N-I#{child_mod.id}-#{i}",
|
.add_nodes("N-I#{child_mod.id}-#{i}",
|
||||||
label: label,
|
label: label,
|
||||||
pos: "#{child_mod.x},-#{child_mod.y}!")
|
pos: "#{child_mod.x / 10},-#{child_mod.y / 10}!")
|
||||||
graph.add_edges(child_node, parent)
|
graph.add_edges(child_node, parent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue