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

Creating Application doesn't work when a contributor is specified #1404

Closed
1 task done
sjd78 opened this issue Sep 27, 2023 · 0 comments · Fixed by #1408
Closed
1 task done

Creating Application doesn't work when a contributor is specified #1404

sjd78 opened this issue Sep 27, 2023 · 0 comments · Fixed by #1408
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@sjd78
Copy link
Member

sjd78 commented Sep 27, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Konveyor version

main

Priority

Critical

Current Behavior

Filling out the new applcation form and adding at least one contributor will cause the application not to be created.

The error toast message looks like this:

image

Expected Behavior

Create should work!

How Reproducible

Always (Default)

Steps To Reproduce

  1. Create a new application
  2. Add a contributor
  3. Click create

Environment

- OS:

Anything else?

This message is typical of passing a full object in the create payload instead of a Ref (just id and name) to the object.

@sjd78 sjd78 added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 27, 2023
@sjd78 sjd78 added this to Planning Sep 27, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in Planning Sep 27, 2023
@sjd78 sjd78 self-assigned this Sep 27, 2023
@sjd78 sjd78 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 27, 2023
@sjd78 sjd78 moved this from 🆕 New to 🏗 In progress in Planning Sep 27, 2023
sjd78 added a commit to sjd78/tackle2-ui that referenced this issue Sep 28, 2023
Followup konveyor#1404 to update the way tags are updated to an existing
application.  Tags that are from an analysis need to be included with
the update payload or they will be removed.  This is different behavior
from archetype or assessment tags.  No updates to an application can
remove archetype or assessment tags.

Summary of changes and refactoring:
  - As form values, keep the tags using just the tag name as a string
  - Moved all data access/mutation code to hook `useApplicationFormData()`
    to logically divide concerns (data access v. UI handling)
  - Tags dropdown will only display/edit the application's "Manual tags"
  - `onSubmit()`'s payload building simplified using partially curried
    helper functions
  - Migrate to use `ItemsSelect` for handling the Tags

Update `useUpdateApplicationMutation()` to provide the mutation's
payload to the `onSuccess()` function.  This allows the `onSuccess()`
function to toast a message with the application's name.

Add utility functions to `model-utils.tsx`:
  - convert objects that look like `Ref` object into exactly a `Ref` object:
    - toRef()
    - toRefs()

  - Match a set of items that look like `Ref` objects against a (set of)
    values and the matching matches as exactly `Ref` objects:
    items into exactly `Ref` objects:
    - matchItemsToRef()
    - matchItemsToRefs()

Signed-off-by: Scott J Dickerson <[email protected]>
sjd78 added a commit that referenced this issue Sep 28, 2023
### Contributors field
The `contributors` field on the `Application` 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 archetype-form to handle getting the
correct set of data.

Related changes (came up when working on #1331 that ended up revealing
#1404):
  - REST `createApplication()` function updated to have the proper return
    type (response data is not unwrapped)

  - Query `useCreateApplicationMutation()` updated to properly pass the
    newly created `Application` to the `onSuccess()` handler

  - `onCreateApplicationSuccess()` in the application form updated to use
    the correct `onSuccess()` response data

Resolves: #1404 

### Tags field
Followup #1403 to update the way tags are updated to an existing
application. Tags that are from an analysis need to be included with the
update payload or they will be removed. This is different behavior from
archetype or assessment sourced tags. No updates to an application can
remove archetype or assessment tags.

Summary of changes and refactoring:
  - As form values, keep the tags using just the tag name as a string
  - Moved all data access/mutation code to hook `useApplicationFormData()`
    to logically divide concerns (data access v. UI handling)
  - Tags dropdown will only display/edit the application's "Manual tags"
  - `onSubmit()`'s payload building simplified using partially curried
    helper functions
  - Migrate to use `ItemsSelect` for handling the Tags

Update `useUpdateApplicationMutation()` to provide the mutation's
payload to the `onSuccess()` function. This allows the `onSuccess()`
function to toast a message with the application's name.

Add utility functions to `model-utils.tsx`:
  - convert objects that look like `Ref` object into exactly a `Ref`
    object:
    - toRef()
    - toRefs()

  - Match a set of items that look like `Ref` objects against a (set of)
    values and return the matching items as exactly `Ref` objects:
    - matchItemsToRef()
    - matchItemsToRefs()

---------

Signed-off-by: Scott J Dickerson <[email protected]>
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Planning Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant