Merge pull request #1263 from Ma27/fix-my-jobs-tab

Fix "My Jobs" tab in user dashboard
This commit is contained in:
Graham Christensen 2022-12-05 01:55:49 +01:00 committed by GitHub
commit 01802efc17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 1 deletions

View file

@ -463,7 +463,7 @@ sub my_jobs_tab :Chained('dashboard_base') :PathPart('my-jobs-tab') :Args(0) {
, "jobset.enabled" => 1 , "jobset.enabled" => 1
}, },
{ order_by => ["project", "jobset", "job"] { order_by => ["project", "jobset", "job"]
, join => ["project", "jobset"] , join => {"jobset" => "project"}
})]; })];
} }

View file

@ -0,0 +1,30 @@
use strict;
use warnings;
use Setup;
my $ctx = test_context();
use HTTP::Request::Common;
use Test2::V0;
use Catalyst::Test ();
Catalyst::Test->import('Hydra');
require Hydra::Schema;
require Hydra::Model::DB;
my $db = $ctx->db();
my $user = $db->resultset('Users')->create({ username => 'alice', emailaddress => 'alice@invalid.org', password => '!' });
$user->setPassword('foobar');
my $builds = $ctx->makeAndEvaluateJobset(
expression => "basic.nix",
build => 1
);
my $login = request(POST '/login', Referer => 'http://localhost', Content => {
username => 'alice',
password => 'foobar',
});
is($login->code, 302);
my $cookie = $login->header("set-cookie");
my $my_jobs = request(GET '/dashboard/alice/my-jobs-tab', Accept => 'application/json', Cookie => $cookie);
ok($my_jobs->is_success);
my $content = $my_jobs->content();
ok($content =~ /empty_dir/);
ok(!($content =~ /fails/));
ok(!($content =~ /succeed_with_failed/));
done_testing;

View file

@ -4,6 +4,8 @@ with import ./config.nix;
mkDerivation { mkDerivation {
name = "empty-dir"; name = "empty-dir";
builder = ./empty-dir-builder.sh; builder = ./empty-dir-builder.sh;
meta.maintainers = [ "alice@invalid.org" ];
meta.outPath = "${placeholder "out"}";
}; };
fails = fails =