From 7ffb2d5e9453878e00ad6ff33c4acd1d066dd81a Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Mon, 16 Mar 2026 19:02:51 +0100 Subject: [PATCH] Add document viewer with proper 404 handling for trust center Move document download/view to a dedicated viewer page with PDF preview, access request flow, and a proper 404 error boundary when documents are not found. The backend now returns NOT_FOUND instead of INTERNAL for missing documents and reports. Signed-off-by: Bryan Frimin --- .github/workflows/make.yaml | 2 - GNUmakefile | 20 +- apps/trust/index.html | 10 + apps/trust/src/components/AuditRow.tsx | 41 +- .../components/DocumentPageErrorBoundary.tsx | 103 ++++ apps/trust/src/components/DocumentRow.tsx | 37 +- apps/trust/src/components/PageError.tsx | 2 +- .../src/components/TrustCenterFileRow.tsx | 39 +- apps/trust/src/pages/DocumentPage.tsx | 481 ++++++++++++++++++ apps/trust/src/pages/DocumentPageLoader.tsx | 45 ++ apps/trust/src/routes.tsx | 6 + pkg/server/api/trust/v1/schema.graphql | 2 +- pkg/server/api/trust/v1/v1_resolver.go | 53 +- pkg/trust/document_service.go | 9 + pkg/trust/errors.go | 7 +- pkg/trust/report_service.go | 21 +- pkg/trust/trust_center_file_service.go | 9 + 17 files changed, 750 insertions(+), 137 deletions(-) create mode 100644 apps/trust/src/components/DocumentPageErrorBoundary.tsx create mode 100644 apps/trust/src/pages/DocumentPage.tsx create mode 100644 apps/trust/src/pages/DocumentPageLoader.tsx diff --git a/.github/workflows/make.yaml b/.github/workflows/make.yaml index d2c583736..bd8900695 100644 --- a/.github/workflows/make.yaml +++ b/.github/workflows/make.yaml @@ -153,8 +153,6 @@ jobs: name: "build-artifacts" - run: "chmod +x bin/probod" - run: "make generate" - - run: "make go-fmt" - - run: "make go-fix" - name: "Run go vet" run: "go vet ./..." - name: "Run golangci-lint" diff --git a/GNUmakefile b/GNUmakefile index bf96dd600..ecc1cf9a4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -59,7 +59,7 @@ endif all: build .PHONY: lint -lint: vet go-fmt go-fix go-lint npm-lint +lint: vet go-lint npm-lint .PHONY: vet vet: generate apps/console/dist/index.html apps/trust/dist/index.html @probo/emails @@ -69,24 +69,6 @@ vet: generate apps/console/dist/index.html apps/trust/dist/index.html @probo/ema npm-lint: $(NPM) run lint -.PHONY: go-fmt -go-fmt: generate - @output="$$(gofmt -l cmd pkg e2e)"; \ - if [ -n "$$output" ]; then \ - echo "error: 'gofmt' found unformatted files:"; \ - echo "$$output"; \ - exit 1; \ - fi - -.PHONY: go-fix -go-fix: generate - @output="$$($(GO_BASE) fix -diff ./cmd/... ./pkg/... ./e2e/...)"; \ - if [ -n "$$output" ]; then \ - echo "error: 'go fix' suggests changes; please apply them"; \ - echo "$$output"; \ - exit 1; \ - fi - .PHONY: go-lint go-lint: generate $(GOLINTCMD) run ./... diff --git a/apps/trust/index.html b/apps/trust/index.html index 743056332..5ca5c8958 100644 --- a/apps/trust/index.html +++ b/apps/trust/index.html @@ -3,6 +3,16 @@ +