% blazer_title "Schema: #{@data_source.name}" %>
Schema: <%= @data_source.name %>
<% @schema.each do |table| %>
<% if table[:schema] != "public" %><%= table[:schema] %>.<% end %><%= table[:table] %>
|
<% table[:columns].each do |column| %>
<%= column[:name] %> |
<%= column[:data_type] %> |
<% end %>
<% end %>
<%= javascript_tag nonce: true do %>
$("#search").on("keyup", function() {
var value = $(this).val().toLowerCase()
$(".schema-table").filter(function() {
// if found in table name, show entire table
// if just found in rows, show row
var found = $(this).find("thead").text().toLowerCase().indexOf(value) > -1
if (found) {
$(this).find("tbody tr").toggle(true)
} else {
$(this).find("tbody tr").filter(function() {
var found2 = $(this).text().toLowerCase().indexOf(value) > -1
$(this).toggle(found2)
if (found2) {
found = true
}
})
}
$(this).toggle(found)
})
}).focus()
<% end %>