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

[SIEM] Move public to new platform #48840

Merged
merged 5 commits into from
Oct 22, 2019

Conversation

XavierM
Copy link
Contributor

@XavierM XavierM commented Oct 21, 2019

Summary

We moved SIEM public into the New platform shim

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@elasticmachine
Copy link
Contributor

Pinging @elastic/siem (Team:SIEM)

@XavierM XavierM added the release_note:skip Skip the PR/issue when compiling release notes label Oct 21, 2019
@elastic elastic deleted a comment from elasticmachine Oct 22, 2019
@elastic elastic deleted a comment from elasticmachine Oct 22, 2019
@spong

This comment has been minimized.

signal: AbortSignal
): Promise<Anomalies> => {
const [kbnVersion] = useKibanaUiSetting(DEFAULT_KBN_VERSION);
Copy link
Member

Choose a reason for hiding this comment

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

The first rule of Hooks Club is Don’t call Hooks from regular JavaScript functions...

We've got eslint-plugin-react-hooks -- any idea why wasn't this caught?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope no idea

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe because useKibanaUISetting is not ordinary hook

Copy link
Contributor Author

@XavierM XavierM Oct 22, 2019

Choose a reason for hiding this comment

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

oh I know why it was working before because we were importing the npStart to get the uiSettings but now we are using the useKibanaCore and useKibanaPlugins hooks so that's why this error came up. So before it was not a real hook, it was working like a get for a config file.

@@ -189,7 +178,6 @@ export const stopDatafeeds = async ({
'kbn-system-api': 'true',
'content-type': 'application/json',
'kbn-xsrf': kbnVersion,
Copy link
Member

Choose a reason for hiding this comment

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

No need to add now (as it's been missed before), but looks like these two API calls are the only ones missing the 'kbn-version': kbnVersion header. We're fine with just `'kbn-xsrf', but should probably be there for consistency with the others. Can refactor remainder in the next NP PR when this all changes again anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we should just create a generic function to build these headers everywhere.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@spong spong left a comment

Choose a reason for hiding this comment

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

Checked out, tested locally and code reviewed. Thanks for making the additional changes from comments as well. LGTM once CI is green. 👍

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@XavierM XavierM merged commit d4d3457 into elastic:master Oct 22, 2019
XavierM added a commit to XavierM/kibana that referenced this pull request Oct 22, 2019
* shim public new platform

* fix import

* fix ml api with kbn version

* review I

* fix bad coding with the hooks
XavierM added a commit to XavierM/kibana that referenced this pull request Oct 22, 2019
* shim public new platform

* fix import

* fix ml api with kbn version

* review I

* fix bad coding with the hooks
XavierM added a commit that referenced this pull request Oct 22, 2019
* shim public new platform

* fix import

* fix ml api with kbn version

* review I

* fix bad coding with the hooks
spong pushed a commit that referenced this pull request Oct 22, 2019
* shim public new platform

* fix import

* fix ml api with kbn version

* review I

* fix bad coding with the hooks
Copy link
Contributor

@rudolf rudolf left a comment

Choose a reason for hiding this comment

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

Searching in plugins/siem there's still 75 files with ui/* imports. Most of these are ui/chrome which you can replace with the NP API's: https://github.com/elastic/kibana/blob/master/src/core/MIGRATION_EXAMPLES.md#L354

this.chrome = chrome;
}

public start(start: StartObject): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

NP will inject two parameters here instead of an object: public start(coreStart: LegacyCoreStart, plugins: PluginsStart)

@@ -31,8 +31,9 @@ type GenericValue = string | boolean | number;
* because the underlying `UiSettingsClient` doesn't support that.
*/
export const useKibanaUiSetting = (key: string, defaultValue?: GenericValue) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not necessary for NP migration, but you could adopt some of the utilities from kibana_react instead of maintaining your own https://github.com/elastic/kibana/blob/master/src/plugins/kibana_react/README.md

@rudolf
Copy link
Contributor

rudolf commented Oct 23, 2019

you can also remove the dependency on 'ui/saved_objects/components/saved_object_finder' by importing src/plugins/kibana_react/public/saved_objects/saved_object_finder.tsx

@spong spong mentioned this pull request Oct 31, 2019
26 tasks
@XavierM XavierM deleted the siem-public-new-platform branch June 4, 2020 16:22
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:SIEM v7.5.0 v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants