mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
Merge pull request #3130 from okriuchykhin/ok_SCI_5458
Improve visibility of experiment workflow image [SCI-5458]
This commit is contained in:
commit
dd9d75a643
2 changed files with 27 additions and 16 deletions
|
@ -368,7 +368,7 @@ GEM
|
|||
minitest (5.14.3)
|
||||
momentjs-rails (2.17.1)
|
||||
railties (>= 3.1)
|
||||
msgpack (1.4.1)
|
||||
msgpack (1.4.2)
|
||||
multi_json (1.15.0)
|
||||
multi_test (0.1.2)
|
||||
multi_xml (0.6.0)
|
||||
|
|
|
@ -9,17 +9,28 @@ module Experiments
|
|||
|
||||
def initialize(experiment:)
|
||||
@exp = experiment
|
||||
@graph = GraphViz.new(:G, type: :digraph, use: :neato)
|
||||
|
||||
@graph[:size] = '4,4'
|
||||
@graph.node[color: Constants::COLOR_ALTO,
|
||||
graph_params = {
|
||||
type: :digraph,
|
||||
use: :neato,
|
||||
inputscale: 3,
|
||||
size: '2,2',
|
||||
pad: '0.4',
|
||||
ratio: 'fill',
|
||||
splines: true,
|
||||
center: true,
|
||||
pack: true,
|
||||
bgcolor: Constants::COLOR_CONCRETE,
|
||||
mode: 'ipsep'
|
||||
}
|
||||
@graph = GraphViz.new(:G, graph_params)
|
||||
@graph.node[color: Constants::COLOR_VOLCANO,
|
||||
style: :filled,
|
||||
fontcolor: Constants::COLOR_VOLCANO,
|
||||
shape: 'circle',
|
||||
fontname: 'Arial',
|
||||
fontsize: '16.0']
|
||||
|
||||
@graph.edge[color: Constants::COLOR_ALTO]
|
||||
@graph.edge[color: Constants::COLOR_VOLCANO, penwidth: '3.0']
|
||||
@errors = []
|
||||
end
|
||||
|
||||
|
@ -36,20 +47,11 @@ module Experiments
|
|||
private
|
||||
|
||||
def draw_diagram
|
||||
# Draw orphan nodes
|
||||
@exp.my_modules.without_group.each do |my_module|
|
||||
@graph.subgraph(rank: 'same').add_nodes(
|
||||
"Orphan-#{my_module.id}",
|
||||
label: '',
|
||||
pos: "#{my_module.x / 10},-#{my_module.y / 10}!"
|
||||
)
|
||||
end
|
||||
|
||||
# Draw grouped modules
|
||||
subg = {}
|
||||
@exp.my_module_groups.each_with_index do |group, gindex|
|
||||
subgraph_id = "cluster-#{gindex}"
|
||||
subg[subgraph_id] = @graph.subgraph(rank: 'same')
|
||||
subg[subgraph_id] = @graph.subgraph
|
||||
nodes = {}
|
||||
|
||||
group.my_modules.workflow_ordered.each_with_index do |my_module, index|
|
||||
|
@ -71,6 +73,15 @@ module Experiments
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Draw orphan nodes
|
||||
@exp.my_modules.without_group.each do |my_module|
|
||||
@graph.subgraph.add_nodes(
|
||||
"Orphan-#{my_module.id}",
|
||||
label: '',
|
||||
pos: "#{my_module.x / 10},-#{my_module.y / 10}!"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def save_file
|
||||
|
|
Loading…
Reference in a new issue