Modifying the dashboard grid to not unnecessarily set appStatus.dirty#9307
Merged
epixa merged 1 commit intoelastic:masterfrom Dec 2, 2016
Merged
Modifying the dashboard grid to not unnecessarily set appStatus.dirty#9307epixa merged 1 commit intoelastic:masterfrom
epixa merged 1 commit intoelastic:masterfrom
Conversation
spalger
approved these changes
Dec 2, 2016
Contributor
spalger
left a comment
There was a problem hiding this comment.
LGTM, but I do have a suggestion for readability
| // on the specific order of the panels. | ||
| // See https://github.com/ducksboard/gridster.js/issues/147 | ||
| // for some additional back story. | ||
| added.sort((a, b) => { |
Contributor
There was a problem hiding this comment.
I was confused about why this worked at first, but then I realized it is sorting a copy of state.panels rather than modifying it. I think future readers would benefit from that fact being a bit more obvious somehow.
Maybe changing added.forEach(addPanel); to addPanels(added) and making addPanels() do something like:
function addPanels(panels) {
// copy and sort the panels by row before applying them so
// that gridster lays them out correctly
const sortedPanels = panels.slice().sort(...);
sortedPanels.forEach(appPanel);
}
Contributor
Author
There was a problem hiding this comment.
I like it! I'll make those changes.
Contributor
There was a problem hiding this comment.
If this change works as-is, let's get it in and then make tweaks in a follow up
epixa
pushed a commit
that referenced
this pull request
Dec 2, 2016
epixa
pushed a commit
that referenced
this pull request
Dec 2, 2016
airow
pushed a commit
to airow/kibana
that referenced
this pull request
Feb 16, 2017
…elastic#9342) Backports PR elastic#9307 **Commit 1:** Modifying the dashboard grid to not unnecessarily set appStatus.dirty * Original sha: 2431ec0 * Authored by kobelb <brandon.kobel@elastic.co> on 2016-12-01T16:23:19Z Former-commit-id: d85c254
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously, we were sorting the
$scope.panelsso that Gridster would display them in the proper order. This has the side-effect of setting theappStatus.dirtyto true whenever this happened as described in #9305Moving the sorting to occur when the panels are about to be added to Gridster resolves this issue because it's no longer modifying
$scope.panels.Closes: #9305