yorkie-js-sdk icon indicating copy to clipboard operation
yorkie-js-sdk copied to clipboard

Add history tab to Devtools

Open chacha912 opened this issue 1 year ago • 1 comments

What this PR does / why we need it?

https://github.com/yorkie-team/yorkie-js-sdk/assets/81357083/cfac3fd2-7e9e-4091-8b53-dcbeeec6543c

Enhancements in Devtools Introduce new features in this PR, enhancing the functionality of Devtools:

  • Addition of History Tab
    • Introducing the History tab, where you can now view the history of document changes (HistoryChangePack).
      • local-change: Highlighted in yellow , remote-change: Highlighted in blue.
      • presence-change: Identified with cursor icon , document-change: Identified with document icon.
    • Time-travel within the History tab.
      • Slide the HistoryChangePack slider to explore the document at specific time points.
      • Click on a HistoryChangePack to access detailed event and operation information associated with the change.
      • Convenient navigation is also possible using the arrows on the right side of the tab. image
  • Enhanced Tree Graph Display
    • Mouseover tree nodes to access attributes, index, path, and pos information. image
  • UI Improvements
    • Resize history, document, and presence tabs by simply dragging.

Any background context you want to provide?

as-is to-be
image image

Devtools are available by default in the development build environment. If you want to change the availability of Devtools, you can do so as follows:

const doc = new yorkie.Document('docKey', {
  enableDevtools: true, // Modify the condition according to your situation
});

What are the relevant tickets?

Fixes #

Checklist

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

chacha912 avatar Mar 04 '24 01:03 chacha912

Codecov Report

Attention: Patch coverage is 50.72993% with 135 lines in your changes are missing coverage. Please review.

Project coverage is 80.47%. Comparing base (a51f356) to head (e766f0f).

Files Patch % Lines
src/document/document.ts 51.29% 61 Missing and 14 partials :warning:
src/devtools/index.ts 10.52% 16 Missing and 1 partial :warning:
src/document/crdt/tree.ts 0.00% 13 Missing :warning:
src/api/converter.ts 85.00% 6 Missing and 3 partials :warning:
src/document/change/change.ts 0.00% 5 Missing :warning:
src/document/json/array.ts 0.00% 2 Missing and 1 partial :warning:
src/document/json/counter.ts 0.00% 3 Missing :warning:
src/document/json/text.ts 0.00% 3 Missing :warning:
src/document/json/tree.ts 0.00% 3 Missing :warning:
src/document/operation/tree_edit_operation.ts 0.00% 3 Missing :warning:
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #760      +/-   ##
==========================================
- Coverage   81.92%   80.47%   -1.45%     
==========================================
  Files          59       59              
  Lines        4338     4431      +93     
  Branches      852      889      +37     
==========================================
+ Hits         3554     3566      +12     
- Misses        532      604      +72     
- Partials      252      261       +9     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 04 '24 01:03 codecov[bot]

@hackerwins Thank you for your review. I've made the following modifications:

A. Lazy generating the operation bytes:

Modified to build byte data from events only when devtools are enabled.

B. Move accumulating logic to Devtools:

Revised to accumulate docEvents in Devtools instead of the Document.

chacha912 avatar Apr 22 '24 01:04 chacha912