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

kie-issues#1542: Implement ListField in the “form-code-generator-patternfly-theme” package #1542 #2826

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

ljmotta
Copy link
Contributor

@ljmotta ljmotta commented Dec 20, 2024

Closes: apache/incubator-kie-issues#1542

Description

The PR adds the ListField for the form-code-generator-patternfly-theme. To enable fields inside the list, the fields onChange and value were modified. For the case the field is part of a list, the valuemust use the list value, and the onChange must update the list.

The ReactFormGenerator was modified to add the @patternfly/react-icons import.

@jomarko
Copy link
Contributor

jomarko commented Jan 2, 2025

@ljmotta hi, is this fix also for the apache/incubator-kie-issues#1313 ?

@ljmotta ljmotta marked this pull request as ready for review January 7, 2025 22:29
@ljmotta ljmotta requested a review from tiagobento as a code owner January 7, 2025 22:29
@ljmotta
Copy link
Contributor Author

ljmotta commented Jan 7, 2025

@jomarko Yes the PR will fix this issue! Thanks for bring this up. But only for the Patternfly. We need the Bootstrap4 PR to close the issue.

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.

Hi @ljmotta , I have issue to see the forms. Here are the steps I did:

  • downloaded bpmn vsix from the PR and installed into my vscode
  • in vscode, kie-tools, I run KIE_TOOLS_BUILD__buildExamples=true pnpm -F @kie-tools-examples/process-compact-architecture build:dev
  • installed the vsix
  • in vscode I opened exmaples/process-compact-architecture
  • I run mvn clean package
  • ctrl+shift+P -> generate forms
  • run mvn clean quarkus:dev -Pdevelopment
  • open http://localhost:8080/q/dev-ui/ -> Forms
    and get:
    Screenshot 2025-01-09 113102
    Screenshot 2025-01-09 113108

@ljmotta
Copy link
Contributor Author

ljmotta commented Jan 9, 2025

@jomarko You will need to rubuild the example as I've changed the jBPM Dev UI:

To skip stunner editors please use the following command:
pnpm -F @kie-tools-examples/process-compact-architecture... -F \!stunner-editors build:dev

@thiagoelg
Copy link
Member

Following @jomarko's steps and building the whole process-compact-architecture dependency tree, the form seems to work fine! 🎉

Copy link
Member

@thiagoelg thiagoelg left a comment

Choose a reason for hiding this comment

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

Is itemProps always ListItemProps? I've seen this prop name used in different places, but sometimes it's ListItemProps and sometimes any.
We could use different names for them if they represent different things.

Also, isn't there any way to infer the typing of this prop when it's defined as any? I know this was not introduced with this PR, but it would be nice to have proper typings in an already complex codebase.

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, now I am able to see the form.

I have these questions after my review:

string vs any

I see in java, skills is list of strings, however react produce array of any

    private List<String> skills;

vs

	const [candidateData__skills, set__candidateData__skills] = useState<any[]>(
		[]
	);

is that expected, shouldn't react produce array of strings?

console logs

opening hiring form produces an error
Screenshot 2025-01-10 110006

is that expected?

@ljmotta
Copy link
Contributor Author

ljmotta commented Jan 10, 2025

@thiagoelg @jomarko Thanks for the reviews.

@thiagoelg No, the any was a mistake, thanks for spotting it. I'm not sure if I've followed what you said about infering the any.

@jomarko My last commit should have fixed both issues.

@thiagoelg
Copy link
Member

@thiagoelg No, the any was a mistake, thanks for spotting it. I'm not sure if I've followed what you said about infering the any.

My question was that: If that specific instance of itemProps was not ListItemProps, then maybe we should type it somehow to avoid the any definition, but since it is ListItemProps then we already have the correct type. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement ListField in the “form-code-generator-patternfly-theme” package
3 participants