All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Wood <michael.g.wood@intel.com>
To: toaster@yoctoproject.org
Subject: Re: [PATCH 2/2] toaster: fix sorting after hiding a column in build tables
Date: Tue, 19 Apr 2016 17:32:11 +0100	[thread overview]
Message-ID: <57165D8B.9010808@intel.com> (raw)
In-Reply-To: <1459242431-17140-3-git-send-email-elliot.smith@intel.com>

Sent to bitbake-devel and added to toaster-next

Thanks,

Michael

On 29/03/16 10:07, Elliot Smith wrote:
> When hiding a column in the build tasks or build packages included
> table, if the column is set as the current order by for the table, the
> order by is not reset to the default. The result is that the table
> stays sorted by the hidden column.
>
> Set the default_orderby for these two tables correctly to ensure the
> corresponding table is re-sorted when a column is hidden, if that column
> was being used as the order by.
>
> [YOCTO #9011]
>
> Signed-off-by: Elliot Smith <elliot.smith@intel.com>
> ---
>   .../lib/toaster/toastergui/templates/tasks.html    |  2 +-
>   bitbake/lib/toaster/toastergui/views.py            | 50 +++++++++++-----------
>   2 files changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/bitbake/lib/toaster/toastergui/templates/tasks.html b/bitbake/lib/toaster/toastergui/templates/tasks.html
> index 23eb957..84bc103 100644
> --- a/bitbake/lib/toaster/toastergui/templates/tasks.html
> +++ b/bitbake/lib/toaster/toastergui/templates/tasks.html
> @@ -131,7 +131,7 @@
>   <script type="text/javascript">
>   
>       $(document).ready(function() {
> -        // enable blue hightlight animation for the order link
> +        // highlight heading on the column for the field used for ordering
>           if (location.href.search('#') > -1) {
>               var task_order = location.href.split('#')[1];
>               $("#" + task_order).addClass("highlight");
> diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
> index cc7ad17..71c74e2 100755
> --- a/bitbake/lib/toaster/toastergui/views.py
> +++ b/bitbake/lib/toaster/toastergui/views.py
> @@ -662,7 +662,9 @@ def recipe_packages(request, build_id, recipe_id):
>   
>   def target_common( request, build_id, target_id, variant ):
>       template = "target.html"
> -    (pagesize, orderby) = _get_parameters_values(request, 25, 'name:+')
> +    default_orderby = 'name:+'
> +
> +    (pagesize, orderby) = _get_parameters_values(request, 25, default_orderby)
>       mandatory_parameters = { 'count': pagesize,  'page' : 1, 'orderby': orderby }
>       retval = _verify_parameters( request.GET, mandatory_parameters )
>       if retval:
> @@ -682,8 +684,6 @@ def target_common( request, build_id, target_id, variant ):
>       queryset = queryset.select_related("recipe", "recipe__layer_version", "recipe__layer_version__layer")
>       packages = _build_page_range( Paginator(queryset, pagesize), request.GET.get( 'page', 1 ))
>   
> -
> -
>       build = Build.objects.get( pk = build_id )
>   
>       # bring in package dependencies
> @@ -800,7 +800,7 @@ eans multiple licenses exist that cover different parts of the source',
>           'objects'              : packages,
>           'packages_sum'         : packages_sum[ 'installed_size__sum' ],
>           'object_search_display': "packages included",
> -        'default_orderby'      : orderby,
> +        'default_orderby'      : default_orderby,
>           'tablecols'            : [
>                       tc_package,
>                       tc_packageVersion,
> @@ -995,29 +995,29 @@ def tasks_common(request, build_id, variant, task_anchor):
>           anchor=task_anchor
>   
>       # default ordering depends on variant
> -    if   'buildtime' == variant:
> -        title_variant='Time'
> -        object_search_display="time data"
> -        filter_search_display="tasks"
> -        (pagesize, orderby) = _get_parameters_values(request, 25, 'elapsed_time:-')
> -    elif 'diskio'    == variant:
> -        title_variant='Disk I/O'
> -        object_search_display="disk I/O data"
> -        filter_search_display="tasks"
> -        (pagesize, orderby) = _get_parameters_values(request, 25, 'disk_io:-')
> -    elif 'cputime'  == variant:
> +    default_orderby = None
> +    filter_search_display = 'tasks'
> +
> +    if 'buildtime' == variant:
> +        default_orderby = 'elapsed_time:-'
> +        title_variant = 'Time'
> +        object_search_display = 'time data'
> +    elif 'diskio' == variant:
> +        default_orderby = 'disk_io:-'
> +        title_variant = 'Disk I/O'
> +        object_search_display = 'disk I/O data'
> +    elif 'cputime' == variant:
> +        default_orderby = 'cpu_time_system:-'
>           title_variant='CPU time'
> -        object_search_display="CPU time data"
> -        filter_search_display="tasks"
> -        (pagesize, orderby) = _get_parameters_values(request, 25, 'cpu_time_system:-')
> -    else :
> -        title_variant='Tasks'
> -        object_search_display="tasks"
> -        filter_search_display="tasks"
> -        (pagesize, orderby) = _get_parameters_values(request, 25, 'order:+')
> +        object_search_display = 'CPU time data'
> +    else:
> +        default_orderby = 'order:+'
> +        title_variant = 'Tasks'
> +        object_search_display = 'tasks'
>   
> +    (pagesize, orderby) = _get_parameters_values(request, 25, default_orderby)
>   
> -    mandatory_parameters = { 'count': pagesize,  'page' : 1, 'orderby': orderby }
> +    mandatory_parameters = {'count': pagesize, 'page' : 1, 'orderby': orderby}
>   
>       template = 'tasks.html'
>       retval = _verify_parameters( request.GET, mandatory_parameters )
> @@ -1211,7 +1211,7 @@ def tasks_common(request, build_id, variant, task_anchor):
>                   'mainheading': title_variant,
>                   'build': build,
>                   'objects': task_objects,
> -                'default_orderby' : orderby,
> +                'default_orderby' : default_orderby,
>                   'search_term': search_term,
>                   'total_count': queryset_with_search.count(),
>                   'tablecols':[



      reply	other threads:[~2016-04-19 16:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29  9:07 [PATCH 0/2] Revert to default sorting when table column is hidden Elliot Smith
2016-03-29  9:07 ` [PATCH 1/2] toaster: ensure ToasterTable headings are reset when order by changes Elliot Smith
2016-03-29  9:07 ` [PATCH 2/2] toaster: fix sorting after hiding a column in build tables Elliot Smith
2016-04-19 16:32   ` Michael Wood [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57165D8B.9010808@intel.com \
    --to=michael.g.wood@intel.com \
    --cc=toaster@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.