-
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] Embeddable API improvements #63846
Comments
"Explicit input""Explicit" input is only a concept because of containers really. The idea for putting I have a interface TimeRangeEmbeddable extends EmbeddableInput {
timeRange: TimeRange;
} I want to add this to a The best approach here is a bit tough to figure out. You can't do:
because an embeddable can't be instantiated without all of its required Container.addNewEmbeddable(type: string, explicitInput: Partial<EEI>): The explicit input that is passed in is retrieved via This is awkward, not properly type checked, and not even a needed feature right now. If I had to do it again I would try to simplify it. If we decided something like this would be a nice feature to have, ideally I think we need a formal way to check which children can be added to which containers depending on their I'd be happy to see it simplified. |
Sgtm, though we have quite a few helpers already that are pretty close to this. We have <EmbeddableFactoryRenderer
getEmbeddableFactory={getEmbeddableFactory}
type={HELLO_WORLD_EMBEDDABLE}
input={{ id: '1234' }}/> Stateless, but only needs the one extra prop. We also have: <embeddableServices.EmbeddablePanel embeddable={embeddable} /> More clean up ideas that might be worth exploring
|
Team asked to give examples, so below I'm just giving more detailed examples for some things. Use
|
Presentable interface: no strong opinion, i would love to see where else this would be usefull if we would to move it to a kibana_urls UIComponent: i am definetely for doing this, as well as doing it everywhere else we can make use of it. simplify interface: seems something that would take quite some time, are you sure thats all we need ? improve output: would be nice, not sure if its possible improve input: no strong feeling, both achieve the same, i would not spend to much time refactoring this. react component: yes! i think it would make sense to create separate issues for some of those which are very concerete:
|
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. |
Existing work
savedObjectId
Future possibilities for improvement
Use
Presentable
interfaceMove
Presentable
interface fromui_actions
intokibana_utils
and makeEmbeddableFactory
extend thePresentable
interface. This would make embeddable factories consistent with action factories.Presentable
interface should have all fields necessary for presenting embeddable factories to users.Use
UiComponent
interfaceUse
UiComponent
interface for specifying UI building block that embeddable renders, instead ofrender()
,destroy()
,reload()
and callingsuper.render()
andsuper.destroy()
and manually subscribing to "input" and "output" observables.Simplify Embeddable API interfaces
Consider simplifying embeddable API surface to something very simple like below. Remove non-essential fields from the interfaces and consider if there are better places where those fields could live.
Improve/standartize "output"
.embeddableLoaded
.editable
.editUrl
embeddable.getIsContainer()
Improve/standartize "input"
An input of the embeddable could be
input$
observable instead ofinput
value.Input could be just read-only stream of values without ability to
updateInput
and without an embedded concept of "explicit input"."Explicit input"
Make concept of "explicit input" more explicit (no pun intended). Possibly remove it from Embeddable itself and create a higher level abstraction which is an embeddable with explicit input.
Possibly for dashboard embeddables the "explicit input" could be built on top of the regular input.
Improve DX of embeddables in React code
Expose
<ReactEmbeddable>
connected component fromembeddable
plugin's start contract, users would be able to use it directly to render embeddablesAdd integration for the above component to
kibana_react
.Expose embeddable child panel from contract.
cc @stacey-gammon @elastic/kibana-app-arch @elastic/kibana-app
Part of #71857
The text was updated successfully, but these errors were encountered: