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

[Fleet] IngestManager Plugin interface for registering UI extensions #82783

Conversation

paul-tavares
Copy link
Contributor

@paul-tavares paul-tavares commented Nov 5, 2020

Summary

  • Introduces a new Plugins#start interface for registering Fleet UI extensions (removes prior single-purpose method)
  • Introduces 3 extension points that can be registered:
    • Integration (Package) detail custom view (note: use of this extension point is not yet implemented)
    • Integration Policy Edit view and
    • Integration Policy Create view.
  • Refactors the existing Endpoint (Security Solution) ui extension to use this new approach

closes #82478

Checklist

Delete any items that are not applicable to this PR.

@paul-tavares paul-tavares added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Endpoint Elastic Endpoint feature Team:Fleet Team label for Observability Data Collection Fleet team v7.11.0 Team:Defend Workflows “EDR Workflows” sub-team of Security Solution labels Nov 5, 2020
@paul-tavares paul-tavares self-assigned this Nov 5, 2020
…gest-ui-extension-registration

# Conflicts:
#	x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/create_package_policy_page/step_configure_package.tsx
…gest-ui-extension-registration

# Conflicts:
#	x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/custom_package_policy.tsx
#	x-pack/plugins/fleet/public/index.ts
#	x-pack/plugins/fleet/public/plugin.ts
#	x-pack/plugins/security_solution/public/common/mock/endpoint/dependencies_start_mock.ts
#	x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/endpoint_policy_edit_extension.tsx
@paul-tavares paul-tavares force-pushed the task/olm-82478-ingest-ui-extension-registration branch from a3380c7 to 77250da Compare November 10, 2020 14:00
Copy link
Contributor

@jen-huang jen-huang left a comment

Choose a reason for hiding this comment

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

The overall architecture looks good and makes sense. I left comments on some areas of concern that I spotted, happy to have discussions for any of them!

x-pack/plugins/fleet/common/types/ui_extensions.ts Outdated Show resolved Hide resolved
x-pack/plugins/fleet/common/types/ui_extensions.ts Outdated Show resolved Hide resolved
x-pack/plugins/fleet/common/types/ui_extensions.ts Outdated Show resolved Hide resolved
@@ -55,6 +63,10 @@ export const StepConfigurePackagePolicy: React.FunctionComponent<{
validationResults,
submitAttempted,
}) => {
const hasUiExtension =
useUIExtension(packageInfo.name, 'integration-policy', from === 'edit' ? 'edit' : 'create') !==
undefined;

This comment was marked as resolved.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it will be a boolean. It's the result of something !== undefined, which should be a boolean.

Copy link
Contributor

Choose a reason for hiding this comment

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

doh 🤦🏻‍♀️ I read it as a nested ternary

Copy link
Member

Choose a reason for hiding this comment

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

good case for replacing the shorthand, if it's initially hard to parse scrolling through

Comment on lines 334 to 348
const { registerExtension } = plugins.ingestManager;

registerExtension({
integration: 'endpoint',
type: 'integration-policy',
view: 'edit',
component: LazyEndpointPolicyEditExtension,
});

registerExtension({
integration: 'endpoint',
type: 'integration-policy',
view: 'create',
component: LazyEndpointPolicyCreateExtension,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

nice 👍🏻

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

Tested locally works as expected, looks good to me 🚀

Copy link
Contributor

@jen-huang jen-huang left a comment

Choose a reason for hiding this comment

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

One minor comment but otherwise LGTM. Thanks for making the review changes; this is a great foundation for all the extensions to come. Nice work!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ingestManager 407 410 +3
securitySolution 2068 2071 +3
total +6

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
ingestManager 1.1MB 1.1MB +4.2KB
securitySolution 7.8MB 7.9MB +87.3KB
total +91.5KB

Distributable file count

id before after diff
default 42775 42784 +9

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
ingestManager 386.2KB 384.6KB -1.6KB
securitySolution 243.6KB 163.5KB -80.0KB
total -81.6KB
Unknown metric groups

async chunk count

id before after diff
securitySolution 8 11 +3

History

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

@paul-tavares paul-tavares removed the request for review from jfsiii November 12, 2020 16:03
Copy link
Member

@pzl pzl left a comment

Choose a reason for hiding this comment

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

looks good, nothing left to say but nits :shipit:

@paul-tavares paul-tavares merged commit 1babb5f into elastic:master Nov 12, 2020
@paul-tavares paul-tavares deleted the task/olm-82478-ingest-ui-extension-registration branch November 12, 2020 16:44
paul-tavares added a commit to paul-tavares/kibana that referenced this pull request Nov 12, 2020
…lastic#82783)

* Expose `registerExtension()` interface on `Plugin#start`
* Refactor use of `CustomConfigurePackagePolicy` to the new registerExtension approach
* Refactor to always show registered ui extension (even if Integration has configuration options)
gmmorris added a commit to gmmorris/kibana that referenced this pull request Nov 12, 2020
* master:
  [ML] Update apidoc config with the Trained models endpoints  (elastic#83274)
  [Fleet] IngestManager Plugin interface for registering UI extensions (elastic#82783)
  [Alerting] Moves the Index & Geo Threshold UIs into the Stack Alerts Public Plugin (elastic#82951)
paul-tavares added a commit that referenced this pull request Nov 12, 2020
…82783) (#83307)

* Expose `registerExtension()` interface on `Plugin#start`
* Refactor use of `CustomConfigurePackagePolicy` to the new registerExtension approach
* Refactor to always show registered ui extension (even if Integration has configuration options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Endpoint Elastic Endpoint feature release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Team:Fleet Team label for Observability Data Collection Fleet team v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Support for UI Extension Points
8 participants