-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Watcher] New Platform (NP) Migration #50908
Conversation
Still need to switch to np ready version of use_request
…her [skip ci] * upstream/master: (54 commits) allows plugins to define validation schema for "enabled" flag (elastic#50286) Add retry to find.existsByDisplayedByCssSelector (elastic#48734) [i18n] integrate latest translations (elastic#50864) ui/resize_checker 👉 src/plugins/kibana_utils (elastic#44750) Fix @reach/router types (elastic#50863) [ML] Adding ML node warning to overview and analytics pages (elastic#50766) Bump storybook dependencies (elastic#50752) [APM Replace usage of idx with optional chaining (elastic#50849) [SIEM] Fix eslint errors (elastic#49713) Improve "Browser client is out of date" error message (elastic#50296) [SIEM][Detection Engine] REST API improvements and changes from UI/UX feedback (elastic#50797) Move @kbn/es-query into data plugin - es-query folder (elastic#50182) Index Management new platform migration (elastic#49359) Increase retry for cloud snapshot to finish (elastic#50781) Removing EuiCode from inside EuiPanel (elastic#50683) [SIEM] Tests for search_after and bulk index (elastic#50129) Make babel understand TypeScript 3.7 syntax (elastic#50772) Fixing mocha tests and broken password change status codes (elastic#50704) [Canvas] Use compressed forms in sidebar (elastic#49419) Add labels to shell scripts in Jenkins (elastic#49657) ...
- Some updates after API changes
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
💔 Build Failed |
@elasticmachine merge upstream |
💔 Build Failed |
💔 Build Failed |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jloleysens nice job with this!
I had a couple comments/questions:
- I think it would be great to remove the
skip
on the component integration tests (now that react has been upgraded) and confirm everything is passing. Not sure how much effort this would be. - What benefit do we get from creating the
np_ready
directory? I only ask because it looks like almost all of the code lives under it. It seems like it would require more overhead on the final migration, as I assume we would remove it and then have to update file paths everywhere. I know we're doing this elsewhere, so there might be something I'm missing. - (nit) I noticed there's a lot of
@ts-ignore
scattered throughout the code. I'm not sure how much effort it would be to createxyz.d.ts
files, but it seems like that would be easier to maintain in the long term.
Overall, testing looks good! I found a couple bugs. I did not test all of the action types.
- I think something is wrong with the
Indices to query
input on the threshold watch. When I type, I would expect it to filter the results (e.g., "kibana_sample_"), but it does not.
- I selected an index (
kibana_sample_data_logs
) on the threshold alert, but when I make changes to the condition and select a field, I see fields from other indices (looks likekibana_sample_data_flights
), which is not expected.
- I noticed this console error when I was on the status page and was waiting for the watch to execute. I can't reproduce it again, though. FWIW I was creating a watch using this example: https://www.elastic.co/guide/en/elasticsearch/reference/7.5/watch-cluster-status.html#health-add-condition
Uncaught (in promise) TypeError: Cannot read property 'watchHistoryItems' of null
at deserializer (api.ts:91)
at _callee2$ (np_ready_request.ts:150)
at tryCatch (runtime.js:45)
at Generator.invoke [as _invoke] (runtime.js:271)
at Generator.prototype.<computed> [as next] (runtime.js:97)
at asyncGeneratorStep (np_ready_request.ts:18)
at _next (np_ready_request.ts:20)
@@ -209,13 +209,6 @@ module.exports = { | |||
'react-hooks/rules-of-hooks': 'off', | |||
}, | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you close #49566 once this PR is merged?
import routes from 'ui/routes'; | ||
import { management, MANAGEMENT_BREADCRUMB } from 'ui/management'; | ||
// @ts-ignore | ||
import { TimeBuckets } from 'ui/time_buckets'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed since you created src/legacy/ui/public/time_buckets/index.d.ts
?
@cjcenizal Thanks for the review! :D @alisonelizabeth Thanks for the review too! :D In response to your comments/questions:
I think this can be considered a separate piece of work as it's more related to the recent react 16.12 upgrade. I created this issue #52620 for tracking this work - I am happy to tackle this straight after :). I get that getting test coverage after a refactor like this is really valuable! Fwiw, after unskipping the
Not sure they are related to the NP migration? [Update]
The primary benefit is outlined here in the migration guide. Basically linting for ensuring that we have moved direct use of all legacy
Most of the remaining untyped JS modules are inside of |
Thanks for the explanations, @jloleysens!
Looks like it might be related. The "received" value is wrapped in
Yeah, it will be quite a lot of work to convert all the models to TS. I think it's ok to leave as is for now - thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with the latest changes. LGTM. Thanks!
x-pack/legacy/plugins/watcher/__jest__/client_integration/helpers/app_context.mock.tsx
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx
Show resolved
Hide resolved
I want to run through the test suite before merging this. I will test it
locally.
…On Tue, Dec 10, 2019, 6:48 PM Elastic Machine ***@***.***> wrote:
💚 Build Succeeded
- continuous-integration/kibana-ci/pull-request
<https://kibana-ci.elastic.co/job/elastic+kibana+pipeline-pull-request/14677/>
- Commit: 471c801
<471c801>
History
- 💚 Build #14585
<https://kibana-ci.elastic.co/job/elastic+kibana+pipeline-pull-request/14585/>
succeeded 6e90b77
<6e90b77>
- 💚 Build #14515
<https://kibana-ci.elastic.co/job/elastic+kibana+pipeline-pull-request/14515/>
succeeded 61078aa
<61078aa>
- 💚 Build #14280
<https://kibana-ci.elastic.co/job/elastic+kibana+pipeline-pull-request/14280/>
succeeded cbf30e1
<cbf30e1>
- 💔 Build #14262
<https://kibana-ci.elastic.co/job/elastic+kibana+pipeline-pull-request/14262/>
failed f65a526
<f65a526>
- 💚 Build #14194
<https://kibana-ci.elastic.co/job/elastic+kibana+pipeline-pull-request/14194/>
succeeded 0ed3d4b
<0ed3d4b>
To update your PR or re-run it, just comment with:
@elasticmachine merge upstream
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#50908?email_source=notifications&email_token=AAK5UDXUNXZ4QU5777EJCW3QYATGTA5CNFSM4JOUL47KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGRLPRY#issuecomment-564312007>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAK5UDWN4XDQPNOOHC5BWULQYATGTANCNFSM4JOUL47A>
.
|
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
Hey @cuff-links , sorry for merging - I missed this message. For any issues you've found I'll open up a fix PR 👍 |
* First iteration of watch public -> new platform Still need to switch to np ready version of use_request * - Switched to using np ready request - Some updates after API changes * First attempt at server shim * Rename file and re-enable react hooks linting * Fix some public types and react hooks lint rules * Fix types * More ES lint react hooks fixes * Migrated server lib -> ts. Part way done with migrating routes to NP router and TS * Big subset of routes to TS and NP router - almost there * Delete legacy error wrappers and moved last set of routes to TS and NP router * Remove @ts-ignore's and update route registration to use shim with http router * Added routes validations, fixes for hooks and fixes for types * Fix more types and finish testing API routes * Fix usage of feature catalogue and fix time buckets types * Fix error message shape [skip ci] * Split legacy from new platform dependencies server-side * Refactor: Seperate client legacy and NP dependencies * Add file: added types file * Fix UISettings client type import * Update license pre-routing factory spec * Update variable names, use of I18nContext (use NP) and docs * Use NP elasticsearchclient * Simplify is_es_error_factory * Fix types * Improve code legibility and remove second use of `useAppContext` * Use @kbn/config-schema (not validate: false) on routes! * Fix watch create JSON spec * Create threshold test working * Unskip watch_edit.test.ts * Unskip watch_list.test.ts * Done re-enabling component integration tests * TimeBuckets typo + remove unnecessary // @ts-ignore
…le-sql-highlighting * 'master' of github.com:elastic/kibana: (56 commits) Migrate url shortener service (elastic#50896) Re-enable datemath in from/to canvas timelion args (elastic#52159) [Logs + Metrics UI] Remove eslint exceptions (elastic#50979) [Logs + Metrics UI] Add missing headers in Logs & metrics (elastic#52405) [ML] API integration tests - initial tests for bucket span estimator (elastic#52636) [Watcher] New Platform (NP) Migration (elastic#50908) Decouple Authorization subsystem from Legacy API. (elastic#52638) [APM] Fix some warnings logged in APM tests (elastic#52487) [ui/public/utils] Delete unused base_object & find_by_param (elastic#52500) [ui/public/utils] Move items into ui/vis (elastic#52615) fix newlines in kbn-analytics build script Add top level examples folder and command to run, `--run-examples`. (elastic#52027) feat(NA): add trap for SIGINT in the git precommit hook (elastic#52662) [DOCS] Updtes description of elasticsearch.requestHeadersWhitelist (elastic#52675) [Telemetry/Pulse] Updates advanced settings text for usage data (elastic#52657) [SIEM][Detection Engine] Adds the default name space to the end of the signals index [Logs UI] Generalize ML module management (elastic#50662) Removing stateful saved object finder (elastic#52166) Shim oss telemetry (elastic#51168) [Reporting/Screenshots] Do not fail the report if request is aborted (elastic#52344) ... # Conflicts: # src/legacy/core_plugins/console/public/legacy.ts # src/legacy/core_plugins/console/public/np_ready/application/models/legacy_core_editor/mode/elasticsearch_sql_highlight_rules.ts # src/legacy/core_plugins/console/public/np_ready/lib/autocomplete/components/full_request_component.ts # src/legacy/core_plugins/console/public/quarantined/src/sense_editor/row_parser.js
* [Watcher] New Platform (NP) Migration (#50908) * First iteration of watch public -> new platform Still need to switch to np ready version of use_request * - Switched to using np ready request - Some updates after API changes * First attempt at server shim * Rename file and re-enable react hooks linting * Fix some public types and react hooks lint rules * Fix types * More ES lint react hooks fixes * Migrated server lib -> ts. Part way done with migrating routes to NP router and TS * Big subset of routes to TS and NP router - almost there * Delete legacy error wrappers and moved last set of routes to TS and NP router * Remove @ts-ignore's and update route registration to use shim with http router * Added routes validations, fixes for hooks and fixes for types * Fix more types and finish testing API routes * Fix usage of feature catalogue and fix time buckets types * Fix error message shape [skip ci] * Split legacy from new platform dependencies server-side * Refactor: Seperate client legacy and NP dependencies * Add file: added types file * Fix UISettings client type import * Update license pre-routing factory spec * Update variable names, use of I18nContext (use NP) and docs * Use NP elasticsearchclient * Simplify is_es_error_factory * Fix types * Improve code legibility and remove second use of `useAppContext` * Use @kbn/config-schema (not validate: false) on routes! * Fix watch create JSON spec * Create threshold test working * Unskip watch_edit.test.ts * Unskip watch_list.test.ts * Done re-enabling component integration tests * TimeBuckets typo + remove unnecessary // @ts-ignore * Backport for "xPack:defaultAdminEmail" 7.x specific behaviour
Summary
NP migration for the watcher application.
Public
Public is a large number of dependencies and should be properly regression tested
(TODO). Most tests expect React ^16.9.Server
Not many changes here at the moment, mostly consumes
server.route
andserver.plugins.elasticsearch
from legacy.How to Reiview
Public
x-pack/legacy/plugins/watcher/public/np_ready/application/sections/watch_edit/components/threshold_watch_edit/watch_visualization.tsx
x-pack/legacy/plugins/watcher/public/np_ready/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.tsx
x-pack/legacy/plugins/watcher/public/np_ready/application
(so lots of path changes)models
directory has been left as is (still JS)__jest__
folder.src/plugins/es_ui_shared/public/request/np_ready_request.ts
to also supportquery
in network requests.Server
x-pack/legacy/plugins/watcher/server/np_ready/routes/api
.Only manual testing performed via the UI, no pre-existing tests!There are some functional tests that help here, but still needed to do a large amount of manual testingmodels
has been left untouchedfeatureCatalogue
APIslib
to TS.wrap_es_errors
from lib - we are just using new kibanaresponse
directly.Deferred