Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding sort button to Docs/Alerts list #2747

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LucasBergholz
Copy link

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.

Copy link
Member

@kingthorin kingthorin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't pulled it and tested. Just a quick look

Comment on lines +1 to +3
/* eslint-disable max-len */
/* eslint-disable no-trailing-spaces */
/* eslint-disable indent */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should actually be addressed instead of suppressed

src/index.js Outdated
Comment on lines 108 to 110
/* rows.map((r) => {
console.log(`${JSON.stringify(r.columns)}`);
}); */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

src/index.js Outdated

function addSortButton(el, idx) {
const img = document.createElement('img');
img.src = "https://uxwing.com/wp-content/themes/uxwing/download/arrow-direction/up-down-arrows-icon.png"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be better to have this locally and referenced relatively.

(Assuming no copyright/permissions issue)

@kingthorin
Copy link
Member

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

@LucasBergholz
Copy link
Author

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

@kingthorin
Copy link
Member

Thanks.

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

@thc202 thc202 reopened this Aug 2, 2024
@thc202
Copy link
Member

thc202 commented Aug 2, 2024

Yes, preferable to keep it open.

Signed-off-by: Lucas Bergholz <[email protected]>
@LucasBergholz
Copy link
Author

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.

@kingthorin
Copy link
Member

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

@kingthorin
Copy link
Member

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)

@LucasBergholz
Copy link
Author

LucasBergholz commented Aug 27, 2024

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!

@kingthorin
Copy link
Member

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

@psiinon
Copy link
Member

psiinon commented Aug 28, 2024

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
Copy link
Member

psiinon commented Aug 28, 2024

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

@psiinon
Copy link
Member

psiinon commented Aug 28, 2024

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 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants