BDMS-777: Update the PDF preview and download button so that they only require view access.#272
Merged
TylerAdamMartinez merged 2 commits intostagingfrom Apr 29, 2026
Merged
Conversation
Preview DeploymentPreview URL: https://preview-tam-bdms-777-auejgdbofq-uc.a.run.app Note: This preview uses the staging API endpoints. |
Preview DeploymentPreview URL: https://preview-tam-bdms-777-auejgdbofq-uc.a.run.app Note: This preview uses the staging API endpoints. |
| import { FieldCompilationNotesPdf } from '@/components/pdf/FieldCompilationNotesPdf' | ||
| import type { IContact, IWell } from '@/interfaces/ocotillo' | ||
| import { formatContactPhones } from '@/components/pdf/fieldCompilationPhoneFormatter' | ||
| import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf.mjs' |
Contributor
Author
There was a problem hiding this comment.
Used a library instead of trying to build a PDF decoder from scratch.
| const extractPdfText = async (pdfBlob: Blob) => { | ||
| const data = new Uint8Array(await pdfBlob.arrayBuffer()) | ||
|
|
||
| for (const match of decodedPdfText.matchAll(/<([0-9A-Fa-f]+)>/g)) { |
Contributor
Author
There was a problem hiding this comment.
The regex failed to capture all the text from the PDF, resulting in a test failure, even though the code behaved as expected.
|
|
||
| describe('FieldCompilationNotesPdf', () => { | ||
| it('appends a final blank page with the requested text when no hydrograph image is provided', async () => { | ||
| it('renders all expected pages and content when no hydrograph image is provided', async () => { |
Contributor
Author
There was a problem hiding this comment.
Update the unit test name to more accurately reflect the test.
jeremyzilar
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
This PR addresses the following problem/context:
How
Implementation summary - the following was changed/added/removed:
canManageAmpforcanViewAmpon the PDF buttons.Notes
Any special considerations, workarounds, or follow-up work to note?