Skip to content
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

Fix bbox export via bbox menu #8152

Merged
merged 4 commits into from
Oct 28, 2024
Merged

Fix bbox export via bbox menu #8152

merged 4 commits into from
Oct 28, 2024

Conversation

MichaelBuessemeyer
Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer commented Oct 28, 2024

For report details see: https://scm.slack.com/archives/C5AKLAV0B/p1730111734807479

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • Create an annotation with a bbox
  • use the export menu entry of the bbox.
  • should open up the modal

Issues:


(Please delete unneeded items, merge only when none are left open)

Summary by CodeRabbit

  • New Features

    • Enhanced export functionality for bounding boxes, providing a more direct and clear export process.
    • Added metadata support for annotations related to Trees and Segments.
    • Introduced a summary row in the time tracking overview.
    • Improved slider functionality with value changes via wheeling and reset on double-click.
    • Enhanced search capabilities for unnamed segments.
    • Increased loading speeds for precomputed meshes.
    • Unified terminology in the UI, replacing "Resolution" with "Magnification."
    • Added support for remote OME-Zarr NGFF version 0.5 datasets.
  • Bug Fixes

    • Fixed issues with dataset uploads related to absolute paths.
    • Resolved bbox export menu item problems.
    • Addressed automatic expansion of groups in skeleton searches and other related bugs.

Copy link
Contributor

coderabbitai bot commented Oct 28, 2024

Walkthrough

The changes involve modifications to the handleExportBoundingBox function within the BoundingBoxTab component in the frontend code. The use of _.partial has been removed, simplifying the function to a direct call for setting the selected bounding box for export. Additionally, the onExport property in the boundingBoxWrapperTableColumns array is updated to directly invoke handleExportBoundingBox(bb) when export is enabled. The overall logic and control flow of bounding box management and display remain unchanged. The changelog has also been updated to reflect new features, changes, and bug fixes across the WEBKNOSSOS platform.

Changes

File Path Change Summary
frontend/javascripts/oxalis/view/right-border-tabs/bounding_box_tab.tsx Simplified handleExportBoundingBox by removing _.partial and directly calling setSelectedBoundingBoxForExport(bb). Updated onExport in boundingBoxWrapperTableColumns to call handleExportBoundingBox(bb) directly when isExportEnabled is true.
CHANGELOG.unreleased.md Updated changelog to include new features, changes, fixes, and migration of testing processes. Notable updates include metadata for annotations, improved slider functionality, enhanced search capabilities, and various bug fixes.

Poem

In the land of code where rabbits play,
A bounding box found a clearer way.
No more partials, just a direct call,
Exporting with ease, we’ll have a ball! 🐇✨
Hopping through functions, so light and spry,
With each little change, we reach for the sky! 🌈


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
frontend/javascripts/oxalis/view/right-border-tabs/bounding_box_tab.tsx (1)

Line range hint 156-156: Consider adding tooltip for disabled export state.

When isExportEnabled is false, the export functionality silently falls back to a no-op. Consider adding a tooltip to explain why the export option is disabled, improving user experience.

Example implementation:

onExport={isExportEnabled 
  ? () => handleExportBoundingBox(bb) 
  : () => {}}
tooltipTitle={!isExportEnabled 
  ? "Export is not available for this dataset type" 
  : undefined}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8993bab and f23c220.

📒 Files selected for processing (1)
  • frontend/javascripts/oxalis/view/right-border-tabs/bounding_box_tab.tsx (1 hunks)
🔇 Additional comments (2)
frontend/javascripts/oxalis/view/right-border-tabs/bounding_box_tab.tsx (2)

93-95: LGTM! Clean implementation of export handler.

The simplified implementation correctly handles the bounding box export by directly setting the state and cleaning up the UI.


Line range hint 273-281: Verify the export modal integration.

The export flow looks correct, but let's verify the integration with DownloadModalView:

  1. Modal receives the correct bounding box ID
  2. Modal opens in export tab mode
  3. Modal properly cleans up on close
✅ Verification successful

Export modal integration is properly implemented

The verification confirms that the export flow is correctly integrated:

  1. The handleExportBoundingBox function properly sets the selected bounding box for export and shows the modal
  2. The DownloadModalView receives all required props:
    • isOpen for modal visibility
    • initialBoundingBoxId with the selected box's ID
    • initialTab="export" to open in export mode
    • onClose handler that cleans up by setting selected box to null
  3. The modal includes proper validation through isBoundingBoxExportable to ensure the export meets size constraints

The implementation follows a consistent pattern seen in other usages of DownloadModalView throughout the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for DownloadModalView usage patterns to verify consistent prop handling
ast-grep --pattern 'DownloadModalView {
  isOpen $_
  isAnnotation $_
  onClose $_
  initialBoundingBoxId $_
  initialTab $_
}'

# Verify export-related prop types and handlers
rg -A 5 'type.*DownloadModalView.*Props'

Length of output: 172


Script:

#!/bin/bash
# Let's try a broader search for DownloadModalView usage and props
rg -A 10 "DownloadModalView"

# Search for the modal component definition
fd -e tsx -e ts "DownloadModalView"

# Look for export-related code in the bounding box tab
rg -A 10 "handleExportBoundingBox|export.*boundingBox" 

Length of output: 15872

@@ -90,7 +90,7 @@ export default function BoundingBoxTab() {
}

function handleExportBoundingBox(bb: UserBoundingBox) {
_.partial(setSelectedBoundingBoxForExport, bb);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_.partial generates a new function which is callable and automatically calls setSelectedBoundingBoxForExport with bb as its first arg -> This returned function is never called
The fix simply calls the function

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
CHANGELOG.unreleased.md (1)

30-30: Enhance the changelog entry with more details.

The current entry "Fixed bbox export menu item" is too brief. Consider expanding it to provide more context about the bug and its fix, similar to other entries in the changelog.

-Fixed bbox export menu item [#8152](https://github.com/scalableminds/webknossos/pull/8152)
+Fixed an issue where the bounding box export functionality was not working correctly when triggered via the bbox menu. Users can now successfully export bounding boxes using the menu entry. [#8152](https://github.com/scalableminds/webknossos/pull/8152)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f23c220 and abf7cf6.

📒 Files selected for processing (1)
  • CHANGELOG.unreleased.md (1 hunks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants