var json = <%= runs_table(@runs).to_json.html_safe -%>;

$j('#workflow_runs_table').dataTable().fnClearTable();
$j('#workflow_runs_table').dataTable().fnAddData(json);

<% if logged_in? && @user_runs %>
  var user_json = <%= runs_table(@user_runs).to_json.html_safe -%>;

  $j('#workflow_user_runs_table').dataTable().fnClearTable();
  $j('#workflow_user_runs_table').dataTable().fnAddData(user_json);
<% end %>

<% if @sweep %>
  $j("#sweep_results").replaceWith('<%= escape_javascript(render(:partial => "sweeps/results_table")) -%>');
  <% if @sweep.complete? %>
    $j('#sweep_results_table').fadeIn();
    window.clearInterval($j('#workflow_runs_table').data('poller')); //stop refresh after sweep has finished
  <% end %>
<% end %>

var json = <%= runs_table(@runs).to_json.html_safe -%>;

$j('#workflow_runs_table').dataTable().fnClearTable();
$j('#workflow_runs_table').dataTable().fnAddData(json);

<% if logged_in? && @user_runs %>
  var user_json = <%= runs_table(@user_runs).to_json.html_safe -%>;

  $j('#workflow_user_runs_table').dataTable().fnClearTable();
  $j('#workflow_user_runs_table').dataTable().fnAddData(user_json);
<% end %>

<% if @sweep %>
  $j("#sweep_results").replaceWith('<%= escape_javascript(render(:partial => "sweeps/results_table")) -%>');
  <% if @sweep.complete? %>
    $j('#sweep_results_table').fadeIn();
    $j("#buttons").replaceWith('<%= escape_javascript(render(:partial => "sweeps/buttons", :locals => {:sweep => @sweep})) %>');
    window.clearInterval($j('#workflow_runs_table').data('poller')); //stop refresh after sweep has finished
  <% end %>
<% end %>

Update button panel on sweep page when sweep completes.
Update button panel on sweep page when sweep completes.
