Browse Source

HUE-808 [beeswax] Result pagination is incorrect

Got rid of old css classes from beeswax_components
Fixed datatables configuration on history page
Added query context to the result pagination
Enrico Berti 13 years ago
parent
commit
c090c58523

+ 4 - 4
apps/beeswax/src/beeswax/templates/beeswax_components.mako

@@ -195,10 +195,10 @@ ${field.label_tag() | n}
 <%def name="pagination(page)">
     <div class="pagination">
         <ul class="pull-right">
-            <li class="prev"><a title="${_('Beginning of List')}" ${toppage(page)} class="bw-firstBlock">&larr; ${_('Beginning of List')}</a></li>
-            <li><a title="${_('Previous Page')}" ${prevpage(page)} class="bw-prevBlock">${_('Previous Page')}</a></li>
-            <li><a title="${_('Next page')}" ${nextpage(page)} class="bw-nextBlock">${_('Next Page')}</a></li>
-            <li class="next"><a title="${_('End of List')}" ${bottompage(page)} class="bw-lastBlock">${_('End of List')} &rarr;</a></li>
+            <li class="prev"><a title="${_('Beginning of List')}" ${toppage(page)}>&larr; ${_('Beginning of List')}</a></li>
+            <li><a title="${_('Previous Page')}" ${prevpage(page)}>${_('Previous Page')}</a></li>
+            <li><a title="${_('Next page')}" ${nextpage(page)}>${_('Next Page')}</a></li>
+            <li class="next"><a title="${_('End of List')}" ${bottompage(page)}>${_('End of List')} &rarr;</a></li>
         </ul>
         <p>${_('Showing %(start)s to %(end)s of %(count)s items, page %(page)s of %(pages)s') % dict(start=page.start_index(),end=page.end_index(),count=page.total_count(),page=page.number,pages=page.num_pages())}</p>
     </div>

+ 1 - 0
apps/beeswax/src/beeswax/templates/list_history.mako

@@ -157,6 +157,7 @@ ${layout.menubar(section='history')}
                 null,
                 null,
                 null,
+                null,
                 { "bSortable": false }
             ],
             "oLanguage": {

+ 4 - 6
apps/beeswax/src/beeswax/templates/watch_results.mako

@@ -101,13 +101,11 @@ ${layout.menubar(section='query')}
 					<div class="pagination pull-right">
 				    	<ul>
 							% if start_row != 0:
-				            <li><a href="${ url('beeswax.views.view_results', query.id, 0) }" title="${_('Back to first row')}">${_('Back to first row')}</a></li>
-							% else:
-							<li class="active"><a href="#" title="${_('Back to first row')}">${_('Back to first row')}</a></li>
+                                <li class="prev"><a title="${_('Beginning of List')}" href="${ url('beeswax.views.view_results', query.id, 0) }${'?context='+context_param if context_param else ''|n}">&larr; ${_('Beginning of List')}</a></li>
 				            % endif
-							% if has_more:
-				    		<li><a href="${ url('beeswax.views.view_results', query.id, next_row) }" title="${_('Next page')}">${_('Next page')} &rarr;</a></li>
-							% endif
+                            % if has_more and len(results) == 100:
+                                <li><a title="${_('Next page')}" href="${ url('beeswax.views.view_results', query.id, next_row) }${'?context='+context_param if context_param else ''|n}">${_('Next Page')} &rarr;</a></li>
+                            % endif
 				    	</ul>
 				    </div>
 		          % endif

+ 3 - 1
apps/beeswax/src/beeswax/views.py

@@ -895,7 +895,8 @@ def view_results(request, id, first_row=0):
   query_history = authorized_get_history(request, id, must_exist=True)
 
   handle = QueryHandle(id=query_history.server_id, log_context=query_history.log_context)
-  context = _parse_query_context(request.GET.get('context'))
+  context_param = request.GET.get('context', '')
+  context = _parse_query_context(context_param)
 
   # Retrieve query results
   try:
@@ -947,6 +948,7 @@ def view_results(request, id, first_row=0):
     'query_context': context,
     'save_form': save_form,
     'can_save': query_history.owner == request.user,
+    'context_param': context_param,
   })