forked from lix-project/hydra
Search: Don't return hidden projects/jobsets
This commit is contained in:
parent
07daff32b8
commit
f3f6e8a4e3
|
@ -311,16 +311,27 @@ sub search :Local Args(0) {
|
||||||
unless $query =~ /^[a-zA-Z0-9_\-]+$/;
|
unless $query =~ /^[a-zA-Z0-9_\-]+$/;
|
||||||
|
|
||||||
$c->stash->{projects} = [ $c->model('DB::Projects')->search(
|
$c->stash->{projects} = [ $c->model('DB::Projects')->search(
|
||||||
{ -or => [ name => { ilike => "%$query%" }, displayName => { ilike => "%$query%" }, description => { ilike => "%$query%" } ] },
|
{ -and =>
|
||||||
|
[ { -or => [ name => { ilike => "%$query%" }, displayName => { ilike => "%$query%" }, description => { ilike => "%$query%" } ] }
|
||||||
|
, { hidden => 0 }
|
||||||
|
]
|
||||||
|
},
|
||||||
{ order_by => ["name"] } ) ];
|
{ order_by => ["name"] } ) ];
|
||||||
|
|
||||||
$c->stash->{jobsets} = [ $c->model('DB::Jobsets')->search(
|
$c->stash->{jobsets} = [ $c->model('DB::Jobsets')->search(
|
||||||
{ -or => [ name => { ilike => "%$query%" }, description => { ilike => "%$query%" } ] },
|
{ -and =>
|
||||||
{ order_by => ["project", "name"] } ) ];
|
[ { -or => [ "me.name" => { ilike => "%$query%" }, "me.description" => { ilike => "%$query%" } ] }
|
||||||
|
, { "project.hidden" => 0, "me.hidden" => 0 }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ order_by => ["project", "name"], join => ["project"] } ) ];
|
||||||
|
|
||||||
$c->stash->{jobs} = [ $c->model('DB::Jobs')->search(
|
$c->stash->{jobs} = [ $c->model('DB::Jobs')->search(
|
||||||
{ name => { ilike => "%$query%" } },
|
{ "me.name" => { ilike => "%$query%" }
|
||||||
{ order_by => ["project", "jobset", "name"] } ) ];
|
, "project.hidden" => 0
|
||||||
|
, "jobset.hidden" => 0
|
||||||
|
},
|
||||||
|
{ order_by => ["project", "jobset", "name"], join => ["project", "jobset"] } ) ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue