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

Add Fusion views (part 1) #1

Merged
merged 44 commits into from
Sep 30, 2021
Merged

Add Fusion views (part 1) #1

merged 44 commits into from
Sep 30, 2021

Conversation

Haprog
Copy link
Contributor

@Haprog Haprog commented Sep 22, 2021

Description

Add some initial Fusion views. The new views are still WIP but working/usable.

Commit some files generated by vaadin-maven-plugin.
Update main-layout.ts to have the navigation menu at the top instead of on the side. Based on top menu option in start.vaadin.com.
Add custom index.html for Fusion based on the layout.html used by the Thymeleaf based views.
Add header and image to the Fusion Home page.
Fix icon-font-path to bootstrap fonts.
Use @JsonIdentityInfo in Owner and Pet classes to prevent Stackoverflow exception when fetching owner data via Fusion endpoint (owner and pet reference each other).
Add FindOwnersView, OwnerDetailsView and OwnersListView. OwnerDetailsView is still WIP.
This prevents "Already had POJO for id" errors when trying to modify/save Owner (via Fusion endpoint) which has a reference to pets.
Add names for routes and use `router.urlForName()` instead of `router.urlForPath()` to simplify getting URLs for to routes.
Add routes for edit-owner, add-pet, edit-pet and add-visit views (not yet implemented).
Just using a basic template based on the original Thymeleaf template for now without added styles.
frontend/index.ts Show resolved Hide resolved
frontend/views/error-view.ts Show resolved Hide resolved
frontend/views/main-layout.ts Outdated Show resolved Hide resolved
frontend/views/owners/create-or-update-owner-view.ts Outdated Show resolved Hide resolved
frontend/views/owners/owners-list-view.ts Outdated Show resolved Hide resolved
frontend/views/vets-view.ts Outdated Show resolved Hide resolved
frontend/views/vets-view.ts Outdated Show resolved Hide resolved

constructor() {
super();
VetEndpoint.list().then(
Copy link
Collaborator

Choose a reason for hiding this comment

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

The endpoint calls are a bit inconsistent: some are in connectedCallbacks, some in firstUpdated, some in the constructor. Would be good to have them consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess connectedCallback would be a good default (when immediately loading data) unless there's a good reason to use something else in a specific case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use connectedCallback() for all other similar cases except for one in owners-list-view.ts where we need onBeforeEnter() to be able to use a router redirect in one case.

frontend/views/vets-view.ts Show resolved Hide resolved
Copy link
Collaborator

@marcushellberg marcushellberg 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 to me

frontend/views/owners/owners-list-view.ts Outdated Show resolved Hide resolved
frontend/views/vets-view.ts Outdated Show resolved Hide resolved

constructor() {
super();
VetEndpoint.list().then(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed.

frontend/views/vets-view.ts Show resolved Hide resolved
- Get rid of unnecessary processing of `router.location` here. The initial value for the last name comes via attribute when needed (from `OwnersListView`).
- Use a change event listener to update a `lastName` property for reactive programming approach instead of using a `Ref` to get the value in `findOwner()`.
- Only add the `lastName` search parameter to the `targetUrl` when `lastName` is not empty (cleaner URL after navigation in this case).
@Haprog
Copy link
Contributor Author

Haprog commented Sep 29, 2021

@marcushellberg I pushed couple of last updates that I didn't have time to finish yesterday. Now all of your comments should have been handled. Could you please review the new changes and check the couple of unresolved conversations above? I think this is starting to be ready to merge (then I'll do a new PR for the couple of views that still need to be implemented).

@Haprog Haprog merged commit fc22020 into main Sep 30, 2021
@Haprog Haprog deleted the fusion-views branch September 30, 2021 04:39
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.

2 participants