12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/helpers/concerns/foreman_teamdynamix/hosts_helper_extensions.rb', line 12
def teamdynamix_fields
td_pane_fields = SETTINGS[:teamdynamix][:fields] || DEFAULT_TD_PANE_FIELDS
return [[_('Asset'), 'None Associated or error from Team Dynamix']] unless @host.teamdynamix_asset
@asset = @host.teamdynamix_asset
fields = asset_uri(td_pane_fields)
td_pane_fields.except(:url).each do |field_name, asset_attr|
asset_attr_val = @asset.key?(asset_attr) ? @asset[asset_attr] : get_nested_attrib_val(asset_attr)
fields += [[_(field_name.to_s), asset_attr_val]] if asset_attr_val.present?
end
fields
rescue StandardError => e
[[_('Error'), e.message]]
end
|