Skip to content

Commit

Permalink
Merge pull request #12614 from ZitaNemeckova/fix_history_button_vm
Browse files Browse the repository at this point in the history
Fix history button in vm infra page
  • Loading branch information
himdel authored Nov 16, 2016
2 parents 4934409 + 9b727fc commit 804cf5e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/mixins/vm_show_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def set_active_elements(feature)
self.x_active_tree ||= feature.tree_list_name
self.x_active_accord ||= feature.accord_name
end
get_node_info(@sb[@sb[:active_accord]].present? ? @sb[@sb[:active_accord]] : x_node)
get_node_info(x_node_right_cell)
end

def set_active_elements_authorized_user(tree_name, accord_name, add_nodes, klass, id)
Expand Down
29 changes: 23 additions & 6 deletions app/controllers/vm_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,11 @@ def action_type(type, amount)
end
end

# return correct node to right cell
def x_node_right_cell
@sb[@sb[:active_accord]].present? ? @sb[@sb[:active_accord]] : x_node
end

# set partial name and cell header for edit screens
def set_right_cell_vars
name = @record.try(:name).to_s
Expand Down Expand Up @@ -1743,7 +1748,10 @@ def set_right_cell_vars
partial = "layouts/performance"
header = _("Capacity & Utilization data for %{vm_or_template} \"%{name}\"") %
{:vm_or_template => ui_lookup(:table => table), :name => name}
x_history_add_item(:id => x_node, :text => header, :button => params[:pressed], :display => params[:display])
x_history_add_item(:id => x_node_right_cell,
:text => header,
:button => params[:pressed],
:display => params[:display])
action = nil
when "policy_sim"
if params[:action] == "policies"
Expand Down Expand Up @@ -1789,7 +1797,9 @@ def set_right_cell_vars
partial = "layouts/tl_show"
header = _("Timelines for %{virtual_machine} \"%{name}\"") %
{:virtual_machine => ui_lookup(:table => table), :name => name}
x_history_add_item(:id => x_node, :text => header, :button => params[:pressed])
x_history_add_item(:id => x_node_right_cell,
:text => header,
:button => params[:pressed])
action = nil
else
# now take care of links on summary screen
Expand All @@ -1809,17 +1819,24 @@ def set_right_cell_vars
:item_name => @item.kind_of?(ScanHistory) ? @item.started_on.to_s : @item.name,
:action => action_type(@sb[:action], 1)
}
x_history_add_item(:id => x_node, :text => header, :action => @sb[:action], :item => @item.id)
x_history_add_item(:id => x_node_right_cell,
:text => header,
:action => @sb[:action],
:item => @item.id)
else
header = _("\"%{action}\" for %{vm_or_template} \"%{name}\"") % {
:vm_or_template => ui_lookup(:table => table),
:name => name,
:action => action_type(@sb[:action], 2)
}
if @display && @display != "main"
x_history_add_item(:id => x_node, :text => header, :display => @display)
else
x_history_add_item(:id => x_node, :text => header, :action => @sb[:action]) if @sb[:action] != "drift_history"
x_history_add_item(:id => x_node_right_cell,
:text => header,
:display => @display)
elsif @sb[:action] != "drift_history"
x_history_add_item(:id => x_node_right_cell,
:text => header,
:action => @sb[:action])
end
end
action = nil
Expand Down

0 comments on commit 804cf5e

Please sign in to comment.