@@ -3,7 +3,7 @@ module RequestInfoHelper
33
44 PROV_FIELD_TYPES = [ :vm , :host , :ds , :template , :vc , :pxe_img , :iso_img , :window_image ] . freeze
55
6- PROV_FIELDS = [ :src_vm_id , :placement_host_name , :placement_ds_name , :attached_ds , :sysprep_custom_spec , :customization_template_id , :pxe_image_id , :iso_image_id , :windows_image_id ] . freeze
6+ PROV_FIELDS = [ :src_vm_id , :placement_host_name , :placement_ds_name , :attached_ds , :sysprep_custom_spec , :customization_template_id , :pxe_image_id , :iso_image_id , :windows_image_id , :src_configuration_script_id ] . freeze
77
88 def provision_tab_configuration ( workflow )
99 prov_tab_labels = workflow . provisioning_tab_list . pluck ( :name )
@@ -54,6 +54,8 @@ def prov_grid_data(field, field_id, spec_required)
5454 { :type => :iso_img , :iso_img => @iso_imgs }
5555 when :windows_image_id
5656 { :type => :window_image , :window_images => @windows_images }
57+ when :src_configuration_script_id
58+ { :type => :configuration_script , :configuration_scripts => @configuration_scripts }
5759 else
5860 { }
5961 end
@@ -93,6 +95,23 @@ def prov_vm_data(data)
9395 { :headers => headers , :rows => rows , :selected => :src_vm_id , :none_index => data [ :none_index ] }
9496 end
9597
98+ def prov_configuration_script_data ( data )
99+ edit = data [ :edit ]
100+ headers = prov_grid_configuration_script_header ( edit , data [ :configuration_scripts ] , data [ :type ] )
101+ rows = [ ]
102+ if data [ :configuration_scripts ]
103+ rows += [ prov_row_item ( data [ :none_index ] , none_cells ( edit [ :configuration_script_headers ] . length - 1 ) ) ]
104+ if data [ :configuration_scripts ]
105+ rows += data [ :configuration_scripts ] . map do |configuration_script |
106+ prov_row_item ( configuration_script . id . to_s , prov_configuration_script_grid_cells ( configuration_script ) )
107+ end
108+ end
109+ else
110+ rows . push ( { :id => data [ :script ] . id . to_s , :clickable => true , :cells => prov_configuration_script_grid_cells ( data [ :script ] ) } )
111+ end
112+ { :headers => headers , :rows => rows , :selected => :src_configuration_script_id , :none_index => data [ :none_index ] }
113+ end
114+
96115 def prov_host_data ( data )
97116 edit = data [ :edit ]
98117 options = edit || data [ :options_data ]
@@ -200,6 +219,20 @@ def prov_grid_vm_header(edit, clones, vms, type)
200219 headers
201220 end
202221
222+ def prov_grid_configuration_script_header ( edit , configuration_scripts , type )
223+ header_keys = prov_header_keys ( type . to_s )
224+ headers = [ ]
225+ edit [ header_keys [ :columns ] ] . each_with_index do |h , index |
226+ item = prov_grid_header_item ( edit [ header_keys [ :headers ] ] [ h ] )
227+ if configuration_scripts
228+ item [ :sort_choice ] = h
229+ item [ :sort_data ] = prov_sort_data ( edit , index , header_keys )
230+ end
231+ headers . push ( item )
232+ end
233+ headers
234+ end
235+
203236 def prov_grid_host_header ( edit , options , type )
204237 header_keys = prov_header_keys ( type . to_s )
205238 headers = [ ]
@@ -272,6 +305,13 @@ def prov_vm_grid_cells(data, edit)
272305 cells
273306 end
274307
308+ def prov_configuration_script_grid_cells ( data )
309+ [
310+ prov_cell_data ( data . name ) ,
311+ prov_cell_data ( data . description ) ,
312+ ]
313+ end
314+
275315 def prov_host_grid_cells ( data , options )
276316 options [ :host_columns ] . map do |col |
277317 prov_cell_data ( data . send ( col ) )
0 commit comments