Preview the output data in tabular format before downloading fixing (Issue#76) #97
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #76
What was changed?
The preview functionality was added to the /temp page of the application, specifically within the DraftOrcaDashboard component. A new "Preview" button was introduced before the "Download Output" button to allow users to view a preview of the output data before downloading. A modal window was also implemented to display the preview content when the user clicks "Preview."
Why was it changed?
This change addresses a need for users to preview data before downloading it, ensuring they can verify the output format and content. The addition of this preview functionality improves user experience by reducing the need to repeatedly download files to check their contents.
How was it changed?
The following modifications were made:
- In DraftOrcaDashboard.js, added a new state variable showPreviewModal to manage the display of the modal window.
- Implemented the fetchDocumentPreview function, which sends a POST request to the /preview endpoint with appropriate parameters (e.g., file_path, search_terms, sections, and specify_lines).
- Added a "Preview" button in the JSX return statement, right before the "Download Output" button.
- Created a modal layout that appears when showPreviewModal is set to true. This modal displays the preview content in a formatted manner, using the previewContent state to hold the data returned by the /preview endpoint.
This change required modifying DraftOrcaDashboard.js to integrate the new button and modal display, along with adjustments to the data formatting to align with backend expectations, ensuring compatibility with the /preview endpoint.
Note
This issue is still in progress