Skip to content
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 1 commit into from
Aug 30, 2023

Conversation

pefernan
Copy link
Contributor

Adding missing README.md

@pefernan pefernan requested review from jomarko and yesamer August 29, 2023 18:38
@pefernan pefernan temporarily deployed to ci August 29, 2023 18:39 — with GitHub Actions Inactive
@pefernan pefernan temporarily deployed to ci August 29, 2023 18:39 — with GitHub Actions Inactive
@pefernan pefernan temporarily deployed to ci August 29, 2023 18:39 — with GitHub Actions Inactive
Copy link
Contributor

@yesamer yesamer left a comment

Choose a reason for hiding this comment

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

Thank you @pefernan

Copy link
Contributor

@jomarko jomarko left a comment

Choose a reason for hiding this comment

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


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`
Copy link
Contributor

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

Project path: /home/jomarko/github/kogito-examples/kogito-quarkus-examples/process-quarkus-example
Form type: patternfly

? Do you want to continue? Yes

Starting Form generation:

Found 5 schemas

Generating form "demo#orderItems"
Cannot generate form "demo#orderItems":  ',' expected. (3:17)
  1 | import React, { useCallback, useEffect, useState }  from "react";
  2 |     import { TextInput, FormGroup, Card, CardBody, Checkbox } from "@patternfly/react-core";
> 3 | const Form__demo#orderItems: React.FC<any> = ( props:any ) => {
    |                 ^
  4 |   const [formApi, setFormApi] = useState<any>();
  5 |   const [ item, set__item ] = useState<string>("");
  6 | const [ order__orderNumber, set__order__orderNumber ] = useState<string>("");

Generating form "demo#orderItems_Verify_order"
Cannot generate form "demo#orderItems_Verify_order":  ',' expected. (3:17)
  1 | import React, { useCallback, useEffect, useState }  from "react";
  2 |     import { Card, CardBody, TextInput, FormGroup, Checkbox } from "@patternfly/react-core";
> 3 | const Form__demo#orderItems_Verify_order: React.FC<any> = ( props:any ) => {
    |                 ^
  4 |   const [formApi, setFormApi] = useState<any>();
  5 |   const [ input1__orderNumber, set__input1__orderNumber ] = useState<string>("");
  6 | const [ input1__shipped, set__input1__shipped ] = useState<boolean>(false);

Generating form "demo#orders"
Cannot generate form "demo#orders":  ',' expected. (3:17)
  1 | import React, { useCallback, useEffect, useState }  from "react";
  2 |     import { TextInput, FormGroup, Card, CardBody, Checkbox } from "@patternfly/react-core";
> 3 | const Form__demo#orders: React.FC<any> = ( props:any ) => {
    |                 ^
  4 |   const [formApi, setFormApi] = useState<any>();
  5 |   const [ approver, set__approver ] = useState<string>("");
  6 | const [ order__orderNumber, set__order__orderNumber ] = useState<string>("");

Generating form "persons"
Successfully generated form "persons.tsx"

Generating form "persons_ChildrenHandling"
Successfully generated form "persons_ChildrenHandling.tsx"

Good bye!

Copy link
Contributor Author

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 like demo#orders.json... the tool uses the schema file name as a formId when building the react forms, probably sanityze the id to avoid that issue (at least to generate the form code)

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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


![List of generated forms in project](./docs/form-generation-5.png)

## Using the Custom Forms with Runtime Tools Quarkus Extension
Copy link
Contributor

Choose a reason for hiding this comment

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

I was able to start and open runtime tools quarkus extension for process-quarkus-example, however when I try to open a form, I got this error, is that expected, known
Screenshot 2023-08-30 120501
issue or new issue please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jomarko this one is related to apache/incubator-kie-issues#525

Copy link
Contributor

@jomarko jomarko left a comment

Choose a reason for hiding this comment

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

Thank you

@tiagobento tiagobento merged commit b8634d1 into apache:main Aug 30, 2023
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.

4 participants