From: Martyn Taylor <mtaylor(a)redhat.com>
---
.../admin/hardware_profiles_controller.rb | 26 +-----
src/app/views/admin/hardware_profiles/_form.haml | 20 +----
src/app/views/admin/hardware_profiles/_list.haml | 5 +-
.../views/admin/hardware_profiles/_properties.haml | 13 +---
src/features/hardware_profile.feature | 86 ++++++++++----------
5 files changed, 56 insertions(+), 94 deletions(-)
diff --git a/src/app/controllers/admin/hardware_profiles_controller.rb b/src/app/controllers/admin/hardware_profiles_controller.rb
index 75c6ab1..04e291f 100644
--- a/src/app/controllers/admin/hardware_profiles_controller.rb
+++ b/src/app/controllers/admin/hardware_profiles_controller.rb
@@ -133,13 +133,8 @@ class Admin::HardwareProfilesController < ApplicationController
def properties
@properties_header = [
{ :name => "Name", :sort_attr => :name},
- { :name => "Kind", :sort_attr => :kind },
- { :name => "Range First", :sort_attr => :range_first},
- { :name => "Range Last", :sort_attr => :range_last },
- { :name => "Enum Entries", :sort_attr => :false },
- { :name => "Default Value", :sort_attr => :value},
- { :name => "Unit", :sort_attr => :unit}
- ]
+ { :name => "Unit", :sort_attr => :unit},
+ { :name => "Minimum Value", :sort_attr => :value}]
@hwp_properties = [@hardware_profile.memory, @hardware_profile.cpu, @hardware_profile.storage, @hardware_profile.architecture]
end
@@ -168,11 +163,7 @@ class Admin::HardwareProfilesController < ApplicationController
@header = [
{ :name => "Name", :sort_attr => :name},
{ :name => "Unit", :sort_attr => :unit},
- { :name => "Kind", :sort_attr => :kind },
- { :name => "Value (Default)", :sort_attr => :value},
- { :name => "Enum Entries", :sort_attr => :false },
- { :name => "Range First", :sort_attr => :range_first},
- { :name => "Range Last", :sort_attr => :range_last }]
+ { :name => "Minimum Value", :sort_attr => :value}]
end
def set_params_and_header
@@ -210,17 +201,10 @@ class Admin::HardwareProfilesController < ApplicationController
hwpp.nil? ? hardwareProfileProperty = HardwareProfileProperty.new : hardwareProfileProperty = hwpp
hardwareProfileProperty.name = params[:name]
- hardwareProfileProperty.kind = params[:kind]
+ hardwareProfileProperty.kind = "fixed"
hardwareProfileProperty.value = params[:value]
hardwareProfileProperty.unit = params[:unit]
- case hardwareProfileProperty.kind
- when "range"
- hardwareProfileProperty.range_first = params[:range_first]
- hardwareProfileProperty.range_last = params[:range_last]
- when "enum"
- hardwareProfileProperty.property_enum_entries = params[:property_enum_entries].split(%r{,\s*}).map { |value| PropertyEnumEntry.new(:value => value, :hardware_profile_property => hardwareProfileProperty) }
- end
- hardwareProfileProperty
+ return hardwareProfileProperty
end
end
diff --git a/src/app/views/admin/hardware_profiles/_form.haml b/src/app/views/admin/hardware_profiles/_form.haml
index 4327007..70c982b 100644
--- a/src/app/views/admin/hardware_profiles/_form.haml
+++ b/src/app/views/admin/hardware_profiles/_form.haml
@@ -10,21 +10,9 @@
%td
=hwpp_form.text_field(:unit, :size => 5, :readonly => "readonly")
%td
- -unless type == :architecture
- =hwpp_form.select("kind", ["fixed", "range", "enum"], {})
+ -if type == :architecture
+ =hwpp_form.select("value", ["i386", "x86_64"], {})
-else
- =hwpp_form.select("kind", ["fixed"], {})
- %td
- =hwpp_form.text_field(:value)
- %td
- -unless type == :architecture
- =hwpp_form.text_field(:property_enum_entries)
- %td
- -unless type == :architecture
- =hwpp_form.text_field(:range_first)
- %td
- -unless type == :architecture
- =hwpp_form.text_field(:range_last)
+ =hwpp_form.text_field(:value)
= hwp_form.submit 'Check Matches', :class => "submit formbutton"
-<!-- Disabled until condor can support new HWP model -->
-<!-- = hwp_form.submit 'Save', :class => 'submit formbutton', :disabled => 'disabled' -->
\ No newline at end of file
+= hwp_form.submit 'Save', :class => 'submit formbutton'
\ No newline at end of file
diff --git a/src/app/views/admin/hardware_profiles/_list.haml b/src/app/views/admin/hardware_profiles/_list.haml
index 621f53b..eee5ff1 100644
--- a/src/app/views/admin/hardware_profiles/_list.haml
+++ b/src/app/views/admin/hardware_profiles/_list.haml
@@ -1,8 +1,7 @@
- form_tag do
#object-actions
- <!-- Disabled until condor can support new HWP model -->
- <!-- = link_to "New Hardware Profile", new_admin_hardware_profile_path, :class => 'button' -->
- <!-- = restful_submit_tag "Delete", "destroy", multi_destroy_admin_hardware_profiles_path -->
+ = link_to "New Hardware Profile", new_admin_hardware_profile_path, :class => 'button'
+ = restful_submit_tag "Delete", 'destroy', multi_destroy_admin_hardware_profiles_path, 'DELETE', :id => 'delete_button'
#selections
%p
Select:
diff --git a/src/app/views/admin/hardware_profiles/_properties.haml b/src/app/views/admin/hardware_profiles/_properties.haml
index 04517bf..0739b84 100644
--- a/src/app/views/admin/hardware_profiles/_properties.haml
+++ b/src/app/views/admin/hardware_profiles/_properties.haml
@@ -1,7 +1,6 @@
%h3
= @hardware_profile.name + "(" + (@hardware_profile.provider_id.nil? ? "Front End" : "Provider" ) + ")"
-<!-- Disabled until condor can support new HWP model -->
-<!-- = link_to 'Edit', edit_admin_hardware_profile_path(@hardware_profile), :class => 'button' -->
+ = link_to 'Edit', edit_admin_hardware_profile_path(@hardware_profile), :class => 'button'
%table
= sortable_table_header @properties_header
- @hwp_properties.each do |hwpp|
@@ -9,14 +8,6 @@
%td
=hwpp.name.nil? ? "n/a" : hwpp.name
%td
- =hwpp.kind.nil? ? "n/a" : hwpp.kind
- %td
- =hwpp.range_first.nil? ? "n/a" : hwpp.range_first
- %td
- =hwpp.range_last.nil? ? "n/a" : hwpp.range_last
- %td
- =hwpp.property_enum_entries.empty? ? "n/a" : (hwpp.property_enum_entries.collect { |enum| enum.value.to_s }).join(", ")
+ =hwpp.unit.nil? ? "n/a" : hwpp.unit
%td
=hwpp.value.nil? ? "n/a" : hwpp.value
- %td
- =hwpp.unit.nil? ? "n/a" : hwpp.unit
diff --git a/src/features/hardware_profile.feature b/src/features/hardware_profile.feature
index ce06e1f..e35e9a3 100644
--- a/src/features/hardware_profile.feature
+++ b/src/features/hardware_profile.feature
@@ -20,7 +20,7 @@ Feature: Manage Pools
| m1-large | 4096 | 4 | 850 | x86_64 |
| m1-xlarge | 8192 | 8 | 1690 | x86_64 |
- Scenario: View a Hardware Profiles Properties
+ Scenario: View a Front End Hardware Profiles Properties
Given there are the following conductor hardware profiles:
| name | memory | cpu |storage | architecture |
| m1-small | 1740 | 2 | 160 | i386 |
@@ -29,11 +29,11 @@ Feature: Manage Pools
And I am on the the hardware profiles page
When I follow "m1-small"
Then I should see the following:
- | Name | Kind | Range First | Range Last | Enum Entries | Default Value | Unit |
- | memory | fixed | n/a | n/a | n/a | 1740 | MB |
- | cpu | fixed | n/a | n/a | n/a | 2 | count |
- | storage | fixed | n/a | n/a | n/a | 160 | GB |
- | architecture | fixed | n/a | n/a | n/a | i386 | label |
+ | Name | Minimum Value | Unit |
+ | memory | 1740 | MB |
+ | cpu | 2 | count |
+ | storage | 160 | GB |
+ | architecture | i386 | label |
Scenario: View a Front End Hardware Profiles Matching Provider Hardware Profiles
Given there are the following conductor hardware profiles:
@@ -84,22 +84,22 @@ Feature: Manage Pools
When I follow "mock1"
Then I should see "mock1(Front End)"
-# Scenario: Create a new Hardware Profile
-# Given I am an authorised user
-# And I am on the hardware profiles page
-# When I follow "New Hardware Profile"
-# Then I should be on the new hardware profile page
-# When I fill in "name" with "Test Hardware Profile"
-# And I enter the following details for the Hardware Profile Properties
-# | name | kind | range_first | range_last | property_enum_entries | value | unit |
-# | memory | fixed | | | | 1740 | MB |
-# | cpu | range | 1 | 4 | | 2 | count |
-# | storage | enum | | | 250, 300, 350 | 300 | GB |
-# | architecture | fixed | | | | i386 | label |
-# And I press "Save"
-# Then I should be on the hardware profiles page
-# And I should see the following:
-# | Test Hardware Profile | 1740 | 1 - 4 | 250, 300, 350 | i386 |
+ Scenario: Create a new Hardware Profile
+ Given I am an authorised user
+ And I am on the hardware profiles page
+ When I follow "New Hardware Profile"
+ Then I should be on the new hardware profile page
+ When I fill in "name" with "Test Hardware Profile"
+ And I enter the following details for the Hardware Profile Properties
+ | name | value | unit |
+ | memory | 1740 | MB |
+ | cpu | 2 | count |
+ | storage | 250 | GB |
+ | architecture | i386 | label |
+ And I press "Save"
+ Then I should be on the hardware profiles page
+ And I should see the following:
+ | Test Hardware Profile | 1740 | 2 | 250 | i386 |
# Scenario: Check New Hardware Profile matching Provider Hardware Profiles
# Given I am an authorised user
@@ -122,24 +122,24 @@ Feature: Manage Pools
# | m1-small | 1740 | 1 | 250 | i386 |
# | m1-medium | 1740 | 2 | 500 | i386 |
-# Scenario: Update a HardwareProfile
-# Given I am an authorised user
-# And there are the following aggregator hardware profiles:
-# | name | memory | cpu |storage | architecture |
-# | m1-small | 1740 | 2 | 160 | i386 |
-# And I am on the hardware profiles page
-# When I follow "m1-small"
-# Then I should see "Properties"
-# When I follow "edit"
-# Then I should be on the edit hardware profiles page
-# When I enter the following details for the Hardware Profile Properties
-# | name | kind | range_first | range_last | property_enum_entries | value |
-# | memory | fixed | | | | 1740 |
-# | cpu | range | 1 | 4 | | 1 |
-# | storage | range | 250 | 500 | | 300 |
-# | architecture | fixed | | | | i386 |
-# And I press "Save"
-# Then I should be on the hardware profiles page
-# Then I should see the following:
-# | Name | Memory | CPU | Storage | Architecture |
-# | m1-small | 1740 | 1 - 4 | 250 - 500 | i386 |
+ Scenario: Update a HardwareProfile
+ Given I am an authorised user
+ And there are the following conductor hardware profiles:
+ | name | memory | cpu |storage | architecture |
+ | m1-small | 2048 | 4 | 160 | x86_64 |
+ And I am on the hardware profiles page
+ When I follow "m1-small"
+ Then I should see "Properties"
+ When I follow "edit"
+ Then I should be on the edit hardware profiles page
+ When I enter the following details for the Hardware Profile Properties
+ | name | value | unit |
+ | memory | 1740 | MB |
+ | cpu | 2 | count |
+ | storage | 250 | GB |
+ | architecture | i386 | label |
+ And I press "Save"
+ Then I should be on the hardware profiles page
+ Then I should see the following:
+ | Name | Memory | CPU | Storage | Architecture |
+ | m1-small | 1740 | 2 | 250 | i386 |
--
1.7.4