Skip to content

feat(oga-app): add template to render Trader submissions correctly in OGA portal#205

Merged
sthanikan2000 merged 6 commits intoOpenNSW:mainfrom
ginaxu1:188-improve-oga-ui-review
Mar 23, 2026
Merged

feat(oga-app): add template to render Trader submissions correctly in OGA portal#205
sthanikan2000 merged 6 commits intoOpenNSW:mainfrom
ginaxu1:188-improve-oga-ui-review

Conversation

@ginaxu1
Copy link
Copy Markdown
Contributor

@ginaxu1 ginaxu1 commented Mar 3, 2026

Closes #188

Screen.Recording.2026-03-20.at.10.03.19.mov

Summary

Add OGA view template support to render Trader-submitted information (including file downloads if a file was uploaded by Trader) in the OGA portal's application detail view. Update backend in order to render specific view templates and enabling file downloads
Flow:

  1. Frontend FileControl detects format:"file" in the .view.json schema
  2. It calls getDownloadUrl(key)GET /api/oga/uploads/{key}
  3. HandleGetUploadURL handler proxies the request to the NSW backend GET /uploads/{key}
  4. The backend returns {download_url, expires_at}
  5. We forward that JSON to the frontend

Changes

OGA Go service

  • oga/internal/service.go add OgaForm field to the Application struct and .view form lookup logic in GetApplication
  • oga/internal/handler.go add HandleGetUploadURL handler (mapped to GET /api/oga/uploads/{key}). This endpoint constructs a direct download URL to the main backend's /content endpoint to bypass identity provider authentication gaps for OGA users
  • oga/internal/config.go add BackendAPIBaseURL to the Config struct, defaulting to http://localhost:8080/api/v1 or the BACKEND_API_BASE_URL environment variable
  • oga/cmd/server/main.go register the GET /api/oga/uploads/{key} route

OGA frontend (oga-app):

  • `portals/apps/oga-app/src/screens/WorkflowDetailScreen.tsx: refactor the "Submitted Information" section. It now checks for the existence of application.ogaForm; if present, it renders the data using JsonForms in a read-only state. It falls back to the previous key-value grid only if ogaForm is missing
  • portals/apps/oga-app/src/api.ts update the OGAApplication interface to include the ogaForm property
  • portals/apps/oga-app/src/services/upload.ts update getDownloadUrl to fetch the URL from the OGA service's new proxy endpoint /api/oga/uploads/${key}
  • portals/apps/oga-app/docker-entrypoint.sh: add VITE_API_BASE_URL to the runtime configuration

Backend seed data

  • 001_insert_seed_form_templates.sql add supportingDocuments with format: "file" to the Phytosanitary Certificate and Health Certificate forms
  • 001_insert_seed_workflow_node_templates.sql add submission.request.meta into the Phytosanitary and Health Certificate nodes to allow the OGA service to identify the correct view templates
  • 001_insert_seed_pre_consignment_template.sql update General Trader Verification node to use the structured submission block with request.meta instead of the deprecated submissionUrl.

Testing

  • Verify the OGA app's /workflows/:id detail view renders submitted data using JsonForms when an ogaForm template exists for the application's meta type
  • Verify file fields (supportingDocuments, labTestReport, tinCertificate, vatCertificate) render as clickable "View" download links (not raw key strings) via the FileControl renderer
  • Verify the upload download URL resolves correctly through the OGA proxy (GET /api/oga/uploads/{key})
  • Verify fallback: when no ogaForm is present, the detail view still shows the key-value grid
  • Verify the Go service compiles with both OgaForm and FeedbackHistory on the Application struct
  • Re-seed the database after pulling to pick up the updated form and workflow node configs
cd oga && go build ./...
cd ../portals && pnpm run --recursive --parallel lint
pnpm -r build
make dev-all

@gemini-code-assist

This comment was marked as outdated.

gemini-code-assist[bot]

This comment was marked as outdated.

gemini-code-assist[bot]

This comment was marked as resolved.

@ginaxu1 ginaxu1 force-pushed the 188-improve-oga-ui-review branch from 6d65f5a to 1bf025b Compare March 3, 2026 05:54
@ginaxu1 ginaxu1 marked this pull request as draft March 3, 2026 07:07
@ginaxu1 ginaxu1 force-pushed the 188-improve-oga-ui-review branch from 1bf025b to ebbac63 Compare March 5, 2026 03:58
@ginaxu1 ginaxu1 changed the title feat(oga-app): OGA App JSON Forms Rendering Integration feat(oga-app): add template to render Trader-submitted information correctly in OGA portal Mar 5, 2026
@ginaxu1 ginaxu1 changed the title feat(oga-app): add template to render Trader-submitted information correctly in OGA portal feat(oga-app): add template to render Trader submissions correctly in OGA portal Mar 5, 2026
gemini-code-assist[bot]

This comment was marked as resolved.

@ginaxu1 ginaxu1 force-pushed the 188-improve-oga-ui-review branch 3 times, most recently from 8649135 to 901f6e7 Compare March 11, 2026 08:32
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully adds support for rendering trader-submitted information using view templates in the OGA portal. However, a critical security vulnerability has been identified: the new endpoint for retrieving file download URLs lacks authentication and relies on an insecure backend mechanism, potentially exposing sensitive trader documents to unauthorized access. This issue is exacerbated by the fact that the proxy generates permanent, unauthenticated URLs while presenting them as temporary, creating a significant security risk if deployed outside of a local development environment.

Comment thread oga/internal/handler.go
@ginaxu1 ginaxu1 marked this pull request as ready for review March 11, 2026 08:48
@ginaxu1 ginaxu1 force-pushed the 188-improve-oga-ui-review branch from 901f6e7 to 50c4f51 Compare March 11, 2026 09:03
@ginaxu1 ginaxu1 force-pushed the 188-improve-oga-ui-review branch from f3876b3 to 18452f8 Compare March 12, 2026 06:12
Comment thread oga/cmd/server/main.go
Comment thread oga/internal/handler.go Outdated
@ginaxu1 ginaxu1 requested a review from sthanikan2000 March 16, 2026 04:23
sthanikan2000
sthanikan2000 previously approved these changes Mar 16, 2026
Copy link
Copy Markdown
Contributor

@sthanikan2000 sthanikan2000 left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment thread oga/internal/config.go Outdated
Comment thread oga/cmd/server/main.go
sthanikan2000
sthanikan2000 previously approved these changes Mar 17, 2026
@sthanikan2000
Copy link
Copy Markdown
Contributor

@ginaxu1 can you rebase with current OpenNSW/main?

@ginaxu1 ginaxu1 force-pushed the 188-improve-oga-ui-review branch 4 times, most recently from 6cf591b to 68000c9 Compare March 19, 2026 05:38
@ginaxu1 ginaxu1 requested a review from sthanikan2000 March 19, 2026 05:49
Comment thread oga/go.mod Outdated
@sthanikan2000 sthanikan2000 self-requested a review March 19, 2026 07:05
sthanikan2000
sthanikan2000 previously approved these changes Mar 19, 2026
Copy link
Copy Markdown
Contributor

@sthanikan2000 sthanikan2000 left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment thread .gitignore Outdated
Comment thread oga/internal/handler.go Outdated
Comment thread oga/internal/handler.go
Comment thread oga/cmd/server/main.go
Copy link
Copy Markdown
Contributor

@sthanikan2000 sthanikan2000 left a comment

Choose a reason for hiding this comment

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

Check the nit
Otherwise LGTM

Comment thread oga/internal/handler.go
@ginaxu1 ginaxu1 requested a review from sthanikan2000 March 23, 2026 03:56
@mushrafmim
Copy link
Copy Markdown
Contributor

Rendering The review form works fine on OGA side (Which satisfies this PR's objective) but still the file rendering is not working as expected (Let's solve this in a separate issue).

  1. When I click on the view button, it's opened in a new window, which is forcing me to log in again.
  2. When I get to the review screen I can see, multiple calls to the /oga/upload endpoint to fetch each file. Which is not intended. It is expected to call these endpoints on demand (When the user clicks on the view button).
image

Since the problem is only on file upload aspects. Approving this PR.

Copy link
Copy Markdown
Contributor

@sthanikan2000 sthanikan2000 left a comment

Choose a reason for hiding this comment

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

LGTM!

@sthanikan2000 sthanikan2000 merged commit 3093448 into OpenNSW:main Mar 23, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FE][OGA] Improve Review Application page -> Submitted Information view

3 participants