Skip to content

Commit

Permalink
Merge pull request #257 from ContinuumIO/bhard/crawl_changes
Browse files Browse the repository at this point in the history
Bhard/crawl changes
  • Loading branch information
chdoig committed Jan 12, 2015
2 parents 6a800ca + ad91e5b commit 7630986
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
37 changes: 25 additions & 12 deletions app/templates/crawl.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,31 @@
show_error();
}
});
$.ajax({ type: "GET", url: "/{{ project.slug }}/crawls/{{ crawl.slug }}/stats",
success: function(data) {
console.log("stats-data" + data);
if (data.nutch) {
$.ajax({
type: "POST",
url: "/{{ project.slug }}/crawls/{{ crawl.slug }}/update_stats",
contentType: 'application/json',
data: JSON.stringify({crawled: data.num_crawled, crawler: 'nutch'}),
});
} else {
$.ajax({
type: "POST",
url: "/{{ project.slug }}/crawls/{{ crawl.slug }}/update_stats",
contentType: 'application/json',
data: JSON.stringify({crawled: data.num_crawled, harvest: data.harvest_rate, crawler:'ache'}),
});
}
},
failure: function() {
$( '#stats-data' ).html(
'<h4>(Statistics are not yet available for this crawl.)</h4>'
);
}
});
});

(function pollStatus() {
Expand Down Expand Up @@ -97,12 +122,6 @@
+ data.num_crawled
+ '</td></tr></table>'
);
$.ajax({
type: "POST",
url: "/{{ project.slug }}/crawls/{{ crawl.slug }}/update_stats",
contentType: 'application/json',
data: JSON.stringify({crawled: data.num_crawled, crawler: 'nutch'}),
});
} 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>'
Expand All @@ -111,12 +130,6 @@
+ data.num_crawled
+'</td></tr></table></div>'
);
$.ajax({
type: "POST",
url: "/{{ project.slug }}/crawls/{{ crawl.slug }}/update_stats",
contentType: 'application/json',
data: JSON.stringify({crawled: data.num_crawled, harvest: data.harvest_rate, crawler:'ache'}),
});
}
},
failure: function() {
Expand Down
14 changes: 3 additions & 11 deletions app/templates/crawls.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,12 @@ <h1>Crawls</h1>
<th>Pages Crawled</th>
</tr>
<tr>
<td>{{ crawl.pages_crawled }}</td>
{% if image_spaces[0] %}
{% for image_space in image_spaces %}
{% if crawl.id == image_space.crawl_id %}
{% if image_space.images %}
<td>{{ image_space.images.all() | length }}</td>
{% else %}
<td>None</td>
{% endif %}
{% endif %}
{% endfor %}
{% if crawl.image_space %}
<td>{{ crawl.image_space.images.all() | length }}</td>
{% else %}
<td>None</td>
{% endif %}
<td>{{ crawl.pages_crawled }}</td>
</tr>
</table>
{% else %}
Expand Down

0 comments on commit 7630986

Please sign in to comment.