-
Notifications
You must be signed in to change notification settings - Fork 337
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
Persist the order of widgets in the Dashboard #1198
Merged
Merged
Conversation
This file contains 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
krschau
requested review from
dhoehna,
guimafelipe,
EricJohnson327 and
AmelBawa-msft
June 23, 2023 19:42
Sergio0694
reviewed
Jun 25, 2023
krschau
force-pushed
the
user/krschau/save-order
branch
from
June 26, 2023 22:33
8d94fd8
to
86646fe
Compare
dhoehna
reviewed
Jun 26, 2023
AmelBawa-msft
approved these changes
Jun 26, 2023
Sergio0694
reviewed
Jun 27, 2023
EricJohnson327
approved these changes
Jun 27, 2023
cinnamon-msft
pushed a commit
that referenced
this pull request
Jul 18, 2023
* save widget order * Use JsonSerializerContext * unflip flipped inserting * rename SetPositionCustomState * Rename to SetPositionCustomStateAsync * PlaceWidget * TryAdd
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.
Summary of the pull request
Each time the Dashboard is opened, the widgets may present in a different order. This change saves their order so they will always be displayed in the same order.
References and relevant issues
#463
Detailed description of the pull request / Additional comments
When we get widgets from the host, they don't always come back in the same order. To keep order, this change adds an "position" field to the json that we keep in the widget's CustomState. When we add a new widget, the position will be the next available position. If a widget is edited, it will keep the position it had. If a widget somehow loses its saved position, it will get appended to the end of the list.
Migrating to a version with this change won't be an issue, any existing widgets will be assigned the order they show up in, as if they had "lost" their order as described above.
Validation steps performed
Tested locally.
PR checklist