From: NjeriChelimo <martha.c.ch...@gmail.com> --- clients/cimi/lib/entities/volume_configuration.rb | 20 ++++++++++++++ clients/cimi/views/machine_templates/index.haml | 12 -------- .../cimi/views/volume_configurations/index.haml | 29 ++++++++++++++++++++ 3 files changed, 49 insertions(+), 12 deletions(-)
diff --git a/clients/cimi/lib/entities/volume_configuration.rb b/clients/cimi/lib/entities/volume_configuration.rb index 7008696..8e2db78 100644 --- a/clients/cimi/lib/entities/volume_configuration.rb +++ b/clients/cimi/lib/entities/volume_configuration.rb @@ -27,4 +27,24 @@ class CIMI::Frontend::VolumeConfiguration < CIMI::Frontend::Entity haml :'volume_configurations/index' end + post '/cimi/volume_configurations' do + volume_configuration_xml = Nokogiri::XML::Builder.new do |xml| + xml.VolumeConfigurations(:xmlns => CIMI::Frontend::CMWG_NAMESPACE) { + xml.name params[:volume_configuration][:name] + xml.description params[:volume_configuration][:description] + xml.format params[:volume_configuration][:format] + xml.capacity params[:volume_configuration][:capacity] + } + end.to_xml + begin + result = create_entity('volume_configurations', volume_configuration_xml, credentials) + volume_configuration = CIMI::Model::VolumeConfigurationCollection.from_xml(result) + flash[:success] = "Volume Configuration was successfully created." + redirect "/cimi/volume_configurations/#{volume_configuration.name}", 302 + rescue => e + flash[:error] = "Volume Configuration cannot be created: #{e.message}" + redirect :back + end + end + end diff --git a/clients/cimi/views/machine_templates/index.haml b/clients/cimi/views/machine_templates/index.haml index 3077bf7..6bcbd24 100644 --- a/clients/cimi/views/machine_templates/index.haml +++ b/clients/cimi/views/machine_templates/index.haml @@ -8,10 +8,6 @@ %li.active MachineTemplateCollection - - - - - content_for :actions do %p @@ -44,14 +40,6 @@ %a{ :href => "#{@machine_templates.id}?format=xml", :class => 'label warning' } XML %a{ :href => "#{@machine_templates.id}?format=json", :class => 'label warning' } JSON - - - - - - - - %blockquote %p A Machine Template Collection entity represents the collection of diff --git a/clients/cimi/views/volume_configurations/index.haml b/clients/cimi/views/volume_configurations/index.haml index 376a112..f284b8b 100644 --- a/clients/cimi/views/volume_configurations/index.haml +++ b/clients/cimi/views/volume_configurations/index.haml @@ -9,6 +9,35 @@ VolumeConfigurationCollection - content_for :actions do + + %p + %a{ :href => '#volumeConfigurationModal', :class => 'btn btn-primary', :'data-toggle' => :modal} New Volume Configuration + + %div{ :id => :volumeConfigurationModal, :class => 'modal hide fade' } + .modal-header + %h3 Create new Volume Configuration + .modal-body + %form{ :action => "/cimi/volume_configurations", :method => :post } + %fieldset + .control-group + %label.control-label{ :for => 'volume_configuration[name]' } Volume Configuration Name + .controls + %input{ :type => :text, :name => 'volume_configuration[name]' } + %label.control-label{ :for => 'volume_configuration[description]' } Volume Configuration Description + .controls + %input{ :type => :text, :description => 'volume_configuration[description]' } + %label.control-label{ :for => 'volume_configuration[format]' } Volume Configuration Format + .controls + %input{ :type => :text, :format => 'volume_configuration[format]' } + %label.control-label{ :for => 'volume_configuration[capacity]' } Volume Configuration Capacity + .controls + %input{ :type => :text, :capacity => 'volume_configuration[capacity]' } + + .modal-footer + %a{ :href => '#', :class => 'btn btn-primary', :'data-loading-text' => 'Creating Volume Configuration...', :onclick => "postModalForm(this, 'volumeConfigurationModal')"} Continue + %a{ :href => '#', :class => 'btn', :'data-dismiss' => 'modal'} Cancel + %p{:style => 'text-align:right;'} + %p %a{ :href => "#{@volume_configurations.id}?format=xml", :class => 'label warning' } XML %a{ :href => "#{@volume_configurations.id}?format=json", :class => 'label warning' } JSON -- 1.7.9.5