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

[EPM] Share package icon location hook #62072

Merged
merged 5 commits into from
Apr 3, 2020

Conversation

jfsiii
Copy link
Contributor

@jfsiii jfsiii commented Mar 31, 2020

Summary

Moved the hook which determines the icon to show for a package to top-level hooks so it can be shared by other components.

Removed code to call HTTP API if an icon couldn't be found.

See commit messages for more information.

Current

Screen Shot 2020-03-31 at 4 33 58 PMScreen Shot 2020-03-31 at 4 34 30 PMScreen Shot 2020-03-31 at 4 35 38 PM

PR

Screen Shot 2020-03-31 at 4 33 25 PMScreen Shot 2020-03-31 at 4 33 01 PMScreen Shot 2020-03-31 at 4 36 07 PM

John Schulz added 2 commits March 31, 2020 16:25
Export the hook used by PackageIcon component.

Removed HTTP API call. `icons` comes from the API, so we don't want to call the API again.
@jfsiii jfsiii marked this pull request as ready for review March 31, 2020 20:49
@jfsiii jfsiii requested a review from a team March 31, 2020 20:49
@jfsiii jfsiii self-assigned this Mar 31, 2020
@jfsiii jfsiii added the Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project label Apr 1, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Feature:EPM)

@jfsiii jfsiii added release_note:skip Skip the PR/issue when compiling release notes v7.8.0 v8.0.0 labels Apr 1, 2020
Copy link
Contributor

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

Question: I see that the API call was removed - will this component still display the correct/expected icon in cases where this it is used with only props packageName and version? (this is (was?) the case in the Agent Config > Datasources list)

@jfsiii
Copy link
Contributor Author

jfsiii commented Apr 1, 2020

@paul-tavares thanks for the context about the API call. I thought it was from the time when registry only gave icon paths for /search but not /package (or vice versa?). I'll look at config > datasources list and adjust

@paul-tavares
Copy link
Contributor

np @jfsiii - it was one of my last contributions to Ingest, so its still fresh in my mind 😃 .
you might still see an icon in the datasouces table, but it might not be the expected one (it might be the one from Eui logo*;

@jfsiii
Copy link
Contributor Author

jfsiii commented Apr 1, 2020

@paul-tavares Do you mean these views?

Screen Shot 2020-04-01 at 2 32 49 PM

Screen Shot 2020-04-01 at 2 33 28 PM

If so, things look good to me. IIUC those views use useGetPackages and useGetPackageInfoByKey to hit EPM's API, so it has icons property

@paul-tavares
Copy link
Contributor

paul-tavares commented Apr 2, 2020 via email

@jfsiii
Copy link
Contributor Author

jfsiii commented Apr 2, 2020

@paul-tavares I was trying to show that activemq, cockroachdb, and other integrations without EUI logos work.

However, it seems to only occur if you've gone through the setup. Hard refresh or starting on that view uses default icon.

I'll update the code one way or another and ping you after.

@paul-tavares
Copy link
Contributor

@jfsiii ahhh. sorry about that - did not realize that was the intent 😄
Yeah, that makes sense - if you go through the setup (or add datasource flow) at least once, the icons will be loaded using the icons object and cached, so subsequent uses will just use the cached value.

John Schulz added 2 commits April 2, 2020 17:35
Trusts given values by default but can opt-in to side-effects like calling API. Prevents trying API when we know none are present (api explicitly returns none).

This also fixes the issue in master where the API was called several times for each item in the datasources list.
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

Copy link
Contributor

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@jfsiii jfsiii merged commit 84867f0 into elastic:master Apr 3, 2020
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 7, 2020
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 62072 or prevent reminders by adding the backport:skip label.

jfsiii pushed a commit that referenced this pull request Apr 8, 2020
* EPM detail page now uses same icon as list page.
* Moved hook from ./components to ./hooks
* Add optional `tryApi` param to `<PackageIcon>`

Trusts given values by default but can opt-in to side-effects like calling API. Prevents trying API when we know none are present (api explicitly returns none).

This also fixes the issue in master where the API was called several times for each item in the datasources list.
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 8, 2020
@jen-huang jen-huang added the Team:Fleet Team label for Observability Data Collection Fleet team label Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants