[PATCH aeolus-conductor] refactored option parser to support multiple same options
by Maros Zatko
From: Maros Zatko <mzatko(a)redhat.com>
---
lib/aeolus_cli/command/config_parser.rb | 208 +++++++++++++++++--------------
1 files changed, 114 insertions(+), 94 deletions(-)
diff --git a/lib/aeolus_cli/command/config_parser.rb b/lib/aeolus_cli/command/config_parser.rb
index 05e0ed4..f0a1748 100644
--- a/lib/aeolus_cli/command/config_parser.rb
+++ b/lib/aeolus_cli/command/config_parser.rb
@@ -25,7 +25,6 @@ module Aeolus
@args = argv
# Default options
@options = {}
- parse
end
def process
@@ -35,6 +34,7 @@ module Aeolus
# Eventually get the config file from user dir if it exists.
# File.expand_path("~")
if COMMANDS.include?(@command)
+ parse(@command)
self.send((a)command.to_sym)
else
@args << "-h"
@@ -44,7 +44,9 @@ module Aeolus
end
private
- def parse
+ def parse(subcommand = nil)
+ subcommand = subcommand.to_sym if subcommand
+
@optparse ||= OptionParser.new do|opts|
opts.banner = "Usage: aeolus-cli [#{COMMANDS.join('|')}] [general options] [command options]"
@@ -70,114 +72,132 @@ module Aeolus
exit(0)
end
- opts.separator ""
- opts.separator "List options:"
- opts.on('-i', '--images', 'Retrieve a list of images') do
- @options[:subcommand] = :images
- end
- opts.on('-b', '--builds ID', 'Retrieve the builds of an image') do |id|
- @options[:subcommand] = :builds
- @options[:id] = id
- end
- opts.on('-t', '--targetimages ID', 'Retrieve the target images from a build') do |id|
- @options[:subcommand] = :targetimages
- @options[:id] = id
- end
- opts.on('-P', '--providerimages ID', 'Retrieve the provider images from a target image') do |id|
- @options[:subcommand] = :providerimages
- @options[:id] = id
- end
- opts.on('-g', '--targets', 'Retrieve the values available for the --target parameter') do
- @options[:subcommand] = :targets
- end
- opts.on('-p', '--providers', 'Retrieve the values available for the --provider parameter') do
- @options[:subcommand] = :providers
- end
- opts.on('-a', '--accounts', 'Retrieve the values available for the --account parameter') do
- @options[:subcommand] = :accounts
+ if !subcommand || subcommand == :list
+ opts.separator ""
+ opts.separator "List options:"
+ opts.on('-i', '--images', 'Retrieve a list of images') do
+ @options[:subcommand] = :images
+ end
+ opts.on('-b', '--builds ID', 'Retrieve the builds of an image') do |id|
+ @options[:subcommand] = :builds
+ @options[:id] = id
+ end
+ opts.on('-t', '--targetimages ID', 'Retrieve the target images from a build') do |id|
+ @options[:subcommand] = :targetimages
+ @options[:id] = id
+ end
+ opts.on('-P', '--providerimages ID', 'Retrieve the provider images from a target image') do |id|
+ @options[:subcommand] = :providerimages
+ @options[:id] = id
+ end
+ opts.on('-g', '--targets', 'Retrieve the values available for the --target parameter') do
+ @options[:subcommand] = :targets
+ end
+ opts.on('-p', '--providers', 'Retrieve the values available for the --provider parameter') do
+ @options[:subcommand] = :providers
+ end
+ opts.on('-a', '--accounts', 'Retrieve the values available for the --account parameter') do
+ @options[:subcommand] = :accounts
+ end
end
- opts.separator ""
- opts.separator "Build options:"
- opts.on('-e', '--template FILE', 'path to file that contains template xml') do |file|
- @options[:template] = file
- end
- opts.on('-z', '--no-validation', 'Do not validation the template against the TDL XML Schema') do |description|
- @options[:validation] = false
+ if !subcommand || subcommand == :build
+ opts.separator ""
+ opts.separator "Build options:"
+ opts.on('-e', '--template FILE', 'path to file that contains template xml') do |file|
+ @options[:template] = file
+ end
+ opts.on('-z', '--no-validation', 'Do not validation the template against the TDL XML Schema') do |description|
+ @options[:validation] = false
+ end
end
- opts.separator ""
- opts.separator "Push options:"
- opts.on('-B', '--build ID', 'push all target images for a build, to same providers as previously') do |id|
- @options[:build] = id
- end
- opts.on('-t', '--targetimages ID', 'Retrieve the target images from a build') do |id|
- @options[:targetimage] = id
- end
- opts.on('-A', '--account NAME', 'name of specific provider account to use for push') do |name|
- @options[:account] = name
+ if !subcommand || subcommand == :push
+ opts.separator ""
+ opts.separator "Push options:"
+ opts.on('-B', '--build ID', 'push all target images for a build, to same providers as previously') do |id|
+ @options[:build] = id
+ end
+ opts.on('-t', '--targetimages ID', 'Retrieve the target images from a build') do |id|
+ @options[:targetimage] = id
+ end
+ opts.on('-A', '--account NAME', 'name of specific provider account to use for push') do |name|
+ @options[:account] = name
+ end
end
- opts.separator ""
- opts.separator "Delete options:"
- opts.on('-I', '--image ID', 'delete build image and associated objects') do |id|
- @options[:subcommand] = :image
- @options[:image] = id
- end
- opts.on('-B', '--build ID', 'delete build and associated objects') do |id|
- @options[:subcommand] = :build
- @options[:build] = id
- end
- opts.on('-m', '--targetimage ID', 'delete target image and its provider images') do |id|
- @options[:subcommand] = :target_image
- @options[:targetimage] = id
- end
- opts.on('-D', '--providerimage ID', 'delete provider image') do |id|
- @options[:subcommand] = :provider_image
- @options[:providerimage] = id
+ if !subcommand || subcommand == :delete
+ opts.separator ""
+ opts.separator "Delete options:"
+ opts.on('-I', '--image ID', 'delete build image and associated objects') do |id|
+ @options[:subcommand] = :image
+ @options[:image] = id
+ end
+ opts.on('-B', '--build ID', 'delete build and associated objects') do |id|
+ @options[:subcommand] = :build
+ @options[:build] = id
+ end
+ opts.on('-m', '--targetimage ID', 'delete target image and its provider images') do |id|
+ @options[:subcommand] = :target_image
+ @options[:targetimage] = id
+ end
+ opts.on('-D', '--providerimage ID', 'delete provider image') do |id|
+ @options[:subcommand] = :provider_image
+ @options[:providerimage] = id
+ end
end
opts.separator ""
opts.separator "URL with credentials to Conductor are set in ~/.aeolus-cli"
opts.separator "Conductor URL should point to https://<host_where_conductor_runs>/conductor/api"
- opts.separator ""
- opts.separator "List Examples:"
- opts.separator "aeolus-cli list --images # list available images"
- opts.separator "aeolus-cli list --builds $image_id # list the builds of an image"
- opts.separator "aeolus-cli list --targetimages $build_id # list the target images from a build"
- opts.separator "aeolus-cli list --providerimages $target_id # list the provider images from a target image"
- opts.separator "aeolus-cli list --targets # list the values available for the --target parameter"
- opts.separator "aeolus-cli list --providers # list the values available for the --provider parameter"
- opts.separator "aeolus-cli list --accounts # list the values available for the --account parameter"
+ if !subcommand || subcommand == :list
+ opts.separator ""
+ opts.separator "List Examples:"
+ opts.separator "aeolus-cli list --images # list available images"
+ opts.separator "aeolus-cli list --builds $image_id # list the builds of an image"
+ opts.separator "aeolus-cli list --targetimages $build_id # list the target images from a build"
+ opts.separator "aeolus-cli list --providerimages $target_id # list the provider images from a target image"
+ opts.separator "aeolus-cli list --targets # list the values available for the --target parameter"
+ opts.separator "aeolus-cli list --providers # list the values available for the --provider parameter"
+ opts.separator "aeolus-cli list --accounts # list the values available for the --account parameter"
+ end
- opts.separator ""
- opts.separator "Build examples:"
- opts.separator "aeolus-cli build --target ec2 --template my.tmpl # build a new image for ec2 from based on the given template"
- opts.separator "aeolus-cli build --target ec2,rhevm --template my.tmpl # build a new image for ec2 and for rhevm based on the given template"
- #opts.separator "aeolus-cli build --image $image_id # (NOT IMPLEMENTED) rebuild the image template and targets from latest build"
- #opts.separator %q{aeolus-cli build --target ec2,rackspace \ # rebuild the image with a new template and set of targets
- # --image $image_i \
- # --template my.tmpl}
+ if !subcommand || subcommand == :build
+ opts.separator ""
+ opts.separator "Build examples:"
+ opts.separator "aeolus-cli build --target ec2 --template my.tmpl # build a new image for ec2 from based on the given template"
+ opts.separator "aeolus-cli build --target ec2,rhevm --template my.tmpl # build a new image for ec2 and for rhevm based on the given template"
+ #opts.separator "aeolus-cli build --image $image_id # (NOT IMPLEMENTED) rebuild the image template and targets from latest build"
+ #opts.separator %q{aeolus-cli build --target ec2,rackspace \ # rebuild the image with a new template and set of targets
+ # --image $image_i \
+ # --template my.tmpl}
+ end
- opts.separator ""
- opts.separator "Push examples:"
- opts.separator "aeolus-cli push --account ec2-account,ec2-account2 --targetimage $target_image_id # Push target images to each of the specified account"
- opts.separator "aeolus-cli push --account ec2-account,rhevm-account --build $build_id # Push target images attached to a particular build to each of the specified accounts"
- opts.separator "aeolus-cli push --account ec2-account,rhevm-account --image $image_id # Push target images attached to a particular image to each of the specified accounts"
+ if !subcommand || subcommand == :push
+ opts.separator ""
+ opts.separator "Push examples:"
+ opts.separator "aeolus-cli push --account ec2-account,ec2-account2 --targetimage $target_image_id # Push target images to each of the specified account"
+ opts.separator "aeolus-cli push --account ec2-account,rhevm-account --build $build_id # Push target images attached to a particular build to each of the specified accounts"
+ opts.separator "aeolus-cli push --account ec2-account,rhevm-account --image $image_id # Push target images attached to a particular image to each of the specified accounts"
+ end
- opts.separator ""
- opts.separator "Import examples:"
- opts.separator "aeolus-cli import --provider ec2-us-east-1 --target ec2 --id $ami_id # import an AMI from the specified provider"
- opts.separator "aeolus-cli import --provider ec2-us-east-1 --target ec2 --id $ami_id --description '<image><name>My Image</name></image>' # import an AMI from the specified provider"
- opts.separator "aeolus-cli import --provider ec2-us-east-1 --target ec2 --id $ami_id --description <path_to_xml_file> # import an AMI from the specified provider"
+ if !subcommand || subcommand == :import
+ opts.separator ""
+ opts.separator "Import examples:"
+ opts.separator "aeolus-cli import --provider ec2-us-east-1 --target ec2 --id $ami_id # import an AMI from the specified provider"
+ opts.separator "aeolus-cli import --provider ec2-us-east-1 --target ec2 --id $ami_id --description '<image><name>My Image</name></image>' # import an AMI from the specified provider"
+ opts.separator "aeolus-cli import --provider ec2-us-east-1 --target ec2 --id $ami_id --description <path_to_xml_file> # import an AMI from the specified provider"
+ end
- opts.separator ""
- opts.separator "Delete examples: (DELETE CURRENTLY NOT IMPLEMENTED) "
- opts.separator "aeolus-cli delete --image $image_id # deletes a image and all associated builds"
- opts.separator "aeolus-cli delete --build $build_id # deletes a build and all associated targetimages"
- opts.separator "aeolus-cli delete --targetimage $target_image # deletes a target image and all associated provider images"
- opts.separator "aeolus-cli delete --providerimage $provider_image # deletes a provider image"
+ if !subcommand || subcommand == :delete
+ opts.separator ""
+ opts.separator "Delete examples: (DELETE CURRENTLY NOT IMPLEMENTED) "
+ opts.separator "aeolus-cli delete --image $image_id # deletes a image and all associated builds"
+ opts.separator "aeolus-cli delete --build $build_id # deletes a build and all associated targetimages"
+ opts.separator "aeolus-cli delete --targetimage $target_image # deletes a target image and all associated provider images"
+ opts.separator "aeolus-cli delete --providerimage $provider_image # deletes a provider image"
+ end
end
begin
--
1.7.7.3
12 years, 3 months
[PATCH conductor] Display the backend provider image ID when deleted
by Tomas Sedovic
From: Tomas Sedovic <tomas(a)sedovic.cz>
https://www.aeolusproject.org/redmine/issues/2850
Since deleting provider image doesn't delete the actual image stored at the
provider (the AMI in EC2's context), we need to give the admins the option to
delete it themselves.
---
src/app/controllers/provider_images_controller.rb | 5 ++++-
src/config/locales/en.yml | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/app/controllers/provider_images_controller.rb b/src/app/controllers/provider_images_controller.rb
index 4b17ce4..94b9df5 100644
--- a/src/app/controllers/provider_images_controller.rb
+++ b/src/app/controllers/provider_images_controller.rb
@@ -50,8 +50,11 @@ class ProviderImagesController < ApplicationController
def destroy
if image = Aeolus::Image::Warehouse::ProviderImage.find(params[:id])
+ target_id = image.target_identifier
+ provider = image.provider
if image.delete!
- flash[:notice] = t('provider_images.flash.notice.deleted')
+ flash[:notice] = t('provider_images.flash.notice.deleted',
+ :target_id => target_id, :provider => provider)
else
flash[:warning] = t('provider_images.flash.warning.delete_failed')
end
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 8c0088c..4747d31 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -677,7 +677,10 @@ en:
provider_images:
flash:
notice:
- deleted: Provider Image Deleted
+ deleted:
+ "Provider Image Deleted. If you want to remove the actual image stored
+ by the provider, visit the %{provider}'s management console and seek
+ out the \"%{target_id}\" image."
upload_start: Provider Image Upload Started
warning:
delete_failed: Unable to Delete Provider Image
--
1.7.6.4
12 years, 3 months
[PATCH] Removed unused rescue block when creating a template
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
This rescue block was catching REXML parse error, but template xml wasn't parsed.
This fixes error with " uninitialized constant REXML::ParseException"
---
src/app/controllers/images_controller.rb | 31 ++++++++++++-----------------
src/config/locales/en.yml | 2 -
2 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
index 222ab60..be95d42 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -105,24 +105,19 @@ class ImagesController < ApplicationController
render :edit_xml and return
end
- begin
- uuid = UUIDTools::UUID.timestamp_create.to_s
- @template = Aeolus::Image::Warehouse::Template.create!(uuid, @xml, {
- :object_type => 'template',
- :uuid => uuid
- })
- uuid = UUIDTools::UUID.timestamp_create.to_s
- body = "<image><name>#{(a)template.name}</name></image>"
- @image = Aeolus::Image::Warehouse::Image.create!(uuid, body, {
- :uuid => uuid,
- :object_type => 'image',
- :template => @template.uuid
- })
- flash.now[:error] = t('images.flash.notice.created')
- rescue REXML::ParseException
- flash.now[:error] = t('images.flash.warning.invalid_xml')
- render :edit_xml and return
- end
+ uuid = UUIDTools::UUID.timestamp_create.to_s
+ @template = Aeolus::Image::Warehouse::Template.create!(uuid, @xml, {
+ :object_type => 'template',
+ :uuid => uuid
+ })
+ uuid = UUIDTools::UUID.timestamp_create.to_s
+ body = "<image><name>#{(a)template.name}</name></image>"
+ @image = Aeolus::Image::Warehouse::Image.create!(uuid, body, {
+ :uuid => uuid,
+ :object_type => 'image',
+ :template => @template.uuid
+ })
+ flash.now[:error] = t('images.flash.notice.created')
redirect_to image_path((a)image.id)
end
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index f69c3b1..5b142fd 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -650,8 +650,6 @@ en:
warning:
delete_failed: Unable to Delete Image
not_found: Image not found
- invalid_xml:
- The provided XML is not valid. Please fix it before continuing.
error:
invalid_url: Could not load the provided URL
new:
--
1.7.6.4
12 years, 3 months
[PATCH conductor] Fix broken the Catalog Entries Cucumber feature
by Tomas Sedovic
From: Tomas Sedovic <tomas(a)sedovic.cz>
---
src/features/catalog_entries.feature | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/features/catalog_entries.feature b/src/features/catalog_entries.feature
index bb0092c..f6d9914 100644
--- a/src/features/catalog_entries.feature
+++ b/src/features/catalog_entries.feature
@@ -37,9 +37,10 @@ Feature: Manage Catalog Entries
And I am on the "default" catalog catalog entries page
When I follow "testdepl"
Then I should see "testdepl"
- And I should see "Name"
- And I should see "description"
- And I should see "Deployable XML"
+ And I should see "Image"
+ And I should see "Build"
+ And I should see "Catalogs"
+ And I should see "Roles"
Scenario: Delete deployables
Given there is a "default" catalog
--
1.7.6.4
12 years, 3 months
[PATCH conductor] Added pagination to events on instance detail page
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=743605
---
src/app/controllers/instances_controller.rb | 1 +
src/app/models/event.rb | 1 +
src/app/views/instances/_history.html.haml | 4 +++-
3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
index b415bc0..0d57885 100644
--- a/src/app/controllers/instances_controller.rb
+++ b/src/app/controllers/instances_controller.rb
@@ -44,6 +44,7 @@ class InstancesController < ApplicationController
@tab_captions = [t('instances.tab_captions.properties'), t('instances.tab_captions.history'), t('instances.tab_captions.permissions')]
@details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
save_breadcrumb(instance_path(@instance), @instance.name)
+ @events = @instance.events.descending_by_created_at.paginate(:page => params[:page] || 1)
respond_to do |format|
format.html { render :action => 'show'}
format.js do
diff --git a/src/app/models/event.rb b/src/app/models/event.rb
index 349e149..a8b23c5 100644
--- a/src/app/models/event.rb
+++ b/src/app/models/event.rb
@@ -42,4 +42,5 @@ class Event < ActiveRecord::Base
validates_presence_of :source_type
scope :lifetime, where(:status_code => [:first_running, :all_running, :some_running, :all_stopped])
+ scope :descending_by_created_at, order('created_at DESC')
end
diff --git a/src/app/views/instances/_history.html.haml b/src/app/views/instances/_history.html.haml
index c4e3349..2facfc3 100644
--- a/src/app/views/instances/_history.html.haml
+++ b/src/app/views/instances/_history.html.haml
@@ -2,7 +2,9 @@
= t 'instances.history.history_for'
= @instance.name
%ul
- - @instance.events.each do |event|
+ - @events.each do |event|
%li
= @instance.name
= event.summary
+
+= will_paginate @events
--
1.7.6.4
12 years, 3 months
[PATCH aeolus-conductor] Updated API for new aeolus-image-rubygem changes
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/controllers/api/images_controller.rb | 5 -----
src/app/views/api/images/_image.xml.haml | 2 +-
2 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/src/app/controllers/api/images_controller.rb b/src/app/controllers/api/images_controller.rb
index 60f5442..01291e4 100644
--- a/src/app/controllers/api/images_controller.rb
+++ b/src/app/controllers/api/images_controller.rb
@@ -28,11 +28,6 @@ module Api
def index
@images = Aeolus::Image::Warehouse::Image.all
- # TODO This should be in aeolus-image-rubygem
- @builds = {}
- @images.each do |img|
- @builds.merge!({img.id => Aeolus::Image::Warehouse::ImageBuild.find_all_by_image_uuid(img.id)})
- end
respond_with(@images)
end
diff --git a/src/app/views/api/images/_image.xml.haml b/src/app/views/api/images/_image.xml.haml
index 971a7b4..f19b1e6 100644
--- a/src/app/views/api/images/_image.xml.haml
+++ b/src/app/views/api/images/_image.xml.haml
@@ -6,5 +6,5 @@
%os_version= image.os.version
%arch= image.os.arch
%builds{:type => 'xs:list'}
- - @builds[image.id].each do |bld|
+ - image.image_builds.each do |bld|
%build{:id => bld.id, :href => api_build_url(bld.id)}
--
1.7.6.4
12 years, 3 months
[PATCH aeolus-image-rubygem 1/2] Fixed where method in WarehouseModel
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
.../model/warehouse/warehouse_model.rb | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/aeolus_image/model/warehouse/warehouse_model.rb b/lib/aeolus_image/model/warehouse/warehouse_model.rb
index b177ce7..14e9323 100644
--- a/lib/aeolus_image/model/warehouse/warehouse_model.rb
+++ b/lib/aeolus_image/model/warehouse/warehouse_model.rb
@@ -106,7 +106,9 @@ module Aeolus
def where(query_string)
self.set_warehouse_and_bucket if self.bucket.nil?
- self.warehouse.query(@bucket_name, query_string)
+ self.warehouse.query(@bucket_name, query_string).xpath('/objects/object').map do |obj|
+ self.new(self.bucket.object(obj.at_xpath('./key/text()').to_s))
+ end
end
def delete(uuid)
--
1.7.6.4
12 years, 3 months
[PATCH conductor 1/2] Change dropdown of catalogs to the name of belonging catalog in catalog_entry#new/edit form
by jzigmund@redhat.com
From: Jozef Zigmund <jzigmund(a)redhat.com>
---
src/app/controllers/catalog_entries_controller.rb | 7 ++-----
src/app/views/catalog_entries/_form.html.haml | 5 +++--
src/app/views/catalog_entries/_from_url.html.haml | 3 ++-
src/app/views/catalog_entries/_upload.html.haml | 3 ++-
src/config/locales/en.yml | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/app/controllers/catalog_entries_controller.rb b/src/app/controllers/catalog_entries_controller.rb
index c17070b..65df174 100644
--- a/src/app/controllers/catalog_entries_controller.rb
+++ b/src/app/controllers/catalog_entries_controller.rb
@@ -32,7 +32,6 @@ class CatalogEntriesController < ApplicationController
@catalog = Catalog.find(params[:catalog_id])
@catalog_entry = params[:catalog_entry].nil? ? CatalogEntry.new() : CatalogEntry.new(params[:catalog_entry])
require_privilege(Privilege::CREATE, CatalogEntry, @catalog)
- load_catalogs
@form_option= params.has_key?(:from_url) ? 'from_url' : 'upload'
respond_to do |format|
format.html
@@ -52,9 +51,10 @@ class CatalogEntriesController < ApplicationController
return
end
- @catalog = Catalog.find(params[:catalog_entry][:catalog_id])
+ @catalog = Catalog.find(params[:catalog_id])
require_privilege(Privilege::CREATE, CatalogEntry, @catalog)
@catalog_entry = CatalogEntry.new(params[:catalog_entry])
+ @catalog_entry.catalog = @catalog
@catalog_entry.owner = current_user
if params.has_key? :url
@@ -75,7 +75,6 @@ class CatalogEntriesController < ApplicationController
end
else
@catalog = Catalog.find(params[:catalog_id])
- load_catalogs
params.delete(:edit_xml) if params[:edit_xml]
flash[:warning]= t('catalog_entries.flash.warning.not_valid') if @catalog_entry.errors.has_key?(:xml)
@form_option = params[:catalog_entry].has_key?(:xml) ? 'upload' : 'from_url'
@@ -87,7 +86,6 @@ class CatalogEntriesController < ApplicationController
@catalog_entry = CatalogEntry.find(params[:id])
require_privilege(Privilege::MODIFY, @catalog_entry)
@catalog = @catalog_entry.catalog
- load_catalogs
end
def update
@@ -99,7 +97,6 @@ class CatalogEntriesController < ApplicationController
flash[:notice] = t"catalog_entries.flash.notice.updated"
redirect_to catalog_catalog_entry_path((a)catalog_entry.catalog, @catalog_entry)
else
- load_catalogs
render :action => 'edit'
end
end
diff --git a/src/app/views/catalog_entries/_form.html.haml b/src/app/views/catalog_entries/_form.html.haml
index c7dff8b..49b9bca 100644
--- a/src/app/views/catalog_entries/_form.html.haml
+++ b/src/app/views/catalog_entries/_form.html.haml
@@ -10,8 +10,9 @@
= form.label :name, t('catalog_entries.index.name')
= form.text_field :name, :class => 'em long'
%p
- = form.label :catalog_id, t('.catalog')
- = form.select :catalog_id, @catalogs.collect{|c| [c.name, c.id]}, :selected => params[:catalog_entry].nil? ? @catalog.id : params[:catalog_entry][:catalog_id]
+ = form.label :catalog_id, t('catalog_entries.form.catalog')
+ = @catalog.name
+ .clear
%p
= form.label :description, t('.description')
= form.text_area :description, :class => 'long'
diff --git a/src/app/views/catalog_entries/_from_url.html.haml b/src/app/views/catalog_entries/_from_url.html.haml
index 6afdb4d..51d86fa 100644
--- a/src/app/views/catalog_entries/_from_url.html.haml
+++ b/src/app/views/catalog_entries/_from_url.html.haml
@@ -7,7 +7,8 @@
= form.text_field :name, :class => 'em long'
%p
= form.label :catalog_id, t('catalog_entries.form.catalog')
- = form.select :catalog_id, @catalogs.collect{|c| [c.name, c.id]}, :selected => params[:catalog_entry].nil? ? @catalog.id : params[:catalog_entry][:catalog_id]
+ = @catalog.name
+ .clear
%p
= form.label :description, t('catalog_entries.form.description')
= form.text_area :description, :class => 'long'
diff --git a/src/app/views/catalog_entries/_upload.html.haml b/src/app/views/catalog_entries/_upload.html.haml
index c11406f..3c02f59 100644
--- a/src/app/views/catalog_entries/_upload.html.haml
+++ b/src/app/views/catalog_entries/_upload.html.haml
@@ -7,7 +7,8 @@
= form.text_field :name, :class => 'em long'
%p
= form.label :catalog_id, t('catalog_entries.form.catalog')
- = form.select :catalog_id, @catalogs.collect{|c| [c.name, c.id]}, :selected => params[:catalog_entry].nil? ? @catalog.id : params[:catalog_entry][:catalog_id]
+ = @catalog.name
+ .clear
%p
= form.label :description, t('catalog_entries.form.description')
= form.text_area :description, :class => 'long'
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 8c0088c..68cdcd4 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -577,7 +577,7 @@ en:
from_url: From URL
form:
choose_xml: "Choose Deployable XML file:"
- catalog: Catalog
+ catalog: "Catalog: "
description: Description
cancel: Cancel
save: Save
--
1.7.6.4
12 years, 3 months