-
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] Move out of legacy #54752
[Watcher] Move out of legacy #54752
Conversation
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
Update route registration and fix license checking for NP
…epath on navigating away from license management) Remove commented out code in watcher
There are two issues I'm noticing as I was working on this: 1I'm seeing a situation with watcher when I am on a license that permits use of watcher (e.g., platinum) then run:
which reverts to basic, then do a page refresh my links still renders. Clicking on it then hides it as this causes a re-render. 2The functionality in |
It only does this when you revert from trial to basic, or also when starting with basic? And by link, you mean the management section link, correct? If you put logs in your license check code, are the logs also broken? This would be helpful in narrowing down whether or not this is a UI issue or an issue with the licensing plugin.
I'm not sure if that is new behavior either, but if so, that would be an issue that maybe the @mattkime could help with. I know he's been digging in the Manaagement app recently for the migration to the New Platform. |
Regarding problem (1): After reading the code, I think this problems stems from the code around trying to conditionally register the Watcher section based on licensing updates and what not. I don't think this is the right approach (though the only possible one right now). Instead, I think the Management API needs to support a similar |
if (this.hasValidLicense) { | ||
const esSection = management.sections.getSection('elasticsearch'); | ||
if (esSection) { | ||
if (!this.hasRegisteredESManagementSection) { |
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.
All of this logic could be great simplified if an API like this existed, similar to the Application API:
esSection.registerApp({
id: 'watcher',
title: 'Watcher',
updater$: licensing.license$.pipe(map(license => {
const { state } = license.check(PLUGIN.ID, PLUGIN.MINIMUM_LICENSE_REQUIRED);
const hasValidLicense =
state === LICENSE_CHECK_STATE.Valid && license.getFeature(PLUGIN.ID).isAvailable;
return {
status: hasValidLicense ? ManagementAppStatus.accessible : ManagementAppStatus.inaccessible
};
})),
mount(...) { ... },
});
@joshdover , for further clarification on scenario 1: This speaks to what you've pointed out. It's specific to the scenario where I've issued a request directly against ES (not from my browser session) to revert to basic. I suppose this would also happen if another user changed the license while I was in Kibana and there was a second emission on the For the second issue I was encountering, I've opened this issue (not sure if there already is one): #55170 |
…t-of-legacy * 'master' of github.com:elastic/kibana: (142 commits) [Vis] Move Timelion Vis to vis_type_timelion (elastic#52069) Deprecate `chrome.navlinks.update` and add documentation (elastic#54893) [ML] Single Metric Viewer: Fix time bounds with custom strings. (elastic#55045) [Vis: Default editor] EUIficate and Reactify the sidebar (elastic#49864) [Mappings editor] Fix cannot set boolean value for "null_value" param (elastic#55015) [SIEM] Adds support for apm-* to the network map (elastic#54876) [Reporting] Define shims of legacy dependencies (elastic#54082) Resolver is overflow: hidden to prevent obscured elements from showing up (elastic#55076) Upgraded EUI to 18.2.1 (elastic#55090) [Maps] Support styles on agg fields with _of_ in name (elastic#54965) Remove xpack_main requirement, it's no longer in use (elastic#55060) Fix Snapshots Policies Alignment Issue in IE11 (elastic#54866) first rule cuts (elastic#54990) [DOCS] Adds geocentroid note to coordinate map (elastic#54389) [Canvas] Fixes the Copy Post Url link (elastic#54831) Fixes bugs with full screen filters (elastic#54792) [ML] Fix decoding in the URL state (elastic#54915) Remove redundant `x-pack/typings`. (elastic#55042) [SIEM][Detection Engine] Adds critical missing status route to prepackaged rules Generate legacy vars when rendering all applications (elastic#54768) ... # Conflicts: # x-pack/plugins/translations/translations/ja-JP.json # x-pack/plugins/translations/translations/zh-CN.json
@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.
Thanks for the orderly commit history! I was able to follow along pretty well. Code LGTM. I've run out of time today so if you'd like me to test locally just hold off on merging and I will get to it tomorrow. Otherwise feel free to merge if you're confident there are no regressions. Might be worth asking @cuff-links to QA this after 7.6 is released.
|
||
setup( | ||
{ application, notifications, http, uiSettings, getStartServices }: CoreSetup, | ||
{ licensing, management, data, home }: Dependencies |
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.
I haven't dug around for this, so apologies for the dumb question, but what's the data
dependency?
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.
Looks like a collection of data access functions (based on src/plugins/data/README.md
) 😂. There is functionality in there that was pulled from legacy in the TimeBuckets
which have been included here.
@elasticmachine merge upstream |
…t-of-legacy * 'master' of github.com:elastic/kibana: Restore 200 OK + response payload for save and delete endpoints (elastic#55535) [SIEM] [Detection Engine] Log time gaps as failures for now (elastic#55515) [NP] KibanaRequest provides request abortion event (elastic#55061)
…t-of-legacy * 'master' of github.com:elastic/kibana: [Watcher] Add support for additional watch action statuses (elastic#55092) [ML] Fix entity controls update. (elastic#55524) [ML] Fixing ML's watcher integration (elastic#55439) [ML] Fixes permissions checks for data visualizer create job links (elastic#55431) [SearchProfiler] Move out of legacy (elastic#55331) # Conflicts: # x-pack/plugins/watcher/server/models/action_status/action_status.js
Tested locally by creating, editing, and deleting both threshold and JSON watches. I also verified that the request flyouts, execution histories, and activation/deactivation actions all work as expected. |
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* Moved out of legacy folder * First iteration of watcher plugin that renders * Move create Timebuckets to plugin root Update route registration and fix license checking for NP * Re-enable Component integration tests * Minor fix for data deserializer in api.ts * Slight logic refactor, more defensive plugin startup * Re-add legacy folder for SCSS pipeline * Remove duplicate style sheet * Fix type issue with TimeBuckets export * Update license management routing logic (issued warning for using basepath on navigating away from license management) Remove commented out code in watcher * More defensive plugin registration * Fix i18n issues and restore registration of feature on home view * Remove watcher license error check copy * Restore license error message in watcher * Fix mock context value Co-authored-by: Elastic Machine <[email protected]> # Conflicts: # .github/CODEOWNERS # x-pack/legacy/plugins/watcher/public/7_x_only.ts # x-pack/plugins/watcher/public/application/boot.tsx
* Moved out of legacy folder * First iteration of watcher plugin that renders * Move create Timebuckets to plugin root Update route registration and fix license checking for NP * Re-enable Component integration tests * Minor fix for data deserializer in api.ts * Slight logic refactor, more defensive plugin startup * Re-add legacy folder for SCSS pipeline * Remove duplicate style sheet * Fix type issue with TimeBuckets export * Update license management routing logic (issued warning for using basepath on navigating away from license management) Remove commented out code in watcher * More defensive plugin registration * Fix i18n issues and restore registration of feature on home view * Remove watcher license error check copy * Restore license error message in watcher * Fix mock context value Co-authored-by: Elastic Machine <[email protected]> # Conflicts: # .github/CODEOWNERS # x-pack/legacy/plugins/watcher/public/7_x_only.ts # x-pack/plugins/watcher/public/application/boot.tsx
Summary
Continuation of work started in #50908. This is the final step of the New Platform (NP) migration.
TODOs before review
TimeBuckets
andMANAGEMENT_SECTION
dependencies. Currently this lives inside of a folder calledlegacy
in the watcher NP folder.How to Review
public/plugin.ts
andserver/plugin.ts
. Most important changes are there - how the plugin starts up and the services it uses.TimeBucket
dep we copied the code to the watcher plugin (per [ML] Copy over TimeBuckets into ML code #44249)git-diff
likegit diff --no-index ../current-master/watcher/public/np_ready/application ./x-pack/plugins/watcher/public/application
for a cleaner summary of application specific changeslicense_management
, we can move this to another PR but it's quite a small fixlegacy
folder containsTimeBucket
andMANAGEMENT_BREADCRUMB
.TODO