Skip to content

Commit

Permalink
Use jobFilter as job/group match by default #273
Browse files Browse the repository at this point in the history
  • Loading branch information
gschueler committed Jan 15, 2013
1 parent ea98b0c commit 6cdb7b3
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,12 @@ class ReportService {
def getCombinedReports(ReportQuery query) {
def eqfilters = getEqFilters()
def txtfilters = getTxtFilters()
def startfilters = getStartsWithFilters()

def filters = [ :]
filters.putAll(txtfilters)
filters.putAll(eqfilters)
filters.putAll(startfilters)


def crit = BaseReport.createCriteria()
Expand Down Expand Up @@ -207,6 +209,12 @@ class ReportService {
]
}

private def getStartsWithFilters() {
return [
//job filter repurposed for reportId
job: 'reportId',
]
}
private def getTxtFilters() {
def txtfilters = [
obj: 'ctxName',
Expand All @@ -217,8 +225,6 @@ class ReportService {
abortedBy: 'abortedByUser',
node: 'node',
message: 'message',
//job filter repurposed for reportId
job: 'reportId',
title: 'title',
tags: 'tags',
]
Expand All @@ -240,8 +246,6 @@ class ReportService {
* Count the query results matching the filter
*/
def countCombinedReports(ReportQuery query) {
def eqfilters = getEqFilters()
def txtfilters = getTxtFilters()

def total = BaseReport.createCriteria().count {

Expand All @@ -260,6 +264,7 @@ class ReportService {
private applyReportsCriteria(ReportQuery query, delegate){
def eqfilters = getEqFilters()
def txtfilters = getTxtFilters()
def startFilters = getStartsWithFilters()
delegate.with{

if (query) {
Expand All @@ -268,6 +273,12 @@ class ReportService {
ilike(val, '%' + query["${key}Filter"] + '%')
}
}
startFilters.each { key, val ->
def qval = query["${key}Filter"]
if (qval) {
ilike(val, qval.contains('%') ? qval : (qval + (qval.endsWith('/')? '%': '/%')))
}
}

eqfilters.each {key, val ->
if (query["${key}Filter"] == 'null') {
Expand Down

0 comments on commit 6cdb7b3

Please sign in to comment.