ACK, all tests passed
Dne 4.5.2011 12:23, jprovazn(a)redhat.com napsal(a):
From: Jan Provaznik<jprovazn(a)redhat.com>
Hardware profile selection list is now filtered according to an assembly
architecture per each assembly.
---
.../resources/deployments_controller.rb | 8 +-------
src/app/views/resources/deployments/new.haml | 6 ++++--
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/app/controllers/resources/deployments_controller.rb
b/src/app/controllers/resources/deployments_controller.rb
index 81378f8..96f17ae 100644
--- a/src/app/controllers/resources/deployments_controller.rb
+++ b/src/app/controllers/resources/deployments_controller.rb
@@ -115,15 +115,9 @@ class Resources::DeploymentsController< ApplicationController
def init_new_deployment_attrs
@pools = Pool.list_for_user(@current_user, Privilege::CREATE, :target_type =>
Deployment)
@realms = FrontendRealm.all
- # FIXME: temporary for debugging
- #arch = @deployment.deployable.assemblies.first.templates.first.architecture
- arch = 'x86_64'
@hardware_profiles = HardwareProfile.all(
:include => :architecture,
- :conditions => {
- :provider_id => nil,
- 'hardware_profile_properties.value' => arch
- }
+ :conditions => {:provider_id => nil}
)
end
end
diff --git a/src/app/views/resources/deployments/new.haml
b/src/app/views/resources/deployments/new.haml
index 6e5a1ff..42e75fe 100644
--- a/src/app/views/resources/deployments/new.haml
+++ b/src/app/views/resources/deployments/new.haml
@@ -16,8 +16,10 @@
%h3 Assemblies hardware profiles
%ul
- @deployment.deployable.assemblies.each do |assembly|
- = label_tag "hw_profiles[#{assembly.id}]", assembly.name
- = select_tag "hw_profiles[#{assembly.id}]",
options_from_collection_for_select(@hardware_profiles, 'id', 'name')
+ %li
+ - hwprofiles = @hardware_profiles.select {|hwp| hwp.architecture.value ==
assembly.templates.first.architecture}
+ = label_tag "hw_profiles[#{assembly.id}]", assembly.name
+ = select_tag "hw_profiles[#{assembly.id}]",
options_from_collection_for_select(hwprofiles, 'id', 'name')
= submit_tag 'Cancel', :name => 'cancel'
= submit_tag 'Launch', :name => 'launch'