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

[ML] Transforms: NP ui/imports migration #58469

Merged
merged 11 commits into from
Feb 28, 2020

Conversation

walterra
Copy link
Contributor

@walterra walterra commented Feb 25, 2020

Summary

Part of #50902.

  • Migrates ui/* imports to NP.
  • Uses direct React mounting instead of Angular.
  • Service Cleanup.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@walterra walterra added :ml v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Transforms ML transforms Feature:NP Migration v7.7.0 labels Feb 25, 2020
@walterra walterra self-assigned this Feb 25, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@walterra walterra marked this pull request as ready for review February 25, 2020 18:51
@walterra walterra requested a review from a team as a code owner February 25, 2020 18:51
Copy link
Contributor

@sebelga sebelga left a comment

Choose a reason for hiding this comment

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

Great work! Code looks good to me. I really like how you import doc links through hooks instead of a documentation service! We'll get inspired by it in our apps 😊

@@ -5,8 +5,9 @@
*/

import React, { useContext, FC } from 'react';
import { unmountComponentAtNode } from 'react-dom';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: you could add the import inside the line below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 299f912.

@@ -29,9 +29,9 @@ export function getDiscoverUrl(indexPatternId: string, baseUrl: string): string
}

export const RedirectToTransformManagement: FC = () => (
<Redirect from={`${CLIENT_BASE_PATH}`} to={`${CLIENT_BASE_PATH}/${SECTION_SLUG.HOME}`} />
<Redirect from={`${CLIENT_BASE_PATH}`} to={`${CLIENT_BASE_PATH}${SECTION_SLUG.HOME}`} />
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: as there is not string character, it could simply be

from={CLIENT_BASE_PATH} to={CLIENT_BASE_PATH + SECTION_SLUG.HOME}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 299f912.

message,
} = error.data;
const errorMessage =
error?.message !== undefined ? error.message : JSON.stringify(error, null, 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could be written error?.message ?? JSON.stringify(error, null, 2);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 299f912.

text: toMountPoint(<ToastNotificationText text={e} />),
text: toMountPoint(
<ToastNotificationText
text={e.message !== undefined ? e.message : JSON.stringify(e, null, 2)}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could be written e.message ?? JSON.stringify(e, null, 2)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 299f912.

@walterra
Copy link
Contributor Author

@joshdover any hints how I could migrate away from chrome.getXsrfToken()?

@@ -61,7 +58,7 @@ export const KibanaProvider: FC<Props> = ({ savedObjectId, children }) => {
const kibanaContext: InitializedKibanaContextValue = {
indexPatterns,
initialized: true,
kbnBaseUrl: npStart.core.injectedMetadata.getBasePath(),
kbnBaseUrl: appDeps.core.injectedMetadata.getBasePath(),
Copy link
Member

Choose a reason for hiding this comment

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

basePath can be got from http, i believe injectedMetadata is deprecated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 5757826.

@@ -124,6 +103,7 @@ export function createPublicShim(): { core: Core; plugins: Plugins } {
uiMetric: {
createUiStatsReporter,
},
xsrfToken: chrome.getXsrfToken(),
Copy link
Member

Choose a reason for hiding this comment

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

ML will soon be replacing our http service with kibana's core http client to remove the need of this token.

let DependenciesContext: React.Context<AppDependencies>;

const setAppDependencies = (deps: AppDependencies) => {
const legacyBasePath = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Running Kibana with a base path, I am seeing this error:

image

and I see a 404 in the console which shows a doubling up of the base path kch
GET http://localhost:5601/kch/kch/api/transform/privileges 404 (Not Found)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in aa8535b.

@walterra walterra requested a review from pgayvallet February 27, 2020 16:14
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

Code LGTM

@walterra walterra merged commit 8f9004b into elastic:master Feb 28, 2020
@walterra walterra deleted the ml-tranforms-deprecate-ui-imports branch February 28, 2020 13:28
walterra added a commit to walterra/kibana that referenced this pull request Feb 28, 2020
- Migrates ui/* imports to NP.
- Uses direct React mounting instead of Angular.
- Service Cleanup.
walterra added a commit that referenced this pull request Feb 28, 2020
- Migrates ui/* imports to NP.
- Uses direct React mounting instead of Angular.
- Service Cleanup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:NP Migration Feature:Transforms ML transforms :ml release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants