-
Notifications
You must be signed in to change notification settings - Fork 39
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
🐛 only render archetypes with associated apps in filter #1609
Conversation
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.
Just hiding archetypes w/o dependencies seems weird. I'd rather see the error message be "No data available".
But....hub doesn't seem to like getting an empty application id list. And since the archetype filter is implemented by joining the application ids for the archetype selected, havinging the filter's getServerFilterValue
return []
doesn't work. Probably just give it something that will never work (like a "-1") and it'll be fine....
getServerFilterValue: (selectedOptions) => {
const a = selectedOptions
?.map((option) => archetypes.find((item) => item.name === option))
.filter(Boolean)
.flatMap(
({ applications }) =>
applications?.map(({ id }) => String(id)) ?? []
)
.filter(Boolean);
return a?.length === 0 ? ["-1"] : a;
},
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1609 +/- ##
=======================================
Coverage 39.24% 39.24%
=======================================
Files 146 146
Lines 4834 4834
Branches 1201 1201
=======================================
Hits 1897 1897
Misses 2836 2836
Partials 101 101
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
selectedOptions | ||
?.map((option) => archetypes.find((item) => item.name === option)) | ||
selectOptions: archetypes | ||
.filter(({ applications }) => applications && applications.length > 0) |
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.
This still filters out archetypes w/o applications. The hack in getServerFilterValue
allows selection of an "empty" archetype.
Signed-off-by: ibolton336 <[email protected]>
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
Thanks for making the change!
Resolves https://issues.redhat.com/browse/MTA-1791