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

Advanced search bar ansible tower fix #1209

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/controllers/automation_manager_controller.rb
Expand Up @@ -262,6 +262,7 @@ def provider_node(id, model)
elsif x_active_tree == :configuration_scripts_tree
cs_provider_node(provider)
else
@show_adv_search = true
@no_checkboxes = true
options = {:model => "ManageIQ::Providers::AutomationManager::InventoryRootGroup",
:match_via_descendants => ConfiguredSystem,
Expand All @@ -279,6 +280,7 @@ def cs_provider_node(provider)
:match_via_descendants => ConfigurationScript,
:where_clause => ["manager_id IN (?)", provider.id],
:gtl_dbname => "automation_manager_configuration_scripts"}
@show_adv_search = true
process_show_list(options)
@right_cell_text = _("%{model} \"%{name}\"") % {:name => provider.name,
:model => "#{ui_lookup(:tables => "job_templates")} under "}
Expand All @@ -291,6 +293,7 @@ def inventory_group_node(id, model)
self.x_node = "root"
get_node_info("root")
else
@show_adv_search = true
options = {:model => "ConfiguredSystem",
:match_via_descendants => ConfiguredSystem,
:where_clause => ["inventory_root_group_id IN (?)", from_cid(@inventory_group_record.id)],
Expand All @@ -308,6 +311,7 @@ def inventory_group_node(id, model)

def configuration_scripts_list(id, model)
return configuration_script_node(id) if id
@show_adv_search = true
@listicon = "configuration_script"
if x_active_tree == :configuration_scripts_tree
options = {:model => model.to_s,
Expand All @@ -319,11 +323,13 @@ def configuration_scripts_list(id, model)

def configuration_script_node(id)
@record = @configuration_script_record = find_record(ManageIQ::Providers::AnsibleTower::AutomationManager::ConfigurationScript, id)
@show_adv_search = false
display_node(id, nil)
end

def default_node
return unless x_node == "root"
@show_adv_search = true
if x_active_tree == :automation_manager_providers_tree
options = {:model => "ManageIQ::Providers::AnsibleTower::AutomationManager",
:gtl_dbname => "automation_manager_providers"}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/mixins/manager_controller_mixin.rb
Expand Up @@ -346,7 +346,7 @@ def configured_system_node(id, model)
end

def display_adv_searchbox
!(@configured_system_record || @in_a_form || group_summary_tab_selected?)
!(@configured_system_record || @configuration_script_record || @in_a_form || group_summary_tab_selected?)
end

def miq_search_node
Expand Down
12 changes: 11 additions & 1 deletion spec/controllers/automation_manager_controller_spec.rb
Expand Up @@ -341,7 +341,9 @@
search_text = controller.instance_variable_get(:@search_text)
expect(search_text).to eq("manager")
view = controller.instance_variable_get(:@view)
show_adv_search = controller.instance_variable_get(:@show_adv_search)
expect(view.table.data.size).to eq(2)
expect(show_adv_search).to eq(true)
end

it "renders tree_select for ansible tower job templates tree node" do
Expand All @@ -351,6 +353,11 @@
controller.instance_variable_set(:@_params, :id => "at-" + ApplicationRecord.compress_id(@automation_manager1.id))
controller.send(:tree_select)
view = controller.instance_variable_get(:@view)
show_adv_search = controller.instance_variable_get(:@show_adv_search)
expect(show_adv_search).to eq(true)
expect(view.table.data.size).to eq(2)
expect(show_adv_search).to eq(true)

expect(view.table.data[0].name).to eq("ConfigScript3")
expect(view.table.data[1].name).to eq("ConfigScript1")
end
Expand Down Expand Up @@ -450,7 +457,8 @@

seed_session_trees('automation_manager', :automation_manager_cs_filter, "cs-#{tree_node_id}")
get :explorer

show_adv_search = controller.instance_variable_get(:@show_adv_search)
expect(show_adv_search).to be_falsey
expect(response.status).to eq(200)
expect(response).to render_template(:partial => 'layouts/_textual_groups_generic')
end
Expand All @@ -476,6 +484,8 @@
allow(controller).to receive(:x_active_accord).and_return(:configuration_scripts)
allow(controller).to receive(:x_node).and_return(tree_node_id)
get :explorer
show_adv_search = controller.instance_variable_get(:@show_adv_search)
expect(show_adv_search).to eq(false)
expect(response.status).to eq(200)
expect(response.body).to include("Question Name")
expect(response.body).to include("Question Description")
Expand Down