Changeset 260


Ignore:
Timestamp:
Jan 12, 2010, 1:09:03 PM (15 years ago)
Author:
gav
Message:

Improve bulk data creation batch times and use dynamic allocation of next available id.
Sort admin view controller classes by name.

Location:
trunk/grails-app
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/TaskDetailedController.groovy

    r253 r260  
    2222    }
    2323
     24    def setTaskSearchParamsMax = {
     25        if(params.newMax.isInteger())
     26            def i = params.newMax.toInteger()
     27            if(params.newMax.toInteger() > 0)
     28        session.taskSearchParamsMax = params.newMax
     29        params.max = params.newMax
     30        forward(action: 'search', params: params)
     31    }
     32
    2433    def search = {
    25         params.max = Math.min( params.max ? params.max.toInteger() : 10,  100 )
     34
     35        if(session.taskSearchParamsMax)
     36            params.max = session.taskSearchParamsMax
     37
     38        // TaskSearchService protects itself but filterPane does not.
     39        params.max = Math.min( params.max ? params.max.toInteger() : 10,  99999 )
     40
     41        def taskInstanceList = []
     42        def taskInstanceTotal
     43        def filterParams = [:]
     44        def personInstance = personService.currentUser
    2645
    2746        // Quick Search:
    2847        if(!FilterUtils.isFilterApplied(params)) {
    29             def taskInstanceList = []
    30             def personInstance = personService.currentUser
    3148
    3249            if(params.quickSearch == "searchMyTodays") {
     
    5269                params.quickSearch = "searchTodays"
    5370            }
    54             return[taskInstanceList: taskInstanceList, taskInstanceTotal: taskInstanceList.totalCount, filterParams: params]
    55         }
    56         // filterPane:
    57         return[ taskInstanceList: filterService.filter( params, Task ),
    58             taskInstanceTotal: filterService.count( params, Task ),
    59             filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params),
    60             params:params ]
    61     }
     71
     72            taskInstanceTotal = taskInstanceList.totalCount
     73            filterParams.quickSearch = params.quickSearch
     74        }
     75        else {
     76            // filterPane:
     77            taskInstanceList = filterService.filter( params, Task )
     78            taskInstanceTotal = filterService.count( params, Task )
     79            filterParams = com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params)
     80        }
     81
     82        // export plugin:
     83        if(params?.format && params.format != "html") {
     84
     85            def dateFmt = { date ->
     86                formatDate(format: "EEE, dd-MMM-yyyy", date: date)
     87            }
     88
     89            String title
     90            if(params.quickSearch)
     91                title = "${params.quickSearch} tasks."
     92            else
     93                title = "Filtered tasks."
     94
     95            response.contentType = ConfigurationHolder.config.grails.mime.types[params.format]
     96            response.setHeader("Content-disposition", "attachment; filename=tasks.${params.extension}")
     97            List fields = ["id", "targetStartDate", "description", "leadPerson", "taskPriority", "taskStatus"]
     98            Map labels = ["id": "ID", "targetStartDate": "Target Start Date", "description": "Description",
     99                                    "leadPerson": "Lead Person", "taskPriority": "Task Priority", "taskStatus": "Task Status"]
     100            Map formatters = [ targetStartDate: dateFmt]
     101            Map parameters = [title: title, separator: ","]
     102
     103            exportService.export(params.format, response.outputStream, taskInstanceList, fields, labels, formatters, parameters)
     104        }
     105
     106        // Add some basic params to filterParams.
     107        filterParams.max = params.max
     108        filterParams.offset = params.offset?.toInteger() ?: 0
     109        filterParams.sort = params.sort ?: "id"
     110        filterParams.order = params.order ?: "desc"
     111
     112        return[ taskInstanceList: taskInstanceList,
     113                taskInstanceTotal: taskInstanceTotal,
     114                filterParams: filterParams ]
     115
     116    } // end search()
    62117
    63118    def searchCalendar = {
     
    128183            // export plugin:
    129184            if(params?.format && params.format != "html") {
     185
     186                def dateFmt = { date ->
     187                    formatDate(format: "EEE, dd-MMM-yyyy", date: date)
     188                }
    130189                response.contentType = ConfigurationHolder.config.grails.mime.types[params.format]
    131190                response.setHeader("Content-disposition", "attachment; filename=tasks.${params.extension}")
     
    133192                Map labels = ["id": "ID", "targetStartDate": "Target Start Date", "description": "Description",
    134193                                        "leadPerson": "Lead Person", "taskStatus": "Task Status", "taskType": "Task Type"]
    135                 Map formatters = [:]
     194                Map formatters = [ targetStartDate: dateFmt]
    136195                String title = "${params.quickSearch} tasks in the last week."
    137                 Map parameters = [title: title]
     196                Map parameters = [title: title, separator: ","]
    138197
    139198                exportService.export(params.format, response.outputStream, taskInstanceList, fields, labels, formatters, parameters)
  • trunk/grails-app/services/TaskSearchService.groovy

    r252 r260  
    66    def authenticateService
    77
     8    def paramsMax = 99999
     9
    810    def getTodays(params) {
    9         params.max = Math.min(params?.max?.toInteger() ?: 10, 100)
     11        params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax)
    1012        params.offset = params?.offset?.toInteger() ?: 0
    1113        params.sort = params?.sort ?: "id"
     
    2426
    2527    def getMyTodays(params) {
    26         params.max = Math.min(params?.max?.toInteger() ?: 10, 100)
     28        params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax)
    2729        params.offset = params?.offset?.toInteger() ?: 0
    2830        params.sort = params?.sort ?: "id"
     
    4244
    4345    def getInTheLastWeek(params) {
    44         params.max = Math.min(params?.max?.toInteger() ?: 10, 100)
     46        params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax)
    4547        params.offset = params?.offset?.toInteger() ?: 0
    4648        params.sort = params?.sort ?: "id"
     
    5961
    6062    def getMyInTheLastWeek(params) {
    61         params.max = Math.min(params?.max?.toInteger() ?: 10, 100)
     63        params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax)
    6264        params.offset = params?.offset?.toInteger() ?: 0
    6365        params.sort = params?.sort ?: "id"
     
    7779
    7880    def getBudgetPlanned(params) {
    79         params.max = Math.min(params?.max?.toInteger() ?: 10, 100)
     81        params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax)
    8082        params.offset = params?.offset?.toInteger() ?: 0
    8183        params.sort = params?.sort ?: "id"
     
    9597
    9698    def getBudgetUnplanned(params) {
    97         params.max = Math.min(params?.max?.toInteger() ?: 10, 100)
     99        params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax)
    98100        params.offset = params?.offset?.toInteger() ?: 0
    99101        params.sort = params?.sort ?: "id"
  • trunk/grails-app/views/appCore/appAdmin.gsp

    r258 r260  
    7979            <div class="dialog">
    8080                <ul>
    81                 <g:each var="c" in="${grailsApplication.controllerClasses}">
     81                <g:each var="c" in="${grailsApplication.controllerClasses.sort { p1, p2 -> p1.fullName.compareToIgnoreCase(p2.fullName) } }">
    8282                        <li class="controller"><g:link controller="${c.logicalPropertyName}">${c.fullName}</g:link></li>
    8383                </g:each>
Note: See TracChangeset for help on using the changeset viewer.