<commit_before><div class="page-header">
  <div id="status-buttons-group" class="btn-group pull-right" data-current-status="<%= @feature.status %>">
    <button type="button" class="btn" value="active" data-selected-class="btn-success">Active</button>
    <button type="button" class="btn" value="rollout" data-selected-class="btn-warning">Roll Out</button>
    <button type="button" class="btn" value="inactive" data-selected-class="btn-danger">Inactive</button>
  </div>
  <h1><span id="editable-name"><%= @feature.name %></span> <small>Feature</small></h1>
  <p id="editable-description"><%= @feature.description %></p>
</div>

<form id="add_metric" action="<%= url("/features/#{@feature.id}/metrics") %>" method="post"><input id="add_metric_type_input" type="hidden" name="metric_type"><input id="add_metric_type_id_input" type="hidden" name="metric_type_id"></form>
<ul class="nav nav-tabs" style="margin-bottom: 20px">
  <% if @metric.nil? && !@params.key?('activity') %><li class="active"><% else %><li><% end %><a href="?">Status</a></li>
  <% if @params.key?('activity') %><li class="active"><% else %><li><% end %><a href="?activity">Activity</a></li>
  <% @feature.metrics.each do |metric| %>
    <% if @metric == metric %><li class="active"><% else %><li><% end %><a href="?metric_type=<%= metric.type %>&amp;metric_type_id=<%= metric.type_id %>"><%= metric.name %></a></li>
  <% end %>
  <li class="dropdown">
    <a id="drop5" role="button" data-toggle="dropdown" href="#">Add <b class="caret"></b></a>
    <ul id="menu2" class="dropdown-menu" role="menu" aria-labelledby="drop5">
      <% if @feature.addable_metrics.any? %>
        <li role="presentation" class="dropdown-header">Metrics</li>
        <% @feature.addable_metrics.each do |metric| %>
        <li role="presentation" data-metric-type-id="<%= metric.type_id %>" data-metric-type="<%= metric.type %>" data-metric-name="<%= metric.name %>" class="add-metric"><a role="menuitem" tabindex="-1" href="#"><%= metric.name %></a></li>
        <% end %>
      <% else %>
        <li role="presentation" class="dropdown-header">No Metrics</li>
      <% end %>
    </ul>
  </li>
</ul>

<% if @metric %>
  <% chartable = Blackbeard::FeatureMetric.new(@feature, @metric) %>
  <%= partial :'shared/charts', :locals => {:charts => [chartable.recent_hours_chart, chartable.recent_days_chart]} %>
<% elsif @params.key?('activity') %>
  <%= partial :'shared/charts', :locals => {:charts => [@feature.recent_hours_chart, @feature.recent_days_chart]} %>
<% else %>
  <%= partial :'features/status_panel' %>
<% end %>


<!--Load the AJAX API-->
<script src="<%= url('javascripts/jquery-1.10.2.min.js') %>"></script>
<script src="<%= url('javascripts/bootstrap.min.js') %>"></script>
<script type="text/javascript">
  $('ul.nav-tabs').on("click", ".add-metric", function (e) {
    e.preventDefault();
    var metricType = $(this).data("metric-type");
    var metricTypeId = $(this).data("metric-type-id");
    var metricName = $(this).data("metric-name");

    if(confirm("Start collecting: "+metricName+"?")) {
      $('#add_metric_type_input').val(metricType);
      $('#add_metric_type_id_input').val(metricTypeId);
      $('#add_metric').submit();
    }
  });

  $("#status-buttons-group").on("click", ":button", function (e) {
    e.preventDefault();
    var status = $(this).val();
    $('#status-buttons-group').data("current-status", status);
    $.post( "<%= url("features/#{@feature.id}") %>", { status: status } , updateButtonStates);
  });

  function updateButtonStates(){
    var v = $('#status-buttons-group').data("current-status");
    $( "#status-buttons-group :button" ).removeClass();
    $( "#status-buttons-group :button" ).addClass("btn");
    var selectedClass = $( "#status-buttons-group :button[value='"+v+"']" ).data("selected-class");
    $( "#status-buttons-group :button[value='"+v+"']" ).addClass( selectedClass );
    $( ".feature-status-panel" ).addClass("hidden");
    $( "#"+v ).removeClass("hidden");
  }

  $(document).ready(updateButtonStates);
</script>
<commit_msg>Load query before rendering rollout form.<commit_after><div class="page-header">
  <div id="status-buttons-group" class="btn-group pull-right" data-current-status="<%= @feature.status %>">
    <button type="button" class="btn" value="active" data-selected-class="btn-success">Active</button>
    <button type="button" class="btn" value="rollout" data-selected-class="btn-warning">Roll Out</button>
    <button type="button" class="btn" value="inactive" data-selected-class="btn-danger">Inactive</button>
  </div>
  <h1><span id="editable-name"><%= @feature.name %></span> <small>Feature</small></h1>
  <p id="editable-description"><%= @feature.description %></p>
</div>

<form id="add_metric" action="<%= url("/features/#{@feature.id}/metrics") %>" method="post"><input id="add_metric_type_input" type="hidden" name="metric_type"><input id="add_metric_type_id_input" type="hidden" name="metric_type_id"></form>
<ul class="nav nav-tabs" style="margin-bottom: 20px">
  <% if @metric.nil? && !@params.key?('activity') %><li class="active"><% else %><li><% end %><a href="?">Status</a></li>
  <% if @params.key?('activity') %><li class="active"><% else %><li><% end %><a href="?activity">Activity</a></li>
  <% @feature.metrics.each do |metric| %>
    <% if @metric == metric %><li class="active"><% else %><li><% end %><a href="?metric_type=<%= metric.type %>&amp;metric_type_id=<%= metric.type_id %>"><%= metric.name %></a></li>
  <% end %>
  <li class="dropdown">
    <a id="drop5" role="button" data-toggle="dropdown" href="#">Add <b class="caret"></b></a>
    <ul id="menu2" class="dropdown-menu" role="menu" aria-labelledby="drop5">
      <% if @feature.addable_metrics.any? %>
        <li role="presentation" class="dropdown-header">Metrics</li>
        <% @feature.addable_metrics.each do |metric| %>
        <li role="presentation" data-metric-type-id="<%= metric.type_id %>" data-metric-type="<%= metric.type %>" data-metric-name="<%= metric.name %>" class="add-metric"><a role="menuitem" tabindex="-1" href="#"><%= metric.name %></a></li>
        <% end %>
      <% else %>
        <li role="presentation" class="dropdown-header">No Metrics</li>
      <% end %>
    </ul>
  </li>
</ul>



<!--Load the AJAX API-->
<script src="<%= url('javascripts/jquery-1.10.2.min.js') %>"></script>
<script src="<%= url('javascripts/bootstrap.min.js') %>"></script>
<script type="text/javascript">
  $('ul.nav-tabs').on("click", ".add-metric", function (e) {
    e.preventDefault();
    var metricType = $(this).data("metric-type");
    var metricTypeId = $(this).data("metric-type-id");
    var metricName = $(this).data("metric-name");

    if(confirm("Start collecting: "+metricName+"?")) {
      $('#add_metric_type_input').val(metricType);
      $('#add_metric_type_id_input').val(metricTypeId);
      $('#add_metric').submit();
    }
  });

  $("#status-buttons-group").on("click", ":button", function (e) {
    e.preventDefault();
    var status = $(this).val();
    $('#status-buttons-group').data("current-status", status);
    $.post( "<%= url("features/#{@feature.id}") %>", { status: status } , updateButtonStates);
  });

  function updateButtonStates(){
    var v = $('#status-buttons-group').data("current-status");
    $( "#status-buttons-group :button" ).removeClass();
    $( "#status-buttons-group :button" ).addClass("btn");
    var selectedClass = $( "#status-buttons-group :button[value='"+v+"']" ).data("selected-class");
    $( "#status-buttons-group :button[value='"+v+"']" ).addClass( selectedClass );
    $( ".feature-status-panel" ).addClass("hidden");
    $( "#"+v ).removeClass("hidden");
  }

  $(document).ready(updateButtonStates);
</script>

<% if @metric %>
  <% chartable = Blackbeard::FeatureMetric.new(@feature, @metric) %>
  <%= partial :'shared/charts', :locals => {:charts => [chartable.recent_hours_chart, chartable.recent_days_chart]} %>
<% elsif @params.key?('activity') %>
  <%= partial :'shared/charts', :locals => {:charts => [@feature.recent_hours_chart, @feature.recent_days_chart]} %>
<% else %>
  <%= partial :'features/status_panel' %>
<% end %>

{'fraction_non_alphanumeric': 0.24543112964552927, 'fraction_numerical': 0.002943701704893904, 'mean_word_length': 4.917271407837446, 'pattern_counts': {'":': 2, '<': 203, '<?xml version=': 0, '>': 211, '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': '3289881', 'n_tokens_mistral': 2806, 'n_tokens_neox': 2670, 'n_words': 471}