-
Notifications
You must be signed in to change notification settings - Fork 201
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
NO-ISSUE: add form-generation-tool README.md #1935
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
## Form Generation Tool | ||
|
||
This is a utility CLI to help generating forms in differents formats for BPMN processes and User Tasks in your Kogito projects. | ||
|
||
### How does it work? | ||
|
||
When building a Kogito project, Kogito generates JSON schemas to represent the data models for both Processes and User Tasks. | ||
|
||
This tool locates those JSON Schemas in the project and taking advantage of the [Uniforms](https://uniforms.tools) APIs, processes them and generate static forms as a resources in the project `src/main/resoures/form` folder. | ||
|
||
### Form Types | ||
|
||
There are two types of form supported with differnt styling and output format: | ||
|
||
- **Patternfly**: generates a React (`.tsx`) forms using Patternfly 4 components. Implementation can be found in `@kie-tools/uniforms-patternfly-codegen` | ||
|
||
- **Bootstrap 4**: generates a HTML (`.html`) forms using Bootstrap 4 styling. | ||
|
||
Each generated form consist in two files, the source code (`.tsx` or `.html`) and a companion `.config` file that defines the external resources (`css` / `js`) the form may need. | ||
|
||
## Build | ||
|
||
In order to build the CLI you must run the following command in the root folder of the repository: | ||
|
||
```shell script | ||
pnpm -F @kie-tools/form-generation-tool... build:prod | ||
``` | ||
|
||
After the command has finished, go to `packages/form-generation-tool/dist` folder and you'll find the CLI binary (`form-generation-cli-macos`, `form-generation-cli-linux` or `form-generation-cli-win.exe` depending on your OS). | ||
|
||
## Running the CLI | ||
|
||
In the command line just execute the CLI binary: | ||
|
||
```shell script | ||
./form-generation-cli-linux | ||
``` | ||
|
||
This command will start a wizard to help you generate the forms: | ||
|
||
1. First set the path to your Kogito Project. | ||
|
||
![Step 1: Set the Kogito Project path](./docs/form-generation-1.png) | ||
|
||
> **ℹ️ NOTE:** Make sure your Kogito project has been compiled, otherwhise the CLI won't be able to find all the form schemas. | ||
|
||
2. Select one of the availables the Form types (Patternfly or Bootstrap 4). | ||
|
||
![Step 2: Select the Form type](./docs/form-generation-2.png) | ||
|
||
3. Confirm Selection to start the Form Generation process. | ||
|
||
![Step 3: Select the Form type](./docs/form-generation-3.png) | ||
|
||
4. If the Form generation process is succesful, you'll get a confirmation message. | ||
|
||
![Form generation succesfully finished](./docs/form-generation-4.png) | ||
|
||
The generated forms will be stored in the `src/main/resources/forms` folder of the Kogito project. | ||
|
||
![List of generated forms in project](./docs/form-generation-5.png) | ||
|
||
## Using the Custom Forms with Runtime Tools Quarkus Extension | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jomarko this one is related to apache/incubator-kie-issues#525 |
||
|
||
If your project is a Quarkus based Kogito project, you can use and test them by using the **Runtime Tools Quarkus Extension**. | ||
|
||
To do so, just add the following dependency in your project `pom.xml`: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>org.kie.kogito</groupId> | ||
<artifactId>runtime-tools-quarkus-extension</artifactId> | ||
<version>${version}</version> | ||
</dependency> | ||
``` | ||
|
||
And start the project in Dev mode with the command: | ||
|
||
```shell script | ||
mvn clean quarkus:dev | ||
``` | ||
|
||
For more information on how to setup the **Runtime Tools Quarkus Extension** in your project look at the oficial Kogito [documentation](https://docs.kogito.kie.org/latest/html_single/#con-runtime-tools-dev-ui_kogito-developing-process-services). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## Uniforms Bootstrap 4 Codegen | ||
|
||
This module contains the [Uniforms](https://uniforms.tools) theme contain to generate Bootstrap 4 forms for the `@kie-tools/form-generation-tool`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## Uniforms Patternfly Codegen | ||
|
||
This module contains the [Uniforms](https://uniforms.tools) theme contain to generate Patternfly forms for the `@kie-tools/form-generation-tool`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not able to use patternfly for the basic process-quarkus-example is that expected, known issues or new issue?
log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jomarko ok, I think this is a new issue. Looks like the problem is because some processes in the example have an id like
demo.order
and that generates a schema file with a name likedemo#orders.json
... the tool uses the schema file name as aformId
when building the react forms, probably sanityze the id to avoid that issue (at least to generate the form code)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pefernan please report a separate issue, or let me know I should do it, then I can approve this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jomarko creating it now:
#
in the filename. incubator-kie-issues#528