-
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
[DISCUSS] Change ui_actions interface to more directly express dependencies #62225
Comments
Pinging @elastic/kibana-app-arch (Team:AppArch) |
Nice, I like it. One thing to consider is that I think most triggers should be created and exposed from a central place, like the So I think we should encourage anyone who wants to create their own trigger to first consider having the app arch team create it so it's central and all solutions can attach their actions to it. Unless it's something very obviously explicit to one app or another (like if the trigger context is an ML job or something - that would mean nothing without the ML app actually existing). If we do opt to have most triggers as part of a single plugin, then the flow would be something like:
|
thanks for the feedback @stacey-gammon (I keep rewriting this) After mulling over the case of registering the same trigger from multiple places I'm thinking about this a lot differently. I like what you're proposing - returning the individual trigger interfaces by name. No need to look items up by id. |
@mattkime I like this change, but I think we should only change these methods
Currently, I don't see why other methods should be changed, but happy to learn. @stacey-gammon What would be an advantage of uiActions.getApplyFilterTrigger() over current uiActions.getTrigger('APPLY_FILTER_TRIGGER') |
I might not be understanding the benefit of looking triggers up by key. |
That example, none. The example where it does make a difference is this one:
vs
is just that it forces the user to not forget to include |
Does this mean we won't need global trigger / action / context types mapping? |
Maybe we could do setup() {
return {
triggers: {
applyFilter,
geoLocation,
valueClick,
rangeBrush,
// ...
}
}
} |
I think types would be simplified a bit but I'm not fully certain.
LGTM @streamich pointed out that the trigger registry is needed for dynamic action storage. We can keep it and look up by |
Yea, I think so. However... I'm a bit worried about this conflicting with the "enhancements" pattern. I've written up my thoughts on this here: #62815 |
@stacey-gammon Can you specify how this would conflict? I might be missing something. |
If we ever wanted to follow the enhancements pattern as outlined in that issue (I am working on an example plugin to make this pattern clearer), then the object you are registering is not the same object you would retrieve off the registry, which makes me wonder if those types id type mappings would come in handy. e.g.
Proceed as you wish, I just have this sneaking feeling I might be missing something that makes these id -> type mappings useful. But it's just a feeling so don't stop the refactor on that account. Just make sure that the types will still complain when you do |
The current version of the enhancement pattern shows that we should be able to factor out the majority of Instead of doing a bit by bit analysis of the existing api I'd rather just say 'apply the enhancement pattern' since I might miss some wrinkles. |
Thank you for contributing to this issue, however, we are closing this issue due to inactivity as part of a backlog grooming effort. If you believe this feature/bug should still be considered, please reopen with a comment. |
This is in follow up to #60168 #60202 - tldr; ui_actions allows triggers and actions to be registered from different plugins to ui_actions but this creates a dependency not expressed through the plugin contracts. Tests became flakey due to indeterminate plugin loading order.
Proposal:
Instead of registering triggers and actions in a central registry, triggers would be created and made available via plugin contracts.
ui_actions service
Part of #71854
The text was updated successfully, but these errors were encountered: