You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/02/29 14:57:09 UTC
[PATCH core 1/5] CIMI: Removed forgotten puts in client app starter
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
clients/cimi/bin/start | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/clients/cimi/bin/start b/clients/cimi/bin/start
index 94d6fc9..1f105a1 100755
--- a/clients/cimi/bin/start
+++ b/clients/cimi/bin/start
@@ -106,8 +106,6 @@ else
argv_opts.flatten!
- puts argv_opts.inspect
-
if have_rerun && options[:env] == "development"
argv_opts.unshift "thin"
command = argv_opts.join(" ")
--
1.7.9.1
[PATCH core 2/5] CIMI: Set CPU value to DC default in MachineConfiguration when DC profile use range for CPU property
Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
server/lib/cimi/model/machine_configuration.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/server/lib/cimi/model/machine_configuration.rb b/server/lib/cimi/model/machine_configuration.rb
index feab4e8..28e314f 100644
--- a/server/lib/cimi/model/machine_configuration.rb
+++ b/server/lib/cimi/model/machine_configuration.rb
@@ -55,7 +55,7 @@ class CIMI::Model::MachineConfiguration < CIMI::Model::Base
:name => profile.name,
:description => "Machine Configuration with #{profile.memory.value} #{profile.memory.unit} "+
"of memory and #{profile.cpu.value} CPU",
- :cpu => profile.cpu.value,
+ :cpu => profile.cpu.value || profile.cpu.default,
:created => Time.now.to_s, # FIXME: DC hardware_profile has no mention about created_at
:memory => { :quantity => profile.memory.value || profile.memory.default, :units => profile.memory.unit },
:disks => [ { :capacity => { :quantity => profile.storage.value || profile.storage.default, :units => profile.storage.unit } } ],
--
1.7.9.1
[PATCH core 3/5] CIMI: Switched to %table from %dl in client app
Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
clients/cimi/lib/cimi_frontend_helper.rb | 22 +++++++++
clients/cimi/public/app.css | 4 ++
clients/cimi/views/cloud_entry_point/index.haml | 13 ++----
clients/cimi/views/machine_admins/show.haml | 25 ++++-------
.../cimi/views/machine_configurations/index.haml | 14 ++----
.../cimi/views/machine_configurations/show.haml | 21 +++-----
clients/cimi/views/machine_images/index.haml | 14 ++----
clients/cimi/views/machine_images/show.haml | 18 +++-----
clients/cimi/views/volumes/index.haml | 13 ++---
clients/cimi/views/volumes/show.haml | 47 +++++++------------
10 files changed, 85 insertions(+), 106 deletions(-)
diff --git a/clients/cimi/lib/cimi_frontend_helper.rb b/clients/cimi/lib/cimi_frontend_helper.rb
index 5827089..e00a6b1 100644
--- a/clients/cimi/lib/cimi_frontend_helper.rb
+++ b/clients/cimi/lib/cimi_frontend_helper.rb
@@ -84,6 +84,28 @@ module CIMI
struct_name.class.name.split('_').last
end
+ def row(label, value)
+ haml_tag :tr do
+ haml_tag :th do
+ haml_concat label
+ end
+ haml_tag :td do
+ haml_concat value.nil? ? '' : convert_urls(value)
+ end
+ end
+ end
+
+ def details(title='', &block)
+ haml_tag :table, { :class => 'table table-bordered table-striped' } do
+ haml_tag :caption do
+ haml_tag :h3 do
+ haml_concat title
+ end
+ end unless title.empty?
+ haml_tag :tbody, &block
+ end
+ end
+
end
end
end
diff --git a/clients/cimi/public/app.css b/clients/cimi/public/app.css
index 1c20dfe..74ccfa4 100644
--- a/clients/cimi/public/app.css
+++ b/clients/cimi/public/app.css
@@ -63,3 +63,7 @@ body {
#toolbar p:first-child {
text-align : right;
}
+
+table caption h3 {
+ text-align : left;
+}
diff --git a/clients/cimi/views/cloud_entry_point/index.haml b/clients/cimi/views/cloud_entry_point/index.haml
index 9475b51..189c71a 100644
--- a/clients/cimi/views/cloud_entry_point/index.haml
+++ b/clients/cimi/views/cloud_entry_point/index.haml
@@ -24,12 +24,7 @@
%a{ :href => "/cimi/#{entity}"}=struct_to_name @entry_point.send(entity.intern)
=not_implemented(entity)
-%h3 Collection details
-
-%dl
- %dt URI
- %dd=@entry_point.uri
- %dt Description
- %dd=@entry_point.description
- %dt Created
- %dd=@entry_point.created
+- details('Collection details') do
+ - row 'URI', @entry_point.uri
+ - row 'Description', @entry_point.description
+ - row 'Created', @entry_point.created
diff --git a/clients/cimi/views/machine_admins/show.haml b/clients/cimi/views/machine_admins/show.haml
index 07602f3..abf8e88 100644
--- a/clients/cimi/views/machine_admins/show.haml
+++ b/clients/cimi/views/machine_admins/show.haml
@@ -18,25 +18,18 @@
%p
%form{ :action => "/cimi/machine_admins/#{@machine_admin.name}/delete", :method => :post, :style => 'display:inline'}
%input{ :type => :hidden, :name => '_method', :value => 'delete'}
- %button{ :class => 'btn danger'} Destroy
+ %button{ :class => 'btn btn-danger'} Destroy
%blockquote
%p
A Machine Admin entity contains the information required to create the
initial administrative super- user of a newly created Machine
-%dl
- %dt URI
- %dd
- %a{ :href => @machine_admin.uri }=@machine_admin.uri
- %dt Description
- %dd=@machine_admin.description
- %dt Created
- %dd=@machine_admin.created
- %dt Username
- %dd=boolean_span_for @machine_admin.username
- %dt Password
- %dd=boolean_span_for @machine_admin.password
- %dt Key
- %dd
- %pre=boolean_span_for @machine_admin.key
+- details 'MachineAdmin Details' do
+ - row 'URI', @machine_admin.uri
+ - row 'Description', @machine_admin.description
+ - row 'Created', @machine_admin.created
+ - row 'Username', boolean_span_for(@machine_admin.username)
+ - row 'Password', boolean_span_for(@machine_admin.password)
+ - row 'Key', '<pre>'+boolean_span_for(@machine_admin.key)+'</pre>'
+
diff --git a/clients/cimi/views/machine_configurations/index.haml b/clients/cimi/views/machine_configurations/index.haml
index cd9bb4d..0f9e8b3 100644
--- a/clients/cimi/views/machine_configurations/index.haml
+++ b/clients/cimi/views/machine_configurations/index.haml
@@ -19,17 +19,13 @@
Machine Configuration entities within a Provider. This entity can be used to
locate and create Machine Configurations.
+%h3 MachineConfigurationCollection
%ul
- @machine_configurations.machine_configurations.each do |conf|
%li
%a{ :href => "/cimi/machine_configurations/#{conf.href.split('/').last}"}=conf.href.split('/').last
-%h3 Collection details
-
-%dl
- %dt URI
- %dd=@machine_configurations.uri
- %dt Description
- %dd=@machine_configurations.description
- %dt Created
- %dd=@machine_configurations.created
+- details('Collection details') do
+ - row 'URI', @machine_configurations.uri
+ - row 'Description', @machine_configurations.description
+ - row 'Created', @machine_configurations.created
diff --git a/clients/cimi/views/machine_configurations/show.haml b/clients/cimi/views/machine_configurations/show.haml
index 387de62..7eff926 100644
--- a/clients/cimi/views/machine_configurations/show.haml
+++ b/clients/cimi/views/machine_configurations/show.haml
@@ -23,16 +23,11 @@
Instance. Machine Configurations are created by Providers and MAY, at the
Providers discretion, be created by Consumers.
-%dl
- %dt URI
- %dd
- %a{ :href => @machine_configuration.uri }=@machine_configuration.uri
- %dt Description
- %dd=@machine_configuration.description
- %dt CPU
- %dd=@machine_configuration.cpu
- %dt Memory
- %dd=[@machine_configuration.memory[:quantity], @machine_configuration.memory[:units]].join(' ')
- %dt Disks
- - @machine_configuration.disks.each do |disk|
- %dd=[disk.capacity.quantity, disk.capacity.units].join(' ')
+- details('MachineConfiguration details') do
+ - row 'URI', @machine_configuration.uri
+ - row 'Description', @machine_configuration.description
+ - row 'Created', @machine_configuration.created
+ - row '# of CPU', @machine_configuration.cpu
+ - row 'Memory (RAM)', [@machine_configuration.memory[:quantity], @machine_configuration.memory[:units]].join(' ')
+ - row 'Storage (disks)', @machine_configuration.disks.map { |d| [ d.capacity.quantity, d.capacity.units ].join(' ') }.join(',')
+
diff --git a/clients/cimi/views/machine_images/index.haml b/clients/cimi/views/machine_images/index.haml
index c8d9c86..defad9a 100644
--- a/clients/cimi/views/machine_images/index.haml
+++ b/clients/cimi/views/machine_images/index.haml
@@ -19,17 +19,13 @@
entities within a Provider. This entity can be used to locate and create
Machine Images.
+%h3 MachineImageCollection
%ul
- @machine_images.machine_images.each do |image|
%li
%a{ :href => "/cimi/machine_images/#{image.href.split('/').last}"}=image.href.split('/').last
-%h3 Collection details
-
-%dl
- %dt URI
- %dd=@machine_images.uri
- %dt Description
- %dd=@machine_images.description
- %dt Created
- %dd=@machine_images.created
+- details('Collection details') do
+ - row 'URI', @machine_images.uri
+ - row 'Description', @machine_images.description
+ - row 'Created', @machine_images.created
diff --git a/clients/cimi/views/machine_images/show.haml b/clients/cimi/views/machine_images/show.haml
index b3c4120..af5ba91 100644
--- a/clients/cimi/views/machine_images/show.haml
+++ b/clients/cimi/views/machine_images/show.haml
@@ -22,15 +22,9 @@
(OVF) package) necessary for hardware virtualized resources to create a
Machine Instance
-%dl
- %dt URI
- %dd
- %a{ :href => @machine_image.uri }=@machine_image.uri
- %dt Description
- %dd=@machine_image.description
- %dt Created
- %dd=@machine_image.created
- %dt Image Location
- %dd=@machine_image.image_location.href
- %dt Image Data
- %dd=@machine_image.image_data
+- details 'MachineImage details' do
+ - row 'URI', @machine_image.uri
+ - row 'Description', @machine_image.description
+ - row 'Created', @machine_image.created
+ - row 'Image Location', @machine_image.image_location.href
+ - row 'Image Data', @machine_image.image_data
diff --git a/clients/cimi/views/volumes/index.haml b/clients/cimi/views/volumes/index.haml
index de37597..08a5cc1 100644
--- a/clients/cimi/views/volumes/index.haml
+++ b/clients/cimi/views/volumes/index.haml
@@ -19,17 +19,14 @@
entities within a Provider. This entity can be used to locate and create
volumes.
+%h3 VolumesCollection
%ul
- @volumes.volumes.each do |volume|
%li
%a{ :href => "/cimi/volumes/#{volume.href.split('/').last}"}=volume.href.split('/').last
-%h3 Collection details
+- details 'Collection details' do
+ - row 'URI', @volumes.uri
+ - row 'Description', @volumes.description
+ - row 'Created', @volumes.created
-%dl
- %dt URI
- %dd=@volumes.uri
- %dt Description
- %dd=@volumes.description
- %dt Created
- %dd=@volumes.created
diff --git a/clients/cimi/views/volumes/show.haml b/clients/cimi/views/volumes/show.haml
index 0352d52..ae477db 100644
--- a/clients/cimi/views/volumes/show.haml
+++ b/clients/cimi/views/volumes/show.haml
@@ -18,34 +18,21 @@
%blockquote
%p
- This entity represents a
- volume Instance
+ This entity represents a volume Instance
+
+- details 'Volume details' do
+ - row 'URI', @volume.uri
+ - row 'Description', @volume.description
+ - row 'Created', @volume.created
+ - row 'Bootable?', boolean_span_for(@volume.bootable)
+ - row 'Support snapshots?', boolean_span_for(@volume.supports_snapshots)
+ - row 'Guest Interface', boolean_span_for(@volume.guest_interface)
+
+- details 'Volume Snapshots' do
+ - @volume.snapshots.each_with_index do |s, i|
+ - row "##{i}", s.ref
+
+- details 'Volume Meters' do
+ - @volume.meters.each_with_index do |m, i|
+ - row "##{i}", m.ref
-%dl
- %dt URI
- %dd
- %a{ :href => @volume.uri }=@volume.uri
- %dt Description
- %dd=@volume.description
- %dt Created
- %dd=@volume.created
- %dt Bootable
- %dd=boolean_span_for @volume.bootable
- %dt Support Snapshots
- %dd=boolean_span_for @volume.supports_snapshots
- %dt Guest Interface
- %dd=boolean_span_for @volume.guest_interface
- %dt Snapshots
- %dd
- - if @volume.snapshots.empty?
- %span.label No snapshots
- - else
- - @volume.snapshots.each do |snapshot|
- %dd=snapshot.ref
- %dt Meters
- %dd
- - if @volume.meters.empty?
- %span.label No meters
- - else
- - @volume.meters.each do |meters|
- %dd=meters.ref
--
1.7.9.1
Re: [PATCH core 1/5] CIMI: Removed forgotten puts in client app starter
Posted by "marios@redhat.com" <ma...@redhat.com>.
ACK series - client views are much nicer like this
On 29/02/12 15:57, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
>
>
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
> clients/cimi/bin/start | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/clients/cimi/bin/start b/clients/cimi/bin/start
> index 94d6fc9..1f105a1 100755
> --- a/clients/cimi/bin/start
> +++ b/clients/cimi/bin/start
> @@ -106,8 +106,6 @@ else
>
> argv_opts.flatten!
>
> - puts argv_opts.inspect
> -
> if have_rerun && options[:env] == "development"
> argv_opts.unshift "thin"
> command = argv_opts.join(" ")
[PATCH core 4/5] CIMI: Moved :new operations to modal dialogs
Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
clients/cimi/lib/entities/machine.rb | 19 ++++-----
clients/cimi/lib/entities/machine_admin.rb | 6 +--
clients/cimi/public/app.js | 20 +++++++++
clients/cimi/views/machine_admins/index.haml | 44 +++++++++++++--------
clients/cimi/views/machine_admins/new.haml | 54 -------------------------
clients/cimi/views/machines/index.haml | 45 +++++++++++++++++----
clients/cimi/views/machines/new.haml | 55 --------------------------
7 files changed, 93 insertions(+), 150 deletions(-)
delete mode 100644 clients/cimi/views/machine_admins/new.haml
delete mode 100644 clients/cimi/views/machines/new.haml
diff --git a/clients/cimi/lib/entities/machine.rb b/clients/cimi/lib/entities/machine.rb
index 256ae77..67e5802 100644
--- a/clients/cimi/lib/entities/machine.rb
+++ b/clients/cimi/lib/entities/machine.rb
@@ -15,7 +15,14 @@
class CIMI::Frontend::Machine < CIMI::Frontend::Entity
- get '/cimi/machines/new' do
+ get '/cimi/machines/:id' do
+ machine_xml = get_entity('machines', params[:id], credentials)
+ @machine= CIMI::Model::Machine.from_xml(machine_xml)
+ haml :'machines/show'
+ end
+
+ get '/cimi/machines' do
+ # We need to include this stuff for new Machine Form
machine_image_xml = get_entity_collection('machine_images', credentials)
@machine_images = CIMI::Model::MachineImageCollection.from_xml(machine_image_xml)
machine_conf_xml = get_entity_collection('machine_configurations', credentials)
@@ -27,16 +34,6 @@ class CIMI::Frontend::Machine < CIMI::Frontend::Entity
rescue RestClient::InternalServerError
@machine_admins = []
end
- haml :'machines/new'
- end
-
- get '/cimi/machines/:id' do
- machine_xml = get_entity('machines', params[:id], credentials)
- @machine= CIMI::Model::Machine.from_xml(machine_xml)
- haml :'machines/show'
- end
-
- get '/cimi/machines' do
machine_xml = get_entity_collection('machines', credentials)
@machines = CIMI::Model::MachineCollection.from_xml(machine_xml)
haml :'machines/index'
diff --git a/clients/cimi/lib/entities/machine_admin.rb b/clients/cimi/lib/entities/machine_admin.rb
index bfa49ad..027a9d0 100644
--- a/clients/cimi/lib/entities/machine_admin.rb
+++ b/clients/cimi/lib/entities/machine_admin.rb
@@ -37,13 +37,11 @@ class CIMI::Frontend::MachineAdmin < CIMI::Frontend::Entity
get '/cimi/machine_admins' do
machine_admin_xml = get_entity_collection('machine_admins', credentials)
- puts machine_admin_xml
@machine_admins = CIMI::Model::MachineAdminCollection.from_xml(machine_admin_xml)
- puts @machine_admins.inspect
haml :'machine_admins/index'
end
- post '/cimi/machine_admin' do
+ post '/cimi/machine_admin' do
machine_admin_xml = Nokogiri::XML::Builder.new do |xml|
xml.MachineAdmin(:xmlns => CIMI::Frontend::CMWG_NAMESPACE) {
xml.name params[:machine_admin][:name]
@@ -60,7 +58,7 @@ class CIMI::Frontend::MachineAdmin < CIMI::Frontend::Entity
redirect "/cimi/machine_admins/#{machine_admin.name}", 302
rescue => e
flash[:error] = "Machine Admin could not be created: #{e.message}"
- redirect :back
+ redirect(back)
end
end
diff --git a/clients/cimi/public/app.js b/clients/cimi/public/app.js
index 09acbd5..4e0a8aa 100644
--- a/clients/cimi/public/app.js
+++ b/clients/cimi/public/app.js
@@ -15,3 +15,23 @@ function toggleConfig(driver) {
$('#providerModal').modal('show');
return false;
}
+
+function postModalForm(btn, id) {
+ $('div#'+id+' form').submit(function(e) {
+ e.preventDefault();
+ var frm = $(this);
+ $(btn).button('loading');
+ $.ajax({
+ type : 'POST',
+ url : frm.attr('action'),
+ data : frm.serialize(),
+ success: function(data) {
+ $(btn).button('Complete!');
+ $('div#'+id).modal('hide');
+ location.reload();
+ }
+ })
+
+ }).submit()
+ return false;
+}
diff --git a/clients/cimi/views/machine_admins/index.haml b/clients/cimi/views/machine_admins/index.haml
index cb04af6..a8bab3c 100644
--- a/clients/cimi/views/machine_admins/index.haml
+++ b/clients/cimi/views/machine_admins/index.haml
@@ -13,7 +13,27 @@
%a{ :href => "#{@machine_admins.uri}?format=xml", :class => 'label warning' } XML
%a{ :href => "#{@machine_admins.uri}?format=json", :class => 'label warning' } JSON
%p
- %a{ :href => '/cimi/machine_admins/new', :class => 'btn info'} New Machine Admin
+ %a{ :href => '#adminModal', :class => 'btn btn-primary', :'data-toggle' => :modal } New Machine Admin
+
+ %div{ :id => :adminModal, :class => 'modal hide fade' }
+ .modal-header
+ %h3 Create mew MachineAdmin entity
+ .modal-body
+ %form{ :action => "/cimi/machine_admin", :method => :post }
+ %fieldset
+ .control-group
+ %label.control-label{ :for => 'machine_admin[name]' } Key Name
+ .controls
+ %input{ :type => :text, :name => 'machine_admin[name]' }
+ %label.control-label{ :for => 'machine_admin[description]' } Key Description
+ .controls
+ %input{ :type => :text, :name => 'machine_admin[description]' }
+ %label.control-label{ :for => 'machine_admin[key]' } PEM data
+ .controls
+ %textarea{:name => 'machine_admin[key]', :class => 'input-xlarge', :rows => 3}
+ .modal-footer
+ %a{ :href => '#', :class => 'btn btn-primary', :'data-loading-text' => 'Creating MachineAdmin...', :onclick => "postModalForm(this, 'adminModal')"} Continue
+ %a{ :href => '#', :class => 'btn', :'data-dismiss' => 'modal'} Cancel
%blockquote
%p
@@ -21,24 +41,14 @@
entities within a Provider. This entity can be used to locate and create
MachineAdmins.
+%h3 MachineAdminCollection
+
%ul
- @machine_admins.machine_admins.each do |conf|
%li
%a{ :href => "/cimi/machine_admins/#{conf.href.split('/').last}"}=conf.href.split('/').last
-- if @machine_admins.machine_admins.empty?
- .alert-message.block-message.warning
- %p
- There are no MachineAdmin entities defined for this collection.
- .alert_actions
- %a{ :href => '/cimi/machine_admins/new', :class => 'btn'} Create new
-
-%h3 Collection details
-
-%dl
- %dt URI
- %dd=@machine_admins.uri
- %dt Description
- %dd=@machine_admins.description
- %dt Created
- %dd=@machine_admins.created
+- details 'Collection details' do
+ - row 'URI', @machine_admins.uri
+ - row 'Description', @machine_admins.description
+ - row 'Created', @machine_admins.created
diff --git a/clients/cimi/views/machine_admins/new.haml b/clients/cimi/views/machine_admins/new.haml
deleted file mode 100644
index b969740..0000000
--- a/clients/cimi/views/machine_admins/new.haml
+++ /dev/null
@@ -1,54 +0,0 @@
-- @title="New MachineAdmin"
-
-- content_for :breadcrumb do
- %ul.breadcrumb
- %li
- %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
- %span.divider="/"
- %li
- %a{ :href => "/cimi/machine_admins"} MachineAdminCollection
- %span.divider="/"
- %li.active New MachineAdmin
-
-
-%form{ :action => "/cimi/machine_admin", :method => :post }
- %fieldset
- %legend Create new MachineAdmin
- %div.clearfix
- %label{ :for => 'machine_admin[name]' }
- Name
- %div.input
- %input{ :type => :text, :name => 'machine_admin[name]' }
- %div.clearfix
- %label{ :for => 'machine_admin[description]' }
- Description
- %div.input
- %input{ :type => :text, :name => 'machine_admin[description]' }
- %div.clearfix
- %label{ :for => 'machine_admin[username]' }
- Username
- %div.input
- %input{ :type => :text, :name => 'machine_admin[username]', :value => "root" }
- %span.help-block
- %span.label.info NOTE
- Property could not be supported by cloud provider
- %div.clearfix
- %label{ :for => 'machine_admin[password]' }
- Password
- %div.input
- %input{ :type => :text, :name => 'machine_admin[password]' }
- %span.help-block
- %span.label.info NOTE
- Property could not be supported by cloud provider
- %div.clearfix
- %label{ :for => 'machine_admin[key]' }
- Key
- %div.input
- %textarea.xlarge{ :name => 'machine_admin[key]', :rows => 3 }
- %span.help-block
- %span.label.info NOTE
- Property could not be supported by cloud provider
- %div.actions
- %input{ :type => :submit, :class => 'btn primary', :value => "Create MachineAdmin" }
- %button{ :type => :reset, :class => 'btn' } Reset
-
diff --git a/clients/cimi/views/machines/index.haml b/clients/cimi/views/machines/index.haml
index 3f436ac..735bd2c 100644
--- a/clients/cimi/views/machines/index.haml
+++ b/clients/cimi/views/machines/index.haml
@@ -13,7 +13,38 @@
%a{ :href => "#{@machines.uri}?format=xml", :class => 'label warning' } XML
%a{ :href => "#{@machines.uri}?format=json", :class => 'label warning' } JSON
%p
- %a{ :href => '/cimi/machines/new', :class => 'btn info'} New machine
+ %a{ :href => '#machineModal', :class => 'btn btn-primary', :'data-toggle' => :modal} New Machine
+
+ %div{ :id => :machineModal, :class => 'modal hide fade' }
+ .modal-header
+ %h3 Create mew Machine entity
+ .modal-body
+ %form{ :action => "/cimi/machines", :method => :post }
+ %fieldset
+ .control-group
+ %label.control-label{ :for => 'machine[name]' } Machine Name
+ .controls
+ %input{ :type => :text, :name => 'machine[name]' }
+ %label.control-label{ :for => 'machine[machine_image]' } Machine Image
+ .controls
+ %select{ :name => 'machine[machine_image]' }
+ - @machine_images.machine_images.each do |image|
+ %option{ :value => image.href }=href_to_id(image.href)
+ %label.control-label{ :for => 'machine[machine_configuration]' } Machine Configuration
+ .controls
+ %select{ :name => 'machine[machine_configuration]' }
+ - @machine_configurations.machine_configurations.each do |configuration|
+ %option{ :value => configuration.href }=href_to_id(configuration.href)
+ - unless @machine_admins.kind_of?(Array)
+ %label.control-label{ :for => 'machine[machine_admin]' } Machine Admin
+ .controls
+ %select{ :name => 'machine[machine_admin]' }
+ - @machine_admins.machine_admins.each do |admin|
+ %option{ :value => admin.href }=href_to_id(admin.href)
+ .modal-footer
+ %a{ :href => '#', :class => 'btn btn-primary', :'data-loading-text' => 'Creating MachineAdmin...', :onclick => "postModalForm(this, 'machineModal')"} Continue
+ %a{ :href => '#', :class => 'btn', :'data-dismiss' => 'modal'} Cancel
+
%blockquote
@@ -34,12 +65,8 @@
.alert_actions
%a{ :href => '/cimi/machine/new', :class => 'btn'} Create new
-%h3 Collection details
-%dl
- %dt URI
- %dd=@machines.uri
- %dt Description
- %dd=@machines.description
- %dt Created
- %dd=@machines.created
+- details('Collection details') do
+ - row 'URI', @machines.uri
+ - row 'Description', @machines.description
+ - row 'Created', @machines.created
diff --git a/clients/cimi/views/machines/new.haml b/clients/cimi/views/machines/new.haml
deleted file mode 100644
index d2a354b..0000000
--- a/clients/cimi/views/machines/new.haml
+++ /dev/null
@@ -1,55 +0,0 @@
-- @title="New Machine"
-
-- content_for :breadcrumb do
- %ul.breadcrumb
- %li
- %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
- %span.divider="/"
- %li
- %a{ :href => "/cimi/machines"} MachineCollection
- %span.divider="/"
- %li.active New Machine
-
-
-%form{ :action => "/cimi/machines", :method => :post }
- %fieldset
- %legend Create new Machine
- %div.clearfix
- %label{ :for => 'machine[name]' }
- Name
- %div.input
- %input{ :type => :text, :name => 'machine[name]' }
- %div.clearfix
- %label{ :for => 'machine[description]' }
- Description
- %div.input
- %input{ :type => :text, :name => 'machine[description]' }
- %div.clearfix
- %label{ :for => 'machine[machine_image]' }
- Machine Image
- %div.input
- %select{ :name => 'machine[machine_image]' }
- - @machine_images.machine_images.each do |image|
- %option{ :value => image.href }=href_to_id(image.href)
- %div.clearfix
- %label{ :for => 'machine[machine_configuration]' }
- Machine Configuration
- %div.input
- %select{ :name => 'machine[machine_configuration]' }
- - @machine_configurations.machine_configurations.each do |configuration|
- %option{ :value => configuration.href }=href_to_id(configuration.href)
- %div.clearfix
- %label{ :for => 'machine[machine_admin]' }
- Machine Admin
- %div.input
- %select{ :name => 'machine[machine_admin]' }
- - if @machine_admins.kind_of?(Array)
- %option{ :value => '', :selected => :selected }
- - @machine_admins.machine_admins.each do |admin|
- %option{ :value => admin.href }=href_to_id(admin.href)
- - else
- %option{ :disabled => 'disabled'}="Not supported"
- %div.actions
- %input{ :type => :submit, :class => 'btn primary', :value => "Create machine" }
- %button{ :type => :reset, :class => 'btn' } Reset
-
--
1.7.9.1
[PATCH core 5/5] CIMI: Added OpenStack option to client app
Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
clients/cimi/views/layout.haml | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/clients/cimi/views/layout.haml b/clients/cimi/views/layout.haml
index b7b48fb..44007cb 100644
--- a/clients/cimi/views/layout.haml
+++ b/clients/cimi/views/layout.haml
@@ -10,6 +10,7 @@
%script{ :src => '/bootstrap/js/bootstrap-dropdown.js' }
%script{ :src => '/bootstrap/js/bootstrap-transition.js' }
%script{ :src => '/bootstrap/js/bootstrap-modal.js' }
+ %script{ :src => '/bootstrap/js/bootstrap-buttons.js' }
%link{ :href => '/bootstrap/bootstrap.min.css', :rel => :stylesheet }
%link{ :href => '/app.css', :rel => :stylesheet }
%script{ :src => '/app.js' }
@@ -31,6 +32,8 @@
%a{ :href => '#ec2', :onclick => "toggleConfig('ec2')"} Amazon EC2
%li
%a{ :href => '#providerModal', :onclick => "toggleConfig('rhevm')"} RHEV-M
+ %li
+ %a{ :href => '#providerModal', :onclick => "toggleConfig('openstack')"} OpenStack
.container
%div{ :id => 'providerModal', :class => 'modal hide fade' }
--
1.7.9.1