Skip to content

Commit

Permalink
Fixed alphabetical order in labels table
Browse files Browse the repository at this point in the history
refactored

Refactoring

make labels sorted

changed methods for consistency

changed method for vm_helper labels

cleaning up dead code and moving some methods

refactoring

refactoring
  • Loading branch information
nimrodshn committed May 22, 2017
1 parent c97f018 commit 00a9686
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
7 changes: 0 additions & 7 deletions app/helpers/container_summary_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module ContainerSummaryHelper
include TextualMixins::TextualName

def textual_ems
textual_link(@record.ext_management_system)
end
Expand Down Expand Up @@ -187,10 +186,4 @@ def collect_env
]
end
end

private

def textual_key_value_group(items)
items.collect { |item| {:label => item.name.to_s, :value => item.value.to_s} }
end
end
5 changes: 5 additions & 0 deletions app/helpers/textual_summary_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ def textual_group_render_options(group_symbol)
}
end

def textual_key_value_group(items)
res = items.collect { |item| {:label => item.name.to_s, :value => item.value.to_s} }
res.sort_by { |k| k[:label] }
end

def textual_tags
label = _("%{name} Tags") % {:name => session[:customer_name]}
h = {:label => label}
Expand Down
8 changes: 1 addition & 7 deletions app/helpers/vm_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def textual_group_ems_custom_attributes
end

def textual_group_labels
TextualGroup.new(_("Labels"), textual_labels)
TextualGroup.new(_("Labels"), textual_key_value_group(@record.custom_attributes))
end

def textual_group_power_management
Expand Down Expand Up @@ -762,12 +762,6 @@ def textual_ems_custom_attributes
attrs.sort_by(&:name).collect { |a| {:label => a.name, :value => a.value} }
end

def textual_labels
attrs = @record.custom_attributes
return nil if attrs.blank?
attrs.sort_by(&:name).collect { |a| {:label => a.name, :value => a.value} }
end

def textual_compliance_history
super(:title => _("Show Compliance History of this VM (Last 10 Checks)"),
:explorer => true)
Expand Down

0 comments on commit 00a9686

Please sign in to comment.