On 06/06/10 19:56 -0400, Mohammed Morsi wrote:
>---
> 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" />

This could be:

img{ :src => "images/dashboard_summary_next.png", :alt => "next" }
img{ :src => "images/dashboard_summary_prev.png", :alt => "prev" }


>+        %p
>+          Average time to submit tasks to provider, 24 hours
>+        <div style="clear: both;" />

Same here:

%div{ :style => "clear:both"}

Or even better, just create a CSS rule:

.separator { 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' />"

%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;

Please include 'border-radius: 5px' here as well ;-)

>+}
>+
>+.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

ACK.

Just small cosmetic nits, nothing big. Also most important thing:
This patch is working as expected, plotting stuff, displaying numbers.
No error / exception. You need to apply [1] in order to get this work.

[1] https://fedorahosted.org/pipermail/deltacloud-devel/2010-June/001531.html


-- 
--------------------------------------------------------
Michal Fojtik, [email protected], +420 532 294 4307
Ruby / Ruby On Rails Developer
Deltacloud API: http://deltacloud.org
--------------------------------------------------------
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to