hans-lizihan / bull-master

Nice UI for bull and bullmq
MIT License
152 stars 12 forks source link

Provide a way to sort jobs lists #48

Open jadkins89 opened 4 years ago

jadkins89 commented 4 years ago

Providing a way to sort the jobs lists by certain attributes, specifically for us delay time (being able to see which one will run next) would be very nice. Maybe something along the lines of clicking on the column name to sort asc / desc?

Secondly, along these same lines. I deal with some queues that have thousands of jobs. Would it be possible to add a page number selector instead of just incrementing through them?

Thanks for this UI tool, its great!

hans-lizihan commented 4 years ago

i'm afraid the ordering is not supported by bulljs

https://github.com/OptimalBits/bull/blob/develop/REFERENCE.md#queuegetjobs

however if it makes sense, it's possible to sort it in the frontend only.

for page number selector, i think you could simply modify the URL page=1 <- change it here

jadkins89 commented 4 years ago

I am thinking front end only sorting, though for large amounts of jobs there may be a noticeable delay. Pagination seems simple enough.

jadkins89 commented 4 years ago

Handling sorting in server/controllers/jobs.js is a viable option. You could add an additional parameter to the query that is a sort type, grab all the jobs, sort and paginate locally versus through the API. If I get time, I'll work up some code.

hans-lizihan commented 4 years ago

hmm that will be great @jadkins89~