From 7428b3c7c88b4092cfa800ce5dd569d86f20a392 Mon Sep 17 00:00:00 2001 From: Dhamo1107 Date: Thu, 25 Jul 2024 11:11:15 +0530 Subject: [PATCH] Added search bar to cloud tenants page --- app/controllers/application_controller.rb | 4 ++-- app/stylesheet/search-bar.scss | 7 +++++++ app/views/cloud_tenant/show.html.haml | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3c64e559744..96504d4a242 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1031,14 +1031,14 @@ def get_view_process_search_text(view) # {Processes,Users,...} in that case, search shoult NOT be applied. # If loading a form such as provisioning, don't filter records # FIXME: This needs to be changed to apply search in some explicit way. - return nil if @display || @in_a_form + return nil if @in_a_form # If we came in through Chart pop-up menu click we don't filter records. return nil if session[:menu_click] # Build sub_filter where clause from search text # This part is for the Hosts screen. In explorer screens we have search (that includes vm_infra and Control/Explorer/Policies) - if (!@parent && @lastaction == "show_list") || @explorer + if (!@parent && @lastaction == "show_list") || @explorer || @display stxt = @search_text.gsub("_", "`_") # Escape underscores stxt.gsub!("%", "`%") # and percents diff --git a/app/stylesheet/search-bar.scss b/app/stylesheet/search-bar.scss index 534d509f294..7a67d73b77c 100644 --- a/app/stylesheet/search-bar.scss +++ b/app/stylesheet/search-bar.scss @@ -27,3 +27,10 @@ margin-right: 2px; } } + +.display-search-bar { + width: 300px; + position:absolute; + right: 20px; + top: -40px +} diff --git a/app/views/cloud_tenant/show.html.haml b/app/views/cloud_tenant/show.html.haml index b4d2a0104d6..3dda82fdc89 100644 --- a/app/views/cloud_tenant/show.html.haml +++ b/app/views/cloud_tenant/show.html.haml @@ -5,6 +5,9 @@ - arr = %w[floating_ips network_ports cloud_tenants cloud_networks cloud_subnets network_routers network_services instances images] - arr.concat(%w[security_groups security_policies cloud_object_store_containers cloud_volumes cloud_volume_snapshots custom_button_events]) - if arr.include?(@display) && @showtype != "compare" + .display-search-bar + = react('SearchBar', :searchText => @search_text, :action => 'show', + :advancedSearch => false) = render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"} - elsif @showtype == "compare" = raise 'compare partial called through "show"'