[PATCH conductor] BZ 786207 - selection validation on launch_new
by Tomas Hrcka
https://bugzilla.redhat.com/show_bug.cgi?id=786207
added javascript to enable next button when name of deployement is filled
---
src/app/views/deployments/_launch_new.html.haml | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/app/views/deployments/_launch_new.html.haml b/src/app/views/deployments/_launch_new.html.haml
index ef18898..46f1499 100644
--- a/src/app/views/deployments/_launch_new.html.haml
+++ b/src/app/views/deployments/_launch_new.html.haml
@@ -41,7 +41,7 @@
%div#realm-description
%fieldset.options
- = submit_tag t('.next'), :class => 'button', :id => "next_button"
+ = submit_tag t('.next'), :class => 'button', :id => "next_button", :disabled => true
:javascript
@@ -61,6 +61,11 @@
e.preventDefault();
$.get('#{check_name_deployments_path}', {name: $('#deployment_name').val() }, function(data) {
$('#name_avail_indicator').html(data == "false" ? "#{t'deployments.launch_new.already_in_use'}" : "#{t'deployments.launch_new.name_available'}");
+ if(data == "true" && $('#next_button').is(':disabled')){
+ $('#next_button').removeAttr('disabled');
+ }else{
+ $('#next_button').attr("disabled", "disabled");
+ }
});
});
--
1.7.1
12 years, 2 months
[PATCH conductor] BZ 799314 - Clarify error when a deployable has images in the wrong environment.
by Matt Wagner
It was unclear from the previous message what a user was to do. This attempts
to clarify what has gone wrong, and tries to walk the line of giving
a meaningful error that the deployable is unusable to end-users, while
giving enough detail to admins that they understand what is misconfigured.
Partially resolves https://bugzilla.redhat.com/show_bug.cgi?id=799314
---
src/app/models/deployable.rb | 2 +-
src/config/locales/en.yml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/app/models/deployable.rb b/src/app/models/deployable.rb
index de00e08..83aaa71 100644
--- a/src/app/models/deployable.rb
+++ b/src/app/models/deployable.rb
@@ -161,7 +161,7 @@ class Deployable < ActiveRecord::Base
else
if image.environment != pool_family.name
deployable_errors << I18n.t("deployables.flash.error.wrong_environment",
- :assembly => assembly.name,
+ :deployable => name,
:uuid => assembly.image_id,
:wrong_env => image.environment,
:environment => pool_family.name)
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 4bcbbc5..e5ef9ee 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -925,7 +925,7 @@ en:
no_catalog_exists: "No catalog exists! Please create one."
no_hwp_exists: "No hardware profile exists! Please create one."
missing_image: "%{assembly}: Image (UUID: %{uuid}) doesn't exist"
- wrong_environment: "%{assembly}: Image (UUID: %{uuid}) belongs to the wrong environment (%{wrong_env}) instead of %{environment}"
+ wrong_environment: "The deployable '%{deployable}' contains an image (UUID %{uuid}) in the wrong environment ('%{wrong_env}' should be '%{environment}') and cannot be used."
warning:
failed: "Deployable was not created: %{message}"
notice:
--
1.7.7.6
12 years, 2 months
[PATCH] BZ 788136 add checks to see if accounts exist
by Tzu-Mainn Chen
---
src/app/controllers/images_controller.rb | 3 +++
src/app/views/images/import.html.haml | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
index b737c42..a462b54 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -194,6 +194,9 @@ class ImagesController < ApplicationController
check_permissions
if 'import' == params[:tab]
@accounts = @environment.provider_accounts.enabled.list_for_user(current_user, Privilege::USE)
+ if !(a)accounts.any?
+ flash[:error] = t("images.flash.error.no_provider_accounts")
+ end
render :import and return
end
diff --git a/src/app/views/images/import.html.haml b/src/app/views/images/import.html.haml
index 1846aeb..c677fe0 100644
--- a/src/app/views/images/import.html.haml
+++ b/src/app/views/images/import.html.haml
@@ -23,4 +23,4 @@
= text_field_tag :name
.buttons.container
- = submit_tag t(:continue), :id => "file_button", :class => "button primary"
+ = submit_tag t(:continue), :id => "file_button", :class => "button primary", :disabled => !(a)accounts.any?
--
1.7.6.5
12 years, 2 months
[PATCH] BZ 795666 show proper error if user does not have permission to destroy a pool
by Tzu-Mainn Chen
---
src/app/controllers/pools_controller.rb | 28 +++++++++++++++++++++-------
1 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/app/controllers/pools_controller.rb b/src/app/controllers/pools_controller.rb
index 5824754..3529b7d 100644
--- a/src/app/controllers/pools_controller.rb
+++ b/src/app/controllers/pools_controller.rb
@@ -182,19 +182,27 @@ class PoolsController < ApplicationController
def destroy
destroyed = []
failed = []
+ permission_failed = []
error_messages = []
Pool.find(ids_list('pools_selected')).each do |pool|
if pool.id == MetadataObject.lookup("self_service_default_pool").id
error_messages << t("pools.flash.error.default_pool_not_deleted")
- elsif check_privilege(Privilege::MODIFY, pool) && pool.destroyable?
+ elsif !check_privilege(Privilege::MODIFY, pool)
+ permission_failed << pool.name
+ elsif !pool.destroyable?
+ failed << pool.name
+ else
pool.destroy
destroyed << pool.name
- else
- failed << pool.name
end
end
+
flash[:success] = t('pools.flash.success.pool_deleted', :list => destroyed.to_sentence, :count => destroyed.size) if destroyed.present?
- flash[:error] = t('pools.flash.error.pool_not_deleted', :list => failed.to_sentence, :count => failed.size) if failed.present?
+ if permission_failed.any?
+ flash[:error] = t('application_controller.permission_denied')
+ elsif failed.any?
+ flash[:error] = t('pools.flash.error.pool_not_deleted', :list => failed.to_sentence, :count => failed.size) if failed.present?
+ end
flash[:warning] = error_messages if error_messages.present?
respond_to do |format|
# TODO - What is expected to be returned on an AJAX delete?
@@ -210,6 +218,7 @@ class PoolsController < ApplicationController
def multi_destroy
destroyed = []
failed = []
+ permission_failed = []
error_messages = []
Pool.find(params[:pools_selected]).each do |pool|
# FIXME: remove this check when pools can be assigned to new users
@@ -217,11 +226,13 @@ class PoolsController < ApplicationController
# to id of 1 and deleting it prevents new users from being created
if pool.id == MetadataObject.lookup("self_service_default_pool").id
error_messages << t("pools.flash.error.default_pool_not_deleted")
- elsif check_privilege(Privilege::MODIFY, pool) && pool.destroyable?
+ elsif !check_privilege(Privilege::MODIFY, pool)
+ permission_failed << pool.name
+ elsif !pool.destroyable?
+ failed << pool.name
+ else
pool.destroy
destroyed << pool.name
- else
- failed << pool.name
end
end
@@ -231,6 +242,9 @@ class PoolsController < ApplicationController
unless failed.empty?
error_messages << t('pools.flash.error.pool_not_deleted', :count => failed.length, :list => failed.join(', '))
end
+ unless permission_failed.empty?
+ error_messages << t('application_controller.permission_denied')
+ end
unless error_messages.empty?
flash[:error] = error_messages.join('<br />')
end
--
1.7.6.5
12 years, 2 months
[PATCH conductor] BZ798574: Separating matching_provider_hardware_profiles action from create
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=798574
---
.../controllers/hardware_profiles_controller.rb | 32 ++++++++++---------
src/app/views/hardware_profiles/_form.html.haml | 3 +-
src/app/views/hardware_profiles/new.html.haml | 2 +-
src/config/routes.rb | 1 +
4 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/src/app/controllers/hardware_profiles_controller.rb b/src/app/controllers/hardware_profiles_controller.rb
index db94433..f845654 100644
--- a/src/app/controllers/hardware_profiles_controller.rb
+++ b/src/app/controllers/hardware_profiles_controller.rb
@@ -19,7 +19,7 @@ class HardwareProfilesController < ApplicationController
before_filter :load_hardware_profiles, :only => [:index, :show]
before_filter :load_hardware_profile, :only => [:show]
before_filter :setup_new_hardware_profile, :only => [:new]
- before_filter :setup_hardware_profile, :only => [:new, :create, :edit, :update]
+ before_filter :setup_hardware_profile, :only => [:new, :create, :matching_provider_hardware_profiles, :edit, :update]
def index
@title = t('hardware_profiles.hardware_profiles')
@@ -32,7 +32,7 @@ class HardwareProfilesController < ApplicationController
format.js do
if params[:hardware_profile]
build_hardware_profile(params[:hardware_profile])
- matching_provider_hardware_profiles
+ find_matching_provider_hardware_profiles
render :partial => 'matching_provider_hardware_profiles'
else
render :partial => 'list'
@@ -53,7 +53,7 @@ class HardwareProfilesController < ApplicationController
@tab_captions = [t('hardware_profiles.tab_captions.properties'), t('hardware_profiles.tab_captions.history'), t('hardware_profiles.tab_captions.matching_provider_hwp')]
@details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
properties
- matching_provider_hardware_profiles
+ find_matching_provider_hardware_profiles
save_breadcrumb(hardware_profile_path(@hardware_profile), @hardware_profile.name)
respond_to do |format|
@@ -81,19 +81,21 @@ class HardwareProfilesController < ApplicationController
require_privilege(Privilege::CREATE, HardwareProfile)
build_hardware_profile(params[:hardware_profile])
- if params[:commit] == 'Save'
- if @hardware_profile.save
- redirect_to hardware_profiles_path
- else
- params.delete :commit
- render :action => 'new'
- end
+ if @hardware_profile.save
+ redirect_to hardware_profiles_path
else
- matching_provider_hardware_profiles
render :action => 'new'
end
end
+ def matching_provider_hardware_profiles
+ require_privilege(Privilege::CREATE, HardwareProfile)
+
+ build_hardware_profile(params[:hardware_profile])
+ find_matching_provider_hardware_profiles
+ render :action => 'new'
+ end
+
def destroy
hardware_profile = HardwareProfile.find(params[:id])
require_privilege(Privilege::MODIFY, hardware_profile)
@@ -121,7 +123,7 @@ class HardwareProfilesController < ApplicationController
redirect_to hardware_profile_path(@hardware_profile)
return
end
- matching_provider_hardware_profiles
+ find_matching_provider_hardware_profiles
end
def update
@@ -133,7 +135,7 @@ class HardwareProfilesController < ApplicationController
if params[:commit] == "Check Matches"
require_privilege(Privilege::VIEW, HardwareProfile)
- matching_provider_hardware_profiles
+ find_matching_provider_hardware_profiles
render :edit and return
end
@@ -183,7 +185,7 @@ class HardwareProfilesController < ApplicationController
:storage => HardwareProfileProperty.new(:name => "storage", :unit => "GB"),
:architecture => HardwareProfileProperty.new(:name => "architecture", :unit => "label"))
end
- matching_provider_hardware_profiles
+ find_matching_provider_hardware_profiles
end
def properties
@@ -195,7 +197,7 @@ class HardwareProfilesController < ApplicationController
end
#TODO Update this method when moving to new HWP Model
- def matching_provider_hardware_profiles
+ def find_matching_provider_hardware_profiles
@provider_hwps_header = [
{ :name => t('hardware_profiles.provider_hwp_headers.provider_name'), :sort_attr => "provider.name" },
{ :name => t('hardware_profiles.provider_hwp_headers.hwp_name'), :sort_attr => :name },
diff --git a/src/app/views/hardware_profiles/_form.html.haml b/src/app/views/hardware_profiles/_form.html.haml
index 0a0fed8..5b1815c 100644
--- a/src/app/views/hardware_profiles/_form.html.haml
+++ b/src/app/views/hardware_profiles/_form.html.haml
@@ -18,5 +18,6 @@
= hwpp_form.select("value", ["i386", "x86_64"], {})
-else
= hwpp_form.text_field(:value)
-= hwp_form.submit t('hardware_profiles.form.check_matches'), :class => "submit button", :id => 'check_matches'
+
+= restful_submit_tag t('hardware_profiles.form.check_matches'), 'matching_provider_hardware_profiles', matching_provider_hardware_profiles_hardware_profiles_path, 'GET', :class => 'button danger', :id => 'check_matches', 'data-none_selected' => t('deployments.flash.error.none_selected')
= hwp_form.submit t('save'), :class => 'submit button', :id => 'save_button'
diff --git a/src/app/views/hardware_profiles/new.html.haml b/src/app/views/hardware_profiles/new.html.haml
index cdb732c..c5b2db8 100644
--- a/src/app/views/hardware_profiles/new.html.haml
+++ b/src/app/views/hardware_profiles/new.html.haml
@@ -12,4 +12,4 @@
= form_for @hardware_profile, :url => hardware_profiles_path, :html => { :multipart => true } do |hwp_form|
= render :partial => "form", :locals => { :hwp_form => hwp_form }
- = render :partial => 'matching_provider_hardware_profiles' if params[:commit] == 'Check Matches'
+ = render :partial => 'matching_provider_hardware_profiles' if @matching_hwps.present? && @matching_hwps.any?
diff --git a/src/config/routes.rb b/src/config/routes.rb
index d24f039..e7dd434 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -137,6 +137,7 @@ Conductor::Application.routes.draw do
resources :hardware_profiles do
delete 'multi_destroy', :on => :collection
post :filter, :on => :collection
+ get :matching_provider_hardware_profiles, :on => :collection
end
resources :providers do
--
1.7.6.5
12 years, 2 months
[PATCH conductor] BZ799492: Fix "push is about to start" message
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=799492
---
src/app/controllers/images_controller.rb | 2 +-
src/app/controllers/provider_images_controller.rb | 2 +-
src/app/views/images/show.html.haml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
index 7d71b73..a085e7b 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -38,7 +38,7 @@ class ImagesController < ApplicationController
@image = Aeolus::Image::Warehouse::Image.find(params[:id])
@environment = PoolFamily.where('name' => @image.environment).first
@push_started = params[:push_started] == 'true'
- @pushed_target_image_id = params[:pushed_target_image_id]
+ @pushed_provider_account = ProviderAccount.find(params[:provider_account_id]) if params[:provider_account_id].present?
if @image.imported?
begin
diff --git a/src/app/controllers/provider_images_controller.rb b/src/app/controllers/provider_images_controller.rb
index 60fabe5..0f94e38 100644
--- a/src/app/controllers/provider_images_controller.rb
+++ b/src/app/controllers/provider_images_controller.rb
@@ -38,7 +38,7 @@ class ProviderImagesController < ApplicationController
flash[:warning] = t('provider_images.flash.warning.upload_failed')
end
redirect_to image_path(params[:image_id], :build => params[:build_id], :push_started => @push_started,
- :pushed_target_image_id => @push_started ? @provider_image.target_image_id : nil)
+ :provider_account_id => @push_started ? provider_account.id : nil)
end
def destroy
diff --git a/src/app/views/images/show.html.haml b/src/app/views/images/show.html.haml
index 38e34cf..bbee92f 100644
--- a/src/app/views/images/show.html.haml
+++ b/src/app/views/images/show.html.haml
@@ -108,7 +108,7 @@
- if timg and b = @builder.find_active_push(timg.id, account.provider.name, account.credentials_hash['username'])
= label_tag b.status
- elsif timg and not pimg and @build and @build.id == @latest_build
- - if @push_started && @pushed_target_image_id == timg.id
+ - if @push_started && @pushed_provider_account == account
.light
= t('images.show.push_started')
- else
--
1.7.6.5
12 years, 2 months
[PATCH] BZ 798548 - fixed redirect on image import fail
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=798548
Added missing 'environment' param
---
src/app/controllers/images_controller.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
index 26f12df..9a6c7b4 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -210,7 +210,7 @@ class ImagesController < ApplicationController
else
flash[:error] = t("images.import.image_not_imported")
end
- redirect_to new_image_url(:tab => 'import')
+ redirect_to new_image_url(:tab => 'import', :environment => @environment)
end
end
--
1.7.7.6
12 years, 2 months