Hey Martyn,
The patch is good but Ladislav pointed out to me how to do some things better. I'm
passing the comments along inline.
----- Original Message -----
From: mtaylor(a)redhat.com
To: deltacloud-devel(a)lists.fedorahosted.org
Sent: Tuesday, December 21, 2010 11:43:59 AM
Subject: [deltacloud-devel] [PATCH aeolus] Added placeholders, views for deployments
From: Martyn Taylor <mtaylor(a)redhat.com>
Adds placeholders, currently no functionality since we do not have the
deployment model in place
---
.../resources/deployments_controller.rb | 28 +++++++++++++++++++-
src/app/stylesheets/newui.scss | 16 +++++++++++
src/app/views/resources/deployments/_history.haml | 1 +
.../views/resources/deployments/_instances.haml | 2 +
src/app/views/resources/deployments/_list.haml | 20 ++++++++++++++
.../views/resources/deployments/_permissions.haml | 2 +
.../views/resources/deployments/_properties.haml | 2 +
.../resources/deployments/_provider_services.haml | 1 +
.../resources/deployments/_required_services.haml | 1 +
src/app/views/resources/deployments/index.haml | 3 +-
src/app/views/resources/deployments/show.haml | 4 +++
11 files changed, 78 insertions(+), 2 deletions(-)
create mode 100644 src/app/views/resources/deployments/_history.haml
create mode 100644 src/app/views/resources/deployments/_instances.haml
create mode 100644 src/app/views/resources/deployments/_list.haml
create mode 100644
src/app/views/resources/deployments/_permissions.haml
create mode 100644
src/app/views/resources/deployments/_properties.haml
create mode 100644
src/app/views/resources/deployments/_provider_services.haml
create mode 100644
src/app/views/resources/deployments/_required_services.haml
create mode 100644 src/app/views/resources/deployments/show.haml
diff --git a/src/app/controllers/resources/deployments_controller.rb
b/src/app/controllers/resources/deployments_controller.rb
index fecdfae..11a35d4 100644
--- a/src/app/controllers/resources/deployments_controller.rb
+++ b/src/app/controllers/resources/deployments_controller.rb
@@ -1,6 +1,32 @@
class Resources::DeploymentsController < ApplicationController
before_filter :require_user
+ before_filter :load_deployments, :only => [:index, :show]
def index
end
-end
+
+ def show
+ if params[:details_tab].blank?
+ @details_tab = 'properties'
+ else
+ @details_tab = params[:details_tab]
+ end
+ if params[:ajax] == 'true'
It turns out that there's a better way of figuring out how to distinguish between a
regular browser request and an ajax one.
Instead of doing the URL params mumbo jumbo, you can do this:
respond_to do |format|
format.js { render :partial => @details_tab }
format.html { render :action => 'show' }
end
+ render :partial => @details_tab
+ return
+ end
+ @url_params = params.clone
Please move the @url_params line into the `load_deployments` method. I's required in
both the `index` and the `show` view.
+ end
+
+ private
+ def load_deployments
+ @header = [
+ { :name => "Deployment name", :sort_attr => :name },
+ { :name => "Deployable", :sortable => false },
+ { :name => "Deployment Owner", :sort_attr =>
"owner.last_name"},
+ { :name => "Running Since", :sort_attr => :running_since },
+ { :name => "Heath Metric", :sort_attr => :health },
+ { :name => "Pool", :sort_attr => "pool.name" }
+ ]
+ end
+end
\ No newline at end of file
diff --git a/src/app/stylesheets/newui.scss
b/src/app/stylesheets/newui.scss
index 4eb16e6..a2ba8e3 100644
--- a/src/app/stylesheets/newui.scss
+++ b/src/app/stylesheets/newui.scss
@@ -1353,6 +1353,22 @@ $content-left: 180px;
}
}
+#object-actions {
+ position: relative;
+ float: left;
+ width: 100%;
+}
+
+#search-actions {
+ position: relative;
+ float: right;
+}
+
+#selections {
+ position: relative;
+ float: left;
+}
+
#details-view {
border: 1px solid;
position: absolute;
diff --git a/src/app/views/resources/deployments/_history.haml
b/src/app/views/resources/deployments/_history.haml
new file mode 100644
index 0000000..9f4a57e
--- /dev/null
+++ b/src/app/views/resources/deployments/_history.haml
@@ -0,0 +1 @@
+%h3 List of deployment events
diff --git a/src/app/views/resources/deployments/_instances.haml
b/src/app/views/resources/deployments/_instances.haml
new file mode 100644
index 0000000..2ac1792
--- /dev/null
+++ b/src/app/views/resources/deployments/_instances.haml
@@ -0,0 +1,2 @@
+%h3 List Instances for Deployment
+%h3 "Expand" button shifts list view to show the Instance list
diff --git a/src/app/views/resources/deployments/_list.haml
b/src/app/views/resources/deployments/_list.haml
new file mode 100644
index 0000000..6c3dee8
--- /dev/null
+++ b/src/app/views/resources/deployments/_list.haml
@@ -0,0 +1,20 @@
+- form_tag do |f|
+ #object-actions
+ = restful_submit_tag "Start", "start", resources_deployments_path,
"PUT"
+ = restful_submit_tag "Stop", "stop", resources_deployments_path,
"PUT"
+ = restful_submit_tag "Delete", "delete",
resources_deployments_path,
"DELETE"
+
+ #search-actions
+ = restful_submit_tag "Save Search", "save_search",
resources_deployments_path, "PUT"
+ = restful_submit_tag "Save Selection", "save_selection",
resources_deployments_path, "PUT"
+ = restful_submit_tag "Export to File", "export",
resources_deployments_path, "PUT"
+
+ #selections
+ %p
+ Select:
+ = link_to "All", @url_params.merge(:select => 'all')
+ %span> ,
+ = link_to "None", @url_params.merge(:select => 'none')
+
+%table
+ = sortable_table_header @header
\ No newline at end of file
diff --git a/src/app/views/resources/deployments/_permissions.haml
b/src/app/views/resources/deployments/_permissions.haml
new file mode 100644
index 0000000..dd88c8e
--- /dev/null
+++ b/src/app/views/resources/deployments/_permissions.haml
@@ -0,0 +1,2 @@
+%h3 Users and roles they are in for this Deployment
+%h3 Manage permissions on tehi deployment (if you have permissions to
do so)
diff --git a/src/app/views/resources/deployments/_properties.haml
b/src/app/views/resources/deployments/_properties.haml
new file mode 100644
index 0000000..5d2c584
--- /dev/null
+++ b/src/app/views/resources/deployments/_properties.haml
@@ -0,0 +1,2 @@
+%h3 Owner Details
+%h3 CDL
diff --git
a/src/app/views/resources/deployments/_provider_services.haml
b/src/app/views/resources/deployments/_provider_services.haml
new file mode 100644
index 0000000..435f470
--- /dev/null
+++ b/src/app/views/resources/deployments/_provider_services.haml
@@ -0,0 +1 @@
+%h3 List of services required by deployment
diff --git
a/src/app/views/resources/deployments/_required_services.haml
b/src/app/views/resources/deployments/_required_services.haml
new file mode 100644
index 0000000..30e7601
--- /dev/null
+++ b/src/app/views/resources/deployments/_required_services.haml
@@ -0,0 +1 @@
+%h3 List of services required by deployment
diff --git a/src/app/views/resources/deployments/index.haml
b/src/app/views/resources/deployments/index.haml
index fdc537d..d051c94 100644
--- a/src/app/views/resources/deployments/index.haml
+++ b/src/app/views/resources/deployments/index.haml
@@ -1 +1,2 @@
-resources/deployments/index.haml
+- content_for :list do
+ = render :partial => 'list'
\ No newline at end of file
diff --git a/src/app/views/resources/deployments/show.haml
b/src/app/views/resources/deployments/show.haml
new file mode 100644
index 0000000..894decb
--- /dev/null
+++ b/src/app/views/resources/deployments/show.haml
@@ -0,0 +1,4 @@
+- content_for :list do
+ = render :partial => 'list'
+
+= render :partial => 'layouts/details_pane', :locals => { :tabs =>
['Properties', 'Instances', 'Provider Services', 'Required
Services',
'History', 'Permissions'] }
It turns out that we will want to render the "Details" pane from multiple
places. As such, it's better that we don't specify the tab titles
("Properties", "Instances", etc.) in each render.
Please declare a `@tabs` array in the `show` controller action and put the tab titles
there. You can look an the `resources/pools_controller` to see how it's done.
Then, you no longer need to specify the `:locals` hash in the `render` method.
--
1.7.2.3
_______________________________________________
deltacloud-devel mailing list
deltacloud-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/deltacloud-devel