-
Notifications
You must be signed in to change notification settings - Fork 584
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
Use set_view() in builtin view operations #4960
base: develop
Are you sure you want to change the base?
Conversation
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes in this pull request enhance the functionality of the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
@imanjra note in the attached video that Interestingly, the exactly analogous steps work for Is it an easy fix to tweak the App so that new saved views can be immediately referenced? save_view_issues.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
- fiftyone/operators/builtin.py (5 hunks)
🧰 Additional context used
🪛 Ruff
fiftyone/operators/builtin.py
1696-1699: Use ternary operator
view = ctx.view if curr_view else _parse_view(ctx, view)
instead ofif
-else
-blockReplace
if
-else
-block withview = ctx.view if curr_view else _parse_view(ctx, view)
(SIM108)
🔇 Additional comments (2)
fiftyone/operators/builtin.py (2)
1737-1744
: Ensure current view is updated after renamingThe code correctly updates the current view if its name has changed, ensuring consistency within the application.
1855-1860
: Reset current view after deleting the active saved viewThe implementation properly resets the current view to the dataset's default view when the active saved view is deleted.
@brimoor yah, I believe it may require slight refactor. For workspace, I think it does a trip to backend so it can get latest workspaces but for view it does it all in the frontend. I'll check it out. It should be doable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fiftyone/operators/builtin.py
Outdated
description=description, | ||
color=color, | ||
overwrite=True, | ||
) | ||
|
||
if curr_view: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope of this PR as it matches workspaces, but we should allow opting out of this for programmatic execution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm good point, is there a way to tell if an operator is being executed programmatically vs prompting?
fiftyone/operators/builtin.py
Outdated
ctx.dataset.update_saved_view_info(name, info) | ||
|
||
if curr_name is not None and curr_name != new_name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
fiftyone/operators/builtin.py
Outdated
ctx.dataset.delete_saved_view(name) | ||
|
||
if curr_view: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
Just to clarify, we can't merge this until/unless saved views are updated per this comment. As it currently stands, one gets the error notifications pictured in the video there. |
36a1959
to
a28b518
Compare
a28b518
to
221ea6c
Compare
Change log
Updates the builtin
save_view
,edit_saved_view_info
, anddelete_saved_view
operators as follows:save_view
: when saving the current view, usectx.ops.set_view()
to update the App to reflect the fact that the current view is now savededit_saved_view_info
: when renaming the current view, usectx.ops.set_view()
to update the App to reflect the current view's new namedelete_saved_view
: when deleting the current view, reset the App to the full datasetThis is consistent with how
save_workspace
,edit_workspace_info
, anddelete_workspace
work as of #4902.TODO