Skip to content

XML Jobs & UI Changes#534

Open
tholulomo wants to merge 13 commits into
developfrom
MigrationWithoutDynamfit
Open

XML Jobs & UI Changes#534
tholulomo wants to merge 13 commits into
developfrom
MigrationWithoutDynamfit

Conversation

@tholulomo
Copy link
Copy Markdown
Contributor

@tholulomo tholulomo commented May 1, 2026

1. New POST /jobs/xml/adjust-status endpoint
- src/routes/jobs.js — Route definition with isAuth and latencyTimer middleware
- src/controllers/jobs.js — Controller with two exports:
- updateStatus(id, status) — Reusable function that updates a single ID's curateState in xmldata (+ entityState: 'IngestSuccess'), falling back to curationState/entityState in curatedsamples
- adjustXmlStatus — HTTP handler for bulk-updating IDs provided via comma-separated text or file
- src/server.js — Mounted /jobs route

2. Auto-update status after curation publish
- src/controllers/curationController.js — After successful serializeAndValidate, silently calls JobsController.updateStatus(id, 'Completed') in a swallowed try/catch

3. Curation pipeline updated
- src/pipelines/curation-pipeline.js — Replaced entityState with curateState/curationState as the source of truth:
- Only returns records where curateState/curationState is 'Review' or 'Completed'
- Still projects status as "Approved" (if Completed) or "Not Approved" (otherwise)

4. Documentation & tests
- src/api-docs/swagger-service.yaml — Swagger docs for the new endpoint
- spec/controllers/jobsController.spec.js — 8 unit tests (validation, text/file input, fallthrough, error handling)

5. UI
useXmlViewer.ts (new composable)
Extracts the shared XML_VIEWER Apollo query, xmlViewer ref, auth/dialog computeds, and approveCuration/approval/closeDialogBox methods — used by both components to follow DRY.

XmlLoader.vue

  • Replaced inline Apollo query, xmlViewer ref, auth/dialog computeds with useXmlViewer() composable
  • Local wrappers for approveCuration, approval, and closeDialogBox preserved to handle XmlLoader-specific dialogMode and approvalInProgress state

XmlHistory.vue

  • Added useXmlViewer() composable for xmlViewer data, auth checks, and approval flow
  • Added Dialog component with confirmation/success states driven by approvalInProgress (matching XmlLoader's pattern)
  • Added approve button to allow XML resubmission from the history page
  • Refetches change logs after successful resubmission

6. Auth
Frontend (apolloClient.ts):

  1. Decoding the JWT payload (base64, no secret needed) to check exp before each request
  2. If expired, skip the request and trigger logout
  3. Add an Apollo onError link to catch auth errors from the backend and trigger logout

Frontend (auth/actions.ts):

  1. In authProcessor: decoding the JWT's exp claim instead of hardcoding 9000 hours
  2. Store the real expiration in localStorage

Backend (getHttpContext.js):

  1. Wrap decodeToken in try/catch — on TokenExpiredError, return { isAuthenticated: false } instead of crashing

…us adjustments as we filter out duplicate Xmls
…been curated, also added a button to resubmit in case we expand the ETL and require a rerun of the XML on the Xml history page
…viewed XML. Reviewed XMLs are XML that are not duplicates and have been successfully validated by the PI
@tholulomo tholulomo requested a review from aswallace as a code owner May 1, 2026 03:04
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.

1 participant