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: Migrate client plugin to NP. #59443

Merged
merged 11 commits into from
Mar 6, 2020

Conversation

walterra
Copy link
Contributor

@walterra walterra commented Mar 5, 2020

Summary

Part of #50902.

Migrates the client side plugin of transforms to NP.

  • Gets rid of the last parts of the shim (http, documentation links)
  • Moves the plugin from x-pack/legacy/plugins/transform/public to x-pack/plugins/transform
  • Creates a custom mock for appDependencies based on NP services
  • Fixes jest tests to get rid of all act() related warnings

Not for kibana-design team: You got pinged here but SCSS files were only moved, not edited.

Checklist

For maintainers

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

Copy link
Contributor

@joshdover joshdover left a comment

Choose a reason for hiding this comment

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

Should licensing affect whether or not this Management app is displayed? I don't see any licensing checking code here.

import { textService } from './app/services/text';

export interface PluginsDependencies {
data: any;
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI you can get the type for this from src/plugins/data/public

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed in abefad6.

Comment on lines 37 to 40
const startServices = await getStartServices();
const [core, plugins] = startServices;
const { chrome, docLinks, uiSettings, savedObjects, overlays } = core;
const { data } = plugins as PluginsDependencies;
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI if you add a type parameter to CoreSetup on line 23, you can remove the typecast on line 40: CoreSetup<PluginDependencies>

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 893275b.

@walterra
Copy link
Contributor Author

walterra commented Mar 6, 2020

@joshdover I copied the behavior from the snapshot_restore plugin to be in line with other plugins in the Elasticsearch section on the management page: The menu item will always be shown but you'll get an error message on the page itself:

image

That code was already in place and no changes were needed for this cut-over PR.

@walterra walterra requested a review from sebelga March 6, 2020 11:40
import { resolve } from 'path';

import { PLUGIN } from './common/constants';

export function transform(kibana: any) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@joshdover is this index.ts file still needed after cutover to x-pack/plugins?

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 @sebelga can also chime in on this one. I based that off the structure of the index_management plugin which also has this one file left in legacy.

Copy link
Contributor

Choose a reason for hiding this comment

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

I had to leave that file in the legacy folder so dependant plugins still in the legacy world that read the configuration would not complain.

If there aren't any plugin the the "legacy" folder that read the transform plugin config, this file should not be needed.

@peteharverson
Copy link
Contributor

When running with a base path, I see the following error:

image

@walterra
Copy link
Contributor Author

walterra commented Mar 6, 2020

@peteharverson basePath issue fixed in d759ac9.

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested and LGTM

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.

Added a comment, but on the whole LGTM

savedObjects: CoreStart['savedObjects'];
overlays: CoreStart['overlays'];
}

let DependenciesContext: React.Context<AppDependencies>;

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

Choose a reason for hiding this comment

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

this doesn't appear to be being used other than to set basePath in the dependency cache, which could be just deps.http.basePath

autocomplete: deps.plugins.data.autocomplete,
docLinks: deps.core.docLinks,
autocomplete: deps.data.autocomplete,
docLinks: deps.docLinks,
basePath: legacyBasePath as any,
Copy link
Member

Choose a reason for hiding this comment

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

could this be deps.http.basePath?

@walterra
Copy link
Contributor Author

walterra commented Mar 6, 2020

@jgowdyelastic Thanks for the review! That legacy stuff for setDependenciesCache() is there because I'm reusing KqlQueryBar from the ML plugin. We're hopefully migrating soon to the now available kql query bar from kibana itself so this code will be gone ... so i'm leaving it as is in this PR.

@walterra walterra merged commit f4f956d into elastic:master Mar 6, 2020
@walterra walterra deleted the ml-transform-client-np branch March 6, 2020 16:44
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

walterra added a commit that referenced this pull request Mar 7, 2020
Migrates the client side plugin of transforms to NP.
- Gets rid of the last parts of the shim (http, documentation links)
- Moves the plugin from x-pack/legacy/plugins/transform/public to x-pack/plugins/transform
- Creates a custom mock for appDependencies based on NP services
- Fixes jest tests to get rid of all act() related warnings
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 9, 2020
* master: (154 commits)
  Add an optional authentication mode for HTTP resources (elastic#58589)
  Implement embeddable drilldown menu options (elastic#59232)
  [Alerting] "Create alert" graph visualization design improvements (elastic#59399)
  Alerting update route throttle property is missing (elastic#59580)
  [SIEM] Adds 'Load prebuilt rules' Cypress test (elastic#59529)
  Show error if field is not found during filter rendering (elastic#59298)
  Navigate back to discover app during test, because the saved search from the preceding test has major performance problems when used with this test (elastic#59571)
  Check for alert dialog when doing a force logout (elastic#59329)
  ensure fs deletes are not cwd dependent (elastic#59570)
  Empty message for APM service map (elastic#59518)
  [Drilldowns] <ActionWizard/> Component (elastic#59032)
  [Reporting] Improve the page exit error messages (elastic#59351)
  Ensure logged out starting state for tests that need it (elastic#59322)
  Hide input value from kbn-config-schema error messages (elastic#58843)
  [ML] Transforms: Migrate client plugin to NP. (elastic#59443)
  [ML] Disable failing functional tests
  [SIEM] Update Timeline to use the latest euiFlyoutBody style (elastic#59524)
  Temporarily remove the project mappings for PR labels (elastic#59493)
  [Alerting] replace index threshold graph usage of watcher APIs with new API (elastic#59385)
  [ML] Show view series link in anomalies table for machine_learning_user role (elastic#59549)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants