Fix for save button disabled when opening spy panel #5942
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #5860.
This fix will need to be backported.
Issue:
When opening the spy panel in the
Visualize
tab, after creating a visualization, the save button is disabled. This occurs because the initial opening of the spy panel renders the vis state as dirty. The underlying problem is that the parameterspyPerPage
for the spy panel gets added to theeditableVis
state, but is not transferred to the actual vis state. And since there is a check here that determines whether theeditableVis
state and the actual vis state are equal, it returnsfalse
therefore rendering the vis state as dirty, causing the save button to be disabled.For a more detailed explanation, see #5860.
Proposed solution:
The parameter
spyPerPage
should not be placed as avis
parameter since it is apart of the spy panel. ThespyPerPage
parameter is moved to the$scope.spy.params
object from the$scope.vis.params
object.It seems that the
spyPerPage
parameter is not actually saved in the state across visualizations or within the same visualization. What I mean by that is, if I change thespyPerPage
parameter in the UI to 25 and then close the spy panel; when I open it back up, thespyPerPage
parameter is reset to 10.This behavior doesn't change with this pull request and allows me to move the parameter to the
$scope.spy
object without having to worry about state changes. However, I believe this should be thoroughly tested in the UI.