Skip to content
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

typescript more dashboard panel code #21810

Merged

Conversation

stacey-gammon
Copy link
Contributor

@stacey-gammon stacey-gammon commented Aug 8, 2018

Typescript the remaining of dashboard/panel/panel_header folder.

This was useful, made me realize that pluggable panel actions need to handle the embeddable object being undefined if the factory hasn't finished instantiating it yet. I don't want to wait to build the context menu without the embeddable because some actions may not care about the embeddable, only containerState - namely the delete panel action. We always want that available even if there was an error inside the embeddable.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@stacey-gammon stacey-gammon force-pushed the 18-08-08-types-dash-context-menu branch from 7a6e710 to da4ef3a Compare August 8, 2018 23:36
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@chrisdavies chrisdavies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just code-review, didn't run it.

@@ -44,7 +44,7 @@ export interface ResetPanelTitleAction

export interface SetPanelTitleActionPayload {
panelId: PanelId;
title: string;
title: string | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is normally designated like this: title?: string

@@ -47,7 +48,7 @@ export class DashboardContextMenuPanel {
/**
* Optional, could be composed of actions instead of content.
*/
public getContent(panelActionAPI: PanelActionAPI): JSX.Element | Element | undefined {
public getContent(panelActionAPI: PanelActionAPI): ReactElement<any> | HTMLElement | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious to know why this change was necessary.

Copy link
Contributor Author

@stacey-gammon stacey-gammon Aug 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what the icon type that is so I followed suit. To be honest, I'm not 100% sure what these should be but I went with the result of this conversation in EUI: elastic/eui#985 (comment)

I think Element was giving me an issue but HTMLElement was not as something that could be passed into EUI. See this too for context: elastic/eui#1098

We just need to define a type of element that plugins can use that can be react, but doesn't have to be. Which I guess is still what it was originally, but I think these types are better. @chandlerprall can maybe weigh in too as I think we kinda settled on these two types over the original two.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@stacey-gammon stacey-gammon merged commit 62f35df into elastic:master Aug 12, 2018
stacey-gammon added a commit to stacey-gammon/kibana that referenced this pull request Aug 12, 2018
* typescript more dashboard panel code

* use ? instead of | undefined
stacey-gammon added a commit that referenced this pull request Aug 12, 2018
* typescript more dashboard panel code

* use ? instead of | undefined
@stacey-gammon stacey-gammon deleted the 18-08-08-types-dash-context-menu branch June 11, 2019 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants