show first visible view on default#6567
Merged
bramkragten merged 4 commits intohome-assistant:devfrom Sep 11, 2020
Merged
Conversation
zsarnett
approved these changes
Aug 7, 2020
balloob
reviewed
Aug 8, 2020
balloob
reviewed
Aug 8, 2020
bramkragten
reviewed
Aug 17, 2020
bramkragten
requested changes
Aug 24, 2020
Member
bramkragten
left a comment
There was a problem hiding this comment.
Move the logic of what view to initial show to line 411
bramkragten
reviewed
Sep 6, 2020
| navigate(this, `${this.route!.prefix}/${views[0].path || 0}`, true); | ||
| newSelectView = 0; | ||
|
|
||
| if ((!viewPath && views.length) || viewPath === "default_view") { |
Member
There was a problem hiding this comment.
Why do we need to check for default_view?
bramkragten
reviewed
Sep 6, 2020
|
|
||
| const viewPath = this.route!.path.split("/")[1]; | ||
|
|
||
| const isVisible = (viewIndex) => |
Member
There was a problem hiding this comment.
Suggested change
| const isVisible = (viewIndex) => | |
| const isVisible = (view) => |
There was a problem hiding this comment.
After this suggested change the patch doesn't work. Without it works fine.
Member
There was a problem hiding this comment.
You would need to rename the var name in the function too
bramkragten
reviewed
Sep 6, 2020
Comment on lines
+466
to
+473
| newSelectView = views.findIndex(isVisible); | ||
| navigate( | ||
| this, | ||
| `${this.route!.prefix}/${ | ||
| views[newSelectView].path || newSelectView | ||
| }`, | ||
| true | ||
| ); |
Member
There was a problem hiding this comment.
Can we extract this in a function so we don't have duplicate code?
|
Just tested this patch, works fine! Everything as expected. I was waiting for it so long time, because I need to show different sets of views for different users (kids, parents etc..). |
bramkragten
approved these changes
Sep 11, 2020
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Breaking change
Proposed change
Show the first view that is visible for the viewer as the default view.
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: