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

[Ingest Manager] Show experimental packages by default #70997

Merged
merged 12 commits into from
Jul 8, 2020

Conversation

jen-huang
Copy link
Contributor

@jen-huang jen-huang commented Jul 7, 2020

Summary

Resolves #70026. Fixes #64981.

This PR enables experimental packages to be shown in Ingest Manager:

  • Adjusts the necessary typings to support registry /search endpoint spec done in Make release field available as part of /search endpoint package-registry#591
  • Adjusts /api/ingest_manager/epm/categories and /api/ingest_manager/epm/packages to pass through experimental: true param to corresponding registry endpoints
  • Always send experimental: true params on client-side to the Ingest Manager endpoints above ^
  • Adds badges and tooltips for Beta and Experimental packages to Integrations list and Integration detail pages

Also, some code clean up was done in Integrations section:

  • Removed unused component files
  • Restructured Integration details page code to use WithHeaderLayout to match rest of app
    • This cleanup also makes loading of details page much nicer - layout doesn't jump around
  • Adjusted misc components to match closer to design (centered package cards, version next to Add integration button, etc)
  • Moved all styled components to outside of function components so that they are not created dynamically each time (there were many console warnings about this)

Testing

  • Until the changes in Make release field available as part of /search endpoint package-registry#591 are deployed, you will need a local registry build that contains these changes
    • Without the above changes, you will not see Beta/Experimental badges on Integrations list page, but you will see the badge on Integration details page
    • With the above changes, you will see Beta/Experimental badges on Integrations list and Integration detail page
    • With or without the above changes, experimental packages will be shown everywhere

Screenshots

image

image

image

@jen-huang jen-huang self-assigned this Jul 7, 2020
@jen-huang jen-huang added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.9.0 v8.0.0 labels Jul 7, 2020
@jen-huang jen-huang marked this pull request as ready for review July 7, 2020 20:44
@jen-huang jen-huang requested a review from a team July 7, 2020 20:44
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@jen-huang jen-huang changed the title [WIP][Ingest Manager] Show experimental packages by default [Ingest Manager] Show experimental packages by default Jul 7, 2020
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@jfsiii jfsiii left a comment

Choose a reason for hiding this comment

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

The design changes are product/design's (@mostlyjason & @hbharding) call but the code/UX improvements LGTM.

@@ -61,7 +61,9 @@ export function EPMHomePage() {

function InstalledPackages() {
useBreadcrumbs('integrations_installed');
const { data: allPackages, isLoading: isLoadingPackages } = useGetPackages();
const { data: allPackages, isLoading: isLoadingPackages } = useGetPackages({
experimental: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this? Doesn't useGetPackages default to experimental: true?

If it's not doing anything different from the defaults, or the other calls without the argument, I'd like to remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this param will be needed when we switch to having a toggle/option to turn on experimental packages (#64869) instead of showing by default because we should always show all installed packages regardless of release type. I'd like to keep this param here as it would be easy to overlook the necessary behavior here when we remove experimental: true from useGetPackages

packageName: string,
internal: boolean = true
): Promise<RegistrySearchResult> {
export async function fetchFindLatestPackage(packageName: string): Promise<RegistrySearchResult> {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's add a second param, options which takes internal: boolean = true and experimental: boolean = true.

That way we can still have this behavior if called with only the package name, but still allow other options if desired.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

from what I saw in the code, the current usage of fetchFindLatestPackage implies finding the latest version given a package name regardless of if it's an internal package or experimental one. both internal and experimental always needs to be true to enable searching across all registry packages, so that's why I removed the existing internal param and didn't replace it with options

Comment on lines +80 to +85
const url = new URL(`${registryUrl}/categories`);
if (params) {
if (params.experimental) {
url.searchParams.set('experimental', params.experimental.toString());
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to skip the individual tests by passing a record to URLSearchParams like

Suggested change
const url = new URL(`${registryUrl}/categories`);
if (params) {
if (params.experimental) {
url.searchParams.set('experimental', params.experimental.toString());
}
}
const url = new URL(`${registryUrl}/categories`);
if (params) {
url.search = new URLSearchParams(params)
}

If we only want some properties from params we can filter them

Copy link
Contributor Author

@jen-huang jen-huang Jul 8, 2020

Choose a reason for hiding this comment

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

params.experimental comes in as a boolean. searchParams doesn't like that, hence the need for conversion to string with params.experimental.toString(). I think your suggestion would run into the same issue. this could be fixed by doing Object.entries(params).map() or similar to convert boolean values, but I'll defer this improvement for now as we're only dealing with one param here atm

@jen-huang jen-huang merged commit 90fb7a6 into elastic:master Jul 8, 2020
@jen-huang jen-huang deleted the ingest/epm-experimental branch July 8, 2020 18:06
jen-huang added a commit that referenced this pull request Jul 8, 2020
* Add beta and experimental badges to epm list and detail pages; clean up some epm components

* Clean up styled warnings

* Fix types

* Allow experimental query param to be passed through to registry /search

* Allow experimental query param to be passed through to registry /categories endpoint

* Fix buggy categories count (#64981)

* Always enable experimental packages and categories

* Handle long package names nicely; misc layout tweaks

* Move experimental=true flag to client side

* Prevent layout jumps even more

* Adjust beta/experimental badge tooltip copy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.9.0 v8.0.0
Projects
None yet
4 participants