[PATCH aggregator] Add correct colors to quota graph
by Steve Linabery
Minor edits to graph_service.rb to make the bars alternate colors.
A scaling tweak on the max_value so that text labels don't get cut off.
Also set the left margin on the QoS graph to 1 so that its black border wouldn't
get cut off.
---
src/app/services/graph_service.rb | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/app/services/graph_service.rb b/src/app/services/graph_service.rb
index a041a08..c2cf4c5 100644
--- a/src/app/services/graph_service.rb
+++ b/src/app/services/graph_service.rb
@@ -74,10 +74,10 @@ class GraphService
plot.set "lmargin","0"
plot.set "rmargin","0"
plot.set "tmargin","0"
- plot.set "boxwidth 0.9 relative"
+ plot.set "boxwidth 0.9"
plot.set "style fill solid 1.0"
plot.set "xrange [.25:2.75]"
- plot.set "yrange [0:#{max_value * 1.25}]" #we want to scale 25% larger to leave room for label
+ plot.set "yrange [0:#{max_value * 1.5}]" #we want to scale maxvalue 50% larger to leave room for label
x = [1,2]
#we'll just have zero values for the unexpected case where cloud_account has no quota
@@ -87,13 +87,22 @@ class GraphService
y = [quota.running_instances,quota.maximum_running_instances]
end
+
#The two arrays above are three columns of data for gnuplot.
- plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds|
+ plot.data << Gnuplot::DataSet.new( [[x[0]], [y[0]]] ) do |ds|
ds.using = "1:2"
- ds.with = "boxes"
+ ds.with = 'boxes linecolor rgb "#8cc63f"'
ds.notitle
end
+ #The two arrays above are three columns of data for gnuplot.
+ plot.data << Gnuplot::DataSet.new( [[x[1]], [y[1]]] ) do |ds|
+ ds.using = "1:2"
+ ds.with = 'boxes linecolor rgb "#cccccc"'
+ ds.notitle
+ end
+
+
plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds|
ds.using = "1:2:2"
ds.with = "labels left offset 0,.15 rotate"
@@ -157,7 +166,7 @@ class GraphService
plot.arbitrary_lines << "unset ytics"
plot.arbitrary_lines << "unset y2tics"
plot.set "bmargin","0"
- plot.set "lmargin","0"
+ plot.set "lmargin","1"
plot.set "rmargin","0"
plot.set "tmargin","0"
--
1.6.6.1
14 years
Fix to Quota Contoller Create Method
by Martyn Taylor
The experienced behaviour:
Did not update CPUS
When creating a quota on a pool or cloud account that already has instances associated with it, it tried to populate the quota, but recieved an error due to a string trying to be matched to a float.
14 years
[PATCH aggregator] quota usage dashboard portlet frontend (revision 1)
by Mo Morsi
---
src/app/controllers/dashboard_controller.rb | 12 +++
src/app/views/dashboard/summary.haml | 143 ++++++++++++++++-----------
src/public/stylesheets/components.css | 77 ++++++++++++++-
3 files changed, 173 insertions(+), 59 deletions(-)
diff --git a/src/app/controllers/dashboard_controller.rb b/src/app/controllers/dashboard_controller.rb
index 716d7bb..6f02c4e 100644
--- a/src/app/controllers/dashboard_controller.rb
+++ b/src/app/controllers/dashboard_controller.rb
@@ -40,8 +40,20 @@ class DashboardController < ApplicationController
end
end
+ def account_quota_graph(opts = {})
+ entity = nil
+ params[:account] = CloudAccount.find(params[:id])
+ graph = GraphService.dashboard_quota(current_user, params)[params[:account]][Graph::QUOTA_INSTANCES_IN_USE]
+ respond_to do |format|
+ format.svg { render :xml => graph.svg}
+ end
+ end
+
def index
+ # FIXME filter to just those that the user has access to
@providers = Provider.find(:all)
+ @cloud_accounts = CloudAccount.find(:all)
+ @pools = Pool.find(:all)
# FIXME remove general role based permission check, replace w/
# more granular / per-permission-object permission checks on the
diff --git a/src/app/views/dashboard/summary.haml b/src/app/views/dashboard/summary.haml
index a0687a9..b556f7d 100644
--- a/src/app/views/dashboard/summary.haml
+++ b/src/app/views/dashboard/summary.haml
@@ -26,67 +26,96 @@
%input{ :id => "hide_getting_started", :type => "checkbox" }
Thanks, don't show this again
-#actions_dashboard_section
- %h2
- Actions
- - if @is_admin
- %a{:href => url_for(:controller => "cloud_accounts", :action => "new")}
- Add a Provider Account
- %a{:href => url_for(:controller => "provider", :action => "new")}
- Add a Provider
- %a{:href => url_for(:controller => "image_descriptor", :action => "new")}
- Create a Template
- %a{:href => url_for(:controller => "users", :action => "new")}
- Create a User
- %a{:href => url_for(:controller => "instance", :action => "index")}
- View Instances
- - else
- %a{:href => url_for(:controller => "", :action => "")}
- Launch Instances
- %a{:href => url_for(:controller => "", :action => "")}
- Enter a help ticket
+.dashboard_column
+ #actions_dashboard_section
+ %h2
+ Actions
+ - if @is_admin
+ %a{:href => url_for(:controller => "cloud_accounts", :action => "new")}
+ Add a Provider Account
+ %a{:href => url_for(:controller => "provider", :action => "new")}
+ Add a Provider
+ %a{:href => url_for(:controller => "", :action => "")}
+ Create a Template
+ %a{:href => url_for(:controller => "users", :action => "new")}
+ Create a User
+ - else
+ %a{:href => url_for(:controller => "", :action => "")}
+ Launch Instances
+ %a{:href => url_for(:controller => "", :action => "")}
+ Enter a help ticket
-#key_indicators_dashboard_section
- %h2
- Key indicators
- %ul
- %li
- Providers
- .count= @providers.size
- %li
- Accounts
- .count= @cloud_accounts.size
- %li
- Pools
- .count= @pools.size
- %li
- Running instances
- .count= @stats[:running_instances]
- %li
- Stopped instances
- .count= @stats[:stopped_instances]
- %li
- Total instances
- .count= @stats[:total_instances]
- .instance_graph #instance_graph
+ #service_quality_dashboard_section
+ - if @is_admin
+ %h2
+ Provider Service Quality
+ .dashboard_section_summary
+ <img src="images/dashboard_summary_next.png" /><img src="images/dashboard_summary_prev.png" />
+ %p
+ Average time to submit tasks to provider, 24 hours
+ <div style="clear: both;" />
+ - @providers.each do |provider|
+ .provider_service_quality_graph
+ = "<object data='" + url_for(:action => :provider_qos_graph, :id => provider.id, :width => 100, :height => 50) + "' type='image/svg+xml' />"
+ .provider_service_quality_graph_summary
+ = provider.name
+ <!-- FIXME 'good/poor/average service... -->
+ <div style="clear: both;" />
+ - else
+ %h2
+ Service Quality
-#service_quality_dashboard_section
- - if @is_admin
+ #key_indicators_dashboard_section
%h2
- Provider Service Quality
- .dashboard_section_summary
- Average time to submit tasks to provider, 24 hours
- <img src="images/dashboard_summary_prev.png" /><img src="images/dashboard_summary_next.png" />
- - @providers.each do |provider|
- .provider_service_quality_graph
- = "<object data='" + url_for(:action => :provider_qos_graph, :id => provider.id, :width => 100, :height => 50) + "' type='image/svg+xml' />"
- .provider_service_quality_graph_summary
- = provider.name
- <!-- FIXME 'good/poor/average service... -->
- <div style="clear: both;" />
- - else
+ Key indicators
+ %ul
+ %li
+ Providers
+ .count= @providers.size
+ %li
+ Accounts
+ .count= @cloud_accounts.size
+ %li
+ Pools
+ .count= @pools.size
+ %li
+ Running instances
+ .count= @stats[:running_instances]
+ %li
+ Stopped instances
+ .count= @stats[:stopped_instances]
+ %li
+ Total instances
+ .count= @stats[:total_instances]
+ .instance_graph #instance_graph
+
+.dashboard_column
+ #quota_usage_dashboard_section
%h2
- Service Quality
+ Quota Usage
+ .dashboard_section_summary
+ Instance utilization by account
+ - @cloud_accounts.each do |account|
+ .account_quota_usage_graph_summary
+ = "Account " + account.username
+ .account_quota_usage_history_graph
+ <!-- FIXME include graph -->
+ .account_quota_usage_current_graph
+ = "<object data='" + url_for(:action => :account_quota_graph, :id => account.id, :width => 100, :height => 50) + "' type='image/svg+xml' />"
+ <div style="clear: both;" />
+ .dashboard_section_summary
+ <img src="images/dashboard_summary_next.png" /><img src="images/dashboard_summary_prev.png" />
+ %p
+ Quota usage by pool
+ <div style="clear: both;" />
+ - @pools.each do |pool|
+ .pool_quota_usage_summary
+ = pool.name
+ .pool_quota_usage_limit
+ <!-- FIXME 'quota limit met'... -->
+ .pool_quota_usage_instances
+ <!-- FIXME 'running instances'... -->
+ <div style="clear: both;" />
:javascript
$("#hide_getting_started").click(function(){
diff --git a/src/public/stylesheets/components.css b/src/public/stylesheets/components.css
index 6ba5969..eec50c0 100644
--- a/src/public/stylesheets/components.css
+++ b/src/public/stylesheets/components.css
@@ -74,20 +74,32 @@ ul.nav li.selected {
}
/* dashboard style */
+.dashboard_column{
+ float: left;
+ width: 47%;
+}
+
.dashboard_section_summary {
background: #F2F2F2;
font-size: 0.8em;
font-weight: bolder;
- margin: 0 15px 10px 0;
+ margin: 10px 15px 10px 0;
padding: 5px 0px 5px 5px;
}
+.dashboard_section_summary p {
+ display: inline;
+ float: left;
+ margin: 3px 0 3px 0;
+}
+
.dashboard_section_summary img:first-child {
- padding-left: 40px;
+ padding-right: 5px;
}
.dashboard_section_summary img {
vertical-align: middle;
+ float: right;
}
#getting_started_dashboard_section {
@@ -210,6 +222,67 @@ ul.nav li.selected {
float: left;
}
+#quota_usage_dashboard_section {
+ width: 390px;
+ border: 1px solid black;
+ padding: 5px 0 5px 15px;
+ margin: 10px 0px 10px 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+}
+
+.account_quota_usage_graph_summary {
+ font-size: 0.8em;
+ padding-left: 15px;
+ display: inline;
+ float: left;
+}
+
+.account_quota_usage_history_graph {
+ display: inline;
+ float: left;
+ margin-left: 10px;
+ border: 1px solid black;
+ width: 120px;
+ height: 20px;
+}
+
+.account_quota_usage_current_graph {
+ display: inline;
+ float: left;
+ margin-left: 10px;
+ border: 1px solid black;
+ width: 140px;
+ height: 20px;
+}
+
+.pool_quota_usage_summary {
+ display: inline;
+ float: left;
+ padding-left: 15px;
+ width: 15%;
+}
+
+.pool_quota_usage_limit {
+ display: inline;
+ float: left;
+ width: 33%;
+ height: 25px;
+ border: 1px solid black;
+ margin-left: 17px;
+}
+
+.pool_quota_usage_instances {
+ display: inline;
+ float: left;
+ width: 33%;
+ height: 25px;
+ border: 1px solid black;
+ margin-left: 17px;
+ margin-bottom: 15px;
+}
+
+
#image_descriptor_form {
width: 800px;
margin: 20px;
--
1.6.2.5
14 years
[PATCH aggregator] Add GraphService to aggregator
by Steve Linabery
Create GraphService object to manage calls to forked gnuplot process
for chart generation. Also add Graph DTO for encapsulating svg or various
other chart description languages.
---
deltacloud-aggregator.spec.in | 1 +
src/app/models/graph.rb | 9 ++
src/app/services/graph_service.rb | 186 +++++++++++++++++++++++++++++++++++++
src/config/environment.rb | 1 +
4 files changed, 197 insertions(+), 0 deletions(-)
create mode 100644 src/app/models/graph.rb
create mode 100644 src/app/services/graph_service.rb
diff --git a/deltacloud-aggregator.spec.in b/deltacloud-aggregator.spec.in
index 6f91751..88ed70e 100644
--- a/deltacloud-aggregator.spec.in
+++ b/deltacloud-aggregator.spec.in
@@ -28,6 +28,7 @@ Requires: rubygem(will_paginate)
Requires: postgresql
Requires: postgresql-server
Requires: ruby-postgres
+Requires: gnuplot >= 4.2.6
%package daemons
Summary: Deltacloud Aggregator daemons config
diff --git a/src/app/models/graph.rb b/src/app/models/graph.rb
new file mode 100644
index 0000000..f520a82
--- /dev/null
+++ b/src/app/models/graph.rb
@@ -0,0 +1,9 @@
+class Graph
+ attr_accessor :svg
+
+ QOS_AVG_TIME_TO_SUBMIT = "qos_avg_time_to_submit"
+ QUOTA_INSTANCES_IN_USE = "quota_instances_in_use"
+ def initialize
+ @svg = ""
+ end
+end
diff --git a/src/app/services/graph_service.rb b/src/app/services/graph_service.rb
new file mode 100644
index 0000000..9a2d12a
--- /dev/null
+++ b/src/app/services/graph_service.rb
@@ -0,0 +1,186 @@
+class GraphService
+ require 'gnuplot'
+ require 'nokogiri'
+
+ def self.dashboard_quota (user,opts = {})
+ #FIXME add permission checks to filter what graphs user can get
+ graphs = Hash.new
+
+ #if a specific cloud account is given, just return that cloud account's graph.
+ #otherwise return all graphs user has permission to see.
+ if opts[:cloud_account]
+ cloud_account = opts[:cloud_account]
+ cloud_account_graphs = Hash.new
+ cloud_account_graphs[Graph::QUOTA_INSTANCES_IN_USE] = quota_instances_in_use_graph(cloud_account,opts)
+ graphs[cloud_account] = cloud_account_graphs
+ else
+ CloudAccount.all.each do |cloud_account|
+ cloud_account_graphs = Hash.new
+ cloud_account_graphs[Graph::QUOTA_INSTANCES_IN_USE] = quota_instances_in_use_graph(cloud_account,opts)
+ graphs[cloud_account] = cloud_account_graphs
+ end
+ end
+ graphs
+ end
+
+ def self.dashboard_qos (user,opts = {})
+ #FIXME add permission checks to filter what graphs user can get
+ graphs = Hash.new
+
+ #if a specific provider is given, just return that provider's graph.
+ #otherwise return all graphs user has permission to see.
+ if opts[:provider]
+ provider = opts[:provider]
+ provider_graphs = Hash.new
+ provider_graphs[Graph::QOS_AVG_TIME_TO_SUBMIT] = qos_avg_time_to_submit_graph(provider,opts)
+ graphs[provider] = provider_graphs
+ else
+ Provider.all.each do |provider|
+ provider_graphs = Hash.new
+ provider_graphs[Graph::QOS_AVG_TIME_TO_SUBMIT] = qos_avg_time_to_submit_graph(provider,opts)
+ graphs[provider] = provider_graphs
+ end
+ end
+ graphs
+ end
+
+ private
+ def self.gnuplot_open( persist=false )
+ cmd = Gnuplot.gnuplot( persist ) or raise 'gnuplot not found'
+ output_stream = IO::popen( cmd, "r+")
+ end
+
+ def self.quota_instances_in_use_graph (cloud_account, opts = {})
+ #things we're checking for in opts: :max_value, :height, :width
+
+ unless max_value = opts[:max_value]
+ max_value = 100 unless max_value = Quota.maximum('maximum_running_instances')
+ end
+ height = 80 unless height = opts[:height]
+ width = 150 unless width = opts[:width]
+
+ raw_svg = ""
+ gp = gnuplot_open
+ Gnuplot::Plot.new( gp ) do |plot|
+ plot.terminal "svg size #{width},#{height}"
+ plot.arbitrary_lines << "unset xtics"
+ plot.arbitrary_lines << "unset x2tics"
+ plot.arbitrary_lines << "unset ytics"
+ plot.arbitrary_lines << "unset y2tics"
+ plot.arbitrary_lines << "unset border"
+
+ plot.set "bmargin","0"
+ plot.set "lmargin","0"
+ plot.set "rmargin","0"
+ plot.set "tmargin","0"
+ plot.set "boxwidth 0.9 relative"
+ plot.set "style fill solid 1.0"
+ plot.set "xrange [.25:2.75]"
+ plot.set "yrange [0:#{max_value * 1.25}]" #we want to scale 25% larger to leave room for label
+
+ x = [1,2]
+ #we'll just have zero values for the unexpected case where cloud_account has no quota
+ y = x.collect { |v| 0 }
+ if cloud_account.quota
+ quota = cloud_account.quota
+ y = [quota.running_instances,quota.maximum_running_instances]
+ end
+
+ #The two arrays above are three columns of data for gnuplot.
+ plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds|
+ ds.using = "1:2"
+ ds.with = "boxes"
+ ds.notitle
+ end
+
+ plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds|
+ ds.using = "1:2:2"
+ ds.with = "labels left offset 0,.15 rotate"
+ ds.notitle
+ end
+ end
+ gp.flush
+ gp.close_write
+ gp.read(nil,raw_svg)
+ gp.close_read
+
+ #massage the svg so that the histogram's bars are oriented horizontally
+ xml = Nokogiri::XML(raw_svg)
+
+ nodes = xml.root.children
+ wrapper = Nokogiri::XML::Node.new "g", xml.root
+
+ nodes.each do |node|
+ node.parent = wrapper if node.name != "desc" && node.name != "defs"
+ end
+
+ wrapper.parent = xml.root
+ wrapper.set_attribute 'transform',"translate(#{width},0) rotate(90) scale(#{height * 1.0 / width},#{width * 1.0/ height})"
+
+ text_nodes = []
+ xml.root.traverse do |node|
+ if node.name == 'text' && node.inner_text.strip =~ /^\d+$/
+ if node.parent.name == 'g'
+ pparent = node.parent
+ text_nodes << pparent
+ end
+ end
+ end
+
+ text_nodes.each do |node|
+ attr = node.get_attribute 'transform'
+ node.remove_attribute 'transform'
+ node.set_attribute 'transform',"#{attr} scale (#{height * 1.0 / width},#{width * 1.0/ height})"
+ end
+
+ modified_svg = xml.to_s
+ graph = Graph.new
+ graph.svg = modified_svg
+ graph
+
+ end
+
+ def self.qos_avg_time_to_submit_graph (provider, opts = {})
+ #things we're checking for in opts: :height, :width
+
+ height = 60 unless height = opts[:height]
+ width = 100 unless width = opts[:width]
+
+ graph = Graph.new
+ gp = gnuplot_open
+
+ Gnuplot::Plot.new( gp ) do |plot|
+ plot.terminal "svg size #{width},#{height}"
+ plot.arbitrary_lines << "unset xtics"
+ plot.arbitrary_lines << "unset x2tics"
+ plot.arbitrary_lines << "unset ytics"
+ plot.arbitrary_lines << "unset y2tics"
+ plot.set "bmargin","0"
+ plot.set "lmargin","0"
+ plot.set "rmargin","0"
+ plot.set "tmargin","0"
+
+ #FIXME: get data from DataService for the provider.
+ #For demo, plot a random walk for demo of graph display until we hook into DataService
+ #First build two equal-length arrays
+ x = (0..500).collect { |v| v.to_f }
+
+ walk = 0
+ y = x.collect { |v| rand > 0.5 ? walk = walk + 1 : walk = walk - 1 }
+ plot.set "yrange [-50:50]"
+
+ #This type of plot takes two equal length arrays of numbers as input.
+ plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds|
+ ds.using = "1:2"
+ ds.with = "lines"
+ ds.notitle
+ end
+ end
+ gp.flush
+ gp.close_write
+ gp.read(nil,graph.svg)
+ gp.close_read
+ graph
+ end
+
+end
diff --git a/src/config/environment.rb b/src/config/environment.rb
index 5efa7bb..53ed761 100644
--- a/src/config/environment.rb
+++ b/src/config/environment.rb
@@ -47,6 +47,7 @@ Rails::Initializer.run do |config|
config.gem "haml"
config.gem "will_paginate"
config.gem "nokogiri", :version => ">= 1.4.0"
+ config.gem "gnuplot"
config.active_record.observers = :instance_observer, :task_observer
# Only load the plugins named here, in the order given. By default, all plugins
--
1.6.6.1
14 years
[PATCH aggregator] integrate graphs into 'provider service quality' portlet (revision 2)
by Mo Morsi
---
src/app/controllers/dashboard_controller.rb | 9 +++++++++
src/app/views/dashboard/summary.haml | 2 +-
src/config/initializers/mime_types.rb | 1 +
src/public/stylesheets/components.css | 1 -
4 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/app/controllers/dashboard_controller.rb b/src/app/controllers/dashboard_controller.rb
index adc83d2..716d7bb 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 provider_qos_graph(opts = {})
+ entity = nil
+ params[:provider] = Provider.find(params[:id])
+ graph = GraphService.dashboard_qos(current_user, params)[params[:provider]][Graph::QOS_AVG_TIME_TO_SUBMIT]
+ respond_to do |format|
+ format.svg { render :xml => graph.svg}
+ end
+ end
+
def index
@providers = Provider.find(:all)
diff --git a/src/app/views/dashboard/summary.haml b/src/app/views/dashboard/summary.haml
index 4dd03f1..a0687a9 100644
--- a/src/app/views/dashboard/summary.haml
+++ b/src/app/views/dashboard/summary.haml
@@ -79,7 +79,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 => :provider_qos_graph, :id => provider.id, :width => 100, :height => 50) + "' 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
diff --git a/src/public/stylesheets/components.css b/src/public/stylesheets/components.css
index 2bfbdde..6ba5969 100644
--- a/src/public/stylesheets/components.css
+++ b/src/public/stylesheets/components.css
@@ -166,7 +166,6 @@ ul.nav li.selected {
.provider_service_quality_graph {
width: 100px;
height: 50px;
- border: 1px solid black;
float: left;
margin: 0px 5px 0px 5px;
}
--
1.6.2.5
14 years
[PATCH aggregator 1/3] added label to cloud account.
by Scott Seago
Signed-off-by: Scott Seago <sseago(a)redhat.com>
---
src/app/models/cloud_account.rb | 2 +-
src/app/views/cloud_accounts/_form.html.erb | 5 +++--
src/app/views/provider/accounts.html.erb | 2 ++
.../20090801045212_create_cloud_accounts.rb | 1 +
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/app/models/cloud_account.rb b/src/app/models/cloud_account.rb
index aaf980e..ca8f31e 100644
--- a/src/app/models/cloud_account.rb
+++ b/src/app/models/cloud_account.rb
@@ -71,7 +71,7 @@ class CloudAccount < ActiveRecord::Base
end
def name
- username
+ label.nil? ? username : label
end
# FIXME: for already-mapped accounts, update rather than add new
diff --git a/src/app/views/cloud_accounts/_form.html.erb b/src/app/views/cloud_accounts/_form.html.erb
index 0d71953..95f339c 100644
--- a/src/app/views/cloud_accounts/_form.html.erb
+++ b/src/app/views/cloud_accounts/_form.html.erb
@@ -3,10 +3,11 @@
<%= hidden_field :cloud_account, :id %>
<%= hidden_field :cloud_account, :provider_id, :value => @provider.id %>
<ul>
+<li><label>Label<span>user-visible name for the account</span></label><%=text_field :cloud_account, :label %></li>
<% if @cloud_account.id.nil? %>
-<li><label>UserName<span>UserName for the account you wish to connect to this pool.</span></label><%= text_field :cloud_account, :username %></li>
+<li><label>UserName<span>UserName for the provider account you wish to add.</span></label><%= text_field :cloud_account, :username %></li>
<% end %>
-<li><label>Password<span>Password for the account you wish to connect to this pool.</span></label><%=password_field :cloud_account, :password %></li>
+<li><label>Password<span>Password for the provider account you wish to add.</span></label><%=password_field :cloud_account, :password %></li>
</ul>
</fieldset>
<%= submit_tag "Save", :class => "submit" %>
diff --git a/src/app/views/provider/accounts.html.erb b/src/app/views/provider/accounts.html.erb
index 8ce98a8..ca8d287 100644
--- a/src/app/views/provider/accounts.html.erb
+++ b/src/app/views/provider/accounts.html.erb
@@ -4,6 +4,7 @@
<table>
<thead>
<tr>
+ <th scope="col">Label</th>
<th scope="col">Username</th>
<th scope="col"></th>
<th scope="col"></th>
@@ -12,6 +13,7 @@
<tbody>
<%(a)provider.cloud_accounts.each {|acct| %>
<tr>
+ <td><%= acct.label %></td>
<td><%= acct.username %></td>
<td><%= link_to "Edit", {:controller => 'cloud_accounts', :action => 'edit', :id => acct.id} if has_account_modify?(@provider) %></td>
<td><%= link_to "Delete", {:controller => 'cloud_accounts', :action => 'destroy', :id => acct.id} if has_account_modify?(@provider) && acct.destroyable? %></td>
diff --git a/src/db/migrate/20090801045212_create_cloud_accounts.rb b/src/db/migrate/20090801045212_create_cloud_accounts.rb
index 316de87..fb5d2c5 100644
--- a/src/db/migrate/20090801045212_create_cloud_accounts.rb
+++ b/src/db/migrate/20090801045212_create_cloud_accounts.rb
@@ -22,6 +22,7 @@
class CreateCloudAccounts < ActiveRecord::Migration
def self.up
create_table :cloud_accounts do |t|
+ t.string :label
t.string :username, :null => false
t.string :password, :null => false
t.integer :provider_id, :null => false
--
1.6.2.5
14 years
[PATCH aggregator] remove left nav sidebar
by Mo Morsi
---
src/app/views/layouts/aggregator.haml | 2 --
src/public/stylesheets/layout.css | 2 +-
2 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/src/app/views/layouts/aggregator.haml b/src/app/views/layouts/aggregator.haml
index 159f385..182087c 100644
--- a/src/app/views/layouts/aggregator.haml
+++ b/src/app/views/layouts/aggregator.haml
@@ -24,8 +24,6 @@
%body
#header
= render :partial => '/layouts/header'
- #side
- = render :partial => '/layouts/main_nav' unless @current_user.nil?
#tabs-and-content-container
#main
#content_area
diff --git a/src/public/stylesheets/layout.css b/src/public/stylesheets/layout.css
index 1ccee4c..94ab2ec 100644
--- a/src/public/stylesheets/layout.css
+++ b/src/public/stylesheets/layout.css
@@ -77,7 +77,7 @@ a { color:#000000; text-decoration: none;}
margin-left: 0;
position: absolute;
top: 70px;
- left: 230px;
+ left: 0;
right: 0px;
bottom: 0px;
overflow: auto;
--
1.6.2.5
14 years
[PATCH aggregator] final fixes integrating graphs into dashboard
by Mo Morsi
---
src/app/services/graph_service.rb | 8 ++++----
src/public/stylesheets/components.css | 3 +--
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/app/services/graph_service.rb b/src/app/services/graph_service.rb
index 9a2d12a..c0c9fc2 100644
--- a/src/app/services/graph_service.rb
+++ b/src/app/services/graph_service.rb
@@ -56,8 +56,8 @@ class GraphService
unless max_value = opts[:max_value]
max_value = 100 unless max_value = Quota.maximum('maximum_running_instances')
end
- height = 80 unless height = opts[:height]
- width = 150 unless width = opts[:width]
+ height = 80 unless height = opts[:height].to_i
+ width = 150 unless width = opts[:width].to_i
raw_svg = ""
gp = gnuplot_open
@@ -143,8 +143,8 @@ class GraphService
def self.qos_avg_time_to_submit_graph (provider, opts = {})
#things we're checking for in opts: :height, :width
- height = 60 unless height = opts[:height]
- width = 100 unless width = opts[:width]
+ height = 60 unless height = opts[:height].to_i
+ width = 100 unless width = opts[:width].to_i
graph = Graph.new
gp = gnuplot_open
diff --git a/src/public/stylesheets/components.css b/src/public/stylesheets/components.css
index eec50c0..467712a 100644
--- a/src/public/stylesheets/components.css
+++ b/src/public/stylesheets/components.css
@@ -251,9 +251,8 @@ ul.nav li.selected {
display: inline;
float: left;
margin-left: 10px;
- border: 1px solid black;
width: 140px;
- height: 20px;
+ height: 50px;
}
.pool_quota_usage_summary {
--
1.6.2.5
14 years
image builder (after rebase)
by Jan Provazník
Previous patch set wasn't applicable, sending again.
ImageBuilder UI patch. Most of functionality should be done.
CSS patch will be tomorow (I hope), "summary" view patch is
not complete (polling build_status, Finish button,...).
14 years
[PATCH aggregator] integrate graphs into 'provider service quality' portlet (revision 1)
by Mo Morsi
---
src/app/controllers/dashboard_controller.rb | 11 +++++++++++
src/app/services/graph_service.rb | 14 +++++++++-----
src/app/views/dashboard/summary.haml | 2 +-
src/config/initializers/mime_types.rb | 1 +
src/public/stylesheets/components.css | 1 -
5 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/src/app/controllers/dashboard_controller.rb b/src/app/controllers/dashboard_controller.rb
index adc83d2..114673f 100644
--- a/src/app/controllers/dashboard_controller.rb
+++ b/src/app/controllers/dashboard_controller.rb
@@ -31,6 +31,17 @@ class DashboardController < ApplicationController
return params[:ajax] == "true"
end
+ def graph(opts = {})
+ entity = nil
+ entity = Provider.find(params[:id]) if params[:entity_type] == 'Provider'
+ gparams = [entity]
+ gparams << params[:width] << params[:height] if params.has_key?(:width) && params.has_key?(:height)
+ graph = GraphService.dashboard_qos(*gparams)[('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..e858cfd 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
@@ -18,6 +18,10 @@ class GraphService
plot.arbitrary_lines << "unset x2tics"
plot.arbitrary_lines << "unset ytics"
plot.arbitrary_lines << "unset y2tics"
+ plot.set "bmargin","0"
+ plot.set "lmargin","0"
+ plot.set "tmargin","0"
+ plot.set "rmargin","0"
#FIXME: get data from DataService for the provider.
#First build three equal-length arrays
@@ -30,7 +34,7 @@ class GraphService
#'lc variable' usage.
plot.data << Gnuplot::DataSet.new( [x, y, c] ) do |ds|
ds.using = "1:2:3"
- ds.with = "lines lc variable"
+ ds.with = "lines"
ds.notitle
end
end
@@ -41,9 +45,9 @@ class GraphService
graph
end
- def dashboard_qos (provider = nil)
+ def self.dashboard_qos (provider = nil, width = 200, height = 100)
graphs = Hash.new
- graphs[Graph::QOS_AVG_TIME_TO_SUBMIT] = qos_avg_time_to_submit_graph(provider)
+ graphs[Graph::QOS_AVG_TIME_TO_SUBMIT] = qos_avg_time_to_submit_graph(provider, width, height)
graphs
end
diff --git a/src/app/views/dashboard/summary.haml b/src/app/views/dashboard/summary.haml
index 633fb84..5a8eed6 100644
--- a/src/app/views/dashboard/summary.haml
+++ b/src/app/views/dashboard/summary.haml
@@ -79,7 +79,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, :width => 100, :height => 50) + "' 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
diff --git a/src/public/stylesheets/components.css b/src/public/stylesheets/components.css
index 1391fc5..abbf0bd 100644
--- a/src/public/stylesheets/components.css
+++ b/src/public/stylesheets/components.css
@@ -164,7 +164,6 @@ ul.nav li.selected {
.provider_service_quality_graph {
width: 100px;
height: 50px;
- border: 1px solid black;
float: left;
margin: 0px 5px 0px 5px;
}
--
1.6.2.5
14 years