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

🐛 Business services: Fix create/edit when owner is included #1418

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

sjd78
Copy link
Member

@sjd78 sjd78 commented Sep 29, 2023

The owner field on the BusinessService payload needs to be a pure Ref object or it will be rejected by the REST API call. Adopt the same set of data transforms used in the application-form to handle getting the correct set of data.

Related changes:

  • Business services related REST API functions updated to have the correct response types

  • Business services queries updated to pass REST API response and input values to onSuccess() and onError() handlers

  • BusinessServiceForm updated to use mutation response data to display the name of the business service in success messages

  • Refactored business-service-form.tsx to move all data access/mutation code to hook `useApplicationFormData() to logically divide concerns (data access v. UI handling)

Resolves: https://issues.redhat.com/browse/MTA-1346

The `owner` field on the `BusinessService` payload needs to be a pure
`Ref` object or it will be rejected by the REST API call.  Adopt the
same set of data transforms used in the application-form to handle
getting the correct set of data.

Related changes:
  - Business service related REST API functions updated to have the
    correct response types

  - Business service queries updated to pass REST API response and
    input values to `onSuccess()` and `onError()` handlers

  - `BusinessServiceForm` updated to use mutation response data to
    display the name of the business service in success messages

  - Refactored `business-service-form.tsx` to move all data
    access/mutation code to hook `useApplicationFormData() to logically
    divide concerns (data access v. UI handling)

Resolves: https://issues.redhat.com/browse/MTA-1346

Signed-off-by: Scott J Dickerson <[email protected]>
@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (76a2645) 41.24% compared to head (6da1079) 41.25%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1418   +/-   ##
=======================================
  Coverage   41.24%   41.25%           
=======================================
  Files         138      138           
  Lines        4347     4349    +2     
  Branches     1005     1005           
=======================================
+ Hits         1793     1794    +1     
- Misses       2542     2543    +1     
  Partials       12       12           
Flag Coverage Δ
client 41.25% <33.33%> (+<0.01%) ⬆️
server ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
client/src/app/api/models.ts 100.00% <ø> (ø)
client/src/app/api/rest.ts 49.71% <58.33%> (+<0.01%) ⬆️
client/src/app/queries/businessservices.ts 30.76% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

obj: BusinessService
): Promise<BusinessService> => axios.put(`${BUSINESS_SERVICES}/${obj.id}`, obj);
export const updateBusinessService = (obj: BusinessService) =>
axios.put<void>(`${BUSINESS_SERVICES}/${obj.id}`, obj);
Copy link
Member

Choose a reason for hiding this comment

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

I like the void callout here. Not sure why we were pretending to get something useful back before.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll be revisiting all of the rest functions soon in a similar way.

@ibolton336
Copy link
Member

Tested and LGTM!

@ibolton336 ibolton336 merged commit 8130ba2 into konveyor:main Sep 29, 2023
6 checks passed
@sjd78 sjd78 deleted the business_service_owner branch September 29, 2023 19:37
@ibolton336
Copy link
Member

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