-
Notifications
You must be signed in to change notification settings - Fork 47
feat: FORMS-2500 Decouples formio modules from CHEFS #1736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Modified the vuex store to include a value called builder which formio builder uses to generate the available components. There is an initial value for this builder and it can be updated to register plugins at runtime. In this example, the checkmatrix component is imported from an external location, then the component is registered, then the form is re-rendered.
The administrator can now import modules from any URL. You can manage each form module's plugin name and the idir access for that module. You can also view all versions for that form module, and manage each form module version. You can update the import data or external URI, although you should not do this unless the application import data format changes or if a URL is no longer working. You should always be importing a form module version from the form module management page to replace an existing version. Any versioned forms will continue to use the older form module version so that they can be viewed in the same way that they were submitted. Related issue: FORMS-69
Was missing the userType when loading form modules. Moved a large section of code into its own function.
Form modules can now be loaded when viewing a submission.
When importing a new form module, the form module version fields are now reset instead of loading what was previously loaded. Tests include the toggleFormModule.
Separated the parsing of form module version parsing, and cleaned up some code.
Some urls were generated with undefined ids, that has been fixed. Updated the kitchensink test for Cypress to "load modules" before proceeding with the form submission. Added an E2E test that authenticates a test user that should exist in your keycloak instance.
E2E test for importing a form module completed with keycloak authentication. Fixed some test cases in the front end.
Added E2E tests for form module management. - Get form module - Import form module version - Update form module version - Update form module - Toggle form module Fixed a bug with form module versions list returning outdated form module versions from the form module rather than the list.
Migrates form module management components from Vuex to Pinia for state management and integrates vue-i18n for localization. Updates UI elements to use localized strings, improves reactivity, and restructures logic for better maintainability. Removes obsolete files and updates related services, router, and tests to support the new store structure.
Replaces Keycloak with JWT service for admin route protection in form module routes. Refactors notification store usage, updates form module and version management components for improved reactivity and UI consistency, and fixes various minor bugs and typos. Also updates internationalization keys and improves expansion panel usage in the UI.
Improves logic for loading form modules by selecting only the latest version and deduplicating external URIs. Adds support for a 'config' field in form module versions at both the database and model levels, and updates usage in the frontend to handle this new field. Also fixes several Vue reactivity and reference issues in designer and management components.
Replaces all usage of 'importData' with 'config' for form module version configuration across frontend, backend, tests, and fixtures. Updates database schema, models, and migration to remove 'importData' and standardize on 'config' as a JSON string. Adjusts UI, store, and utility constants to support the new structure and updates test cases and seed data accordingly.
Refactored unit tests for form module controller, service, and routes to improve consistency and readability. Updated import paths to use tilde (~) in frontend tests, replaced Jest with Vitest in formModuleService.spec.js, and standardized mock setups. Adjusted route and endpoint count assertions to reflect new routes. Minor formatting and code style improvements applied throughout.
Introduces validation middleware for formModuleId and formModuleVersionId route parameters and integrates them into form module routes. Updates the publishDraft logic to associate only the latest version of each form module. Adds and extends unit tests for form module routes, controller, and service to cover new validation and logic.
| const controller = require('./controller'); | ||
| const validateParameter = require('../common/middleware/validateParameter'); | ||
|
|
||
| routes.use(currentUser); |
Check failure
Code scanning / CodeQL
Missing rate limiting
| await controller.listFormModules(req, res, next); | ||
| }); | ||
|
|
||
| routes.post('/', jwtService.protect('admin'), async (req, res, next) => { |
Check failure
Code scanning / CodeQL
Missing rate limiting
| await controller.readFormModule(req, res, next); | ||
| }); | ||
|
|
||
| routes.put('/:formModuleId', jwtService.protect('admin'), async (req, res, next) => { |
Check failure
Code scanning / CodeQL
Missing rate limiting
| await controller.updateFormModule(req, res, next); | ||
| }); | ||
|
|
||
| routes.post('/:formModuleId/toggle', jwtService.protect('admin'), async (req, res, next) => { |
Check failure
Code scanning / CodeQL
Missing rate limiting
| await controller.listFormModuleVersions(req, res, next); | ||
| }); | ||
|
|
||
| routes.post('/:formModuleId/version', jwtService.protect('admin'), async (req, res, next) => { |
Check failure
Code scanning / CodeQL
Missing rate limiting
| await controller.readFormModuleVersion(req, res, next); | ||
| }); | ||
|
|
||
| routes.put('/:formModuleId/version/:formModuleVersionId', jwtService.protect('admin'), async (req, res, next) => { |
Check failure
Code scanning / CodeQL
Missing rate limiting
Added comprehensive unit tests for ManageFormModule.vue, covering rendering, version count, update logic, error handling, and panel state. Refactored backend formModule API tests to use valid UUIDs for formModuleId and formModuleVersionId, and mocked parameter validation middleware for improved test accuracy. Also simplified versionCount computed property and ensured fetchFormModule is awaited after updates.
This comment has been minimized.
This comment has been minimized.
Replaces string-based config handling with JSON parsing and validation for form module version creation and update flows. Updates the config schema from string to object, adds user notifications for invalid JSON, and removes legacy component build scripts and related npm scripts for @bcgov/formio.
Removes a leftover console.log statement and ensures the parsed config object is used when updating the form module version, instead of the raw string.
Deleted the entire 'components' directory, including all source, config, and build files, to remove the contrib components library from the project. Also updated the Dockerfile to remove obsolete npm purge and clean commands, and removed debug console.log statements from AddVersion.vue and Import.vue.
Removed the unused 'preserve' script and added a 'purge' script to delete node_modules. This streamlines script management and improves developer workflow.
This comment has been minimized.
This comment has been minimized.
Refactored code to simplify and deduplicate logic for handling externalUris and identityProviders in form module version creation and updates. Improved helper functions and modularized logic in FormModuleLoader, and removed unnecessary variables and style tags. Also updated browser compatibility check in main.js for modern browsers.
This comment has been minimized.
This comment has been minimized.
Introduced a utility function getLatestVersion to select the latest version by date and refactored form version linking logic to use it, improving clarity and efficiency. Standardized toggleFormModule parameter order in both controller and service, and updated related unit tests for consistency.
Extracted form module version submission and validation logic into a new composable (useFormModuleVersion) to reduce code duplication and improve maintainability. Updated AddVersion.vue, Import.vue, and FormModuleAddVersion.vue to use the new composable. Adjusted related i18n keys for error messages.
Refactored the form module creation process to use the store's createFormModule method and updated the version submission logic to remove redundant parameters. Improved error handling and internationalization messages for form module creation. Updated related unit tests to reflect changes in how form module versions are inserted.
Enhanced the logic for loading modules when a form draft is present by checking for an associated formVersionId and loading the correct modules. Refactored the builder update to filter modules by identity provider only for drafts, and simplified the latest version selection.
Deleted the unused import of formModuleService from the Import.vue file to clean up the code.
Added new translation keys and values for form module management, error messages, and UI labels in Arabic, German, Spanish, Farsi, French, and other language JSON files under internationalization/trans/chefs. This update supports new form module features and improves localization coverage.
This comment has been minimized.
This comment has been minimized.
Introduces new API endpoints for managing form modules, including creation, retrieval, updating, toggling active status, version management, and identity provider listing. Adds related OpenAPI schema definitions for FormModule, FormModuleVersion, and their input types, supporting extensible form functionality.
Updated file creation permissions to allow API users in addition to authenticated users. Added apiAccess middleware to the file upload route to ensure proper access control.
Introduces models, migration, and services for CORS domain requests and approval status tracking. Adds CORS middleware using allowed origins from config and database. Updates file upload routes to use new CORS middleware. Seeds approval status codes and links CORS domain requests to approval status history.
The 'config' module import was not used in the file and has been removed to clean up the code.
Introduces full-stack support for managing CORS origin requests, including new frontend components for users and admins, backend models, services, and API endpoints. Adds approval status tracking, admin approval UI, and internationalization updates. Refactors database schema and backend logic to use 'origin' instead of 'domain', and implements CORS middleware improvements for dynamic origin validation.
Eliminated unnecessary console.log statements from the CORS origin retrieval and middleware functions to clean up server logs and improve performance.
Corrected the import statement for CorsError to use the proper file name casing, ensuring consistent module resolution across environments.
Introduces a 'cors.allowedOrigins' config option and updates CORS middleware to support origins from config or environment. Moves CORS middleware usage from file routes to v1 router for broader coverage. Updates OpenShift deployment and documentation to include CORS_ALLOWED_ORIGINS configuration.
Replaces the hardcoded list of allowedOrigins in the CORS config with a reference to the CORS_ALLOWED_ORIGINS environment variable for improved flexibility and configuration management.
|



Description
This feature introduces modularity by decoupling FormIO components from the application core. Form modules, each versioned independently, can now be injected at runtime with configurable builder behavior (categorization, component enablement, etc.).
Details
Developer Use Case
Third-party developers may leverage these endpoints to:
Type of Change
feat (a new feature)
build (change in build system or dependencies)
ci (change in continuous integration / deployment)
Checklist
Further comments