By default, show the first 250 jobs only

This is particularly useful for the Nixpkgs jobsets, which now have
~24K jobs.
This commit is contained in:
Eelco Dolstra 2013-08-28 11:10:40 +00:00
parent 10d959a9ff
commit 9002b69c2d
2 changed files with 16 additions and 5 deletions

View file

@ -199,7 +199,10 @@ sub job_status_tab : Chained('jobsetChain') PathPart('job-status-tab') Args(0) {
}
$c->stash->{evals} = $evals;
$c->stash->{jobs} = [sort (keys %jobs)];
my @jobs = sort (keys %jobs);
$c->stash->{nrJobs} = scalar @jobs;
splice @jobs, 250 if $c->stash->{filter} eq "";
$c->stash->{jobs} = [@jobs];
}

View file

@ -1,18 +1,22 @@
[% PROCESS common.tt; USE Math %]
<form class="form-search" id="filter-jobs">
<input name="filter" type="text" class="input-large search-query" placeholder="Filter jobs..." [% HTML.attributes(value => filter) %]></input>
<input name="filter" type="text" class="input-large search-query" placeholder="Search jobs by name" [% HTML.attributes(value => filter) %]></input>
<img src="/static/images/ajax-loader.gif" alt="Loading..." style="display: none;" id="filter-loading" />
</form>
<script>
$('#filter-jobs').submit(function() {
$('#filter-loading').show();
$('#tabs-job-status').load("[% c.uri_for('/jobset' project.name jobset.name "job-status-tab") %]", $('#filter-jobs').serialize(), function(response, status, xhr) {
function setFilter(filter) {
$('#filter-loading').show().focus();
$('#tabs-job-status').load("[% c.uri_for('/jobset' project.name jobset.name "job-status-tab") %]", filter, function(response, status, xhr) {
if (status == "error") {
$('#[% tabName %]').html("<div class='alert alert-error'>Error loading tab: " + xhr.status + " " + xhr.statusText + "</div>");
}
});
};
$('#filter-jobs').submit(function() {
setFilter($('#filter-jobs').serialize());
return false;
});
</script>
@ -23,6 +27,10 @@
[% ELSE %]
[% IF nrJobs > jobs.size %]
<div class="alert">Showing the first [% jobs.size %] jobs only. <a href="javascript:setFilter('filter=%')">Show all [% nrJobs %] jobs...</a></div>
[% END %]
[% evalIds = evals.keys.nsort.reverse %]
<table class="table table-striped table-condensed table-header-rotated">
<thead>