-
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
[Drilldowns] import dashboard url generator from plugin contract #64628
[Drilldowns] import dashboard url generator from plugin contract #64628
Conversation
Pinging @elastic/kibana-app-arch (Team:AppArch) |
@@ -153,7 +150,7 @@ export class DashboardToDashboardDrilldown | |||
} | |||
} | |||
|
|||
return getUrlGenerator(DASHBOARD_APP_URL_GENERATOR).createUrl({ | |||
return this.params.getDashboardUrlGenerator().createUrl!({ |
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.
huh, having a hard time following this without pulling down the code... why would this possibly be undefined?
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 just realised a difference...
When I started exporting directly and using directly it is UrlGeneratorsDefinition
But when we access from share
plugin registry it is UrlGeneratorContract
.
So url generator registry wrap the definition and adds additional logic. Which means this "refactor" is not 1 to 1 functionality match.
Not sure how to proceed from here in this case, but this pr is incorrect then right now...
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.
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!
share
plugin is optional in dashboard. So I guess this also means that dashboardUrlGenerator will be optional on dashboard
plugin contract?
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.
somewhat of a bummer, but that share plugin contains the code for handling migrations automatically, which is why the Definition
becomes a Contract
. This may change when Persistable state registries becomes a formal, generic service. I would take the path of least resistance for now (require share plugin for this functionality), and we can revisit when we know more about how the persistable state registries will work.
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.
@stacey-gammon please take a look 🙏
hope I followed the proposed solution correctly.
This needs further clean up: like removing global mappings and fixing how ML uses it, but I don't want to do this in this pr, because it points to drilldowns branch
const actionFlyoutCreateDrilldown = new FlyoutCreateDrilldownAction({ start }); | ||
uiActions.addTriggerAction(CONTEXT_MENU_TRIGGER, actionFlyoutCreateDrilldown); | ||
|
||
const actionFlyoutEditDrilldown = new FlyoutEditDrilldownAction({ start }); | ||
uiActions.addTriggerAction(CONTEXT_MENU_TRIGGER, actionFlyoutEditDrilldown); | ||
|
||
const dashboardToDashboardDrilldown = new DashboardToDashboardDrilldown({ | ||
getSavedObjectsClient, | ||
start, |
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 think this is a move in the wrong direction. While it's very easy to just pass down start
it encourages tight coupling to core. See https://www.notion.so/Tight-Coupling-in-Kibana-fcee0454319140d39aa5e83052bba901
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.
Had a similar comment in a PR from Vadim, we can move this discussion outside this PR. Don't let it block you.
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.
code review only
a26e409
to
18935b8
Compare
@elasticmachine merge upstream |
const getDashboardUrlGenerator = () => { | ||
const urlGenerator = start().plugins.dashboard.dashboardUrlGenerator; | ||
if (!urlGenerator) | ||
throw new Error('dashboardUrlGenerator is required for dashboard to dashboard drilldown'); |
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.
This message contains error message specific for drilldowns.
... required for dashboard to dashboard drilldown
When somebody else in this plugin will start using the dashboard URL generator, this error message will not make sense for them.
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.
But it is inside /dashboard_drilldowns_services.ts
🤔
@elasticmachine merge upstream |
@majagrubic or @ThomThomson might taking a code owner look please? 🙏 |
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 locally on chrome and safari. Everything dashboard / Kibana App related still works as expected. I also took the opportunity to understand the broader context of this change, and that makes sense as well.
LGTM!
const { plugins } = this.params.start(); | ||
|
||
return plugins.share.urlGenerators.getUrlGenerator(DASHBOARD_APP_URL_GENERATOR).createUrl({ | ||
return this.params.getDashboardUrlGenerator().createUrl({ |
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.
This looks much cleaner!
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
…ct (elastic#64628) Co-authored-by: Elastic Machine <[email protected]>
* master: (58 commits) [Drilldowns][chore] import dashboard url generator from plugin contract (elastic#64628) fix double flyouts in add panel flow (elastic#65861) Point 7.x to 7.9.0 in .backportrc.json Mount ui/new_platform applications in same div structure as Core (elastic#63930) [Uptime] Settings threshold validation (elastic#65454) Fix edit alert flyout to update initialAlert after edit (elastic#65359) Fix anomalies display on focused APM service map (elastic#65882) [SIEM][Detection Engine] Increases the template limit for ECS mappings [SIEM][CASE] Moves functional tests from "legacyEs" to "Es" (elastic#65851) [Metrics UI] Fix p95/p99 charts and alerting error (elastic#65579) [ML] Add job timing stats to anomaly jobs (elastic#65696) restore index pattern management data-test-subj's (elastic#64697) [Discover] Prevent whitespace wrapping of doc table header (elastic#52861) [SIEM] Fixes a CSS issue with Timeline field truncation (elastic#65789) Skipping failing tests. elastic#65867 elastic#65866 elastic#65865 [Discover] Deangularize the hits counter and create a react component (elastic#65631) Tsvb less update (elastic#65467) [TSVB] Remove remaining lodash.set usage (elastic#65846) [Uptime] Add `a11y` tests (elastic#65514) [Uptime] Enable loading on monitor list (elastic#65670) ...
…ct (#64628) (#65972) Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
Summary
Following up on #63108 (comment)
Following recommendation from: #62815
Instead of importing url generator using ID and registry, import it via plugin contract.
@stacey-gammon, should I create a ticket to clean url generator registry and to use the same approach in ML?
Checklist
Delete any items that are not applicable to this PR.
For maintainers