<commit_before>%h1
  = link_to @scraper.owner.to_param, @scraper.owner
  \/
  = link_to @scraper.name, @scraper

%h4= @scraper.description

-# Show the big picture status of this scraper here
- if @scraper.queued?
  .alert.alert-info
    The scraper is <strong>queued to run</strong>. It was queued
    = time_ago_in_words(@scraper.queued_at)
    ago. (For the time being you will need to refresh this page to update this</quiet>)
- elsif @scraper.running?
  .alert.alert-info
    The scraper is <strong>running</strong>. It was started
    = time_ago_in_words(@scraper.started_at)
    ago. (For the time being you will need to refresh this page to update this</quiet>)
- elsif @scraper.last_run_completed
  - if @scraper.last_run_successful?
    .alert.alert-success
      Last run completed successfully
      = time_ago_in_words(@scraper.last_run_at)
      ago
  - else
    .alert.alert-danger
      Last run failed
      = time_ago_in_words(@scraper.last_run_at)
      ago with status code #{@scraper.last_run_status_code}. See any console output below.
- else
  .alert.alert-info
    This scraper has not yet been run

= link_to "Go to GitHub", @scraper.github_url

- if @scraper.owned_by?(current_user)
  = button_to "Run it now!", run_scraper_path(@scraper), class: ((@scraper.queued? || @scraper.running?) ? "btn btn-primary btn-large disabled" : "btn btn-primary btn-large")

  %h3 Settings
  = semantic_form_for @scraper do |f|
    = f.inputs do
      = f.input :auto_run, hint: "Automatically run this scraper once per day"
    = f.actions do
      = f.action :submit, :label => "Update settings"

- if @scraper.last_run_completed && !@scraper.last_run_completed.log_lines.empty?
  %h3 Console output
  %p Hint: Keep this to a minimum during normal use (so that things remain readable)
  %pre
    - @scraper.last_run_completed.log_lines.order(:number).each do |line|
      -# TODO Highlight stderr differently
      %span{:class => line.stream}= line.text

- if @rows
  %h3 Data
  %ul
    %li= link_to "Download table (as CSV)", scraper_data_path(@scraper, :format => :csv)
    %li= link_to "Download SQLite database", scraper_data_path(@scraper, :format => :sqlite)
    %li= link_to "Use the API", api_path
  %p (First 10 rows)
  .table-responsive<commit_msg>If not your scraper still show the settings but disable changes. Fixed #48<commit_after>%h1
  = link_to @scraper.owner.to_param, @scraper.owner
  \/
  = link_to @scraper.name, @scraper

%h4= @scraper.description

-# Show the big picture status of this scraper here
- if @scraper.queued?
  .alert.alert-info
    The scraper is <strong>queued to run</strong>. It was queued
    = time_ago_in_words(@scraper.queued_at)
    ago. (For the time being you will need to refresh this page to update this</quiet>)
- elsif @scraper.running?
  .alert.alert-info
    The scraper is <strong>running</strong>. It was started
    = time_ago_in_words(@scraper.started_at)
    ago. (For the time being you will need to refresh this page to update this</quiet>)
- elsif @scraper.last_run_completed
  - if @scraper.last_run_successful?
    .alert.alert-success
      Last run completed successfully
      = time_ago_in_words(@scraper.last_run_at)
      ago
  - else
    .alert.alert-danger
      Last run failed
      = time_ago_in_words(@scraper.last_run_at)
      ago with status code #{@scraper.last_run_status_code}. See any console output below.
- else
  .alert.alert-info
    This scraper has not yet been run

= link_to "Go to GitHub", @scraper.github_url

- if @scraper.owned_by?(current_user)
  = button_to "Run it now!", run_scraper_path(@scraper), class: ((@scraper.queued? || @scraper.running?) ? "btn btn-primary btn-large disabled" : "btn btn-primary btn-large")

%h3 Settings
= semantic_form_for @scraper do |f|
  = f.inputs do
    = f.input :auto_run, hint: "Automatically run this scraper once per day", input_html: {disabled: !@scraper.owned_by?(current_user)}
  - if @scraper.owned_by?(current_user)
    = f.actions do
      = f.action :submit, :label => "Update settings"

- if @scraper.last_run_completed && !@scraper.last_run_completed.log_lines.empty?
  %h3 Console output
  %p Hint: Keep this to a minimum during normal use (so that things remain readable)
  %pre
    - @scraper.last_run_completed.log_lines.order(:number).each do |line|
      -# TODO Highlight stderr differently
      %span{:class => line.stream}= line.text

- if @rows
  %h3 Data
  %ul
    %li= link_to "Download table (as CSV)", scraper_data_path(@scraper, :format => :csv)
    %li= link_to "Download SQLite database", scraper_data_path(@scraper, :format => :sqlite)
    %li= link_to "Use the API", api_path
  %p (First 10 rows)
  .table-responsive
{'fraction_non_alphanumeric': 0.11354921175969322, 'fraction_numerical': 0.0034086067319982955, 'mean_word_length': 3.6809571286141574, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5543104', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1650, 'n_words': 456}