Skip to content

Commit

Permalink
Added existing search bar React component in Cloud Tenant module
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhamo1107 committed Jul 17, 2024
1 parent 8adaffa commit c029c79
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions app/stylesheet/search-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@
margin-right: 2px;
}
}

.display-search-bar {
width: 300px;
position:absolute;
right: 20px;
top: -40px
}
2 changes: 2 additions & 0 deletions app/views/cloud_tenant/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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"'
Expand Down

0 comments on commit c029c79

Please sign in to comment.