puppetboard icon indicating copy to clipboard operation
puppetboard copied to clipboard

Record sort order in URL for auto-refreshing

Open kirkins opened this issue 8 years ago • 8 comments
trafficstars

This is a code snippet that allows the sort order to be controlled via a URL parameter set by clicking on a table header. #314

kirkins avatar Nov 07 '17 18:11 kirkins

@mterzo let me know if this is Ok so far. If so I will add a second parameter for ascending vs descending.

kirkins avatar Nov 07 '17 18:11 kirkins

Coverage Status

Coverage remained the same at 81.76% when pulling 85a957bb47f24a7b92dc5b63249458dec92f07e6 on kirkins:patch-6 into d456d19bb4125bdb570c4d7f037edc84f100517d on voxpupuli:master.

coveralls avatar Nov 07 '17 18:11 coveralls

Coverage Status

Coverage remained the same at 81.76% when pulling aa891298971106d0eec5782e6d9a5020b90705a3 on kirkins:patch-6 into d456d19bb4125bdb570c4d7f037edc84f100517d on voxpupuli:master.

coveralls avatar Nov 07 '17 18:11 coveralls

We shouldn’t have to post back to the server on this. I haven’t had a chance to look but most JS sort library’s have a display to show and an actual value. For IPs we just need to conver them to their interfered value.

mterzo avatar Nov 07 '17 18:11 mterzo

I’m also looking into the larger scale installations where we are causing too many queries back to PuppetDB. If we don’t have to requery data we already have that would be helpful. Of course if we are paging the results the sort is on the result set not the entire data set.

mterzo avatar Nov 07 '17 18:11 mterzo

@mterzo this doesn't post back to the server I'm using an HTML5 feature that lets you update the URL without querying the website.

https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState()_method

Also this isn't related to the IP sorting. It is related to the fact that Puppetboard automatically refreshes every X seconds and forgets which column the user was sorting by.

kirkins avatar Nov 07 '17 18:11 kirkins

@mterzo can you please have a look at this?

bastelfreak avatar May 11 '19 15:05 bastelfreak

This works fine for me, but it only records the sort key, not the order (desc or asc).

raphink avatar Jul 29 '20 12:07 raphink