8000 fix(nc-gui): expand row issue in canvas by rameshmane7218 · Pull Request #10535 · nocodb/nocodb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(nc-gui): expand row issue in canvas #10535

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

Merged
merged 1 commit into from
Feb 18, 2025
Merged

fix(nc-gui): expand row issue in canvas #10535

merged 1 commit into from
Feb 18, 2025

Conversation

rameshmane7218
Copy link
Member

Change Summary

Provide summary of changes with issue number if any.

Change type

  • feat: (new feature for the user, not a new feature for build script)
  • fix: (bug fix for the user, not a fix to a build script)
  • docs: (changes to the documentation)
  • style: (formatting, missing semi colons, etc; no production code change)
  • refactor: (refactoring production code, eg. renaming a variable)
  • test: (adding missing tests, refactoring tests; no production code change)
  • chore: (updating grunt tasks etc; no production code change)

Test/ Verification

Provide summary of changes.

Additional information / screenshots (optional)

Anything for maintainers to be made aware of

Copy link
Contributor
coderabbitai bot commented Feb 18, 2025
📝 Walkthrough

Walkthrough

The change updates the extractHoverMetaColRegions function within the canvas grid component. The modification revises the condition used for rendering the checkbox region by adding checks to ensure that the row is neither being reordered nor marked as read-only. This adjustment affects when the checkbox region is pushed during hover interactions, altering the visual feedback during user interaction.

Changes

File Path Change Summary
packages/nc-gui/.../canvas/index.vue Modified extractHoverMetaColRegions to include additional conditions (not reordering and not read-only) for pushing the checkbox region.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant F as extractHoverMetaColRegions
    participant R as Row State Checker
    participant CR as Checkbox Renderer

    U->>F: Hover over row
    F->>R: Evaluate row state (hovered, checked, reordering, read-only)
    R-->>F: Return row state details
    F->>CR: If valid (hovered/checked, not reordering, not read-only), push checkbox region
Loading

Suggested labels

🐛 Type: Bug, 👓 Scope : View, size:S, lgtm

Suggested reviewers

  • DarkPhoenix2704
  • dstala

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

🧹 Nitpick comments (1)
packages/nc-gui/components/smartsheet/grid/canvas/index.vue (1)

474-538: Consider improving code maintainability with these refactors.

  1. Extract magic numbers as named constants for better readability:
+const ROW_META_PADDING = 4
+const CHECKBOX_PADDING = 6
+const ICON_PADDING = 8
+const REGION_WIDTH = 24
+const CHECKBOX_TOTAL_WIDTH = 30

 function extractHoverMetaColRegions(row: Row) {
   const isAtMaxSelection = selectedRows.value.length >= MAX_SELECTED_ROWS
   const isCheckboxDisabled = (!row.rowMeta.selected && isAtMaxSelection) || vSelectedAllRecords.value || readOnly.value
   const isChecked = row.rowMeta?.selected || vSelectedAllRecords.value
   const isHover = hoverRow.value === row.rowMeta.rowIndex
   const regions = []
-  let currentX = 4
+  let currentX = ROW_META_PADDING
   let isCheckboxRendered = false
   if (isChecked || (selectedRows.value.length && isHover) || (isHover && !isRowReOrderEnabled.value && !readOnly.value)) {
     if (isChecked || isHover) {
       regions.push({
-        x: currentX + 6,
+        x: currentX + CHECKBOX_PADDING,
-        width: 24,
+        width: REGION_WIDTH,
         action: isCheckboxDisabled ? 'none' : 'select',
       })
       isCheckboxRendered = true
-      currentX += 30
+      currentX += CHECKBOX_TOTAL_WIDTH
     }
   }
   // ... rest of the function
  1. Consider using a more functional approach to determine regions:
function getRegionConfig(row: Row, currentX: number): RegionConfig {
  if (shouldShowCheckbox(row)) {
    return {
      x: currentX + CHECKBOX_PADDING,
      width: REGION_WIDTH,
      action: isCheckboxDisabled(row) ? 'none' : 'select',
      offsetX: CHECKBOX_TOTAL_WIDTH
    }
  }
  // ... other region configs
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e8ea81 and e49dd04.

📒 Files selected for processing (1)
  • packages/nc-gui/components/smartsheet/grid/canvas/index.vue (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: release-docker / buildx
  • GitHub Check: pre-build-for-playwright / playwright
  • GitHub Check: unit-tests-pg
  • GitHub Check: unit-tests
🔇 Additional comments (2)
packages/nc-gui/components/smartsheet/grid/canvas/index.vue (2)

482-482: LGTM! The condition change improves UX by preventing conflicting interactions.

The updated condition for showing the checkbox region now properly handles row reordering and read-only states, preventing the checkbox from appearing when:

  1. Row reordering is enabled, avoiding confusion between reorder and select actions
  2. The grid is in read-only mode, maintaining consistent read-only behavior

474-538:

❓ Verification inconclusive

Verify test coverage for the updated checkbox visibility logic.

The changes to extractHoverMetaColRegions affect when checkboxes are shown in the row meta column. Please ensure:

  1. Test cases cover the new condition, especially the interaction between row reordering and checkbox visibility
  2. Edge cases are tested (e.g., read-only mode with hover, reorder mode with hover)

Run this script to check for existing tests:


🏁 Script executed:

#!/bin/bash
# Search for tests related to checkbox visibility in row meta column
rg -t ts -t vue "extractHoverMetaColRegions|checkbox.*visibility|row.*reorder.*checkbox" test/

Length of output: 124


Ensure Comprehensive Test Coverage for the Updated Checkbox Visibility Logic

The changes to extractHoverMetaColRegions introduce new conditions that affect how checkboxes are rendered—especially during row reordering, in read-only mode, and when the maximum selection count is reached. Our initial search for tests referencing this function did not return any results (and encountered an issue with the file type filter for Vue files), so it's important to manually verify that:

  • Test cases exist (or are added) that cover:

    • The interaction of row hover with row reordering.
    • Scenarios in which checkboxes should be enabled or disabled, particularly when the maximum number of selected rows is reached or in read-only mode.
    • Edge cases such as the interplay between vSelectedAllRecords, hover state, and the reorder mode.
  • Manual verification is performed for any functionality that isn't already covered by automated tests.

Copy link
Contributor
github-actions bot commented Feb 18, 2025

Uffizzi Preview deployment-61054 was deleted.

@mertmit mertmit merged commit 7baf6bf into develop Feb 18, 2025
22 checks passed
@mertmit mertmit deleted the nc-fix/expand-btn branch February 18, 2025 16:33
@coderabbitai coderabbitai bot mentioned this pull request Feb 18, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0