This repository demonstrates a Backstage plugin that customizes and extends the orchestrator workflow execution form. It provides a standalone Backstage instance for testing and debugging the plugin before integration with the orchestrator in a Red Hat Developer Hub (RHDH) deployment. The plugin’s features are illustrated using an example workflow. This workflow’s input schema includes custom UI properties that trigger specific form enhancements, such as the property "ui:widget": "CountryWidget", which loads the plugin's custom CountryWidget
component.
yarn install
yarn dev
Open your browser and go to http://localhost:3000. In the navigation panel, select Custom Form to explore the extended workflow execution form in action.
Follow these instructions to install the workflow.
Note: when running the workflow without the plugin installed, the form will throw errors.
Add the following entry to the RHDH plugins ConfigMap:
- disabled: false
package: "https://github.com/parodos-dev/custom-form-example-plugin/releases/download/0.2.0/custom-form-example-plugin-0.2.0.tgz"
integrity: sha512-1L2JKfvJBYHXFQsb6NrgvdXUrAXkmlloDAQiTeR8La2cNqOTeBMF91E+0ixhm4wy10gzdZXtytORjk1UWFVHlw==
pluginConfig:
dynamicPlugins:
frontend:
custom-form-example-plugin:
apiFactories:
- importName: formApiFactory
Access the Custom Form: Open RHDH in your browser. Navigate to the Orchestrator and run the workflow titled Extendable workflow.
-
Custom Widgets
- The Country field dropdown is customized to fetch country data from the public API: https://restcountries.com/v3.1/all.
- In the second step, observe the custom dropdown for the Language field.
-
Custom Inter-field Validation
- Enter mismatching passwords and click Next to see the error message:
".personalInfo.password passwords do not match."
- Enter mismatching passwords and click Next to see the error message:
-
Custom Async Validation
- Custom asynchronous validation occurs after all other validations pass and Next is clicked.
- Fill in all required fields correctly, then enter "admin" as the First name and click Next. A message will appear:
"firstName Name admin is reserved"
. Notice the Next button is temporarily in a busy state as async validation runs.
-
Custom Inter-field Dependencies
- Complete the form’s first step and click Next. The Language dropdown will display a language relevant to the selected country.
Note: This example is specific to a single workflow. Since only one plugin like this can be provided, a generic implementation is recommended to support all workflows. For example, using a property like
ui:validationType
can allow the plugin to provide custom validations for variousvalidationType
values.
More details on the architecture are available here.