<% if @errors %>
  $('#flash-messages').
    replaceWith("<%= escape_javascript(render(partial: "layouts/webui/flash", locals: { flash: { error: @errors } })) %>");
  $("html, body").scrollTop(0);
  liveLog.finish();
<% else %>
  <% if @finished %>
    <% if @first_request %>
      $('#log_space').html('<%= escape_javascript(@log_chunk) %>');
    <% end %>
    liveLog.finish();
  <% else %>
    $('#log_space').append('<%= escape_javascript(@log_chunk) %>');
    liveLog.showAbort();
    liveLog.offset = <%= @offset %>;
    setTimeout($.proxy(liveLog.loadContent, liveLog), 2000);
  <% end %>
  liveLog.autoScroll();
<% end %>
