y-scope / yscope-log-viewer

A tool that can be used to view logs compressed in CLP's IR Stream format.
Apache License 2.0
9 stars 12 forks source link

new-log-viewer: Add `UrlContextProvider` to provide URL parameters and use them in the `StateContextProvider`. #48

Closed Henry8192 closed 1 month ago

Henry8192 commented 2 months ago

Description

UrlContextProvider provides 3 main functions: setSearchParamSet, setHashParamSet and copyToClipboard.

Validation performed

In Layout.tsx, add this test code block after useContext(UrlContext):

setSearchParamSet({filePath: "path/to/file", seek: "begin"});
setHashParamSet({searchEventIdx: 114514});
copyToClipboard({filePath: "path/to/filePath"}, {searchEventIdx: 1919810});

Results: Moded URL: http://localhost:3010/?seek=begin&filePath=path/to/file#searchEventIdx=114514 Clipboard: http://localhost:3010/?seek=begin&filePath=path%2Fto%2FfilePath#searchEventIdx=1919810

junhaoliao commented 1 month ago

Thanks for the changes.

Some significant refinements are needed before we can merge the PR. Let's use this patch file as a reference changes.patch and feel free to ask any questions offline.

junhaoliao commented 1 month ago

Thanks for the changes.

Some significant refinements are needed before we can merge the PR. Let's use this patch file as a reference changes.patch and feel free to ask any questions offline.

Let's also add some demo elements in the and/or so we can better demo the usages and be more confident that our implementations are working:

  1. (Likely only need to modify ) Add a button which copies the link with logEventNum=theLastLogEvent to the clipboard.
  2. (Likely only need to modify ) Set logEventNum in the URL after a page is loaded.
  3. (Likely only need to modify ) Support loading a specific log by changing the logEventNum in the URL.
junhaoliao commented 1 month ago

Thanks for the changes. Some significant refinements are needed before we can merge the PR. Let's use this patch file as a reference changes.patch and feel free to ask any questions offline.

Let's also add some demo elements in the and/or so we can better demo the usages and be more confident that our implementations are working:

  1. (Likely only need to modify ) Add a button which copies the link with logEventNum=theLastLogEvent to the clipboard.
  2. (Likely only need to modify ) Set logEventNum in the URL after a page is loaded.
  3. (Likely only need to modify ) Support loading a specific log by changing the logEventNum in the URL.

(2.) has been implemented. Let's continue to work on (1.) and (3.).

Let me know if you need help for (3.). I believe we also need to update some of the service worker code.