[PATCH conductor] BZ798510 Added message when no Provider Account is assigned to template's Environment
Tomas Hrcka
thrcka at redhat.com
Mon Mar 19 14:45:07 UTC 2012
On 03/16/2012 04:26 PM, jtomasek at redhat.com wrote:
> From: Jiri Tomasek<jtomasek at redhat.com>
>
> ---
> src/app/controllers/images_controller.rb | 3 ++-
> src/app/views/images/show.html.haml | 13 ++++++++-----
> src/config/locales/en.yml | 2 +-
> 3 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
> index a06a249..d3cb780 100644
> --- a/src/app/controllers/images_controller.rb
> +++ b/src/app/controllers/images_controller.rb
> @@ -64,7 +64,8 @@ class ImagesController< ApplicationController
> load_builds
> load_target_images(@build)
> @target_image_exists = @target_images_by_target.any?
> - flash[:error] = t("images.flash.error.no_provider_accounts") if @account_groups.size == 0
> + @account_groups_listing = @account_groups.select{ |driver, group| group[:included] || @target_images_by_target[driver] || (@build and @builder.find_active_build(@build.id, driver)) }
> + flash[:error] = t("images.flash.error.no_provider_accounts") if @account_groups_listing.blank?
>
> respond_to do |format|
> format.html
> diff --git a/src/app/views/images/show.html.haml b/src/app/views/images/show.html.haml
> index edfa8c6..d0fe21f 100644
> --- a/src/app/views/images/show.html.haml
> +++ b/src/app/views/images/show.html.haml
> @@ -40,17 +40,17 @@
> - build_text = '.rebuild'
> - else
> - build_text = '.build'
> - - if @account_groups.size> 1
> + - if @account_groups_listing.size> 1
> - build_text<< '_all'
> - = button_to t(build_text), rebuild_all_image_path(@image.id), :class => 'button pill'
> + = button_to t(build_text), rebuild_all_image_path(@image.id), :class => 'button pill' unless @account_groups_listing.blank?
> #push-all-btn
> - if @build&& @build.id == @latest_build&& @target_image_exists
> = button_to t('.push_all'), push_all_image_path(@image.id, :build_id => @build.id), :class => 'button pill'
>
> .content
> - %ul.image_builds
> - - @account_groups.each do |driver, group|
> - - if group[:included] || @target_images_by_target[driver] || (@build and @builder.find_active_build(@build.id, driver))
> + - if @account_groups_listing.present?
> + - @account_groups_listing.each do |driver, group|
> + %ul.image_builds
> - timg = @target_images_by_target[driver]
> %li
> %dl
> @@ -121,6 +121,9 @@
> - else
>
> .clear
> + - else
> + .centered.align-center
> + %strong= t("images.flash.error.no_provider_accounts")
>
> :javascript
> $(document).ready(function(){
> diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
> index 7dff372..e815210 100644
> --- a/src/config/locales/en.yml
> +++ b/src/config/locales/en.yml
> @@ -804,7 +804,7 @@ en:
> invalid_url: Could not load the provided URL
> no_file: You must specify the template XML file
> no_template: "The image doesn't have a template because it's been imported."
> - no_provider_accounts: Images cannot be built, as no provider accounts are currently enabled.
> + no_provider_accounts: "Images cannot be built, as there are no enabled Provider Accounts associated to this Environment."
> no_provider_accounts_for_import: Images cannot be imported, as no provider accounts are currently enabled for this environment.
> new:
> new_image: New Image
ACK.
More information about the aeolus-devel
mailing list