Revert to default sorting when table column is hidden
cover Revert to default sorting when table column is hidden
Hiding a column in a table does not revert the sort order to the default one for the table: the table remains sorted by the hidden column.
Modify ToasterTable and non-ToasterTable tables so that hiding a column will revert the sort order to the default.
This should fix the issue for all of the tables in Toaster.
Changes since eea41e44 (toaster-next) are ingit://git.yoctoproject.org/poky-contrib, elliot/toaster/default_sort-9011
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=elliot/toaster/default_sort-9011
Related bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=9011
Elliot Smith (1):
toaster: fix sorting after hiding a column in build tables
Michael Wood (1):
toaster: ensure ToasterTable headings are reset when order by changes
bitbake/lib/toaster/toastergui/static/js/table.js | 6 ++- .../lib/toaster/toastergui/templates/tasks.html | 2 +- bitbake/lib/toaster/toastergui/views.py | 50 +++++++++++----------- 3 files changed, 31 insertions(+), 27 deletions(-)
--
Elliot Smith
Software Engineer
Intel OTC
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH 1/2 toaster: ensure ToasterTable headings are reset when order by changes
From: Michael Wood <[email protected]>
If a ToasterTable is ordered by an optional column and that column is subsequently hidden, the table ordering switches back to the default ordering for the table. However, the table headings don't update to reflect the new ordering. This is because the code which sets the heading weight and hides/shows the caret symbols only runs when the table is first loaded.
Store the default order by and re-apply it when the data is updated.
[YOCTO #9011]
--- bitbake/lib/toaster/toastergui/static/js/table.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
bitbake/lib/toaster/toastergui/static/js/table.js +5 -1
@@ -232,6 +232,10 @@ function tableInit(ctx){ } } + if (col.field_name === tableData.default_orderby){ + title.addClass("default-orderby"); + } + } else { /* Not orderable */ header.css("font-weight", "normal");
@@ -377,7 +381,7 @@ function tableInit(ctx){ if (col === tableParams.orderby || '-' + col === tableParams.orderby){ tableParams.orderby = null; - loadData(tableParams); + $("#"+ctx.tableName +" .default-orderby").click(); } }
Signature · 14 lines
Elliot Smith Software Engineer Intel OTC --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH 2/2 toaster: fix sorting after hiding a column in build tables
In reply to Elliot SmithWhen 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]
--- .../lib/toaster/toastergui/templates/tasks.html | 2 +- bitbake/lib/toaster/toastergui/views.py | 50 +++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-)
bitbake/lib/toaster/toastergui/templates/tasks.html +1 -1
@@ -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");
bitbake/lib/toaster/toastergui/views.py +25 -25
83 lines not on this page · raw message
Signature · 14 lines
Elliot Smith Software Engineer Intel OTC --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Re: [PATCH 2/2] toaster: fix sorting after hiding a column in build tables
Sent to bitbake-devel and added to toaster-next
Thanks,
Michael
Quoted 122 lines · Elliot Smith
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_orderbyfor 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 <[email protected]>--- .../lib/toaster/toastergui/templates/tasks.html | 2 +- bitbake/lib/toaster/toastergui/views.py | 50 +++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-)bitbake/lib/toaster/toastergui/templates/tasks.html +1
-1@@ -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");bitbake/lib/toaster/toastergui/views.py +25
-25@@ -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':[