-
Notifications
You must be signed in to change notification settings - Fork 40
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
✨ Enhance tag handling on forms #1519
Conversation
8157f72
to
cb1190f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm couple nits
- Update api functions `createApplication` and `createArchetype` to take as input a `New<>` payload and return the newly created entity as a result. - Update query `useCreateApplicationMutation` to pass the proper values to the `onSuccess` and `onError` callbacks. - Update various fetch queries to return `isSuccess` so component code can ensure at least 1 successful fetch has happened before rendering data that depends on the fetch results. - Add query `useFetchTagsWithTagItems` as a convenience to get a full list of tags with tag category refs, and a `TagItemType` transform of the tags to be useful for display. Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Refactor `Autocomplete` and related - Use a complex object for its `options` and `selections` props. This allows for a richer experience with the typeahead component, select list, and selected label list. - Minimize the states in use and to replace `useEffect` in favor of `useMemo`. - An `AutocompleteOptionProp` allows rendering a name, a separate name in the selected label list, and a tooltip for the selected label. - Renamed `ItemsSelect` to `HookFormAutocomplete` since all it needs to do now is wrap a react-hook-form around an `Autocomplete` Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Tag fields will now: - Show the tag category and tag name together in the select list - Show the tag category and tag name on the selected label list - Provide a tooltip on the tag with the name of the tag's tag category This uses refactoring in `Autocomplete` to support keeping a complex `id` and `name` object in the form values. Default value and `onValidSubmit` payload building have been updated as needed. Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Upgrade handling of Stakeholders and Stakeholder Groups with `Autocomplete` to: - use Ref as the form value type and default values - make sure only Ref values get put in the assessment payload - transform full data objects into items specifically formatted for use by Autocomplete Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
c9a4428
to
4a55766
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1519 +/- ##
==========================================
- Coverage 40.82% 40.71% -0.11%
==========================================
Files 145 145
Lines 4576 4588 +12
Branches 1073 1076 +3
==========================================
Hits 1868 1868
- Misses 2696 2706 +10
- Partials 12 14 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Summary
Enhance tag handling on forms to:
Resolves: https://issues.redhat.com/browse/MTA-1533
Details
Enhance Tag handling on Application form, Tag and Stakeholder handling on Archetype form, and Stakeholder handling on Assessment Wizard
Tag fields will now:
TagItemType
Ref
values get put in the assessment payloadTagItemType[]
provided by a new query for the list of options to work withStakeholders and Stakeholder Groups fields will now:
Ref
as the form value type and default valuesRef
values get put in the assessment payloadAutocomplete
This uses refactoring in
Autocomplete
to support keeping a complex id and name object in the form values.Form value types, default value calculations, and
onValidSubmit
payload building have been updated as needed. Form values are using complex objects with at least{ id, name }
data. Default values can push any objects that match the minimum form value complex object type. The payload builds make sure that the form values are converted to exactly aRef
object to satisfy hub's strict data marshaling.Refactor
Autocomplete
andHookFormAutocomplete
Use a complex object for its
options
andselections
props. This allows for a richer experience with the typeahead component, select list, and selected label list.Minimize the states in use and to replace
useEffect
in favor ofuseMemo
.An
AutocompleteOptionProp
allows rendering a name, a separate name in the selected label list, and a tooltip for the selected label.Renamed
ItemsSelect
toHookFormAutocomplete
since all it needs to do now is wrap a react-hook-form around an AutocompleteUpdate application and archetype rest api functions and queries
Update api functions
createApplication
andcreateArchetype
to take as input aNew<>
payload and return the newly created entity as a result.Update query
useCreateApplicationMutation
to pass the proper values to theonSuccess
andonError
callbacks.Update various fetch queries to return
isSuccess
so component code can ensure at least 1 successful fetch has happened before rendering data that depends on the fetch results.Add query
useFetchTagsWithTagItems
as a convenience to get a full list of tags with tag category refs, and aTagItemType
transform of the tags to be useful for display.Screen Shots
Manual Tags select list on Application Create:
Manual Tags showing existing selected tags:
Update Archetype form with existing selections for Criteria tags, Archetype Tags, Stakeholder(s) and Stakeholder Group(s) and a mouse hover on a selected criteria tag showing the tooltip: