<commit_before>{% extends "base.html" %}
{% set active_page = "overview" %}

{%- block extrahead %}

{% for script in scripts %}
 {{ script | safe }}
{% endfor %}

<script>
$( document ).ready(function() {

    $('[data-toggle="tooltip"]').tooltip();

    $('#reload').on('click', function(){
        location.reload(true);
    });

    var ME = ME || {};
    ME.polling = true;

    function show_error(){
            ME.polling = false;
            // alert("Error: could not start crawl.")
            $( '#status' ).text( "Error (could not start crawl)" );
    }

    $('#playButton').on('click', function() {

        $( '#status' ).text( "Starting..." );

        $.ajax({
          type: "POST",
            url: "{{ url_for('run_crawl', project_slug=project.slug, crawl_slug=crawl.slug) }}",
          success: function(retval) {
            if (retval == "Error") show_error();
            else $( '#status' ).text(retval);
          },
          failure: function() {
            show_error();
          }
        });
    });

    $('#stopButton').on('click', function(){

        $( '#status' ).text( "Stopping..." );

        $.ajax({
          type: "POST",
            url: "{{ url_for('stop_crawl', project_slug=project.slug, crawl_slug=crawl.slug) }}",
          success: function(retval) {
            if (retval == "Error") show_error();
            else $( '#status' ).text(retval);
          },
          failure: function() {
            show_error();
          }
        });
    });

    (function pollStatus() {

      // If polling has been turned off, break the loop
      if (!ME.polling) return;

        $.ajax({
            url: "{{ url_for('status_crawl', project_slug=project.slug, crawl_slug=crawl.slug) }}",
            type: "GET",
            success: function(data) { $('#status').text( data ) },
            complete: setTimeout(pollStatus, 5000),
            timeout: 2000
        });
    })();

    $('#imageDump').on('click', function(){
        $.ajax({
          type: "POST",
          url: "/{{ project.slug }}/crawls/{{ crawl.slug }}/dump",
          success: console.log("crawlImagesDumped")
        }).done(function() {
          window.location.href = "/{{ project.slug }}/image_space/{{ crawl.slug }}"
        });
    }); 
    var statsPoll = function(){ $.ajax({ type: "GET", url: "/{{ project.slug }}/crawls/{{ crawl.slug }}/stats",
          success: function(data) {
                console.log("stats-data" + data);
                if (data.nutch) {
                  $( '#stats-data' ).html(
                      '<div class="col-sm-2"><table class="table table-striped"><tr><th>Site(s) crawled</th></tr><tr><td>' 
                      + data.num_crawled 
                      + '</td></tr></table>'
                    );
                } else {
                  $( '#stats-data' ).html(
                      '<div class="col-sm-12"><table class="table table-striped"><tr><th>Harvest Rate</th><th>Site(s) crawled</th></tr><tr><td>' 
                      + data.harvest_rate 
                      + '</td><td>' 
                      + data.num_crawled 
                      +'</td></tr></table></div>'
                    );
                }
            },
          failure: function() {
                  $( '#stats-data' ).html(
                  '<h4>(Statistics are not yet available for this crawl.)</h4>'
                    );
          }
        })
    };
    var statsInterval = setInterval(function(){statsPoll()}, 10000);
});
</script>

{% endblock %}

{% block content %}
{% include 'sidebar.html' %}
<div class='row'><commit_msg>Design fixes.<commit_after>{% extends "base.html" %}
{% set active_page = "overview" %}

{%- block extrahead %}

{% for script in scripts %}
 {{ script | safe }}
{% endfor %}

<script>
$( document ).ready(function() {

    $('[data-toggle="tooltip"]').tooltip();

    $('#reload').on('click', function(){
        location.reload(true);
    });

    var ME = ME || {};
    ME.polling = true;

    function show_error(){
            ME.polling = false;
            // alert("Error: could not start crawl.")
            $( '#status' ).text( "Error (could not start crawl)" );
    }

    $('#playButton').on('click', function() {

        $( '#status' ).text( "Starting..." );

        $.ajax({
          type: "POST",
            url: "{{ url_for('run_crawl', project_slug=project.slug, crawl_slug=crawl.slug) }}",
          success: function(retval) {
            if (retval == "Error") show_error();
            else $( '#status' ).text(retval);
          },
          failure: function() {
            show_error();
          }
        });
    });

    $('#stopButton').on('click', function(){

        $( '#status' ).text( "Stopping..." );

        $.ajax({
          type: "POST",
            url: "{{ url_for('stop_crawl', project_slug=project.slug, crawl_slug=crawl.slug) }}",
          success: function(retval) {
            if (retval == "Error") show_error();
            else $( '#status' ).text(retval);
          },
          failure: function() {
            show_error();
          }
        });
    });

    (function pollStatus() {

      // If polling has been turned off, break the loop
      if (!ME.polling) return;

        $.ajax({
            url: "{{ url_for('status_crawl', project_slug=project.slug, crawl_slug=crawl.slug) }}",
            type: "GET",
            success: function(data) { $('#status').text( data ) },
            complete: setTimeout(pollStatus, 5000),
            timeout: 2000
        });
    })();

    $('#imageDump').on('click', function(){
        $.ajax({
          type: "POST",
          url: "/{{ project.slug }}/crawls/{{ crawl.slug }}/dump",
          success: console.log("crawlImagesDumped")
        }).done(function() {
          window.location.href = "/{{ project.slug }}/image_space/{{ crawl.slug }}"
        });
    }); 
    var statsPoll = function(){ 
          $.ajax({ type: "GET", url: "/{{ project.slug }}/crawls/{{ crawl.slug }}/stats",
          success: function(data) {
                console.log("stats-data" + data);
                if (data.nutch) {
                  $( '#stats-data' ).html(
                      '<div class="col-sm-12"><table class="table table-striped"><tr><th>Site(s) crawled</th></tr><tr><td>' 
                      + data.num_crawled 
                      + '</td></tr></table>'
                    );
                } else {
                  $( '#stats-data' ).html(
                      '<div class="col-sm-12"><table class="table table-striped"><tr><th>Harvest Rate</th><th>Site(s) crawled</th></tr><tr><td>' 
                      + data.harvest_rate 
                      + '</td><td>' 
                      + data.num_crawled 
                      +'</td></tr></table></div>'
                    );
                }
            },
          failure: function() {
                  $( '#stats-data' ).html(
                  '<h4>(Statistics are not yet available for this crawl.)</h4>'
                    );
          }
        })
    };
    var statsInterval = setInterval(function(){statsPoll()}, 10000);
});
</script>

{% endblock %}

{% block content %}
{% include 'sidebar.html' %}
<div class='row'>
{'fraction_non_alphanumeric': 0.19349930843706778, 'fraction_numerical': 0.005117565698478562, 'mean_word_length': 1.652604548789435, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 67, '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': '2725101', 'n_tokens_mistral': 2201, 'n_tokens_neox': 2069, 'n_words': 402}