[Ovirt-devel] [PATCH server] Add fallback message when flexchart is missing
Jason Guiditta
jguiditt at redhat.com
Fri Jul 24 20:17:53 UTC 2009
On Fri, 2009-07-24 at 14:50 -0500, Steve Linabery wrote:
> Check filesystem to see if flexchart.swf is present. If not,
> offer location of precompiled swf hosted at ovirt.org.
> ---
> src/app/helpers/graph_helper.rb | 9 +++++++++
> src/app/views/graph/history_graphs.rhtml | 7 +++++++
> 2 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/src/app/helpers/graph_helper.rb b/src/app/helpers/graph_helper.rb
> index bb1f05b..c57ddda 100644
> --- a/src/app/helpers/graph_helper.rb
> +++ b/src/app/helpers/graph_helper.rb
> @@ -1,5 +1,14 @@
> module GraphHelper
>
> + def swf_is_present
> + File.exists?(Rails.root.join('public','swfs','flexchart.swf'))
> + end
> +
> + def swf_bits_download_url
> + "http://ovirt.org/flexchart/flexchart.swf"
> + end
> +
> +
> # generate some json for the snapshot graph
> def snapshot_graph_json(target, snapshots)
> data = snapshots[:avg][target]
> diff --git a/src/app/views/graph/history_graphs.rhtml b/src/app/views/graph/history_graphs.rhtml
> index 7a7e1e1..2683952 100644
> --- a/src/app/views/graph/history_graphs.rhtml
> +++ b/src/app/views/graph/history_graphs.rhtml
> @@ -1,4 +1,7 @@
> <%= javascript_include_tag "jquery.flash.js" %>
> +
> +<% if swf_is_present %>
> +
> <div id="flex_history_chart"></div>
> <script type="text/javascript">
> $(document).ready(function(){
> @@ -16,3 +19,7 @@ $('#flex_history_chart').flash(
> );
> });
> </script>
> +
> +<% else %>
> +<div id="flex_history_chart">Missing Performance Chart (/swfs/flexchart.swf), which can be obtained at <%= link_to(swf_bits_download_url,swf_bits_download_url) %></div>
> +<% end %>
ACK, this looks good and works fine for me.
-j
More information about the ovirt-devel
mailing list