@@ -77,3 +77,8 @@ AWS_ACCESS_KEY="your aws access key" |
||
77 | 77 |
|
78 | 78 |
# Set AWS_SANDBOX to true if you're developing Huginn code. |
79 | 79 |
AWS_SANDBOX=false |
80 |
+ |
|
81 |
+# Use Graphviz for generating diagrams instead of using Google Chart |
|
82 |
+# Tools. Specify a dot(1) command path built with SVG support |
|
83 |
+# enabled. |
|
84 |
+#USE_GRAPHVIZ_DOT=dot |
@@ -14,4 +14,19 @@ module ApplicationHelper |
||
14 | 14 |
link_to '<span class="label label-warning">No</span>'.html_safe, agent_path(agent, :tab => (agent.recent_error_logs? ? 'logs' : 'details')) |
15 | 15 |
end |
16 | 16 |
end |
17 |
+ |
|
18 |
+ def render_dot(dot_format_string) |
|
19 |
+ if (command = ENV['USE_GRAPHVIZ_DOT']) && |
|
20 |
+ (svg = IO.popen([command, *%w[-Tsvg -q1 -o/dev/stdout /dev/stdin]], 'w+') { |dot| |
|
21 |
+ dot.print dot_format_string |
|
22 |
+ dot.close_write |
|
23 |
+ dot.read |
|
24 |
+ } rescue false) |
|
25 |
+ svg.html_safe |
|
26 |
+ else |
|
27 |
+ tag('img', src: URI('https://chart.googleapis.com/chart').tap { |uri| |
|
28 |
+ uri.query = URI.encode_www_form(cht: 'gv', chl: dot_format_string) |
|
29 |
+ }) |
|
30 |
+ end |
|
31 |
+ end |
|
17 | 32 |
end |
@@ -19,8 +19,7 @@ |
||
19 | 19 |
end |
20 | 20 |
dot_format_string = dot_format_string + "}" |
21 | 21 |
%> |
22 |
- |
|
23 |
- <img src="https://chart.googleapis.com/chart?cht=gv&chl=<%= CGI::escape dot_format_string %>" /> |
|
22 |
+ <%= render_dot(dot_format_string) %> |
|
24 | 23 |
</div> |
25 | 24 |
</div> |
26 | 25 |
</div> |