Skip to content

Commit

Permalink
Show dashboard/textual summary based on configuration or user prefere…
Browse files Browse the repository at this point in the history
…nce(in session)
  • Loading branch information
ZitaNemeckova committed Jan 24, 2017
1 parent 3da53aa commit cf02ffc
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
1 change: 0 additions & 1 deletion app/controllers/configuration_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def filters_field_changed
# AJAX driven routine for gtl view selection
def view_selected
# ui2 form
binding.pry
return unless load_edit("config_edit__ui2", "configuration")
@edit[:new][:views][VIEW_RESOURCES[params[:resource]]] = params[:view] # Capture the new view setting
@edit[:new][:display][:display_vms] = params[:display_vms] == 'true' if params.key?(:display_vms)
Expand Down
13 changes: 11 additions & 2 deletions app/controllers/ems_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ def show_dashboard
@showtype = "dashboard"
@lastaction = "show_dashboard"
drop_breadcrumb(:name => @ems.name + _(" (Dashboard)"), :url => show_link(@ems))
@sb[:summary_mode] = 'dashboard' unless @sb[:summary_mode] == 'dashboard'
render :action => "show_dashboard"
end

def show_main
@sb[:summary_mode] = 'textual' unless @sb[:summary_mode] == 'textual'
super
end

def show_ad_hoc_metrics
@showtype = "ad_hoc_metrics"
@lastaction = "show_ad_hoc_metrics"
Expand Down Expand Up @@ -118,14 +124,17 @@ def show_entities(display)
view_setup_helper(display, *view_setup_params[display])
end

def dashboard_view
false
end

def show
return unless init_show
session[:vm_summary_cool] = (settings(:views, :vm_summary_cool).to_s == "summary")
@summary_view = session[:vm_summary_cool]
@ems = @record

drop_breadcrumb({:name => ui_lookup(:tables => @table_name), :url => "/#{@table_name}/show_list?page=#{@current_page}&refresh=y"}, true)

case params[:display]
when 'main' then show_main
when 'download_pdf', 'summary_only' then show_download
Expand All @@ -140,7 +149,7 @@ def show
if pagination_or_gtl_request? # pagination controls
show_entities(@display) # display loaded from session
else # or default display
show_main
dashboard_view ? show_dashboard : show_main
end
else show_entities(params[:display])
end
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/ems_container_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ def self.table_name
@table_name ||= "ems_container"
end

def dashboard_view
if @sb[:summary_mode].present?
@sb[:summary_mode] == 'dashboard'
else
current_user[:settings][:views][:summary_mode] == 'dashboard'
end
end

def show_list
process_show_list(:gtl_dbname => 'emscontainer')
end
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/ems_infra_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ def new_ems_path
new_ems_infra_path
end

def dashboard_view
if @sb[:summary_mode].present?
@sb[:summary_mode] == 'dashboard'
else
current_user[:settings][:views][:summary_mode] == 'dashboard'
end
end

def index
redirect_to :action => 'show_list'
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class ApplicationHelper::Toolbar::DashboardSummaryToggleView < ApplicationHelper
N_('Summary View'),
nil,
:url => "/",
:url_parms => ""),
:url_parms => "?display=main"
),
twostate(
:view_topology,
'fa pficon-topology',
Expand Down
2 changes: 0 additions & 2 deletions app/helpers/configuration_helper/configuration_view_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module ConfigurationHelper
module ConfigurationViewHelper
def render_view_buttons(resource, view)
#binding.pry
(case resource
when :compare, :drift
view == "compressed" ? compare_or_drift_compressed(resource) : compare_or_drift_expanded(resource)
Expand All @@ -10,7 +9,6 @@ def render_view_buttons(resource, view)
when :treesize
view == "20" ? treesize_small : treesize_large
when :summary_mode
#binding.pry
view == "dashboard" ? summary_mode_dashboard(resource) : summary_mode_textual(resource)
else
case view
Expand Down

0 comments on commit cf02ffc

Please sign in to comment.