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

Notes feature added to Site Tree Node #8307

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

Conversation

amitpanwar789
Copy link
Contributor

@amitpanwar789 amitpanwar789 commented Jan 15, 2024

Overview

Added Notes feature in Site Tree
Screenshot from 2024-01-15 22-10-23

Related Issues

Related to: #8240

Checklist

  • Update help
  • [] Update changelog
  • Run ./gradlew spotlessApply for code formatting
  • Write tests
  • Check code coverage
  • Sign-off commits
  • Squash commits
  • Use a descriptive title

For more details, please refer to the developer rules and guidelines.

Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
@ganesh-dagadi
Copy link
Contributor

Please squash the commits
https://www.freecodecamp.org/news/git-squash-commits/

@kingthorin
Copy link
Member

The history IDs should probably be sorted, and the text input only active/enabled when an ID is selected (you could default select the first one I guess). Otherwise I'm sure entering text and not having one selected will fail somehow 😉
(This feedback based solely on the screenshot)

Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
@kingthorin
Copy link
Member

kingthorin commented Jan 22, 2024

@thc202 this should be checking whether or not the HistoryReference(s) have a temporary type? (No point trying to put notes on those, right?)

HistoryReference.getTemporaryTypes()

@amitpanwar789
Copy link
Contributor Author

@thc202 this should be checking whether or not the HistoryReference(s) have a temporary type? (No point trying to put notes on those, right?)

HistoryReference.getTemporaryTypes()

can you please tell me what is temporary type and how a user change type of href ?

@kingthorin
Copy link
Member

kingthorin commented Jan 24, 2024

Users can't aren't meant to change them, they're set programmatically. There are temporary nodes in the tree to facilitate display, but they're removed when the session ends.

@thc202
Copy link
Member

thc202 commented Jan 24, 2024

#8307 (comment)

Correct.

@amitpanwar789
Copy link
Contributor Author

Users can't aren't meant to change them, they're set programmatically. There are temporary nodes in the tree to facilitate display, but they're removed when the session ends.

ok , i will do it, but HistoryReference.getTemporaryTypes() return a set of integers and how can i check from this set if a href is TemporaryType or not ?

@kingthorin
Copy link
Member

On the reference you can getHistoryType() the type and check if it's in the collection.

@amitpanwar789
Copy link
Contributor Author

amitpanwar789 commented Jan 24, 2024

On the reference you can getHistoryType() the type and check if it's in the collection.

@kingthorin i think this will work


   private void fillJSet(Set<HistoryReference> set, SiteNode curSiteNode) {
        HistoryReference curHref = curSiteNode.getHistoryReference();
        if(!HistoryReference.getTemporaryTypes().contains(curHref.getHistoryType())) {
            set.add(curHref);
        }
        
        Vector<HistoryReference> pastHistoryReference = curSiteNode.getPastHistoryReference();
        for(HistoryReference href : pastHistoryReference) {
            if(!HistoryReference.getTemporaryTypes().contains(href.getHistoryType())) {
                set.add(href);
            }
        }
        

        for (Object o : Collections.list(curSiteNode.children())) {
            fillJSet(set, (SiteNode) o);
        }
    }

@kingthorin
Copy link
Member

LGTM

Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
@kingthorin
Copy link
Member

That's the last thing I see. I still haven't pulled the PR and tested it, but it seems okay.

Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
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.

Thanks

@amitpanwar789
Copy link
Contributor Author

Hi @thc202 , Any chance you could peek at my PR for any feedback ? Eager to jump on next issue.

@thc202
Copy link
Member

thc202 commented Jan 28, 2024

Sorry but this didn't (and doesn't) seem to be ready yet:

Edit: To be clear, it's fine if you don't want to implement those, but you should mention that.

The help should be being updated too.

@@ -269,6 +275,7 @@ public void hook(ExtensionHook extensionHook) {
extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuJumpTo());
// ZAP: Added history notes
extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuNote());
extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuSiteNote());
Copy link
Member

Choose a reason for hiding this comment

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

new PopupMenuSiteNote(getView()))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

new PopupMenuSiteNote(getView()))

why we would pass getView to PopupMenuSiteNote it need extensionHistory as parameter ? i have take the reference from PopMenuNote.

Copy link
Member

Choose a reason for hiding this comment

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

Because it's the only dependency it has, the dialog can live in the pop up menu item (less API exposure overall, this should be moved to an add-on at some point).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry but still didn't get it.

Copy link
Member

Choose a reason for hiding this comment

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

I think he is suggesting the only reason it passes the extension is for its view.

Copy link
Member

Choose a reason for hiding this comment

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

Instantiate it directly, as mentioned in the first comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@thc202 thc202 Feb 6, 2024

Choose a reason for hiding this comment

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

The unused popupMenuSiteNote instance variable can be removed. The ZAP comment should be updated accordingly to latest changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you mean the comments in ExtensionHistory file ? i think the previous comment is still appropriate.
// ZAP: 2024/01/25 Added SiteNotesAddDialog and its utility methods (Issue 8240).

Copy link
Member

Choose a reason for hiding this comment

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

It's just adding the popup menu item now.

…ge added

Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
Copy link

github-actions bot commented Jan 30, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@amitpanwar789
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

zapbot added a commit to zaproxy/cla that referenced this pull request Jan 30, 2024
@amitpanwar789
Copy link
Contributor Author

amitpanwar789 commented Jan 31, 2024

Sorry but this didn't (and doesn't) seem to be ready yet:

Edit: To be clear, it's fine if you don't want to implement those, but you should mention that.

The help should be being updated too.

for the second part do we need to warn the user if he is deleting siteNode or if he is deleting Href from historyExtension list window ?

@thc202
Copy link
Member

thc202 commented Jan 31, 2024

From my understanding, the latter.

@amitpanwar789
Copy link
Contributor Author

amitpanwar789 commented Jan 31, 2024

From my understanding, the latter.

I think for this we can just edit the existing warning from ExtensionHistory.java text like
"Are you sure you want to delete the record(s)?
This will also delete if any Note is associated with this record(s). "

@thc202
Copy link
Member

thc202 commented Jan 31, 2024

I'd prefer if it was added only when there are notes but that should be fine too.

Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
@amitpanwar789
Copy link
Contributor Author

Sorry but this didn't (and doesn't) seem to be ready yet:

Edit: To be clear, it's fine if you don't want to implement those, but you should mention that.

The help should be being updated too.

where do i need to update help section ?

@amitpanwar789
Copy link
Contributor Author

Sorry but this didn't (and doesn't) seem to be ready yet:

Edit: To be clear, it's fine if you don't want to implement those, but you should mention that.

The help should be being updated too.

where do i need to update help section ?

??

@kingthorin
Copy link
Member

In the add-on, you can model it similar to others, just look at the src tree.

As for dealing with help for the core component that'll be done in zap-core-help. But is separate so don't get stuck on it for now.

Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
… null

Signed-off-by: amitpanwar789 <amitpanwar02705@gmail.com>
@amitpanwar789
Copy link
Contributor Author

amitpanwar789 commented Feb 20, 2024

@thc202 Is this complete or do I need to implement anything else ?

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

Successfully merging this pull request may close these issues.

None yet

4 participants