zaproxy-website icon indicating copy to clipboard operation
zaproxy-website copied to clipboard

Adding sort button to Docs/Alerts list

Open LucasBergholz opened this issue 1 year ago • 12 comments

Proposal of sort button for the Alert Table. It identifies if the content of the column is a number or a string, and sort it in alphabetical order, or if it is a number, in upwards or downwards order. This is my first contribution in ZAP, so, if i can change anything to improve the functionality, let me know.

LucasBergholz avatar Aug 01 '24 18:08 LucasBergholz

Probably better to remove unrelated commits, squash it all, and use rebase (vs merge) in the future

kingthorin avatar Aug 01 '24 19:08 kingthorin

Okay, @kingthorin , thank you for the feedback. I will close this PR and after fixing it all, open it again.

LucasBergholz avatar Aug 01 '24 19:08 LucasBergholz

Thanks.

For future reference you could have applied the changes to the existing branch/PR and just force pushed.

kingthorin avatar Aug 01 '24 21:08 kingthorin

Yes, preferable to keep it open.

thc202 avatar Aug 02 '24 04:08 thc202

I pushed to the repo the changes asked in this topic. I also took out the unrelated commits. The image used for the button is copyright free.

LucasBergholz avatar Aug 13 '24 22:08 LucasBergholz

Thanks @LucasBergholz I'll try to pull it and test it in the next few days.

kingthorin avatar Aug 14 '24 00:08 kingthorin

Filtering seems to be broken.

You can filter, but then if you sort the filter is discarded and can't be re-applied. In order to filter once again you have to fully reload the page. (Tested locally with Firefox on Kali)

kingthorin avatar Aug 19 '24 13:08 kingthorin

Hello @kingthorin , i saw your feedback on the filtering and sorting not working together and made the necessary changes that resolve the bug you mentioned before. I created a array named elements which is updated every time a filtering happens. This way, the sort button only sorts the elements array, which contains the filtered lines of the table. Hope this makes it 100% functional now. Im glad to hear more feedbacks if needed!

LucasBergholz avatar Aug 27 '24 00:08 LucasBergholz

Thanks for tackling that. I probably won't get a chance to test it till Thursday.

kingthorin avatar Aug 27 '24 18:08 kingthorin

Works really well ... but, we already have support for sortable tables :/ See https://www.zaproxy.org/docs/statistics/active-scan-rules-last-month/ and https://github.com/zaproxy/zaproxy-website/blob/main/site/layouts/shortcodes/ascan-rules.html Very happy to have the alerts table sortable, but we should only have one way to do it.

psiinon avatar Aug 28 '24 10:08 psiinon

A nice enhancement to the current mechanism would be to add hover over text like Sort or even Sort by <field name>

psiinon avatar Aug 28 '24 10:08 psiinon

And sorry for not pointing this out earlier - I'd forgotten we'd added this, I was just searching for how to set the cursor as I remembered we had done that 😉

psiinon avatar Aug 28 '24 10:08 psiinon