<commit_before>:ruby
  table_dom_id = SecureRandom.hex
  show_actions ||= 0

:css
  .sql-text {
    word-break: break-all;
  }

%table.table.table-hover{:id => table_dom_id, :data => {:toggle => 'table',
  :pagination => 'true',
  :show_pagination_switch => 'false',
  :page_list => "[5, 10, 20, 50, 100, 200]",
  :page_size => current_user.num_table_rows,
  :search => 'false',
  :export_types => "['csv', 'txt', 'excel']",
  :show_export => 'false',
  :show_columns => 'false',
  :show_toggle => 'false',
  :cookie => 'true',
  :cookie_id_table => "saved_queries_id",
  :cookie_expire => "1y"}}
  %thead
    %tr
      %th.left{:data => {:visible => 'false'}} Object Key
      %th.center{:data => {:sortable => 'true'}} Name
      %th.center{:data => {:sortable => 'true'}} Description
      %th.center{:data => {:sortable => 'true'}} Shared To
      %th.center{:data => {:sortable => 'true'}} Shared From
      %th.center{:data => {:visible => 'true', :sortable => 'false'}} SQL Query
      %th.center{:data => {:visible => 'true', :sortable => 'true'}} Created Date & Time
      %th.center{:data => {:visible => 'true', :sortable => 'false'}} Created By
      %th.center{:data => {:visible => 'true', :sortable => 'false'}} Last Update Date & Time
      %th.center{:data => {:visible => 'true', :sortable => 'false'}} Last Updated By
      %th.center{:data => {:visible => 'true', :sortable => 'false'}} 

  %tbody
    - @queries.each do |s|
      - is_own_query = current_user && current_user.id == s.created_by_user_id
      %tr{:id => s.object_key}
        %td.left= s.object_key
        %td.center= s.name
        %td.lecenterft= s.description.html_safe
        %td.center
          - if can?(:share, s) && s.shared?
            - if s.organizations.count > 1
              %span.hidden
                Multiple
              %a.transam-popover{href: '#', data: {toggle: 'popover', content: s.organizations.pluck(:short_name).join('<br>').html_safe}, title: 'Shared To'}
                Multiple
            - else
              = s.organizations.first.try(:to_s)
        %td.center
          - unless is_own_query
            = s.created_by_user.try(:organization)
        %td.center
          %a.sql-popover{href: '#', data: {toggle: 'popover', content: "<div class='col-sm-12 sql-text'><textarea class='form-group form-control' rows='10' cols='50' readonly>#{s.to_sql.html_safe}</textarea><button type='button' class='btn btn-primary copy-sql'>Copy SQL</button></div>"}, title: 'SQL Query'}
            Click to Show SQL
        %td.center= format_as_date_time(s.created_at)
        %td.center= s.created_by_user
        %td.center= format_as_date_time(s.updated_at)
        %td.center= s.updated_by_user
        %td.right
          - if can?(:update, s)
            = link_to saved_query_path(s), :title => "Update this query." do
              %i.fa.fa-fw.fa-edit.text-primary.fa-1-5x<commit_msg>set current organization_list to each query<commit_after>:ruby
  table_dom_id = SecureRandom.hex
  show_actions ||= 0

:css
  .sql-text {
    word-break: break-all;
  }

%table.table.table-hover{:id => table_dom_id, :data => {:toggle => 'table',
  :pagination => 'true',
  :show_pagination_switch => 'false',
  :page_list => "[5, 10, 20, 50, 100, 200]",
  :page_size => current_user.num_table_rows,
  :search => 'false',
  :export_types => "['csv', 'txt', 'excel']",
  :show_export => 'false',
  :show_columns => 'false',
  :show_toggle => 'false',
  :cookie => 'true',
  :cookie_id_table => "saved_queries_id",
  :cookie_expire => "1y"}}
  %thead
    %tr
      %th.left{:data => {:visible => 'false'}} Object Key
      %th.center{:data => {:sortable => 'true'}} Name
      %th.center{:data => {:sortable => 'true'}} Description
      %th.center{:data => {:sortable => 'true'}} Shared To
      %th.center{:data => {:sortable => 'true'}} Shared From
      %th.center{:data => {:visible => 'true', :sortable => 'false'}} SQL Query
      %th.center{:data => {:visible => 'true', :sortable => 'true'}} Created Date & Time
      %th.center{:data => {:visible => 'true', :sortable => 'false'}} Created By
      %th.center{:data => {:visible => 'true', :sortable => 'false'}} Last Update Date & Time
      %th.center{:data => {:visible => 'true', :sortable => 'false'}} Last Updated By
      %th.center{:data => {:visible => 'true', :sortable => 'false'}} 

  %tbody
    - @queries.each do |s|
      - s.organization_list = @organization_list
      - is_own_query = current_user && current_user.id == s.created_by_user_id
      %tr{:id => s.object_key}
        %td.left= s.object_key
        %td.center= s.name
        %td.lecenterft= s.description.html_safe
        %td.center
          - if can?(:share, s) && s.shared?
            - if s.organizations.count > 1
              %span.hidden
                Multiple
              %a.transam-popover{href: '#', data: {toggle: 'popover', content: s.organizations.pluck(:short_name).join('<br>').html_safe}, title: 'Shared To'}
                Multiple
            - else
              = s.organizations.first.try(:to_s)
        %td.center
          - unless is_own_query
            = s.created_by_user.try(:organization)
        %td.center
          %a.sql-popover{href: '#', data: {toggle: 'popover', content: "<div class='col-sm-12 sql-text'><textarea class='form-group form-control' rows='10' cols='50' readonly>#{s.to_sql.html_safe}</textarea><button type='button' class='btn btn-primary copy-sql'>Copy SQL</button></div>"}, title: 'SQL Query'}
            Click to Show SQL
        %td.center= format_as_date_time(s.created_at)
        %td.center= s.created_by_user
        %td.center= format_as_date_time(s.updated_at)
        %td.center= s.updated_by_user
        %td.right
          - if can?(:update, s)
            = link_to saved_query_path(s), :title => "Update this query." do
              %i.fa.fa-fw.fa-edit.text-primary.fa-1-5x
{'fraction_non_alphanumeric': 0.1852417302798982, 'fraction_numerical': 0.008142493638676845, 'mean_word_length': 2.8087855297157622, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 109, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1206946', 'n_tokens_mistral': 2099, 'n_tokens_neox': 2012, 'n_words': 410}