---
 src/app/controllers/dashboard_controller.rb |    9 +++++++++
 src/app/services/graph_service.rb           |    6 +++---
 src/app/views/dashboard/summary.haml        |    2 +-
 src/config/initializers/mime_types.rb       |    1 +
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/app/controllers/dashboard_controller.rb 
b/src/app/controllers/dashboard_controller.rb
index 5061284..106552a 100644
--- a/src/app/controllers/dashboard_controller.rb
+++ b/src/app/controllers/dashboard_controller.rb
@@ -31,6 +31,15 @@ class DashboardController < ApplicationController
     return params[:ajax] == "true"
   end
 
+  def graph(opts = {})
+    entity = nil
+    entity = Provider.find(params[:id]) if params[:entity_type] == 'Provider'
+    graph = 
GraphService.dashboard_qos(p)[('Graph::'+params[:type]).constantize]
+    respond_to do |format|
+      format.svg  { render :xml => graph.svg}
+   end
+  end
+
   def index
     @providers = Provider.find(:all)
 
diff --git a/src/app/services/graph_service.rb 
b/src/app/services/graph_service.rb
index 8fc5bad..9bb8177 100644
--- a/src/app/services/graph_service.rb
+++ b/src/app/services/graph_service.rb
@@ -1,13 +1,13 @@
 class GraphService
   require 'gnuplot'
 
-  def gnuplot_open( persist=false )
+  def self.gnuplot_open( persist=false )
     cmd = Gnuplot.gnuplot( persist ) or raise 'gnuplot not found'
     output_stream = IO::popen( cmd, "r+")
   end
 
 
-  def qos_avg_time_to_submit_graph ( provider=nil, width=200, height=100 )
+  def self.qos_avg_time_to_submit_graph ( provider=nil, width=200, height=100 )
 
     graph = Graph.new
     gp = gnuplot_open
@@ -41,7 +41,7 @@ class GraphService
     graph
   end
 
-  def dashboard_qos (provider = nil)
+  def self.dashboard_qos (provider = nil)
     graphs = Hash.new
     graphs[Graph::QOS_AVG_TIME_TO_SUBMIT] = 
qos_avg_time_to_submit_graph(provider)
     graphs
diff --git a/src/app/views/dashboard/summary.haml 
b/src/app/views/dashboard/summary.haml
index f3d6ab6..6e7e267 100644
--- a/src/app/views/dashboard/summary.haml
+++ b/src/app/views/dashboard/summary.haml
@@ -53,7 +53,7 @@
       <img src="images/dashboard_summary_prev.png" /><img 
src="images/dashboard_summary_next.png" />
     - @providers.each do |provider|
       .provider_service_quality_graph
-        <!-- FIXME include graph -->
+        = "<object data='" + url_for(:action => :graph, :type => 
'QOS_AVG_TIME_TO_SUBMIT', :entity_type => 'Provider', :id => provider.id) + "' 
type='image/svg+xml' />"
       .provider_service_quality_graph_summary
         = provider.name
         <!-- FIXME 'good/poor/average service... -->
diff --git a/src/config/initializers/mime_types.rb 
b/src/config/initializers/mime_types.rb
index 72aca7e..c0feb58 100644
--- a/src/config/initializers/mime_types.rb
+++ b/src/config/initializers/mime_types.rb
@@ -3,3 +3,4 @@
 # Add new mime types for use in respond_to blocks:
 # Mime::Type.register "text/richtext", :rtf
 # Mime::Type.register_alias "text/html", :iphone
+Mime::Type.register "image/svg+xml", :svg
-- 
1.6.2.5

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to