Skip to content

Feat 175 export import generalization#181

Open
karimouf wants to merge 13 commits into
devfrom
feat-175-export-import-study-templates
Open

Feat 175 export import generalization#181
karimouf wants to merge 13 commits into
devfrom
feat-175-export-import-study-templates

Conversation

@karimouf
Copy link
Copy Markdown
Collaborator

@karimouf karimouf commented Apr 26, 2026

Export/Import Generalization

Refactored the export and import workflow into fully generic, reusable modal components (ImportFormatModal, ExportFormatModal) and integrated them across all major template (not user data) dashboard entities, replacing per-component implementations.


New User Features

  • Export any workflow, tag set, configuration, study template, or template directly from the dashboard table row via a download button
  • Import any of the above entities from the dashboard header via an upload button
  • Format choice: both export and import supports a number of formats import: (json, yml) export:(json, yml, text, csv)
  • Import wizard: multi-step flow — file selection → data preview with column mapping → item selection → per-item success/failure feedback before committing

New Dev Features

  • ImportFormatModal.open(table, childTable, { overrides, socket }) — generic API for any table:
    • table: table model for the imported data
    • childTable: child table(if exists) for child table model like study_steps to studies for example
    • overrides: force-merge fields into every imported record (e.g. { template: true })
    • socket.name: emit to a custom socket event instead of appDataUpdate
    • socket.dataKey: nest item payload under a specific key, or spread flat if not used
    • socket.extra: inject extra top-level fields into the socket payload
  • ExportFormatModal.open(id, table, childTable, tableOptions, childTableOptions) — generic export API:
    • id — primary key of the record to export; pass null to export all records currently loaded in the table
    • table — Vuex table name to read parent records from (e.g. "workflow", "tag_set"); maps to table/{table}/getFiltered in the store
    • childTable — Vuex table name for records to nest inside each parent (e.g. "workflow_step", "tag"); children are matched via a foreign key auto-derived from the parent name (e.g. "tag_set"tagSetId); pass null when no nesting is needed
    • tableOptions — reserved for future parent-table configuration; pass null for now
    • childTableOptions.key — overrides the property name used to nest the children array in the exported object (e.g. "tags" instead of "tag"); defaults to the raw childTable name when omitted

Improvements

  • UploadModal is now documents-only (PDF) — configuration upload logic was removed and replaced by ImportFormatModal
  • Consistent import/export UX and behavior across all dashboard views (Workflows, Tags, Configurations, Study Templates, Templates)

Known Limitations

  • Export reads from the client-side Vuex store — records not yet loaded into the store (e.g. due to pagination or lazy subscription) will not appear in the export file

@karimouf karimouf requested a review from dennis-zyska April 30, 2026 20:57
@karimouf karimouf changed the title Feat 175 export import study templates Feat 175 export import generalization Apr 30, 2026
@karimouf karimouf marked this pull request as ready for review April 30, 2026 21:15
Copy link
Copy Markdown
Collaborator

@dennis-zyska dennis-zyska left a comment

Choose a reason for hiding this comment

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

  • I tried to generate a study template and to download everything, but I get a TypeError in the browser console ("Cannot read properties of null (reading 'key')")
  • Please also have a look into the lint problems, you can see it here in GitHub in the "Changes" tab of the PR

* This is the single source of truth for downloadObjectsAs and getSupportedExportFormats.
*/
const EXPORT_FORMATS = {
csv: { serialize: objectsToCSV, mimeType: "text/csv", label: "CSV Format", icon: "filetype-csv", description: "Comma-separated values, compatible with spreadsheets", extensions: [".csv"] },
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we format that a bit better, such that it is more easy to read?

};
},
methods: {
/**
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This docstring looks really ugly

: "Item";
return [
{ title: "File Selection" },
{ title: `${itemLabel} Selection` },
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The itemLabel in the study import is study, which is why in the stepper in the frontend it looks like study Selection, but it would be better "Study Selection"

},
methods: {
/**
* Opens the import modal.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

here the docstring as well, do we need all the examples etc.?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What are the reasons for those removements?

name="Create Template"
@click="createTemplate"
/>
<BasicButton
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The buttons locations needs to improved, any idea?

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.

2 participants