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

🐛 only render archetypes with associated apps in filter #1609

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

ibolton336
Copy link
Member

Copy link
Member

@sjd78 sjd78 left a 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;
      },

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0f42c7e) 39.24% compared to head (43d6328) 39.24%.

❗ Current head 43d6328 differs from pull request most recent head 1e1f2ad. Consider uploading reports for the commit 1e1f2ad to get more accurate results

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           
Flag Coverage Δ
client 39.24% <ø> (ø)
server ∅ <ø> (∅)

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

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

selectedOptions
?.map((option) => archetypes.find((item) => item.name === option))
selectOptions: archetypes
.filter(({ applications }) => applications && applications.length > 0)
Copy link
Member

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.

Copy link
Member

@sjd78 sjd78 left a 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!

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