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

new-log-viewer: Add support for exporting decoded logs as a file. #72

Merged
merged 26 commits into from
Sep 23, 2024

Conversation

Henry8192
Copy link
Collaborator

@Henry8192 Henry8192 commented Sep 15, 2024

References

Description

Add "Export Logs" button to download the current uncompressed logs.
The button triggers exportLogs function defined in StateContextProvider, which posts a EXPORT_LOG worker request to MainWorker. The worker parses log events into chunks in loadChunk and posts CHUNK_DATA responses back to StateContextProvider. It appends the posted log chunk using logExportManager, which triggers a download when it receives all log chunks.

Validation performed

Click download button, the logs are downloaded with timestamped fileNames. Click download button multiple times, the logs are downloaded with different timestamps.

new-log-viewer/src/contexts/StateContextProvider.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/contexts/StateContextProvider.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/contexts/StateContextProvider.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/contexts/StateContextProvider.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogFileManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogFileManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/MainWorker.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/MainWorker.ts Show resolved Hide resolved
Henry8192 and others added 2 commits September 16, 2024 12:43
new-log-viewer/src/utils/downloadDecompressedLogs.ts Outdated Show resolved Hide resolved
new-log-viewer/src/utils/downloadDecompressedLogs.ts Outdated Show resolved Hide resolved
new-log-viewer/src/utils/downloadDecompressedLogs.ts Outdated Show resolved Hide resolved
new-log-viewer/src/utils/downloadDecompressedLogs.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/MainWorker.ts Outdated Show resolved Hide resolved
new-log-viewer/src/components/MenuBar/index.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/contexts/StateContextProvider.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/contexts/StateContextProvider.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/contexts/StateContextProvider.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/utils/file.ts Show resolved Hide resolved
@Henry8192 Henry8192 marked this pull request as ready for review September 17, 2024 16:27
@Henry8192 Henry8192 changed the title Export Logs draft new-log-viewer: add export logs to download decompressed logs Sep 17, 2024
Copy link
Collaborator

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

Looks really good. Let's address the final comments.

new-log-viewer/src/utils/file.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogExportManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/utils/file.ts Outdated Show resolved Hide resolved
Co-authored-by: Junhao Liao <junhao@junhao.ca>
@junhaoliao
Copy link
Collaborator

How about changing the PR title to

Add log export feature to download all decoded logs as a file.

@Henry8192 Henry8192 changed the title new-log-viewer: add export logs to download decompressed logs new-log-viewer: Add log export feature to download all decoded logs as a file. Sep 18, 2024
@junhaoliao
Copy link
Collaborator

All my concerns have been addressed. @Henry8192, @junhaoliao, please review the latest changes I made.

For the PR title, how about:

new-log-viewer: Add support for exporting decoded logs as a file.

I agree with Kirk's proposal of the PR title.

@Henry8192 Henry8192 changed the title new-log-viewer: Add log export feature to download all decoded logs as a file. new-log-viewer: Add support for exporting decoded logs as a file. Sep 23, 2024
@Henry8192 Henry8192 merged commit d185624 into y-scope:main Sep 23, 2024
1 check passed
@Henry8192 Henry8192 deleted the export-logs branch September 24, 2024 19:12
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.

3 participants