Skip to content

Commit

Permalink
Merge pull request #2402 from Fryguy/lazy_vmdb_database
Browse files Browse the repository at this point in the history
Allow for VmdbDatabase to not be present
  • Loading branch information
martinpovolny committed Oct 14, 2017
2 parents 652cf1b + 8c4a3aa commit dcb4496
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
8 changes: 5 additions & 3 deletions app/controllers/ops_controller/db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ def db_get_info
@right_cell_text = _("VMDB Summary")
elsif @sb[:active_tab] == "db_utilization"
@record = VmdbDatabase.my_database
perf_gen_init_options # Initialize perf chart options, charts will be generated async
@sb[:record_class] = @record.class.base_class.name # Hang on to record class/id for async trans
@sb[:record_id] = @record.id
if @record
perf_gen_init_options # Initialize perf chart options, charts will be generated async
@sb[:record_class] = @record.class.base_class.name # Hang on to record class/id for async trans
@sb[:record_id] = @record.id
end
@right_cell_text = _("VMDB Utilization")
else
@right_cell_text = case @sb[:active_tab]
Expand Down
10 changes: 10 additions & 0 deletions app/helpers/ops_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module OpsHelper::TextualSummary
TOP_TABLES_BY_COUNT = 5

def textual_group_vmdb_connection_properties
return if @record.nil?

TextualGroup.new(
_("Properties"),
%i(
Expand All @@ -16,18 +18,26 @@ def textual_group_vmdb_connection_properties
end

def textual_group_vmdb_tables_most_rows
return if @record.nil?

TextualListview.new_from_hash(textual_vmdb_tables_most_rows)
end

def textual_group_vmdb_tables_largest_size
return if @record.nil?

TextualListview.new_from_hash(textual_vmdb_tables_largest_size)
end

def textual_group_vmdb_tables_most_wasted_space
return if @record.nil?

TextualListview.new_from_hash(textual_vmdb_tables_most_wasted_space)
end

def textual_group_vmdb_connection_capacity_data
return if @record.nil?

TextualGroup.new(
_("Capacity Data"),
%i(
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/tree_builder_ops_vmdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def root_options

# Get root nodes count/array for explorer tree
def x_get_tree_roots(count_only, _options)
objects = Rbac.filtered(VmdbDatabase.my_database.evm_tables).to_a
objects = Rbac.filtered(VmdbDatabase.my_database.try(:evm_tables).to_a).to_a
# storing table names and their id in hash so they can be used to build links on summary screen in top 5 boxes
@sb[:vmdb_tables] = {}
objects.each do |o|
Expand Down
2 changes: 1 addition & 1 deletion app/views/ops/_all_tabs.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
= render :partial => "db_details_tab"
- if tree_node == "root" || tree_node.split("-").first == TreeBuilder.get_prefix_for_model("VmdbTable")
= miq_tab_content("db_utilization", @sb[:active_tab]) do
- if @sb[:active_tab] == "db_utilization"
- if @sb[:active_tab] == "db_utilization" && @record
= render(:partial => "layouts/performance")
:javascript
miq_tabs_init("#ops_tabs", "/ops/change_tab");

0 comments on commit dcb4496

Please sign in to comment.