-
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
[wip] typescript dashboard stuff #27167
Conversation
💔 Build Failed |
) => {}; | ||
embeddableIsInitializing: EmbeddableActions; | ||
embeddableIsInitialized: ( | ||
embeddableIsInitialized: import('ui/embeddable/embeddable').EmbeddableMetadata |
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 the intake ci is choking on these inline imports. I know we fixed them, but then ended up throwing the changes away and didn't go back around to it.
16:51:13 [21:51:13] → I18N ERROR Error in src/legacy/core_plugins/kibana/public/dashboard/panel/dashboard_panel.tsx
16:51:13 Error: Unexpected token (42:28):
16:51:13 embeddableFactory: EmbeddableFactory;
16:51:13 embeddableStateChanged: (
16:51:13 embeddableStateChanges: import('ui/embeddable/types').EmbeddableState
16:51:13 ) => {};
16:51:13 embeddableIsInitializing: EmbeddableActions;
16:51:13 ERROR I18N ERROR Error in src/legacy/core_plugins/kibana/public/dashboard/panel/dashboard_panel.tsx
16:51:13 Error: Unexpected token (42:28):
16:51:13 embeddableFactory: EmbeddableFactory;
16:51:13 embeddableStateChanged: (
16:51:13 embeddableStateChanges: import('ui/embeddable/types').EmbeddableState
16:51:13 ) => {};
16:51:13 embeddableIsInitializing: EmbeddableActions;
16:51:13 Warning: non-zero exit code 1� Use --force to continue.
16:51:13
Look at the intake failures first, it's possible something being caught in there is causing the later selenium failures as well, but the error output on the intake one is easier to pinpoint what exactly the issue is.
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.
Awesome! I think I was able to rebase the commits from my feature branch over that should have the import changes in dashboard panel.
b24f897
to
37be13d
Compare
💔 Build Failed |
interface DashboardPanelProps { | ||
intl: any; | ||
viewOnlyMode: boolean; | ||
onPanelFocused: (panel: string) => {}; |
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.
onPanelFocused: (panel: string) => {}; | |
onPanelFocused?: (panel: string) => {}; |
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 a ton for looking this over. Adding this change in my branch since it's not causing any new problems by making this optional.
intl: any; | ||
viewOnlyMode: boolean; | ||
onPanelFocused: (panel: string) => {}; | ||
onPanelBlurred: (panel: string) => {}; |
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.
onPanelBlurred: (panel: string) => {}; | |
onPanelBlurred?: (panel: string) => {}; |
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.
Awesome! Changing this to optional since it's not causing any additional problems.
viewOnlyMode: boolean; | ||
onPanelFocused: (panel: string) => {}; | ||
onPanelBlurred: (panel: string) => {}; | ||
error: string | object; |
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.
error: string | object; | |
error?: string | object; |
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.
Changing this to optional results in the following errors that were then resolved when marking
error?: string | object;
in line 150 as well
"message": "Argument of type 'typeof DashboardPanelUi' is not assignable to parameter of type 'ComponentType'.\n Type 'typeof DashboardPanelUi' is not assignable to type 'ComponentClass'.\n Type 'DashboardPanelUi' is not assignable to type 'Component<DashboardPanelProps, ComponentState, any>'.\n Types of property 'shouldComponentUpdate' are incompatible.\n Type '(nextProps: { containerState: ContainerState; error: string | object; initialized: boolean; }) => boolean' is not assignable to type '(nextProps: Readonly, nextState: Readonly, nextContext: any) => boolean'.\n Types of parameters 'nextProps' and 'nextProps' are incompatible.\n Type 'Readonly' is not assignable to type '{ containerState: ContainerState; error: string | object; initialized: boolean; }'.",
"source": "ts",
"startLineNumber": 198,
"startColumn": 42,
"endLineNumber": 198,
"endColumn": 58
}
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.
You should actually use the same interface for nextProps
, it now has conflicting types which is causing the error. so instead of
nextProps: {
containerState: ContainerState;
error: string | object;
initialized: boolean;
})
do
nextProps: DashboardPanelProps)
panel: PanelState; | ||
isPopoverOpen: boolean; | ||
isLoading: boolean; | ||
calloutTitle: string; |
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.
Hm, this one is interesting, I don't see if used anywhere, nor in the old props. Any reason you added?
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 removed
isPopoverOpen: boolean; isLoading: boolean; calloutTitle: string;
in my branch and it's not causing any issues. I might have added these by accident earlier...
Removing panel: PanelState;
causes some errors (line 82, 115, 122, 170)
Thank you so much for looking this over
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.
yep, keep panel
, it's used.
embeddableError: EmbeddableErrorAction; | ||
initialized: boolean; | ||
panel: PanelState; | ||
isPopoverOpen: boolean; |
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 one also looks unused
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.
Awesome - removed embeddableError and isPopoverOpen. The panel and initialized cause errors when I remove them here so I left them.
onPanelBlurred: (panel: string) => {}; | ||
error: string | object; | ||
destroy: () => void; | ||
containerState: ContainerState; |
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.
According to original code, this one is optional too.
containerState: ContainerState; | |
containerState?: ContainerState; |
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 is causing ts problems when marked as optional in terms of lines this.embeddable.render(this.panelElement, this.props.containerState)
and
if (this.embeddable && !_.isEqual(nextProps.containerState, this.props.containerState))
initialized: boolean; | ||
panel: PanelState; | ||
isPopoverOpen: boolean; | ||
isLoading: boolean; |
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.
unused?
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.
Removed isPopoverOpen and isLoading thanks!
embeddableIsInitializing(); | ||
embeddableFactory.create(panel, embeddableStateChanged) | ||
.then((embeddable) => { | ||
embeddableFactory |
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 you dropped the first call to embeddableIsInitializing();
. intentional? Might be the reason for the failing tests.
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 a ton! I was struggling on an error when adding this back in but recently figured that out. Changed the code to include embeddableIsInitializing() and changed line 48 to embeddableIsInitializing: () => void;
if (this.mounted) { | ||
embeddableError(error.message); | ||
this.embeddableError = error.message; |
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.
don't think you want to change this to a local variable, the function was setting in the redux state tree
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.
Ah ok thanks! Changed it back
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
src/legacy/core_plugins/kibana/public/dashboard/panel/panel_utils.ts
Outdated
Show resolved
Hide resolved
src/legacy/core_plugins/kibana/public/dashboard/panel/panel_utils.ts
Outdated
Show resolved
Hide resolved
src/legacy/core_plugins/kibana/public/dashboard/panel/panel_utils.ts
Outdated
Show resolved
Hide resolved
src/legacy/core_plugins/kibana/public/dashboard/panel/panel_utils.ts
Outdated
Show resolved
Hide resolved
src/legacy/core_plugins/kibana/public/dashboard/panel/panel_utils.ts
Outdated
Show resolved
Hide resolved
💚 Build Succeeded |
💚 Build Succeeded |
fixed imports in dpc consitency across id -> i for gridData, improvment made in dashboard_panel.tsx changed DashboardPanelUiProps onPanelFocused and onPanelBlurred (panel: PanelState) to (panel: string) resolved Problems in TS
…rd_panel.tsx Updated snapshot for dashboard_panel.test.tsx
…ze_x and size_y to numbers adding comment to clarify panel.panelIndex.toString()
…pes.ts modified to show panelIndex string | number reverting panel_utils and types.ts changes with panelIndex, keeping other changes from Emmas suggestions
…instead of mutation revert mutation in panel utils removed ts-ignore in __tests__/panel_state.ts
💚 Build Succeeded |
In the panel_utils.ts file, |
* gridData id changed to i * to.equal panel_state.ts * clarifying return values in panel_utils *fixed imports in dpc consitency across id -> i for gridData, improvment made in dashboard_panel.tsx changed DashboardPanelUiProps onPanelFocused and onPanelBlurred (panel: PanelState) to (panel: string) resolved Problems in TS * Resolved ts testing type errors with DashboardPanelUiProps in dashboard_panel.tsx Updated snapshot for dashboard_panel.test.tsx * Code review from Emma with changes partial PanelState and defining size_x and size_y to numbers adding comment to clarify panel.panelIndex.toString() * test commit to take in Emmas feedback and show the panel_utils and types.ts modified to show panelIndex string | number reverting panel_utils and types.ts changes with panelIndex, keeping other changes from Emmas suggestions * Fixed panel_utils and panel_utils test to create updatedPanel object instead of mutation Revert mutation in panel utils removed ts-ignore statements in __tests__/panel_state.ts
* gridData id changed to i * to.equal panel_state.ts * clarifying return values in panel_utils *fixed imports in dpc consitency across id -> i for gridData, improvment made in dashboard_panel.tsx changed DashboardPanelUiProps onPanelFocused and onPanelBlurred (panel: PanelState) to (panel: string) resolved Problems in TS * Resolved ts testing type errors with DashboardPanelUiProps in dashboard_panel.tsx Updated snapshot for dashboard_panel.test.tsx * Code review from Emma with changes partial PanelState and defining size_x and size_y to numbers adding comment to clarify panel.panelIndex.toString() * test commit to take in Emmas feedback and show the panel_utils and types.ts modified to show panelIndex string | number reverting panel_utils and types.ts changes with panelIndex, keeping other changes from Emmas suggestions * Fixed panel_utils and panel_utils test to create updatedPanel object instead of mutation Revert mutation in panel utils removed ts-ignore statements in __tests__/panel_state.ts
No description provided.