zap-extensions icon indicating copy to clipboard operation
zap-extensions copied to clipboard

[WIP] automation: keep job selected when moved

Open mydeveloperplanet opened this issue 3 years ago • 8 comments

Fixed it by firing only the changed index nodes instead of the complete tree structure. After debugging, I found out that firing the complete tree also invokes the clearSelection of the selection model. By only firing a change for what is changed, the issue is resolved.

mydeveloperplanet avatar Aug 10 '21 14:08 mydeveloperplanet

Please, update the changelog.

thc202 avatar Aug 10 '21 14:08 thc202

sorry, this is my first commit to this project, how and where do i update the changelog?

mydeveloperplanet avatar Aug 10 '21 14:08 mydeveloperplanet

No problem at all - the changelog for this add-on is https://github.com/zaproxy/zap-extensions/blob/main/addOns/automation/CHANGELOG.md - you can add your fix to the Unreleased / Fixed section at the top.

Thanks for getting involved!

psiinon avatar Aug 10 '21 14:08 psiinon

This does not work correctly when the jobs being moved have tests (nodes are left behind).

thc202 avatar Aug 10 '21 18:08 thc202

FYI both of the spiders have test nodes added by default, and you can add more nodes via the buttons.

psiinon avatar Aug 11 '21 07:08 psiinon

This does not work correctly when the jobs being moved have tests (nodes are left behind).

I see, it fails after a new test has been added. Well tested!

mydeveloperplanet avatar Aug 11 '21 07:08 mydeveloperplanet

I am a bit stuck here, maybe someone has an idea? I have tried a lot of things, but what should work according to me, is the following:

  for (int j = 0; j < jobNode.getChildCount(); j++) {
      DefaultMutableTreeNode testNode = (DefaultMutableTreeNode) jobNode.getChildAt(j);
      this.fireTreeNodesChanged(this, this.getPathToRoot(jobNode), new int[] {j}, new Object[] {testNode});
   }

However, the child nodes remain at the same location in the GUI when the job node is expanded. When the job node is collapsed, everything works fine (also without firing a node change for the children).

mydeveloperplanet avatar Aug 12 '21 10:08 mydeveloperplanet

Yeah, I would have thought that should work as well, but I couldnt even get this far :/

psiinon avatar Aug 23 '21 10:08 psiinon