From c029c7973f4b5a51913d16f486d54b8234288580 Mon Sep 17 00:00:00 2001 From: Dhamo1107 Date: Wed, 17 Jul 2024 13:44:13 +0530 Subject: [PATCH] Added existing search bar React component in Cloud Tenant module --- app/controllers/application_controller.rb | 4 ++-- app/stylesheet/search-bar.scss | 7 +++++++ app/views/cloud_tenant/show.html.haml | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 510b8620c4c..a257b230cb6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1032,14 +1032,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..d56385e7152 100644 --- a/app/views/cloud_tenant/show.html.haml +++ b/app/views/cloud_tenant/show.html.haml @@ -5,6 +5,8 @@ - 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"'