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

Make Angular component consumable multiple times #1657

Merged
merged 1 commit into from
Dec 3, 2020

Conversation

eneufeld
Copy link
Member

The JSONForms Angular component needs the jsonforms service
to set the right data, schema, uischema etc.
The problem is, that the service is a singleton,
as it is registering as a root service.

This commit introduces a new root component jsonforms
which allows to pass all parameters into the component.
The component is now initializing the service internally.
Furthermore, the service is not registered as a root service anymore.
Now multiple jsonforms components can be used next to each other.

@coveralls
Copy link

coveralls commented Nov 25, 2020

Coverage Status

Coverage remained the same at 88.445% when pulling 2335e64 on eneufeld:multi-form-angular into dcb224d on eclipsesource:master.

Copy link
Member

@AlexandraBuzila AlexandraBuzila left a comment

Choose a reason for hiding this comment

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

Overall the changes look good, but there seem to be some problems now with the example app:

  • there's no validation. Open any example with a required property (e.g. Day 2) and remove the data from the required field -> no errors are shown
  • some examples don't work anymore, e.g. Day 1 now shows No applicable renderer found!

@eneufeld eneufeld force-pushed the multi-form-angular branch 2 times, most recently from d8232b4 to 5c9ecbc Compare December 1, 2020 15:36
Copy link
Member

@AlexandraBuzila AlexandraBuzila left a comment

Choose a reason for hiding this comment

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

Thanks, looks good now!

Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

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

Looks good in general! Can you add a small description in the migration guide?

packages/angular-material/example/app/app.component.ts Outdated Show resolved Hide resolved
packages/angular-test/src/boolean.ts Outdated Show resolved Hide resolved
packages/angular/src/jsonforms.service.ts Outdated Show resolved Hide resolved
packages/angular/src/jsonforms.service.ts Show resolved Hide resolved
packages/angular/src/jsonforms.service.ts Outdated Show resolved Hide resolved
@sdirix
Copy link
Member

sdirix commented Dec 1, 2020

I assume an update to the Angular seed app is then required? Could you provide the changes in a PR so we can test them locally (for example via yalc)?

Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

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

I had a look! Looks good but I also saw some things which I missed on the first review.

packages/angular-material/example/app/app.component.ts Outdated Show resolved Hide resolved
packages/angular/src/jsonforms.service.ts Outdated Show resolved Hide resolved
packages/angular/src/jsonforms.service.ts Show resolved Hide resolved
packages/angular/src/jsonforms.service.ts Outdated Show resolved Hide resolved
packages/angular/src/jsonforms-root.component.ts Outdated Show resolved Hide resolved
@eneufeld eneufeld force-pushed the multi-form-angular branch 2 times, most recently from 8ad6906 to 5a0e291 Compare December 2, 2020 13:44
Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

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

Found two problems in the new code.

packages/angular/src/jsonforms-root.component.ts Outdated Show resolved Hide resolved
packages/angular/src/jsonforms.service.ts Outdated Show resolved Hide resolved
packages/angular/src/jsonforms-root.component.ts Outdated Show resolved Hide resolved
The JSONForms Angular component needs the jsonforms service
to set the right data, schema, uischema etc.
The problem is, that the service is a singleton,
as it is registering as a root service.

This commit introduces a new root component `jsonforms`
which allows to pass all parameters into the component.
The component is now initializing the service internally.
Furthermore, the service is not registered as a root service anymore.
Now multiple jsonforms components can be used next to each other.

The angular tests were adapted to work with the behavior change.
Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

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

LGTM

@sdirix sdirix merged commit 2af111d into eclipsesource:master Dec 3, 2020
@eneufeld eneufeld deleted the multi-form-angular branch December 3, 2020 08:25
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.

4 participants