Merge pull request #899 from grahamc/horses

Projects, jobsets: order jobsets with disabled, hidden rows at the end
This commit is contained in:
Graham Christensen 2021-03-31 16:54:24 +00:00 committed by GitHub
commit 0693cc713e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -104,7 +104,7 @@ sub deserialize :ActionClass('Deserialize') { }
sub index :Path :Args(0) { sub index :Path :Args(0) {
my ($self, $c) = @_; my ($self, $c) = @_;
$c->stash->{template} = 'overview.tt'; $c->stash->{template} = 'overview.tt';
$c->stash->{projects} = [$c->model('DB::Projects')->search({}, {order_by => 'name'})]; $c->stash->{projects} = [$c->model('DB::Projects')->search({}, {order_by => ['enabled DESC', 'name']})];
$c->stash->{newsItems} = [$c->model('DB::NewsItems')->search({}, { order_by => ['createtime DESC'], rows => 5 })]; $c->stash->{newsItems} = [$c->model('DB::NewsItems')->search({}, { order_by => ['createtime DESC'], rows => 5 })];
$self->status_ok($c, $self->status_ok($c,
entity => $c->stash->{projects} entity => $c->stash->{projects}

View file

@ -113,7 +113,7 @@ sub registerRoot {
sub jobsetOverview_ { sub jobsetOverview_ {
my ($c, $jobsets) = @_; my ($c, $jobsets) = @_;
return $jobsets->search({}, return $jobsets->search({},
{ order_by => "name" { order_by => ["hidden ASC", "enabled DESC", "name"]
, "+select" => , "+select" =>
[ "(select count(*) from Builds as a where a.finished = 0 and me.project = a.project and me.name = a.jobset and a.isCurrent = 1)" [ "(select count(*) from Builds as a where a.finished = 0 and me.project = a.project and me.name = a.jobset and a.isCurrent = 1)"
, "(select count(*) from Builds as a where a.finished = 1 and me.project = a.project and me.name = a.jobset and buildstatus <> 0 and a.isCurrent = 1)" , "(select count(*) from Builds as a where a.finished = 1 and me.project = a.project and me.name = a.jobset and buildstatus <> 0 and a.isCurrent = 1)"