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

Show removed node in devtools #835

Merged
merged 3 commits into from
Jun 14, 2024
Merged

Show removed node in devtools #835

merged 3 commits into from
Jun 14, 2024

Conversation

chacha912
Copy link
Contributor

@chacha912 chacha912 commented May 30, 2024

What this PR does / why we need it?

Enhance Tree Data Type in DevTools

  • View deleted nodes by clicking the Show removed node button to toggle the visibility of deleted nodes.
  • Display of the current revision number in the history tab.
  • Add the node size information in the node detail when hovering over a node in the Tree data type.
devtools-removed-node.mov

Any background context you want to provide?

What are the relevant tickets?

Fixes #

Checklist

  • Added relevant tests or not required
  • Didn't break anything

Summary by CodeRabbit

  • New Features

    • Added an indicator to show the size of nodes in the devtools panel.
    • Introduced functionality to hide or show removed nodes based on user interaction.
    • Displayed the current event index and total number of events in the history view.
  • Style

    • Updated various styling properties including margins, font sizes, colors, and heights for devtools panel elements.
    • Applied specific styles to differentiate removed nodes visually.

Copy link

coderabbitai bot commented May 30, 2024

Walkthrough

The updates primarily center around enhancing the user interface and functionality of the devtools application. These include conditional styling for tree nodes to reflect their removal status, displaying node sizes, and improved visibility settings for removed nodes. Additionally, other UI elements such as history buttons now display the current index and total events, and there are minor style adjustments to various components.

Changes

Files Summary
Detail.tsx Updated TreeNode component to conditionally apply 'removed' class and display node size.
styles.css Adjusted styles for history buttons, content sections, toggle buttons, and tree node displaying.
Document.tsx Imported classNames, added state for hideRemovedNode, modified rendering logic based on interaction.
History.tsx Added display of the current event index and total events in the history view.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DevTools
    participant Detail as Detail.tsx
    participant Document as Document.tsx
    participant History as History.tsx

    User ->> DevTools: Toggle 'hideRemovedNode'
    DevTools ->> Document: Update `hideRemovedNode` state
    Document ->> Detail: Render TreeNode
    Detail ->> User: Node with/without 'removed' class

    User ->>DevTools: Change Event in History
    DevTools ->> History: Update Current Event Index
    History ->> User: Display Updated Index
Loading

Poem

Under the code, a rabbit toils day and night,
Crafting buttons and nodes, such a meticulous sight.
Now they show their hidden truths with grace,
Removed nodes fade, leaving no trace.
Numbers in history, clear as dawn,
The devtools evolve, and the work goes on.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented May 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.68%. Comparing base (9a6f1cf) to head (0d85d2b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #835   +/-   ##
=======================================
  Coverage   80.68%   80.68%           
=======================================
  Files          59       59           
  Lines        4586     4586           
  Branches      932      932           
=======================================
  Hits         3700     3700           
  Misses        617      617           
  Partials      269      269           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chacha912 chacha912 marked this pull request as ready for review June 13, 2024 14:32
@chacha912 chacha912 requested a review from hackerwins June 13, 2024 14:36
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (2)
tools/devtools/src/devtools/components/Detail.tsx (1)

Line range hint 130-138: Specify the button type to prevent unintended form submissions.

+ type="button"

Also applies to: 141-149

tools/devtools/src/devtools/tabs/History.tsx (1)

Line range hint 126-131: Specify the button type to prevent unintended form submissions.

+ type="button"

Also applies to: 141-149, 151-160, 162-171, 174-181

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9a6f1cf and 0d85d2b.

Files ignored due to path filters (1)
  • tools/devtools/package-lock.json is excluded by !**/package-lock.json
Files selected for processing (5)
  • tools/devtools/package.json (2 hunks)
  • tools/devtools/src/devtools/components/Detail.tsx (2 hunks)
  • tools/devtools/src/devtools/panel/styles.css (5 hunks)
  • tools/devtools/src/devtools/tabs/Document.tsx (3 hunks)
  • tools/devtools/src/devtools/tabs/History.tsx (1 hunks)
Files not summarized due to errors (1)
  • tools/devtools/package.json: Error: Server error. Please try again later.
Additional context used
Biome
tools/devtools/src/devtools/tabs/Document.tsx

[error] 77-82: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset


[error] 88-93: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

tools/devtools/src/devtools/components/Detail.tsx

[error] 130-138: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset


[error] 141-149: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

tools/devtools/src/devtools/tabs/History.tsx

[error] 126-131: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset


[error] 141-149: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset


[error] 151-160: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset


[error] 162-171: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset


[error] 174-181: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

Additional comments not posted (9)
tools/devtools/package.json (1)

23-23: Updated yorkie-js-sdk dependency to version 0.4.23 to ensure compatibility.

tools/devtools/src/devtools/tabs/Document.tsx (2)

18-18: Imported classnames for dynamic class assignment.


30-30: Introduced state variable hideRemovedNode to manage the visibility of removed nodes.

tools/devtools/src/devtools/components/Detail.tsx (1)

83-85: Added display of node size in the TreeNode component.

tools/devtools/src/devtools/tabs/History.tsx (1)

138-140: Displayed the current event index in the history view.

tools/devtools/src/devtools/panel/styles.css (4)

107-110: The changes to the .devtools-history-buttons .history-index improve readability and spacing. Good job!


279-279: Adjusting the height and adding a border-top to .selected-content enhances the layout's clarity and separation. Well done!


314-327: The styling updates for .toggle-removed-node-btn enhance its visual appeal and interactivity. These changes are well-executed.


394-397: The new styles for hiding removed nodes and highlighting them when visible are crucial for the toggle feature's functionality. The use of a distinct red background for removed nodes is a good choice for visual distinction.

Also applies to: 435-437

tools/devtools/src/devtools/tabs/Document.tsx Show resolved Hide resolved
Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

@hackerwins hackerwins merged commit 157a7a6 into main Jun 14, 2024
2 checks passed
@hackerwins hackerwins deleted the devtools-removed-node branch June 14, 2024 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants