Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vm_controller and session mixin #865

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/mixins/generic_session_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def set_session_data
session["#{prefix}_filters".to_sym] = @filters
session["#{prefix}_catinfo".to_sym] = @catinfo
session["#{prefix}_showtype".to_sym] = @showtype
session[:miq_compressed] = @compressed unless @compressed.nil?
session[:miq_exists_mode] = @exists_mode unless @exists_mode.nil?
end
end
end
23 changes: 8 additions & 15 deletions app/controllers/vm_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class VmController < ApplicationController
after_action :set_session_data
include VmCommon # common methods for vm controllers
include VmRemote # methods for VM remote access
include Mixins::GenericSessionMixin

def index
session[:vm_type] = nil # Reset VM type if coming in from All tab
Expand All @@ -17,28 +18,20 @@ def show_list
process_show_list(options)
end

private ####
def title
_("Virtual Machines")
end

private

def get_session_data
@title = _("Virtual Machines")
@layout = "vm"
@lastaction = session[:vm_lastaction]
@showtype = session[:vm_showtype]
@filters = session[:vm_filters]
@catinfo = session[:vm_catinfo]
@display = session[:vm_display]
super
@polArr = session[:polArr] || "" # current tags in effect
@policy_options = session[:policy_options] || ""
end

def set_session_data
session[:vm_lastaction] = @lastaction
session[:vm_showtype] = @showtype
session[:miq_compressed] = @compressed unless @compressed.nil?
session[:miq_exists_mode] = @exists_mode unless @exists_mode.nil?
session[:vm_filters] = @filters
session[:vm_catinfo] = @catinfo
session[:vm_display] = @display unless @display.nil?
super
session[:polArr] = @polArr unless @polArr.nil?
session[:policy_options] = @policy_options unless @policy_options.nil?
end
Expand Down