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

「AppArch」Interpreter 👉 New Platform #39329

Merged
merged 45 commits into from
Jul 2, 2019
Merged

「AppArch」Interpreter 👉 New Platform #39329

merged 45 commits into from
Jul 2, 2019

Conversation

streamich
Copy link
Contributor

@streamich streamich commented Jun 20, 2019

Summary

This moves about half of the Interpreter plugin to new platform.

Interpreter has two major parts: (1) registries; (2) the run() function. This PR moves the registries to the NP, a subsequent PR will move the run function.

Checklist

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

For maintainers

@streamich streamich requested a review from a team as a code owner June 20, 2019 09:42
@streamich streamich requested a review from ppisljar June 20, 2019 09:42
@streamich streamich added the release_note:skip Skip the PR/issue when compiling release notes label Jun 20, 2019
@elastic elastic deleted a comment from elasticmachine Jun 20, 2019
@elastic elastic deleted a comment from elasticmachine Jun 20, 2019
@streamich
Copy link
Contributor Author

streamich commented Jun 20, 2019

Error when running yarn test:browser --force.

  {
    "message": "Uncaught TypeError: Cannot read property 'plugin' of undefined\nat http://localhost:5610/bundles/tests.bundle.js:282524:12\n\nTypeError: Cannot read property 'plugin' of undefined\n    at http://localhost:5610/bundles/tests.bundle.js:282524:12",
    "str": "Uncaught TypeError: Cannot read property 'plugin' of undefined\nat http://localhost:5610/bundles/tests.bundle.js:282524:12\n\nTypeError: Cannot read property 'plugin' of undefined\n    at http://localhost:5610/bundles/tests.bundle.js:282524:12"
  }

Contents of test bundle:

image


Above error is caused when NP plugin imports from '@kbn/interpreter/common', thus the import in this PR is changed to '@kbn/interpreter/target/common'. @spalger to investigate the cause.

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch

@elastic elastic deleted a comment from elasticmachine Jun 21, 2019
@elastic elastic deleted a comment from elasticmachine Jun 21, 2019
@elastic elastic deleted a comment from elasticmachine Jun 21, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@spalger
Copy link
Contributor

spalger commented Jun 21, 2019

Please re-request review once this is ready

@spalger spalger removed the request for review from a team June 21, 2019 19:14
@elastic elastic deleted a comment from elasticmachine Jun 27, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💔 Build Failed


export function interpreterProvider(config) {
Copy link
Contributor

Choose a reason for hiding this comment

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

another problem with any - I often don't understand it is just a temporary mock or I can use any for real

@elastic elastic deleted a comment from elasticmachine Jul 1, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@streamich streamich changed the title Interpreter 👉 New Platform 「AppArch」Interpreter 👉 New Platform Jul 1, 2019
Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

LGTM, things seem to work well and requested changes are addressed!

@eliperelman eliperelman self-requested a review July 1, 2019 22:04
Copy link
Member

@ppisljar ppisljar 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

Copy link
Contributor

@mshustov mshustov left a comment

Choose a reason for hiding this comment

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

agreed to unify Setup & Start Interfaces in followup

@streamich streamich merged commit f18e743 into elastic:master Jul 2, 2019
* under the License.
*/

export const mockNewPlatformBackdoor = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The name and location of this file suggests that it's a generic New Platform mock so other developers might also use this in their tests although the plugins.data mock is very specific to your unit tests. We'd rather want them to use #39351

Can you move this mock file into your plugin so that the code is more local?

Optional: Use / adapt #39351 for your tests. You'll have to add an empty plugins mock to https://github.com/elastic/kibana/pull/39351/files#diff-a0d66a99cc197c9ae8a0956f8df3bbdeR28

and then in your tests:

import { pluginsMock } from '../../../../../../../../core/public/ui_new_platform.test.mocks';
pluginsMock.mockReturnValue({
 data: {
   expressions: {...}
}    

Copy link
Contributor Author

@streamich streamich Jul 2, 2019

Choose a reason for hiding this comment

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

Created PR #40123 to address this.

streamich added a commit that referenced this pull request Jul 8, 2019
* 「AppArch」Interpreter 👉 New Platform (#39329)

* feat: 🎸 set-up NP data plugin

* refactor: 💡 move interpreter functions registry to NP

* refactor: 💡 move interpreter renderer registry to NP plugin

* refactor: 💡 move interpreter typesRegistry to NP

* refactor: 💡 move interpreter types to NP

* chore: 🤖 import typeRegistry from NP and change TS type folder

* refactor: 💡 move interpreter expression types to NP

* refactor: 💡 move rest of interpreter common folder to NP plugin

* fix: 🐛 fix TypeScript errors

* test: 💍 improve typings and test mocks

* refactor: 💡 make Interpreter internal registry impl private

* test: 💍 inline NP backdoor mock creation in test suites

* chore: 🤖 change @kbn/interpreter import paths to try fix errors

* fix: 🐛 improve core Plugin interfaces

* feat: 🎸 add stop() lifecycle to NP data plugins

* refactor: 💡 move interpreter into expressions service data NP

* refactor: 💡 inline Registry @kbn/interpreter class

* refactor: 💡 remove dependency on @kbn/interpreter in data pub

* refactor: 💡 move interpreter common dir into expressions dir

* fix: 🐛 use TS types in kibana_context

* feat: 🎸 add types suggested in PR review

* feat: 🎸 add semantic interpreter registration functions

* refactor: 💡 use require for all @kbn/interpreter imports

* test: 💍 add Karma test mocks, thx @spalger 🙏

* docs: ✏️ update Core docs

* test: 💍 add Sinon stubs for registries

* chore: 🤖 change import syntax in hopes CI will work

* chore: 🤖 set App Architecture as owners of data plugin

* docs: ✏️ add README

* chore: 🤖 change import in hopes to fix optimizer

* fix: 🐛 make stop() plugin life-cycle optional

* docs: ✏️ update Core API docs

* test: 💍 remove unnecessary Jest mock

* chore: 🤖 don't import from deeply inside a plugin

* refactor: 💡 try different interpreter import

* fix: 🐛 fix Karma mocking

* fix: 🐛 fix TypeScript type imports

* test: 💍 fix broken test

* fix: 🐛 use "kibana" version to make it work everywhere

* style: 💄 fix linter error
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 review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants