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

Clean up time range handling in embeddables #17718

Conversation

stacey-gammon
Copy link
Contributor

Also: pass down container state on render rather than rely on specific
function call orders.

Convert all inner time range formats to utc for consistency. don't store entire timeRange object in the redux tree.

@stacey-gammon stacey-gammon added Feature:Dashboard Dashboard related features :Sharing labels Apr 16, 2018
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@stacey-gammon stacey-gammon force-pushed the 2018-04-clean-up-time-range-embeddables branch from 061128d to 2326eff Compare April 18, 2018 23:42
@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.

Just the one concern.

* @param {ContainerState} containerState
*/
render(domNode, containerState) {
this.onContainerStateChanged(containerState);
this.domNode = domNode;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little concerned about the this.onContainerStateChanged(containerState); in the render. I know this isn't React, but in general, I think of render as a "Make the DOM look like this" kind of function. If we are doing onContainerStateChanged here, it seems like it might be easy to get into a loop where onContainerStateChanged makes a change, which then makes a render happen, which then calls onContainerStateChanged, etc. Just a thought!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think your concerns are legit but this code is going to change soon with some updates @timroes is making to the loader. I think in the end it will be something like this pseudocode:

onContainerStateChanged(containerState) {
 this.saveState(containerState);
 this.reloadVisualization(getStateForRefresh());
}

render(dom, containerState) {
 this.saveState(containerState);
 this.createVisualization(domNode, getStateForFullRender());
}

Would that alleviate your concerns? It would just refactor the actual storing of state into a separate function both things could call.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@stacey-gammon
Copy link
Contributor Author

Any more comments or feedback @nreese or @chrisdavies ?

@chrisdavies
Copy link
Contributor

None from me!

@nreese
Copy link
Contributor

nreese commented May 1, 2018

Are you waiting for a review or did you want to add more functional tests first?

/**
* @param dashboard {DashboardState}
* @return {string|undefined}
* @return {string} timeRange.from
Copy link
Contributor

Choose a reason for hiding this comment

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

How come there are 2 return definitions?

@stacey-gammon stacey-gammon force-pushed the 2018-04-clean-up-time-range-embeddables branch 2 times, most recently from 2080754 to 26c68dc Compare May 8, 2018 19:30
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

- pass down container state on render rather than rely on specific
function call orders.
@stacey-gammon stacey-gammon force-pushed the 2018-04-clean-up-time-range-embeddables branch from 26c68dc to 8bc8e04 Compare May 10, 2018 13:54
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

lgtm

@stacey-gammon stacey-gammon merged commit ba080a1 into elastic:master May 10, 2018
stacey-gammon added a commit to stacey-gammon/kibana that referenced this pull request May 10, 2018
* Convert all inner time range formats to utc for consistency

- pass down container state on render rather than rely on specific
function call orders.

* remove accidentally left in return jsdoc line
stacey-gammon added a commit that referenced this pull request May 10, 2018
* Convert all inner time range formats to utc for consistency

- pass down container state on render rather than rely on specific
function call orders.

* remove accidentally left in return jsdoc line
@stacey-gammon stacey-gammon deleted the 2018-04-clean-up-time-range-embeddables branch May 31, 2018 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Dashboard Dashboard related features v6.4.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants