From: Imre Farkas <ifarkas(a)redhat.com>
---
src/app/controllers/catalog_entries_controller.rb | 171 ++-----------------
src/app/controllers/deployables_controller.rb | 176 +++++++++++++++++++-
src/app/models/catalog_entry.rb | 2 +
src/app/views/catalog_entries/_form.html.haml | 27 ---
src/app/views/catalog_entries/_from_url.html.haml | 27 ---
src/app/views/catalog_entries/_list.html.haml | 38 -----
src/app/views/catalog_entries/_new.html.haml | 65 -------
.../catalog_entries/_new_from_image.html.haml | 24 ---
.../catalog_entries/_section_header.html.haml | 4 -
src/app/views/catalog_entries/_upload.html.haml | 27 ---
src/app/views/catalog_entries/edit.html.haml | 15 --
src/app/views/catalog_entries/index.html.haml | 3 -
src/app/views/catalog_entries/new.html.haml | 2 -
src/app/views/catalog_entries/show.html.haml | 58 -------
src/app/views/catalogs/show.html.haml | 12 +-
src/app/views/deployables/_form.html.haml | 27 +++
src/app/views/deployables/_from_url.html.haml | 27 +++
src/app/views/deployables/_list.html.haml | 38 +++++
src/app/views/deployables/_new.html.haml | 65 +++++++
.../views/deployables/_new_from_image.html.haml | 24 +++
.../views/deployables/_section_header.html.haml | 4 +
src/app/views/deployables/_upload.html.haml | 27 +++
src/app/views/deployables/edit.html.haml | 15 ++
src/app/views/deployables/index.html.haml | 3 +
src/app/views/deployables/new.html.haml | 2 +
src/app/views/deployables/show.html.haml | 64 +++++++
src/app/views/deployments/_overview.html.haml | 2 +-
.../deployments/launch_from_catalog.html.haml | 2 +-
src/config/locales/en.yml | 2 +
src/config/routes.rb | 2 +-
src/features/catalog_entries.feature | 89 ----------
src/features/deployables.feature | 89 ++++++++++
.../step_definitions/catalog_entry_steps.rb | 19 --
src/features/step_definitions/deployable_steps.rb | 19 ++
src/features/support/paths.rb | 4 +-
.../controllers/catalog_entries_controller_spec.rb | 46 -----
.../controllers/deployables_controller_spec.rb | 46 +++++
37 files changed, 652 insertions(+), 615 deletions(-)
delete mode 100644 src/app/views/catalog_entries/_form.html.haml
delete mode 100644 src/app/views/catalog_entries/_from_url.html.haml
delete mode 100644 src/app/views/catalog_entries/_list.html.haml
delete mode 100644 src/app/views/catalog_entries/_new.html.haml
delete mode 100644 src/app/views/catalog_entries/_new_from_image.html.haml
delete mode 100644 src/app/views/catalog_entries/_section_header.html.haml
delete mode 100644 src/app/views/catalog_entries/_upload.html.haml
delete mode 100644 src/app/views/catalog_entries/edit.html.haml
delete mode 100644 src/app/views/catalog_entries/index.html.haml
delete mode 100644 src/app/views/catalog_entries/new.html.haml
delete mode 100644 src/app/views/catalog_entries/show.html.haml
create mode 100644 src/app/views/deployables/_form.html.haml
create mode 100644 src/app/views/deployables/_from_url.html.haml
create mode 100644 src/app/views/deployables/_list.html.haml
create mode 100644 src/app/views/deployables/_new.html.haml
create mode 100644 src/app/views/deployables/_new_from_image.html.haml
create mode 100644 src/app/views/deployables/_section_header.html.haml
create mode 100644 src/app/views/deployables/_upload.html.haml
create mode 100644 src/app/views/deployables/edit.html.haml
create mode 100644 src/app/views/deployables/index.html.haml
create mode 100644 src/app/views/deployables/new.html.haml
create mode 100644 src/app/views/deployables/show.html.haml
delete mode 100644 src/features/catalog_entries.feature
create mode 100644 src/features/deployables.feature
delete mode 100644 src/features/step_definitions/catalog_entry_steps.rb
create mode 100644 src/features/step_definitions/deployable_steps.rb
delete mode 100644 src/spec/controllers/catalog_entries_controller_spec.rb
create mode 100644 src/spec/controllers/deployables_controller_spec.rb
diff --git a/src/app/controllers/catalog_entries_controller.rb
b/src/app/controllers/catalog_entries_controller.rb
index a8adbb6..5fbe113 100644
--- a/src/app/controllers/catalog_entries_controller.rb
+++ b/src/app/controllers/catalog_entries_controller.rb
@@ -15,181 +15,38 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at
http://www.gnu.org/copyleft/gpl.html.
-require 'uri'
class CatalogEntriesController < ApplicationController
- before_filter :require_user
-
- def index
- clear_breadcrumbs
- save_breadcrumb(catalog_catalog_entries_path(:viewstate => @viewstate ?
@viewstate.id : nil))
- @deployables = Deployable.list_for_user(current_user, Privilege::VIEW)
- @catalog_entries = @deployables.collect { |d| d.catalog_entries.first }
- #@catalog_entries = CatalogEntry.list_for_user(current_user,
Privilege::VIEW).apply_filters(:preset_filter_id =>
params[:catalog_entries_preset_filter], :search_filter =>
params[:catalog_entries_search])
- @catalog = @catalog_entries.first.catalog unless @catalog_entries.empty?
- set_header
- end
-
- def new
- @catalog_entry = params[:catalog_entry].nil? ? CatalogEntry.new() :
CatalogEntry.new(params[:catalog_entry])
- @catalog_entry.deployable = Deployable.new unless @catalog_entry.deployable
- require_privilege(Privilege::CREATE, Deployable)
- if params[:create_from_image]
- @image = Aeolus::Image::Warehouse::Image.find(params[:create_from_image])
- @hw_profiles = HardwareProfile.frontend.list_for_user(current_user,
Privilege::VIEW)
- @catalog_entry.deployable.name = @image.name
- load_catalogs
- else
- @catalog = Catalog.find(params[:catalog_id])
- require_privilege(Privilege::MODIFY, @catalog)
- end
- @form_option= params.has_key?(:from_url) ? 'from_url' : 'upload'
- respond_to do |format|
- format.html
- format.js {render :partial => @form_option}
- end
- end
-
- def show
- @catalog_entry = CatalogEntry.find(params[:id])
- require_privilege(Privilege::VIEW, @catalog_entry.deployable)
- save_breadcrumb(catalog_catalog_entry_path((a)catalog_entry.catalog, @catalog_entry),
@catalog_entry.deployable.name)
- @providers = Provider.all
- @catalogs_options = Catalog.all.map {|c| [c.name, c.id]}
- add_permissions_inline((a)catalog_entry.deployable)
- end
def create
- if params[:cancel]
- redirect_to catalog_catalog_entries_path
- return
- end
-
-
@catalog_entry = CatalogEntry.new(params[:catalog_entry])
- if params[:create_from_image].present?
- @catalog = @catalog_entry.catalog
- @catalog_entry.deployable = Deployable.new unless @catalog_entry.deployable
- else
- @catalog = Catalog.find(params[:catalog_id])
- @catalog_entry.catalog = @catalog
- end
- require_privilege(Privilege::MODIFY, @catalog)
- require_privilege(Privilege::CREATE, Deployable)
- @catalog_entry.deployable.owner = current_user
-
- if params.has_key? :url
- xml = import_xml_from_url(params[:url])
- unless xml.nil?
- #store xml_filename for url (i.e. url ends to: foo || foo.xml)
- @catalog_entry.deployable.xml_filename =
File.basename(URI.parse(params[:url]).path)
- @catalog_entry.deployable.xml = xml
- end
- elsif params[:create_from_image].present?
- hw_profile = HardwareProfile.frontend.find(params[:hardware_profile])
- require_privilege(Privilege::VIEW, hw_profile)
- @catalog_entry.deployable.set_from_image(params[:create_from_image], hw_profile)
- end
+ require_privilege(Privilege::MODIFY, @catalog_entry.catalog)
+ require_privilege(Privilege::MODIFY, @catalog_entry.deployable)
if @catalog_entry.save
- flash[:notice] = t "catalog_entries.flash.notice.added"
- if params[:edit_xml]
- redirect_to edit_catalog_catalog_entry_path @catalog_entry.catalog.id,
@catalog_entry.id, :edit_xml =>true
- else
- redirect_to catalog_catalog_entries_path(@catalog)
- end
+ redirect_to catalog_deployable_path((a)catalog_entry.catalog, @catalog_entry),
:notice => t('catalog_entries.flash.notice.added')
else
- flash[:warning]= t('catalog_entries.flash.warning.not_valid') if
@catalog_entry.errors.has_key?(:xml)
- if params[:create_from_image].present?
- load_catalogs
- @image = Aeolus::Image::Warehouse::Image.find(params[:create_from_image])
- @hw_profiles = HardwareProfile.frontend.list_for_user(current_user,
Privilege::VIEW)
- @catalog_entry.deployable.name = @image.name
- else
- params.delete(:edit_xml) if params[:edit_xml]
- @form_option = params[:catalog_entry].has_key?(:xml) ? 'upload' :
'from_url'
- @form_option = params[:catalog_entry][:deployable].has_key?(:xml) ?
'upload' : 'from_url'
- end
- render :new
+ flash[:warning] = t('catalog_entries.flash.warning.failed')
+ redirect_to catalog_deployable_path((a)catalog_entry.deployable.catalogs.first,
@catalog_entry)
end
end
- def edit
+ def destroy
@catalog_entry = CatalogEntry.find(params[:id])
- require_privilege(Privilege::MODIFY, @catalog_entry.deployable)
- @catalog = @catalog_entry.catalog
- end
+ deployable = @catalog_entry.deployable
+ catalog = @catalog_entry.catalog
- def update
- @catalog_entry = CatalogEntry.find(params[:id])
+ require_privilege(Privilege::MODIFY, @catalog_entry.catalog)
require_privilege(Privilege::MODIFY, @catalog_entry.deployable)
- params[:catalog_entry][:deployable].delete(:owner_id) if params[:catalog_entry] and
params[:catalog_entry][:deployable]
+ @catalog_entry.destroy
- if @catalog_entry.update_attributes(params[:catalog_entry])
- flash[:notice] = t"catalog_entries.flash.notice.updated"
- redirect_to catalog_catalog_entry_path((a)catalog_entry.catalog, @catalog_entry)
+ if deployable.catalog_entries.empty?
+ redirect_to catalog_path(catalog), :notice =>
t('catalog_entries.flash.notice.deleted')
else
- render :action => 'edit'
- end
- end
-
- def multi_destroy
- @catalog = nil
- CatalogEntry.find(params[:catalog_entries_selected]).to_a.each do |d|
- require_privilege(Privilege::MODIFY, d.catalog)
- require_privilege(Privilege::MODIFY, d.deployable)
- @catalog = d.catalog
- # Don't do this when we're managing deployables independently
- d.deployable.destroy
- d.destroy
+ catalog_entry_to_nagigate = deployable.catalog_entries.first
+ redirect_to catalog_deployable_path(catalog_entry_to_nagigate.catalog,
catalog_entry_to_nagigate), :notice =>
t('catalog_entries.flash.notice.deleted')
end
- redirect_to catalog_path(@catalog)
- end
- def destroy
- catalog_entry = CatalogEntry.find(params[:id])
- require_privilege(Privilege::MODIFY, catalog_entry.catalog)
- require_privilege(Privilege::MODIFY, catalog_entry.deployable)
- @catalog = catalog_entry.catalog
- # Don't do this when we're managing deployables independently
- catalog_entry.deployable.destroy
- catalog_entry.destroy
-
- respond_to do |format|
- format.html { redirect_to catalog_path(@catalog) }
- end
end
- def filter
- original_path = Rails.application.routes.recognize_path(params[:current_path])
- original_params =
Rack::Utils.parse_nested_query(URI.parse(params[:current_path]).query)
- redirect_to
original_path.merge(original_params).merge("catalog_entries_preset_filter" =>
params[:catalog_entries_preset_filter], "catalog_entries_search" =>
params[:catalog_entries_search])
- end
-
- private
-
- def set_header
- @header = [
- { :name => 'checkbox', :class => 'checkbox', :sortable =>
false },
- { :name => t("catalog_entries.index.name"), :sort_attr => :name },
- { :name => t("catalogs.index.catalog_name"), :sortable => false },
- { :name => t("catalog_entries.index.deployable_xml"), :sortable =>
:url }
- ]
- end
-
- def load_catalogs
- @catalogs = Catalog.list_for_user(current_user, Privilege::MODIFY)
- end
-
- def import_xml_from_url(url)
- begin
- response = RestClient.get(url, :accept => :xml)
- if response.code == 200
- response
- end
- rescue RestClient::Exception, SocketError, URI::InvalidURIError
- flash[:error] = t('catalog_entries.flash.warning.not_valid_or_reachable',
:url => url)
- nil
- end
- end
end
diff --git a/src/app/controllers/deployables_controller.rb
b/src/app/controllers/deployables_controller.rb
index 6e96439..9c19932 100644
--- a/src/app/controllers/deployables_controller.rb
+++ b/src/app/controllers/deployables_controller.rb
@@ -15,11 +15,181 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at
http://www.gnu.org/copyleft/gpl.html.
+require 'uri'
class DeployablesController < ApplicationController
+ before_filter :require_user
+
+ def index
+ clear_breadcrumbs
+ save_breadcrumb(catalog_deployables_path(:viewstate => @viewstate ? @viewstate.id
: nil))
+ @deployables = Deployable.list_for_user(current_user, Privilege::VIEW)
+ @catalog_entries = @deployables.collect { |d| d.catalog_entries.first }
+ #@catalog_entries = CatalogEntry.list_for_user(current_user,
Privilege::VIEW).apply_filters(:preset_filter_id =>
params[:catalog_entries_preset_filter], :search_filter =>
params[:catalog_entries_search])
+ @catalog = @catalog_entries.first.catalog unless @catalog_entries.empty?
+ set_header
+ end
+
+ def new
+ @catalog_entry = params[:catalog_entry].nil? ? CatalogEntry.new() :
CatalogEntry.new(params[:catalog_entry])
+ @catalog_entry.deployable = Deployable.new unless @catalog_entry.deployable
+ require_privilege(Privilege::CREATE, Deployable)
+ if params[:create_from_image]
+ @image = Aeolus::Image::Warehouse::Image.find(params[:create_from_image])
+ @hw_profiles = HardwareProfile.frontend.list_for_user(current_user,
Privilege::VIEW)
+ @catalog_entry.deployable.name = @image.name
+ load_catalogs
+ else
+ @catalog = Catalog.find(params[:catalog_id])
+ require_privilege(Privilege::MODIFY, @catalog)
+ end
+ @form_option= params.has_key?(:from_url) ? 'from_url' : 'upload'
+ respond_to do |format|
+ format.html
+ format.js {render :partial => @form_option}
+ end
+ end
+
def show
- flash.keep
- @deployable = Deployable.find(params[:id])
- redirect_to catalog_entry_path((a)deployable.catalog_entries.first)
+ @catalog_entry = CatalogEntry.find(params[:id])
+ require_privilege(Privilege::VIEW, @catalog_entry.deployable)
+ save_breadcrumb(catalog_deployable_path((a)catalog_entry.catalog, @catalog_entry),
@catalog_entry.deployable.name)
+ @providers = Provider.all
+ @catalogs_options = Catalog.all.map {|c| [c.name, c.id]}
+ add_permissions_inline((a)catalog_entry.deployable)
+ end
+
+ def create
+ if params[:cancel]
+ redirect_to catalog_deployables_path
+ return
+ end
+
+
+ @catalog_entry = CatalogEntry.new(params[:catalog_entry])
+ if params[:create_from_image].present?
+ @catalog = @catalog_entry.catalog
+ @catalog_entry.deployable = Deployable.new unless @catalog_entry.deployable
+ else
+ @catalog = Catalog.find(params[:catalog_id])
+ @catalog_entry.catalog = @catalog
+ end
+ require_privilege(Privilege::MODIFY, @catalog)
+ require_privilege(Privilege::CREATE, Deployable)
+ @catalog_entry.deployable.owner = current_user
+
+ if params.has_key? :url
+ xml = import_xml_from_url(params[:url])
+ unless xml.nil?
+ #store xml_filename for url (i.e. url ends to: foo || foo.xml)
+ @catalog_entry.deployable.xml_filename =
File.basename(URI.parse(params[:url]).path)
+ @catalog_entry.deployable.xml = xml
+ end
+ elsif params[:create_from_image].present?
+ hw_profile = HardwareProfile.frontend.find(params[:hardware_profile])
+ require_privilege(Privilege::VIEW, hw_profile)
+ @catalog_entry.deployable.set_from_image(params[:create_from_image], hw_profile)
+ end
+
+ if @catalog_entry.save
+ flash[:notice] = t "catalog_entries.flash.notice.added"
+ if params[:edit_xml]
+ redirect_to edit_catalog_deployable_path @catalog_entry.catalog.id,
@catalog_entry.id, :edit_xml =>true
+ else
+ redirect_to catalog_deployables_path(@catalog)
+ end
+ else
+ flash[:warning]= t('catalog_entries.flash.warning.not_valid') if
@catalog_entry.errors.has_key?(:xml)
+ if params[:create_from_image].present?
+ load_catalogs
+ @image = Aeolus::Image::Warehouse::Image.find(params[:create_from_image])
+ @hw_profiles = HardwareProfile.frontend.list_for_user(current_user,
Privilege::VIEW)
+ @catalog_entry.deployable.name = @image.name
+ else
+ params.delete(:edit_xml) if params[:edit_xml]
+ @form_option = params[:catalog_entry].has_key?(:xml) ? 'upload' :
'from_url'
+ @form_option = params[:catalog_entry][:deployable].has_key?(:xml) ?
'upload' : 'from_url'
+ end
+ render :new
+ end
+ end
+
+ def edit
+ @catalog_entry = CatalogEntry.find(params[:id])
+ require_privilege(Privilege::MODIFY, @catalog_entry.deployable)
+ @catalog = @catalog_entry.catalog
+ end
+
+ def update
+ @catalog_entry = CatalogEntry.find(params[:id])
+ require_privilege(Privilege::MODIFY, @catalog_entry.deployable)
+ params[:catalog_entry][:deployable].delete(:owner_id) if params[:catalog_entry] and
params[:catalog_entry][:deployable]
+
+ if @catalog_entry.update_attributes(params[:catalog_entry])
+ flash[:notice] = t"catalog_entries.flash.notice.updated"
+ redirect_to catalog_deployable_path((a)catalog_entry.catalog, @catalog_entry)
+ else
+ render :action => 'edit'
+ end
+ end
+
+ def multi_destroy
+ @catalog = nil
+ CatalogEntry.find(params[:catalog_entries_selected]).to_a.each do |d|
+ require_privilege(Privilege::MODIFY, d.catalog)
+ require_privilege(Privilege::MODIFY, d.deployable)
+ @catalog = d.catalog
+ # Don't do this when we're managing deployables independently
+ d.deployable.destroy
+ d.destroy
+ end
+ redirect_to catalog_path(@catalog)
+ end
+
+ def destroy
+ catalog_entry = CatalogEntry.find(params[:id])
+ require_privilege(Privilege::MODIFY, catalog_entry.catalog)
+ require_privilege(Privilege::MODIFY, catalog_entry.deployable)
+ @catalog = catalog_entry.catalog
+ # Don't do this when we're managing deployables independently
+ catalog_entry.deployable.destroy
+ catalog_entry.destroy
+
+ respond_to do |format|
+ format.html { redirect_to catalog_path(@catalog) }
+ end
+ end
+
+ def filter
+ original_path = Rails.application.routes.recognize_path(params[:current_path])
+ original_params =
Rack::Utils.parse_nested_query(URI.parse(params[:current_path]).query)
+ redirect_to
original_path.merge(original_params).merge("catalog_entries_preset_filter" =>
params[:catalog_entries_preset_filter], "catalog_entries_search" =>
params[:catalog_entries_search])
+ end
+
+ private
+
+ def set_header
+ @header = [
+ { :name => 'checkbox', :class => 'checkbox', :sortable =>
false },
+ { :name => t("catalog_entries.index.name"), :sort_attr => :name },
+ { :name => t("catalogs.index.catalog_name"), :sortable => false },
+ { :name => t("catalog_entries.index.deployable_xml"), :sortable =>
:url }
+ ]
+ end
+
+ def load_catalogs
+ @catalogs = Catalog.list_for_user(current_user, Privilege::MODIFY)
+ end
+
+ def import_xml_from_url(url)
+ begin
+ response = RestClient.get(url, :accept => :xml)
+ if response.code == 200
+ response
+ end
+ rescue RestClient::Exception, SocketError, URI::InvalidURIError
+ flash[:error] = t('catalog_entries.flash.warning.not_valid_or_reachable',
:url => url)
+ nil
+ end
end
end
diff --git a/src/app/models/catalog_entry.rb b/src/app/models/catalog_entry.rb
index 69c67b6..21a8b9b 100644
--- a/src/app/models/catalog_entry.rb
+++ b/src/app/models/catalog_entry.rb
@@ -39,6 +39,8 @@ class CatalogEntry < ActiveRecord::Base
validates_presence_of :catalog
validates_presence_of :deployable
+ validates_uniqueness_of :catalog_id, :scope => [:deployable_id]
+
# This probably goes away once we separate catalog entry creation from deployables
accepts_nested_attributes_for :deployable
PRESET_FILTERS_OPTIONS = []
diff --git a/src/app/views/catalog_entries/_form.html.haml
b/src/app/views/catalog_entries/_form.html.haml
deleted file mode 100644
index 5c8b2bb..0000000
--- a/src/app/views/catalog_entries/_form.html.haml
+++ /dev/null
@@ -1,27 +0,0 @@
-- if @catalog_entry.errors.any?
- = render 'layouts/error_messages', :object => @catalog_entry
-%fieldset
- - if params[:edit_xml]
- = form.fields_for :deployable, @catalog_entry.deployable do |deployable_fields|
- %p
- = deployable_fields.label :xml, t('.deployable_xml')
- = deployable_fields.text_area :xml, :class => 'long'
- - else
- %p
- = form.label :catalog_id, t('catalog_entries.form.catalog')
- = @catalog.name
- .clear
- = form.fields_for :deployable, @catalog_entry.deployable do |deployable_fields|
- %p
- = deployable_fields.label :name, t('catalog_entries.index.name')
- = deployable_fields.text_field :name, :class => 'em long'
- %p
- = deployable_fields.label :description, t('.description')
- = deployable_fields.text_area :description, :class => 'long'
- %p
- = deployable_fields.label :xml, t('.deployable_xml')
- = link_to t("catalog_entries.properties.edit_deployable_xml"),
edit_catalog_catalog_entry_path((a)catalog_entry.catalog.id, @catalog_entry.id,
:edit_xml=>true)
-
-%fieldset.options
- = link_to t('cancel'), catalog_path(@catalog), :class => 'button
danger'
- = submit_tag t('save'), :name => 'save', :class =>
'button', :id => 'save_button'
diff --git a/src/app/views/catalog_entries/_from_url.html.haml
b/src/app/views/catalog_entries/_from_url.html.haml
deleted file mode 100644
index 4d9b583..0000000
--- a/src/app/views/catalog_entries/_from_url.html.haml
+++ /dev/null
@@ -1,27 +0,0 @@
-= form_for @catalog_entry, :url => catalog_catalog_entries_path(@catalog), :html =>
{:class => 'generic', :multipart => true } do |form|
- - if @catalog_entry.errors.any?
- = render 'layouts/error_messages', :object => @catalog_entry
- %fieldset
- %p
- = form.label :catalog_id, t('catalog_entries.form.catalog')
- = @catalog.name
- .clear
- =form.fields_for :deployable, @catalog_entry.deployable do |deployable_fields|
- %fieldset
- %p
- = deployable_fields.label :name, t('catalog_entries.index.name')
- = deployable_fields.text_field :name, :class => 'em long'
- %p
- = deployable_fields.label :description,
t('catalog_entries.form.description')
- = deployable_fields.text_area :description, :class => 'long'
- %fieldset
- %p
- = label_tag :url, t('catalog_entries.form.deployable_xml_url')
- = text_field_tag :url
- %p
- = check_box_tag(:edit_xml, true, false)
- = label_tag :edit_xml, t('catalog_entries.form.edit_xml_after_save')
-
- %fieldset.options
- = link_to t('cancel'), catalog_path(@catalog), :class => 'button
danger'
- = submit_tag t('save'), :name => 'save', :class =>
'button', :id => 'save_button'
diff --git a/src/app/views/catalog_entries/_list.html.haml
b/src/app/views/catalog_entries/_list.html.haml
deleted file mode 100644
index 31e8481..0000000
--- a/src/app/views/catalog_entries/_list.html.haml
+++ /dev/null
@@ -1,38 +0,0 @@
-%section.admin-content-section
- %header
- %h2=t'catalog_entries.list.catalog_entries_list'
-
- .content
- - content_for :form_header do
- %li= restful_submit_tag t("catalog_entries.show.delete"),
"destroy", multi_destroy_catalog_catalog_entries_path(@catalog),
'DELETE', :id => 'delete_button', :class => 'button danger'
-
- - content_for :filter_controls do
- %li
- = label_tag :catalog_entries_preset_filter, t('filter_table.viewing')
- = hidden_field_tag :current_path, request.fullpath
- = select_tag(:catalog_entries_preset_filter,
preset_filters_options_for_select(CatalogEntry::PRESET_FILTERS_OPTIONS,
params[:catalog_entries_preset_filter]), :include_blank =>
t("catalog_entries.preset_filters.all_catalog_entries"), :disabled => true)
- = restful_submit_tag t("filter_table.apply_filters"),
"filter", filter_catalog_catalog_entries_path(@catalog), 'POST', :class
=> 'button', :id => 'apply_catalog_entries_preset_filter'
- %span.label.badge.dark= @catalog_entries.count
- %li.table-search-filter
- = text_field_tag :catalog_entries_search, params[:catalog_entries_search],
:placeholder => t("filter_table.search")
- = restful_submit_tag "", "search",
filter_catalog_catalog_entries_path(@catalog), 'POST', :class =>
'button', :id => 'apply_catalog_entries_search'
-
- :javascript
- $(document).ready(function(){
- $("#apply_catalog_entries_preset_filter").hide();
- $("#catalog_entries_preset_filter").change(function() {
- $("#apply_catalog_entries_preset_filter").click();
- });
- });
-
- = filter_table(@header, @catalog_entries) do |catalog_entry|
- %tr{:class => cycle('nostripe','stripe')}
- %td{:class => 'checkbox'}
- - selected = params[:select] == 'all'
- = check_box_tag "catalog_entries_selected[]", catalog_entry.id,
selected, :id => "catalog_entry_checkbox_#{catalog_entry.id}"
- %td
- = link_to catalog_entry.deployable.name, catalog_catalog_entry_path(@catalog,
catalog_entry.id)
- %td
- = link_to catalog_entry.catalog.name, catalog_entry.catalog
- %td
- = link_to catalog_entry.deployable.xml_filename,
catalog_catalog_entry_path(@catalog, catalog_entry.id)
diff --git a/src/app/views/catalog_entries/_new.html.haml
b/src/app/views/catalog_entries/_new.html.haml
deleted file mode 100644
index c66ca64..0000000
--- a/src/app/views/catalog_entries/_new.html.haml
+++ /dev/null
@@ -1,65 +0,0 @@
-= render :partial => 'section_header'
-
-%section.admin-content-section
- %header
- %h2=t'catalog_entries.new.add_catalog_entry'
-
-%section.admin-content-section.image-upload
- %p.description=t'.choose_option_to_upload'
-
- %nav#image-upload-tabs.faceted
- %ul.tabs
- %li
- = link_to t('catalog_entries.new.upload'),
new_catalog_catalog_entry_path(@catalog), :id => "upload", :class =>
"#{'selected' if @form_option == 'upload'}"
- %li
- = link_to t('catalog_entries.new.from_url'),
new_catalog_catalog_entry_path(@catalog, :from_url => true), :id =>
"from_url", :class => "#{'selected' if @form_option ==
'from_url'}"
-
- .form_option
- = render :partial => @form_option
-
-:javascript
- $(document).ready(function() {
- $("a#upload").click(function(ev){
- var entry_name = read_name_field();
- var entry_description = read_description_field();
- var $clicked_element = $(this)
- ev.preventDefault();
- $.get('#{new_catalog_catalog_entry_url(@catalog)}', function(data){
- change_selected($clicked_element, $('a#from_url'));
- $('.form_option').empty();
- $('.form_option').html(data).show();
- $('input#catalog_entry_name').val(entry_name);
- $('textarea#catalog_entry_description').val(entry_description);
- });
- });
- $("a#from_url").click(function(ev){
- var entry_name = read_name_field();
- var entry_description = read_description_field();
- var $clicked_element = $(this)
- ev.preventDefault();
- $.get('#{new_catalog_catalog_entry_url(@catalog, :from_url => true)}',
function(data){
- change_selected($clicked_element, $("a#upload"));
- $('.form_option').empty();
- $('.form_option').html(data).show();
- $('input#catalog_entry_name').val(entry_name);
- $('textarea#catalog_entry_description').val(entry_description);
- });
- });
- });
-
- function change_selected($add_selected, $remove_selected){
- $remove_selected.removeClass('selected');
- $add_selected.addClass('selected');
- }
-
- function read_name_field() {
- if ($('input#catalog_entry_name').val()) {
- return $('input#catalog_entry_name').val();
- }
- }
-
- function read_description_field() {
- if ($('textarea#catalog_entry_description').val()) {
- return $('textarea#catalog_entry_description').val();
- }
- }
diff --git a/src/app/views/catalog_entries/_new_from_image.html.haml
b/src/app/views/catalog_entries/_new_from_image.html.haml
deleted file mode 100644
index 81215e5..0000000
--- a/src/app/views/catalog_entries/_new_from_image.html.haml
+++ /dev/null
@@ -1,24 +0,0 @@
-%section.admin-content-section
- %header.admin-page-header
- %h2=t('.catalog_entry_name', :name => @catalog_entry.deployable.name)
-
- .content
- = form_for @catalog_entry, :html => {:class => 'generic'} do |form|
- = hidden_field_tag :create_from_image, params[:create_from_image]
- - if @catalog_entry.errors.any?
- = render 'layouts/error_messages', :object => @catalog_entry
- %fieldset
- %p
- %h2
- =t('.title')
- =t('.description', :name => @image.name)
- %p
- = form.label :name, t('catalog_entries.new.hw_profile')
- = select_tag :hardware_profile,
options_from_collection_for_select(@hw_profiles, :id, :name, params[:hardware_profile])
- %p
- = form.label :catalog_id, t('catalog_entries.form.catalog')
- = form.select :catalog_id, @catalogs.collect{|c| [c.name, c.id]}
-
- %fieldset.options
- = link_to "#{t'catalog_entries.form.cancel'}", catalogs_path,
:class => 'button danger'
- = submit_tag "#{t'catalog_entries.form.save'}", :name =>
'save', :class => 'button', :id => 'save_button'
diff --git a/src/app/views/catalog_entries/_section_header.html.haml
b/src/app/views/catalog_entries/_section_header.html.haml
deleted file mode 100644
index 2adf689..0000000
--- a/src/app/views/catalog_entries/_section_header.html.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-%header.admin-page-header
- %h1{:class =>
controller.controller_name}=t'catalog_entries.index.catalog_entries'
- #obj_actions.button-group
- = link_to "#{t'catalog_entries.new_catalog_entry'}",
new_catalog_catalog_entry_url(@catalog), :class => 'button primary', :id =>
'new_catalog_entry_button'
diff --git a/src/app/views/catalog_entries/_upload.html.haml
b/src/app/views/catalog_entries/_upload.html.haml
deleted file mode 100644
index 73c7d28..0000000
--- a/src/app/views/catalog_entries/_upload.html.haml
+++ /dev/null
@@ -1,27 +0,0 @@
-= form_for @catalog_entry, :url => catalog_catalog_entries_path(@catalog), :html =>
{:class => 'generic', :multipart => true } do |form|
- - if @catalog_entry.errors.any?
- = render 'layouts/error_messages', :object => @catalog_entry
- %fieldset
- %p
- = form.label :catalog_id, t('catalog_entries.form.catalog')
- = @catalog.name
- .clear
- = form.fields_for :deployable, @catalog_entry.deployable do |deployable_fields|
- %fieldset
- %p
- = deployable_fields.label :name, t('catalog_entries.index.name')
- = deployable_fields.text_field :name, :class => 'em long'
- %p
- = deployable_fields.label :description,
t('catalog_entries.form.description')
- = deployable_fields.text_area :description, :class => 'long'
- %p
- = deployable_fields.label :xml, t('catalog_entries.form.choose_xml')
- = deployable_fields.file_field :xml
- %fieldset
- %p
- = check_box_tag(:edit_xml, true, false)
- = label_tag :edit_xml, t('catalog_entries.form.edit_xml_after_save')
-
- %fieldset.options
- = link_to t('cancel'), catalog_path(@catalog), :class => 'button
danger'
- = submit_tag t('save'), :name => 'save', :class =>
'button', :id => 'save_button'
diff --git a/src/app/views/catalog_entries/edit.html.haml
b/src/app/views/catalog_entries/edit.html.haml
deleted file mode 100644
index 7737b68..0000000
--- a/src/app/views/catalog_entries/edit.html.haml
+++ /dev/null
@@ -1,15 +0,0 @@
-= render :partial => 'layouts/admin_nav'
-%header.admin-page-header
- %h1{:class => controller.controller_name}= @catalog_entry.deployable.name
- #obj_actions.button-container
- = link_to 'New Deployable',
new_catalog_catalog_entry_path((a)catalog_entry.catalog, @catalog_entry), :class =>
'button primary', :id => 'new_deployable_button'
- .button-group
- = link_to 'Cancel Editing',
catalog_catalog_entries_path((a)catalog_entry.catalog), :class => 'button pill
danger', :id => 'new_deployable_button'
-
-%section.admin-content-section.user
- %header
- %h2=t'catalog_entries.edit.editing_catalog_entry'
-
- .content
- = form_for @catalog_entry, :url =>
catalog_catalog_entry_path((a)catalog_entry.catalog, @catalog_entry), :html => { :method
=> :put, :class => 'generic' } do |f|
- = render :partial => "form", :locals => { :form => f }
diff --git a/src/app/views/catalog_entries/index.html.haml
b/src/app/views/catalog_entries/index.html.haml
deleted file mode 100644
index 3fae6b6..0000000
--- a/src/app/views/catalog_entries/index.html.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-= render :partial => 'layouts/admin_nav'
-= render :partial => 'section_header'
-= render :partial => 'list'
diff --git a/src/app/views/catalog_entries/new.html.haml
b/src/app/views/catalog_entries/new.html.haml
deleted file mode 100644
index 893345f..0000000
--- a/src/app/views/catalog_entries/new.html.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-= render :partial => 'layouts/admin_nav'
-= render :partial => params[:create_from_image] ? 'new_from_image' :
'new'
diff --git a/src/app/views/catalog_entries/show.html.haml
b/src/app/views/catalog_entries/show.html.haml
deleted file mode 100644
index 177d494..0000000
--- a/src/app/views/catalog_entries/show.html.haml
+++ /dev/null
@@ -1,58 +0,0 @@
-= render :partial => 'layouts/admin_nav'
-%header.admin-page-header
- %h1{:class => controller.controller_name}= @catalog_entry.deployable.name
- #obj_actions.button-container
- .button-group
- = button_to t('catalog_entries.show.delete'),
catalog_catalog_entry_path((a)catalog_entry.catalog, @catalog_entry), :method =>
'delete', :confirm =>
"#{t'catalog_entries.show.confirm_delete'}", :class => 'button
danger', :id => 'delete'
- = link_to t('catalog_entries.show.edit'),
edit_catalog_catalog_entry_path((a)catalog_entry.catalog, @catalog_entry), :class =>
'button', :id => 'edit_button'
-
- = link_to t('deployments.overview.launch'),
launch_new_deployments_path(:deployable_id => @catalog_entry.deployable.id, :pool_id
=> @catalog_entry.catalog.pool), :id => :launch_deployment
-
-%section.admin-content-section.deployable
- %section.image
- %header
- %h2= t('.image')
- %pre= @catalog_entry.deployable.xml
-
-
- %section.build
- %header
- %h2= t('.build')
-
- = form_tag() do
- = select_tag :build_option, options_for_select([[t("rebuild_all"),
1]])
- = submit_tag t('.start'), :id => :start_build
-
- %p.description= t('.build_description')
-
- %ul#providers-list
- - @providers.each do |provider|
- %li
- %span.provider= provider.name
- %span.status Building 98%
- = form_tag()
- %button on/off
-
-
- %section.catalogs
- %header
- %h2= t('.catalogs')
-
- %p= t('.choose_catalog')
- = form_tag() do
- = select_tag :catalog, options_for_select(@catalogs_options)
- = submit_tag t('.add_catalog'), :id => :add_catalog
-
- %p
- %label= t('.catalog_name')
- = @catalog_entry.catalog.name
- %p
- %label= t('.environment')
- = @catalog_entry.catalog.pool.pool_family.name
-
-
- - if check_privilege(Privilege::PERM_VIEW,@permission_object)
- %section.roles
- %header
- %h2= t('users.users')
- = render :partial => 'permissions/permissions'
diff --git a/src/app/views/catalogs/show.html.haml
b/src/app/views/catalogs/show.html.haml
index 6bb4819..1dd4259 100644
--- a/src/app/views/catalogs/show.html.haml
+++ b/src/app/views/catalogs/show.html.haml
@@ -20,19 +20,19 @@
.content
- content_for :form_header do
- %li= restful_submit_tag t("delete"), "destroy",
multi_destroy_catalog_catalog_entries_path(@catalog), 'DELETE', :id =>
'delete_button', :class => 'button danger'
- %li= link_to t("catalog_entries.new_catalog_entry"),
new_catalog_catalog_entry_path(@catalog), :class => 'button', :id =>
'new_catalog_entry_button'
+ %li= restful_submit_tag t("delete"), "destroy",
multi_destroy_catalog_deployables_path(@catalog), 'DELETE', :id =>
'delete_button', :class => 'button danger'
+ %li= link_to t("catalog_entries.new_catalog_entry"),
new_catalog_deployable_path(@catalog), :class => 'button', :id =>
'new_catalog_entry_button'
- content_for :filter_controls do
%li
= label_tag :catalog_entries_preset_filter, t('filter_table.viewing')
= hidden_field_tag :current_path, request.fullpath
= select_tag(:catalog_entries_preset_filter,
preset_filters_options_for_select(CatalogEntry::PRESET_FILTERS_OPTIONS,
params[:catalog_entries_preset_filter]), :include_blank =>
t("catalog_entries.preset_filters.all_catalog_entries"), :disabled => true)
- = restful_submit_tag t("filter_table.apply_filters"),
"filter", filter_catalog_catalog_entries_path(@catalog), 'POST', :class
=> 'button', :id => 'apply_catalog_entries_preset_filter'
+ = restful_submit_tag t("filter_table.apply_filters"),
"filter", filter_catalog_deployables_path(@catalog), 'POST', :class
=> 'button', :id => 'apply_catalog_entries_preset_filter'
%span.label.badge.dark= @catalog_entries.count
%li.table-search-filter
= text_field_tag :catalog_entries_search, params[:catalog_entries_search],
:placeholder => t("filter_table.search")
- = restful_submit_tag "", "search",
filter_catalog_catalog_entries_path(@catalog), 'POST', :class =>
'button', :id => 'apply_catalog_entries_search'
+ = restful_submit_tag "", "search",
filter_catalog_deployables_path(@catalog), 'POST', :class => 'button',
:id => 'apply_catalog_entries_search'
:javascript
$(document).ready(function(){
@@ -48,6 +48,6 @@
- selected = params[:select] == 'all'
= check_box_tag "catalog_entries_selected[]", catalog_entry.id,
selected, :id => "catalog_entry_checkbox_#{catalog_entry.id}"
%td
- = link_to catalog_entry.deployable.name, catalog_catalog_entry_path(@catalog,
catalog_entry.id)
+ = link_to catalog_entry.deployable.name, catalog_deployable_path(@catalog,
catalog_entry)
%td
- = link_to catalog_entry.deployable.xml_filename,
catalog_catalog_entry_path(@catalog, catalog_entry.id, :deployable_xml => true)
+ = link_to catalog_entry.deployable.xml_filename,
catalog_deployable_path(@catalog, catalog_entry, :deployable_xml => true)
diff --git a/src/app/views/deployables/_form.html.haml
b/src/app/views/deployables/_form.html.haml
new file mode 100644
index 0000000..bbf0b25
--- /dev/null
+++ b/src/app/views/deployables/_form.html.haml
@@ -0,0 +1,27 @@
+- if @catalog_entry.errors.any?
+ = render 'layouts/error_messages', :object => @catalog_entry
+%fieldset
+ - if params[:edit_xml]
+ = form.fields_for :deployable, @catalog_entry.deployable do |deployable_fields|
+ %p
+ = deployable_fields.label :xml, t('.deployable_xml')
+ = deployable_fields.text_area :xml, :class => 'long'
+ - else
+ %p
+ = form.label :catalog_id, t('catalog_entries.form.catalog')
+ = @catalog.name
+ .clear
+ = form.fields_for :deployable, @catalog_entry.deployable do |deployable_fields|
+ %p
+ = deployable_fields.label :name, t('catalog_entries.index.name')
+ = deployable_fields.text_field :name, :class => 'em long'
+ %p
+ = deployable_fields.label :description, t('.description')
+ = deployable_fields.text_area :description, :class => 'long'
+ %p
+ = deployable_fields.label :xml, t('.deployable_xml')
+ = link_to t("catalog_entries.properties.edit_deployable_xml"),
edit_catalog_deployable_path((a)catalog_entry.catalog.id, @catalog_entry.id,
:edit_xml=>true)
+
+%fieldset.options
+ = link_to t('cancel'), catalog_path(@catalog), :class => 'button
danger'
+ = submit_tag t('save'), :name => 'save', :class =>
'button', :id => 'save_button'
diff --git a/src/app/views/deployables/_from_url.html.haml
b/src/app/views/deployables/_from_url.html.haml
new file mode 100644
index 0000000..439d23e
--- /dev/null
+++ b/src/app/views/deployables/_from_url.html.haml
@@ -0,0 +1,27 @@
+= form_for @catalog_entry, :url => catalog_deployables_path(@catalog), :html =>
{:class => 'generic', :multipart => true } do |form|
+ - if @catalog_entry.errors.any?
+ = render 'layouts/error_messages', :object => @catalog_entry
+ %fieldset
+ %p
+ = form.label :catalog_id, t('catalog_entries.form.catalog')
+ = @catalog.name
+ .clear
+ =form.fields_for :deployable, @catalog_entry.deployable do |deployable_fields|
+ %fieldset
+ %p
+ = deployable_fields.label :name, t('catalog_entries.index.name')
+ = deployable_fields.text_field :name, :class => 'em long'
+ %p
+ = deployable_fields.label :description,
t('catalog_entries.form.description')
+ = deployable_fields.text_area :description, :class => 'long'
+ %fieldset
+ %p
+ = label_tag :url, t('catalog_entries.form.deployable_xml_url')
+ = text_field_tag :url
+ %p
+ = check_box_tag(:edit_xml, true, false)
+ = label_tag :edit_xml, t('catalog_entries.form.edit_xml_after_save')
+
+ %fieldset.options
+ = link_to t('cancel'), catalog_path(@catalog), :class => 'button
danger'
+ = submit_tag t('save'), :name => 'save', :class =>
'button', :id => 'save_button'
diff --git a/src/app/views/deployables/_list.html.haml
b/src/app/views/deployables/_list.html.haml
new file mode 100644
index 0000000..117e636
--- /dev/null
+++ b/src/app/views/deployables/_list.html.haml
@@ -0,0 +1,38 @@
+%section.admin-content-section
+ %header
+ %h2=t'catalog_entries.list.catalog_entries_list'
+
+ .content
+ - content_for :form_header do
+ %li= restful_submit_tag t("catalog_entries.show.delete"),
"destroy", multi_destroy_catalog_deployables_path(@catalog), 'DELETE',
:id => 'delete_button', :class => 'button danger'
+
+ - content_for :filter_controls do
+ %li
+ = label_tag :catalog_entries_preset_filter, t('filter_table.viewing')
+ = hidden_field_tag :current_path, request.fullpath
+ = select_tag(:catalog_entries_preset_filter,
preset_filters_options_for_select(CatalogEntry::PRESET_FILTERS_OPTIONS,
params[:catalog_entries_preset_filter]), :include_blank =>
t("catalog_entries.preset_filters.all_catalog_entries"), :disabled => true)
+ = restful_submit_tag t("filter_table.apply_filters"),
"filter", filter_catalog_deployables_path(@catalog), 'POST', :class
=> 'button', :id => 'apply_catalog_entries_preset_filter'
+ %span.label.badge.dark= @catalog_entries.count
+ %li.table-search-filter
+ = text_field_tag :catalog_entries_search, params[:catalog_entries_search],
:placeholder => t("filter_table.search")
+ = restful_submit_tag "", "search",
filter_catalog_deployables_path(@catalog), 'POST', :class => 'button',
:id => 'apply_catalog_entries_search'
+
+ :javascript
+ $(document).ready(function(){
+ $("#apply_catalog_entries_preset_filter").hide();
+ $("#catalog_entries_preset_filter").change(function() {
+ $("#apply_catalog_entries_preset_filter").click();
+ });
+ });
+
+ = filter_table(@header, @catalog_entries) do |catalog_entry|
+ %tr{:class => cycle('nostripe','stripe')}
+ %td{:class => 'checkbox'}
+ - selected = params[:select] == 'all'
+ = check_box_tag "catalog_entries_selected[]", catalog_entry.id,
selected, :id => "catalog_entry_checkbox_#{catalog_entry.id}"
+ %td
+ = link_to catalog_entry.deployable.name, catalog_deployable_path(@catalog,
catalog_entry.id)
+ %td
+ = link_to catalog_entry.catalog.name, catalog_entry.catalog
+ %td
+ = link_to catalog_entry.deployable.xml_filename,
catalog_deployable_path(@catalog, catalog_entry.id)
diff --git a/src/app/views/deployables/_new.html.haml
b/src/app/views/deployables/_new.html.haml
new file mode 100644
index 0000000..a1d1589
--- /dev/null
+++ b/src/app/views/deployables/_new.html.haml
@@ -0,0 +1,65 @@
+= render :partial => 'section_header'
+
+%section.admin-content-section
+ %header
+ %h2=t'catalog_entries.new.add_catalog_entry'
+
+%section.admin-content-section.image-upload
+ %p.description=t'.choose_option_to_upload'
+
+ %nav#image-upload-tabs.faceted
+ %ul.tabs
+ %li
+ = link_to t('catalog_entries.new.upload'),
new_catalog_deployable_path(@catalog), :id => "upload", :class =>
"#{'selected' if @form_option == 'upload'}"
+ %li
+ = link_to t('catalog_entries.new.from_url'),
new_catalog_deployable_path(@catalog, :from_url => true), :id =>
"from_url", :class => "#{'selected' if @form_option ==
'from_url'}"
+
+ .form_option
+ = render :partial => @form_option
+
+:javascript
+ $(document).ready(function() {
+ $("a#upload").click(function(ev){
+ var entry_name = read_name_field();
+ var entry_description = read_description_field();
+ var $clicked_element = $(this)
+ ev.preventDefault();
+ $.get('#{new_catalog_deployable_url(@catalog)}', function(data){
+ change_selected($clicked_element, $('a#from_url'));
+ $('.form_option').empty();
+ $('.form_option').html(data).show();
+ $('input#catalog_entry_name').val(entry_name);
+ $('textarea#catalog_entry_description').val(entry_description);
+ });
+ });
+ $("a#from_url").click(function(ev){
+ var entry_name = read_name_field();
+ var entry_description = read_description_field();
+ var $clicked_element = $(this)
+ ev.preventDefault();
+ $.get('#{new_catalog_deployable_url(@catalog, :from_url => true)}',
function(data){
+ change_selected($clicked_element, $("a#upload"));
+ $('.form_option').empty();
+ $('.form_option').html(data).show();
+ $('input#catalog_entry_name').val(entry_name);
+ $('textarea#catalog_entry_description').val(entry_description);
+ });
+ });
+ });
+
+ function change_selected($add_selected, $remove_selected){
+ $remove_selected.removeClass('selected');
+ $add_selected.addClass('selected');
+ }
+
+ function read_name_field() {
+ if ($('input#catalog_entry_name').val()) {
+ return $('input#catalog_entry_name').val();
+ }
+ }
+
+ function read_description_field() {
+ if ($('textarea#catalog_entry_description').val()) {
+ return $('textarea#catalog_entry_description').val();
+ }
+ }
diff --git a/src/app/views/deployables/_new_from_image.html.haml
b/src/app/views/deployables/_new_from_image.html.haml
new file mode 100644
index 0000000..81215e5
--- /dev/null
+++ b/src/app/views/deployables/_new_from_image.html.haml
@@ -0,0 +1,24 @@
+%section.admin-content-section
+ %header.admin-page-header
+ %h2=t('.catalog_entry_name', :name => @catalog_entry.deployable.name)
+
+ .content
+ = form_for @catalog_entry, :html => {:class => 'generic'} do |form|
+ = hidden_field_tag :create_from_image, params[:create_from_image]
+ - if @catalog_entry.errors.any?
+ = render 'layouts/error_messages', :object => @catalog_entry
+ %fieldset
+ %p
+ %h2
+ =t('.title')
+ =t('.description', :name => @image.name)
+ %p
+ = form.label :name, t('catalog_entries.new.hw_profile')
+ = select_tag :hardware_profile,
options_from_collection_for_select(@hw_profiles, :id, :name, params[:hardware_profile])
+ %p
+ = form.label :catalog_id, t('catalog_entries.form.catalog')
+ = form.select :catalog_id, @catalogs.collect{|c| [c.name, c.id]}
+
+ %fieldset.options
+ = link_to "#{t'catalog_entries.form.cancel'}", catalogs_path,
:class => 'button danger'
+ = submit_tag "#{t'catalog_entries.form.save'}", :name =>
'save', :class => 'button', :id => 'save_button'
diff --git a/src/app/views/deployables/_section_header.html.haml
b/src/app/views/deployables/_section_header.html.haml
new file mode 100644
index 0000000..ed41a09
--- /dev/null
+++ b/src/app/views/deployables/_section_header.html.haml
@@ -0,0 +1,4 @@
+%header.admin-page-header
+ %h1{:class =>
controller.controller_name}=t'catalog_entries.index.catalog_entries'
+ #obj_actions.button-group
+ = link_to "#{t'catalog_entries.new_catalog_entry'}",
new_catalog_deployable_url(@catalog), :class => 'button primary', :id =>
'new_catalog_entry_button'
diff --git a/src/app/views/deployables/_upload.html.haml
b/src/app/views/deployables/_upload.html.haml
new file mode 100644
index 0000000..7c2917e
--- /dev/null
+++ b/src/app/views/deployables/_upload.html.haml
@@ -0,0 +1,27 @@
+= form_for @catalog_entry, :url => catalog_deployables_path(@catalog), :html =>
{:class => 'generic', :multipart => true } do |form|
+ - if @catalog_entry.errors.any?
+ = render 'layouts/error_messages', :object => @catalog_entry
+ %fieldset
+ %p
+ = form.label :catalog_id, t('catalog_entries.form.catalog')
+ = @catalog.name
+ .clear
+ = form.fields_for :deployable, @catalog_entry.deployable do |deployable_fields|
+ %fieldset
+ %p
+ = deployable_fields.label :name, t('catalog_entries.index.name')
+ = deployable_fields.text_field :name, :class => 'em long'
+ %p
+ = deployable_fields.label :description,
t('catalog_entries.form.description')
+ = deployable_fields.text_area :description, :class => 'long'
+ %p
+ = deployable_fields.label :xml, t('catalog_entries.form.choose_xml')
+ = deployable_fields.file_field :xml
+ %fieldset
+ %p
+ = check_box_tag(:edit_xml, true, false)
+ = label_tag :edit_xml, t('catalog_entries.form.edit_xml_after_save')
+
+ %fieldset.options
+ = link_to t('cancel'), catalog_path(@catalog), :class => 'button
danger'
+ = submit_tag t('save'), :name => 'save', :class =>
'button', :id => 'save_button'
diff --git a/src/app/views/deployables/edit.html.haml
b/src/app/views/deployables/edit.html.haml
new file mode 100644
index 0000000..e76b3e2
--- /dev/null
+++ b/src/app/views/deployables/edit.html.haml
@@ -0,0 +1,15 @@
+= render :partial => 'layouts/admin_nav'
+%header.admin-page-header
+ %h1{:class => controller.controller_name}= @catalog_entry.deployable.name
+ #obj_actions.button-container
+ = link_to 'New Deployable',
new_catalog_deployable_path((a)catalog_entry.catalog, @catalog_entry), :class =>
'button primary', :id => 'new_deployable_button'
+ .button-group
+ = link_to 'Cancel Editing',
catalog_deployables_path((a)catalog_entry.catalog), :class => 'button pill
danger', :id => 'new_deployable_button'
+
+%section.admin-content-section.user
+ %header
+ %h2=t'catalog_entries.edit.editing_catalog_entry'
+
+ .content
+ = form_for @catalog_entry, :url => catalog_deployable_path((a)catalog_entry.catalog,
@catalog_entry), :html => { :method => :put, :class => 'generic' } do
|f|
+ = render :partial => "form", :locals => { :form => f }
diff --git a/src/app/views/deployables/index.html.haml
b/src/app/views/deployables/index.html.haml
new file mode 100644
index 0000000..3fae6b6
--- /dev/null
+++ b/src/app/views/deployables/index.html.haml
@@ -0,0 +1,3 @@
+= render :partial => 'layouts/admin_nav'
+= render :partial => 'section_header'
+= render :partial => 'list'
diff --git a/src/app/views/deployables/new.html.haml
b/src/app/views/deployables/new.html.haml
new file mode 100644
index 0000000..893345f
--- /dev/null
+++ b/src/app/views/deployables/new.html.haml
@@ -0,0 +1,2 @@
+= render :partial => 'layouts/admin_nav'
+= render :partial => params[:create_from_image] ? 'new_from_image' :
'new'
diff --git a/src/app/views/deployables/show.html.haml
b/src/app/views/deployables/show.html.haml
new file mode 100644
index 0000000..2d914e9
--- /dev/null
+++ b/src/app/views/deployables/show.html.haml
@@ -0,0 +1,64 @@
+= render :partial => 'layouts/admin_nav'
+%header.admin-page-header
+ %h1{:class => controller.controller_name}= @catalog_entry.deployable.name
+ #obj_actions.button-container
+ .button-group
+ = button_to t('catalog_entries.show.delete'),
catalog_deployable_path((a)catalog_entry.catalog, @catalog_entry), :method =>
'delete', :confirm =>
"#{t'catalog_entries.show.confirm_delete'}", :class => 'button
danger', :id => 'delete'
+ = link_to t('catalog_entries.show.edit'),
edit_catalog_deployable_path((a)catalog_entry.catalog, @catalog_entry), :class =>
'button', :id => 'edit_button'
+
+ = link_to t('deployments.overview.launch'),
launch_new_deployments_path(:deployable_id => @catalog_entry.deployable.id, :pool_id
=> @catalog_entry.catalog.pool), :id => :launch_deployment
+
+%section.admin-content-section.deployable
+ %section.image
+ %header
+ %h2= t('.image')
+ %pre= @catalog_entry.deployable.xml
+
+
+ %section.build
+ %header
+ %h2= t('.build')
+
+ = form_tag() do
+ = select_tag :build_option, options_for_select([[t("rebuild_all"),
1]])
+ = submit_tag t('.start'), :id => :start_build
+
+ %p.description= t('.build_description')
+
+ %ul#providers-list
+ - @providers.each do |provider|
+ %li
+ %span.provider= provider.name
+ %span.status Building 98%
+ -#= form_tag()
+ -# %button on/off
+
+
+ %section.catalogs
+ %header
+ %h2= t('.catalogs')
+
+ %p= t('.choose_catalog')
+ = form_for(:catalog_entry, :url => catalog_entries_path) do |f|
+ = f.select :catalog_id, options_for_select(@catalogs_options)
+ = f.hidden_field(:deployable_id, :value => @catalog_entry.deployable.id)
+ = f.submit t('catalog_entries.show.add_catalog'), :id => :add_catalog
+
+ %table
+ %tr
+ %th
+ %label= t('.catalog_name')
+ %th
+ %label= t('.environment')
+ - @catalog_entry.deployable.catalog_entries.each do |catalog_entry|
+ %tr
+ %td
+ = button_to t('catalog_entries.show.delete'),
catalog_entry_path(@catalog_entry), :method => 'delete', :confirm =>
"#{t'catalog_entries.show.confirm_delete'}", :id => 'delete'
+ = catalog_entry.catalog.name
+ %td= catalog_entry.catalog.pool.pool_family.name
+
+ - if check_privilege(Privilege::PERM_VIEW,@permission_object)
+ %section.roles
+ %header
+ %h2= t('users.users')
+ = render :partial => 'permissions/permissions'
diff --git a/src/app/views/deployments/_overview.html.haml
b/src/app/views/deployments/_overview.html.haml
index e445c2b..e8da927 100644
--- a/src/app/views/deployments/_overview.html.haml
+++ b/src/app/views/deployments/_overview.html.haml
@@ -20,7 +20,7 @@
%p= @deployment.deployable_xml.description
%h3= t('.deployable_xml')
- =link_to @deployable.xml_filename,
catalog_catalog_entry_path((a)deployable.catalogs.first,
@deployable.catalog_entries.first.id, :deployable_xml => true)
+ =link_to @deployable.xml_filename,
catalog_deployable_path((a)deployable.catalogs.first, @deployable.catalog_entries.first.id,
:deployable_xml => true)
⇒
%h3= t('.image_ids')
diff --git a/src/app/views/deployments/launch_from_catalog.html.haml
b/src/app/views/deployments/launch_from_catalog.html.haml
index 7f99d89..dd464f5 100644
--- a/src/app/views/deployments/launch_from_catalog.html.haml
+++ b/src/app/views/deployments/launch_from_catalog.html.haml
@@ -37,7 +37,7 @@
%td= deployable.hw_profile_for_image(image.id).storage
%td= deployable.hw_profile_for_image(image.id).memory
%td= deployable.hw_profile_for_image(image.id).architecture
- %td= link_to deployable.xml_filename,
catalog_catalog_entry_path(deployable.catalogs.first, deployable.catalog_entries.first.id,
:deployable_xml => true)
+ %td= link_to deployable.xml_filename,
catalog_deployable_path(deployable.catalogs.first, deployable.catalog_entries.first.id,
:deployable_xml => true)
.align-center
%div= will_paginate @deployables
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index b6dc774..a3c726e 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -639,9 +639,11 @@ en:
warning:
not_valid_or_reachable: "Catalog entry XML file is either invalid or no
longer reachable at %{url}"
not_valid: "Deployable XML file doesn't resolve valid XML"
+ failed: Catalog entry was not created.
notice:
added: Catalog entry added.
updated: Catalog entry updated successfully!
+ deleted: Catalog entry deleted.
preset_filters:
all_catalog_entries: All Catalog Entries
catalogs:
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 515d6b7..854818e 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -202,7 +202,7 @@ Conductor::Application.routes.draw do
delete 'multi_destroy', :on => :collection
post 'create'
post :filter, :on => :collection
- resources :catalog_entries do
+ resources :deployables do
delete 'multi_destroy', :on => :collection
post :filter, :on => :collection
end
diff --git a/src/features/catalog_entries.feature b/src/features/catalog_entries.feature
deleted file mode 100644
index d950c50..0000000
--- a/src/features/catalog_entries.feature
+++ /dev/null
@@ -1,89 +0,0 @@
-Feature: Manage Catalog Entries
- In order to manage catalog entries
- As an admin
- I want to add/edit/remove catalog entries
-
- Background:
- Given I am an authorised user
- And I am logged in
-
- Scenario: Create new catalog entry
- Given there is a "default" catalog
- When I am on the "default" catalog catalog entries page
- Then I should see "Catalog Entries"
- When I follow "new_catalog_entry_button"
- Then I should see "Add New Catalog Entry"
- When I fill in "catalog_entry[deployable_attributes][name]" with
"test1"
- And I fill in "catalog_entry[deployable_attributes][description]" with
"description"
- When I attach the file "features/upload_files/deployable.xml" to
"catalog_entry[deployable_attributes][xml]"
- And I press "save_button"
- Then I should see "Catalog entry added"
-
- Scenario: Change the name
- Given there is a "default" catalog
- And a catalog entry "testdepl" exists
- When I am on the "default" catalog catalog entries page
- When I follow "testdepl"
- And I follow "edit_button"
- Then I should see "Editing Catalog Entry"
- When I fill in "catalog_entry[deployable_attributes][name]" with
"testdepl-renamed"
- And I press "save_button"
- Then I should see "Catalog entry updated successfully!"
- And I should see "testdepl-renamed"
-
- Scenario: Show catalog entry details
- Given there is a "default" catalog
- And a catalog entry "testdepl" exists
- And I am on the "default" catalog catalog entries page
- When I follow "testdepl"
- Then I should see "testdepl"
- And I should see "Image"
- And I should see "Build"
- And I should see "Catalogs"
- And I should see "Users"
-
- Scenario: Launch a deployment
- Given there is a "default" catalog
- And a catalog entry "testdepl" exists
- And I am on testdepl's catalog entry page
- When I follow "launch_deployment"
- Then I should be on the launch new deployments page
-
- Scenario: Delete deployables
- Given there is a "default" catalog
- And a catalog entry "testdepl1" exists for "default" catalog
- And a catalog entry "testdepl2" exists for "default" catalog
- And I am on the "default" catalog catalog entries page
- When I check "testdepl1" catalog entry
- And I check "testdepl2" catalog entry
- And I press "delete_button"
- Then there should be only 0 catalog entries
- And I should be on the "default" catalog page
- And I should not see "testdepl1"
- And I should not see "testdepl2"
-
- Scenario: Delete deployable
- Given there is a "default" catalog
- And a catalog entry "testdepl1" exists for "default" catalog
- And I am on the "default" catalog page
- When I follow "testdepl1"
- And I press "delete"
- Then there should be only 0 catalog entries
- And I should be on the "default" catalog page
- And I should not see "testdepl1"
-
- #Scenario: Search Catalog Entries
- # Given there is a "testcatalog" catalog
- # And a catalog entry "mycatalog_entry" exists
- # And a catalog entry "somecatalog_entry" exists
- # And I am on the "testcatalog" catalog catalog entries page
- # Then I should see "mycatalog_entry"
- # And I should see "somecatalog_entry"
- # When I fill in "catalog_entries_search" with "some"
- # And I press "apply_catalog_entries_search"
- # Then I should see "somecatalog_entry"
- # And I should not see "mycatalog_entry"
- # When I fill in "catalog_entries_search" with "mycatalog_entry"
- # And I press "apply_catalog_entries_search"
- # Then I should see "mycatalog_entry"
- # And I should not see "somecatalog_entry"
diff --git a/src/features/deployables.feature b/src/features/deployables.feature
new file mode 100644
index 0000000..d950c50
--- /dev/null
+++ b/src/features/deployables.feature
@@ -0,0 +1,89 @@
+Feature: Manage Catalog Entries
+ In order to manage catalog entries
+ As an admin
+ I want to add/edit/remove catalog entries
+
+ Background:
+ Given I am an authorised user
+ And I am logged in
+
+ Scenario: Create new catalog entry
+ Given there is a "default" catalog
+ When I am on the "default" catalog catalog entries page
+ Then I should see "Catalog Entries"
+ When I follow "new_catalog_entry_button"
+ Then I should see "Add New Catalog Entry"
+ When I fill in "catalog_entry[deployable_attributes][name]" with
"test1"
+ And I fill in "catalog_entry[deployable_attributes][description]" with
"description"
+ When I attach the file "features/upload_files/deployable.xml" to
"catalog_entry[deployable_attributes][xml]"
+ And I press "save_button"
+ Then I should see "Catalog entry added"
+
+ Scenario: Change the name
+ Given there is a "default" catalog
+ And a catalog entry "testdepl" exists
+ When I am on the "default" catalog catalog entries page
+ When I follow "testdepl"
+ And I follow "edit_button"
+ Then I should see "Editing Catalog Entry"
+ When I fill in "catalog_entry[deployable_attributes][name]" with
"testdepl-renamed"
+ And I press "save_button"
+ Then I should see "Catalog entry updated successfully!"
+ And I should see "testdepl-renamed"
+
+ Scenario: Show catalog entry details
+ Given there is a "default" catalog
+ And a catalog entry "testdepl" exists
+ And I am on the "default" catalog catalog entries page
+ When I follow "testdepl"
+ Then I should see "testdepl"
+ And I should see "Image"
+ And I should see "Build"
+ And I should see "Catalogs"
+ And I should see "Users"
+
+ Scenario: Launch a deployment
+ Given there is a "default" catalog
+ And a catalog entry "testdepl" exists
+ And I am on testdepl's catalog entry page
+ When I follow "launch_deployment"
+ Then I should be on the launch new deployments page
+
+ Scenario: Delete deployables
+ Given there is a "default" catalog
+ And a catalog entry "testdepl1" exists for "default" catalog
+ And a catalog entry "testdepl2" exists for "default" catalog
+ And I am on the "default" catalog catalog entries page
+ When I check "testdepl1" catalog entry
+ And I check "testdepl2" catalog entry
+ And I press "delete_button"
+ Then there should be only 0 catalog entries
+ And I should be on the "default" catalog page
+ And I should not see "testdepl1"
+ And I should not see "testdepl2"
+
+ Scenario: Delete deployable
+ Given there is a "default" catalog
+ And a catalog entry "testdepl1" exists for "default" catalog
+ And I am on the "default" catalog page
+ When I follow "testdepl1"
+ And I press "delete"
+ Then there should be only 0 catalog entries
+ And I should be on the "default" catalog page
+ And I should not see "testdepl1"
+
+ #Scenario: Search Catalog Entries
+ # Given there is a "testcatalog" catalog
+ # And a catalog entry "mycatalog_entry" exists
+ # And a catalog entry "somecatalog_entry" exists
+ # And I am on the "testcatalog" catalog catalog entries page
+ # Then I should see "mycatalog_entry"
+ # And I should see "somecatalog_entry"
+ # When I fill in "catalog_entries_search" with "some"
+ # And I press "apply_catalog_entries_search"
+ # Then I should see "somecatalog_entry"
+ # And I should not see "mycatalog_entry"
+ # When I fill in "catalog_entries_search" with "mycatalog_entry"
+ # And I press "apply_catalog_entries_search"
+ # Then I should see "mycatalog_entry"
+ # And I should not see "somecatalog_entry"
diff --git a/src/features/step_definitions/catalog_entry_steps.rb
b/src/features/step_definitions/catalog_entry_steps.rb
deleted file mode 100644
index 73bf7be..0000000
--- a/src/features/step_definitions/catalog_entry_steps.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-Given /^a catalog entry "([^"]*)" exists$/ do |arg1|
- deployable = FactoryGirl.create :deployable, :name => arg1
- entry = FactoryGirl.create :catalog_entry, :deployable => deployable
-end
-
-When /^I check "([^"]*)" catalog entry$/ do |arg1|
- dep = CatalogEntry.find_by_deployable_id(Deployable.find_by_name(arg1))
- check("catalog_entry_checkbox_#{dep.id}")
-end
-
-Then /^there should be only (\d+) catalog entries$/ do |arg1|
- CatalogEntry.count.should == arg1.to_i
-end
-
-Given /^a catalog entry "([^"]*)" exists for "([^"]*)"
catalog$/ do |arg1, catalog_name|
- catalog = Catalog.find_by_name(catalog_name) || FactoryGirl.create(:catalog, :name
=> catalog_name)
- deployable = FactoryGirl.create :deployable, :name => arg1
- entry = FactoryGirl.create :catalog_entry, :deployable => deployable, :catalog =>
catalog
-end
diff --git a/src/features/step_definitions/deployable_steps.rb
b/src/features/step_definitions/deployable_steps.rb
new file mode 100644
index 0000000..73bf7be
--- /dev/null
+++ b/src/features/step_definitions/deployable_steps.rb
@@ -0,0 +1,19 @@
+Given /^a catalog entry "([^"]*)" exists$/ do |arg1|
+ deployable = FactoryGirl.create :deployable, :name => arg1
+ entry = FactoryGirl.create :catalog_entry, :deployable => deployable
+end
+
+When /^I check "([^"]*)" catalog entry$/ do |arg1|
+ dep = CatalogEntry.find_by_deployable_id(Deployable.find_by_name(arg1))
+ check("catalog_entry_checkbox_#{dep.id}")
+end
+
+Then /^there should be only (\d+) catalog entries$/ do |arg1|
+ CatalogEntry.count.should == arg1.to_i
+end
+
+Given /^a catalog entry "([^"]*)" exists for "([^"]*)"
catalog$/ do |arg1, catalog_name|
+ catalog = Catalog.find_by_name(catalog_name) || FactoryGirl.create(:catalog, :name
=> catalog_name)
+ deployable = FactoryGirl.create :deployable, :name => arg1
+ entry = FactoryGirl.create :catalog_entry, :deployable => deployable, :catalog =>
catalog
+end
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index e976e1c..ebf0bc1 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -30,7 +30,7 @@ module NavigationHelpers
deployable = Deployable.find_by_name($1)
catalog_entry = deployable.catalog_entries.first
catalog = catalog_entry.catalog
- catalog_catalog_entry_path(catalog, catalog_entry)
+ catalog_deployable_path(catalog, catalog_entry)
when /the account page/
account_path
@@ -159,7 +159,7 @@ module NavigationHelpers
when /^the "(.*)" catalog catalog entries page/
- url_for catalog_catalog_entries_path(Catalog.find_by_name($1))
+ url_for catalog_deployables_path(Catalog.find_by_name($1))
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
diff --git a/src/spec/controllers/catalog_entries_controller_spec.rb
b/src/spec/controllers/catalog_entries_controller_spec.rb
deleted file mode 100644
index ed00c89..0000000
--- a/src/spec/controllers/catalog_entries_controller_spec.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Copyright (C) 2011 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA. A copy of the GNU General Public License is
-# also available at
http://www.gnu.org/copyleft/gpl.html.
-
-require 'spec_helper'
-
-describe CatalogEntriesController do
-
- fixtures :all
- before(:each) do
- @admin_permission = FactoryGirl.create :admin_permission
- @admin = @admin_permission.user
- @image = mock(Aeolus::Image::Warehouse::Image, :id =>
'3c58e0d6-d11a-4e68-8b12-233783e56d35', :name => 'image1', :uuid =>
'3c58e0d6-d11a-4e68-8b12-233783e56d35')
- Aeolus::Image::Warehouse::Image.stub(:find).and_return(@image)
- end
-
- it "should provide ui to create new catalog entry from image" do
- mock_warden(@admin)
- get :new, :create_from_image => @image.id
- response.should be_success
- response.should render_template("new")
- end
-
- it "should create new catalog entry from image" do
- hw_profile = FactoryGirl.create(:front_hwp1)
- catalog = FactoryGirl.create(:catalog)
- mock_warden(@admin)
- post(:create, :create_from_image => @image.id, :hardware_profile =>
hw_profile.id, :catalog_entry => {:catalog_id => catalog.id})
- response.should redirect_to(catalog_catalog_entries_url(catalog.id))
- end
-
-end
diff --git a/src/spec/controllers/deployables_controller_spec.rb
b/src/spec/controllers/deployables_controller_spec.rb
new file mode 100644
index 0000000..eb0a6f8
--- /dev/null
+++ b/src/spec/controllers/deployables_controller_spec.rb
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2011 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA. A copy of the GNU General Public License is
+# also available at
http://www.gnu.org/copyleft/gpl.html.
+
+require 'spec_helper'
+
+describe DeployablesController do
+
+ fixtures :all
+ before(:each) do
+ @admin_permission = FactoryGirl.create :admin_permission
+ @admin = @admin_permission.user
+ @image = mock(Aeolus::Image::Warehouse::Image, :id =>
'3c58e0d6-d11a-4e68-8b12-233783e56d35', :name => 'image1', :uuid =>
'3c58e0d6-d11a-4e68-8b12-233783e56d35')
+ Aeolus::Image::Warehouse::Image.stub(:find).and_return(@image)
+ end
+
+ it "should provide ui to create new catalog entry from image" do
+ mock_warden(@admin)
+ get :new, :create_from_image => @image.id
+ response.should be_success
+ response.should render_template("new")
+ end
+
+ it "should create new catalog entry from image" do
+ hw_profile = FactoryGirl.create(:front_hwp1)
+ catalog = FactoryGirl.create(:catalog)
+ mock_warden(@admin)
+ post(:create, :create_from_image => @image.id, :hardware_profile =>
hw_profile.id, :catalog_entry => {:catalog_id => catalog.id})
+ response.should redirect_to(catalog_deployables_url(catalog.id))
+ end
+
+end
--
1.7.6.4