Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSW Submission Shortcut

A Data Stewardship Wizard client plugin (following the ai-document-plugin example) that adds a one-click "Export & Submit" action to the project actions menu.

On click it exports the project with a configured document template + format and submits the result to a configured document submission service — in a single step, with no separate dialog to pick the template, format, or service each time.

It is purely a client plugin and uses only the standard DSW components:

  • the wizard server REST API (generate the document, create the submission), and
  • the document worker, which renders the document.

There is no backend service of its own. The plugin is just a JS bundle served over HTTP(S) and registered in DSW.

How it works

Export & Submit (project actions menu)
   │  POST /documents { documentTemplateUuid, formatUuid, projectUuid }      (wizard server queues it)
   │  GET  /documents?projectUuid=…   poll until DoneDocumentState           (document worker renders)
   │  GET  /documents/{doc}/available-submission-services   (verify the service accepts it)
   │  POST /documents/{doc}/submissions { serviceId }        (server forwards the doc to the service)
   │  GET  /documents/{doc}/submissions   poll until DoneSubmissionState
   ▼
shows the submission location (the receipt link) returned by the service

All calls are made as the logged-in user (getApiUrlAndToken() reads the session); no secrets live in the bundle.

Configuration

The plugin has plugin settings (Administration → Plugins → Submission Shortcut) with three dropdowns, populated live from the DSW API:

  • Document submission service — chosen from the services configured in Administration → Document Submission (GET /tenants/current/config).
  • Document template — chosen from the installed document templates (GET /document-templates/all).
  • Export format — a format of the chosen template.

If the chosen template/format is not among the selected service's supported formats, the settings page warns you (DSW would otherwise reject the submission).

Prerequisites configured the normal DSW way (this plugin only references them): install the document template you want to export, and configure the document submission service in Administration → Document Submission.

Repository layout

plugin/   the DSW client plugin
  src/lib/        dsw-api.ts (tiny wizard-api client) + submit-flow.ts (the orchestration; UI-free)
  src/components/ SettingsComponent.tsx + SubmitActionComponent.tsx
  test/           e2e.test.ts (drives the real flow against an in-process mock wizard-api)
  Dockerfile      rootless-nginx image that serves the built bundle (like the ds-wizard importers)
scripts/  test-e2e.sh / teardown-e2e.sh (clone the DSW deployment + run it), register_plugin.sh

Build & test

make install      # install deps
make test         # flow test (no DSW required — runs the real flow against a mock wizard-api)
make typecheck    # tsc --noEmit
make build        # plugin/dist/plugin.js + plugin/dist/manifest.js

make test is the automated test (also run in CI): it spins up an in-process mock wizard-api and drives the real export-and-submit flow (src/lib/submit-flow.ts) through it over HTTP, including the document-render polling and the failure paths.

Local end-to-end against a real DSW

No host webserver is needed. make test-e2e clones the official DSW deployment example into a gitignored .dsw-deployment/, runs the stack, adds this plugin as its own container (a rootless-nginx image built from plugin/Dockerfile — the same pattern the official ds-wizard importer plugins use), and registers the plugin by inserting a row into the DSW postgres database (per the DSW Plugins guide):

make test-e2e      # clone deployment, bring up DSW + the plugin container, register the plugin row
make teardown-e2e  # stop it (PRUNE=1 also deletes the cloned deployment + its data)

When it finishes:

Then install the document template you want to export, configure a Document Submission service (Administration → Document Submission), configure this plugin (Administration → Plugins → Submission Shortcut), and open a project → Export & Submit appears in the project actions menu.

To register the plugin against a deployment you already run (or a public bundle URL on S3/a proxy), use scripts/register_plugin.sh directly and override PLUGIN_URL / DSW_COMPOSE.

About

plugin to shortcut DSW submissions to 1-click

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages