Skip to content

Commit

Permalink
Merge pull request #6998 from h-kataria/remove_vmdb_accordion_from_ops
Browse files Browse the repository at this point in the history
Removed "Database" accordion from Configuration explorer
  • Loading branch information
skateman authored May 12, 2020
2 parents 1bfe5f0 + 05c2a99 commit 9347dd8
Show file tree
Hide file tree
Showing 31 changed files with 16 additions and 1,068 deletions.
39 changes: 12 additions & 27 deletions app/controllers/application_controller/performance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -645,33 +645,18 @@ def perf_gen_data_before_wait
end

# Get the report definition (yaml) and set the where clause based on the record type
if @perf_record.kind_of?(VmdbDatabase)
rpt = perf_get_chart_rpt(@perf_options[:model].underscore)
rpt.where_clause = ["vmdb_database_id = ? and timestamp >= ? and timestamp <= ? and capture_interval_name = ?",
@perf_record.id,
from_dt,
to_dt,
interval_type]
elsif @perf_record.kind_of?(VmdbTable)
rpt = perf_get_chart_rpt(@perf_options[:model].underscore)
rpt.where_clause = ["resource_type = ? and resource_id = ? and timestamp >= ? and timestamp <= ? and capture_interval_name = ?",
@perf_options[:model],
@perf_record.id,
from_dt,
to_dt,
interval_type]
else # Doing VIM performance on a normal CI
suffix = @perf_record.kind_of?(AvailabilityZone) || @perf_record.kind_of?(HostAggregate) ? "_cloud" : "" # Get special cloud version with 'Instances' headers
rpt = perf_get_chart_rpt("vim_perf_#{interval_type}#{suffix}")
rpt.where_clause = [
"resource_type = ? and resource_id = ? and timestamp >= ? and timestamp <= ? and capture_interval_name = ?",
@perf_options[:model],
@perf_record.id,
from_dt,
to_dt,
interval_type
]
end
# Doing VIM performance on a normal CI
suffix = @perf_record.kind_of?(AvailabilityZone) || @perf_record.kind_of?(HostAggregate) ? "_cloud" : "" # Get special cloud version with 'Instances' headers
rpt = perf_get_chart_rpt("vim_perf_#{interval_type}#{suffix}")
rpt.where_clause = [
"resource_type = ? and resource_id = ? and timestamp >= ? and timestamp <= ? and capture_interval_name = ?",
@perf_options[:model],
@perf_record.id,
from_dt,
to_dt,
interval_type
]

rpt.tz = @perf_options[:tz]
rpt.time_profile_id = @perf_options[:time_profile]

Expand Down
1 change: 0 additions & 1 deletion app/controllers/mixins/sandbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def x_active_tree
utilization_tree
vandt_tree
vat_tree
vmdb_tree
vms_filter_tree
vms_instances_filter_tree
widgets_tree
Expand Down
46 changes: 1 addition & 45 deletions app/controllers/ops_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class OpsController < ApplicationController
# Methods for accordions
include_concern 'Db'
include_concern 'Diagnostics'
include_concern 'OpsRbac'
include_concern 'Settings'
Expand Down Expand Up @@ -63,7 +62,6 @@ def display_ae_namespaces
'collect_logs' => :logs_collect,
'collect_current_logs' => :collect_current_logs,
'custom_button' => :custom_buttons,
'db_refresh' => :db_refresh,
'delete_server' => :delete_server,
'demote_server' => :demote_server,
'fetch_audit_log' => :fetch_audit_log,
Expand Down Expand Up @@ -214,7 +212,7 @@ def tree_select
tree_selected_model
set_active_tab(params[:id])
session[:changed] = false
self.x_node = params[:id] # if x_active_tree == :vmdb_tree #params[:action] == "x_show"
self.x_node = params[:id] #params[:action] == "x_show"
get_node_info(params[:id])
replace_right_cell(:nodetype => @nodetype)
end
Expand Down Expand Up @@ -251,9 +249,6 @@ def change_tab(new_tab_id = nil)
if x_active_tree == :settings_tree
settings_get_info
replace_right_cell(:nodetype => "root")
elsif x_active_tree == :vmdb_tree
db_get_info
replace_right_cell(:nodetype => "root")
elsif x_active_tree == :diagnostics_tree
diagnostics_get_info
case @sb[:active_tab]
Expand Down Expand Up @@ -321,8 +316,6 @@ def features
}
]

features.push(:role => "ops_db", :name => :vmdb, :title => _("Database")) if ::Settings.ui.display_ops_database

features.map { |hsh| ApplicationController::Feature.new_with_hash(hsh) }
end

Expand Down Expand Up @@ -367,11 +360,6 @@ def set_active_tab_and_node
@sb[:active_tab] ||= "diagnostics_summary"
end

if x_active_tree == :vmdb_tree
x_node_set("root", :vmdb_tree) unless x_node(:vmdb_tree)
@sb[:active_tab] ||= "db_summary"
end

@sb[:active_node] ||= {}

if MiqServer.my_server(true).logon_status != :ready
Expand Down Expand Up @@ -447,9 +435,6 @@ def set_active_tab(nodetype)
when "svr"
@sb[:active_tab] = "diagnostics_summary"
end
when :vmdb_tree
nodes = x_node.split('-')
@sb[:active_tab] = %w[ti xx].include?(nodes[0]) ? "db_indexes" : "db_summary"
end
end

Expand Down Expand Up @@ -562,7 +547,6 @@ def get_node_info(treenodeid, show_list = true)
when :diagnostics_tree then diagnostics_get_info
when :rbac_tree then rbac_get_info
when :settings_tree then settings_get_info
when :vmdb_tree then db_get_info
end

region_text = _("[Region: %{description} [%{region}]]") % {:description => MiqRegion.my_region.description,
Expand All @@ -571,30 +555,10 @@ def get_node_info(treenodeid, show_list = true)
when :diagnostics_tree then _("Diagnostics %{text}") % {:text => region_text}
when :settings_tree then _("Settings %{text}") % {:text => region_text}
when :rbac_tree then _("Access Control %{text}") % {:text => region_text}
when :vmdb_tree then _("Database []")
end
{:view => @view, :pages => @pages}
end

def open_parent_nodes
existing_node = nil # Init var

parent_rec = VmdbTableEvm.find(@record.vmdb_table_id)
parents = [parent_rec, {:id => @record.vmdb_table_id.to_s}]
# Go up thru the parents and find the highest level unopened, mark all as opened along the way
# Skip if no parents or parent already open
unless parents.empty? || x_tree[:open_nodes].include?(x_build_node_id(parents.last))
parents.reverse_each do |p|
p_node = x_build_node_id(p)
unless x_tree[:open_nodes].include?(p_node)
x_tree[:open_nodes].push(p_node)
existing_node = p_node
end
end
tree_add_child_nodes(existing_node) # Build the new nodes hash
end
end

# replace_trees can be an array of tree symbols to be replaced
def replace_right_cell(options = {})
nodetype, replace_trees = options.values_at(:nodetype, :replace_trees)
Expand All @@ -608,15 +572,10 @@ def replace_right_cell(options = {})
@explorer = true
tree_selected_model if @tree_selected_model.nil?

# Clicked on right cell record, open the tree enough to show the node,
# if not already showing a record
# Not in a form
add_nodes = open_parent_nodes if params[:action] == "x_show" && @record && !@in_a_form
locals = set_form_locals if @in_a_form
build_supported_depots_for_select

presenter = ExplorerPresenter.new(:active_tree => x_active_tree)
presenter[:add_nodes] = add_nodes if add_nodes

replace_explorer_trees(replace_trees, presenter)
rebuild_toolbars(presenter)
Expand All @@ -638,9 +597,6 @@ def x_active_tree_replace_cell(nodetype, presenter)
settings_replace_right_cell(nodetype, presenter)
when :diagnostics_tree
diagnostics_replace_right_cell(nodetype, presenter)
when :vmdb_tree # "root","tb", "ti","xx" # Check if vmdb root or table is selected
# Need to replace all_tabs to show table name as tab label
presenter.replace(:ops_tabs, r[:partial => "all_tabs"])
end
end

Expand Down
152 changes: 0 additions & 152 deletions app/controllers/ops_controller/db.rb

This file was deleted.

7 changes: 1 addition & 6 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,6 @@ def view_to_url(view, parent = nil)
action = 'show'
return url_for_only_path(:action => action, :id => params[:id]) + "?display=generic_objects&generic_object_id="
end
# If we do not want to use redirect or any kind of click action
if %w[Job VmdbDatabaseSetting VmdbDatabaseConnection VmdbIndex].include?(view.db) &&
%w[ops].include?(params[:controller])
return false
end
if %w[MiqTask].include?(view.db) && %w[miq_task].include?(params[:controller])
return true
end
Expand Down Expand Up @@ -298,7 +293,7 @@ def view_to_url(view, parent = nil)
else
return "/" + request.parameters[:controller] + "/tree_select/?id=" + x_node.split("-")[1]
end
elsif %w[VmdbTableEvm MiqServer].include?(view.db) &&
elsif view.db == "MiqServer" &&
%w[ops report].include?(request.parameters[:controller])
return "/" + request.parameters[:controller] + "/tree_select/?id=" + TREE_WITH_TAB[active_tab]
elsif %w[MiqAction
Expand Down
7 changes: 0 additions & 7 deletions app/helpers/application_helper/button/db_refresh.rb

This file was deleted.

10 changes: 0 additions & 10 deletions app/helpers/application_helper/toolbar/vmdb_table_center.rb

This file was deleted.

10 changes: 0 additions & 10 deletions app/helpers/application_helper/toolbar/vmdb_tables_center.rb

This file was deleted.

Loading

0 comments on commit 9347dd8

Please sign in to comment.