Skip to content

Conversation

@czwe-01
Copy link
Collaborator

@czwe-01 czwe-01 commented May 28, 2025

#2542

Summary by CodeRabbit

  • Enhancements
    • Moved "Selection Type", "Entity Type", and "Display Property" settings from the "Common" tab to the "Data" tab in the settings form for improved organization.
    • Changed "Selection Type" input to a dropdown with "Single" and "Multiple" options.
    • Added a tooltip to the "Dialog Width" input, clarifying supported CSS units and default behavior.
    • Improved form input handling with dynamic evaluation of model types for enhanced query building.
    • Enhanced file upload container styling with consistent sizing and improved scrollbar appearance.

@czwe-01 czwe-01 requested a review from James-Baloyi May 28, 2025 06:45
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 28, 2025

Walkthrough

The changes reorganize the placement of entity selection-related input fields within a settings form, moving them from the "Common" tab to the "Data" tab. The "Selection Type" input type is changed from a query builder to a dropdown. A tooltip is added to the "Dialog Width" input to clarify acceptable CSS units. The InputComponent updates form data access by replacing useFormData with useShaFormInstance. The settingsInput component now evaluates the modelType string dynamically before passing it to MetadataProvider. No changes are made to exported function signatures.

Changes

File(s) Change Summary
shesha-reactjs/src/designer-components/entityPicker/settingsForm.ts Moved "Selection Type," "Entity Type," and "Display Property" inputs from "Common" tab to "Data" tab; changed "Selection Type" input to dropdown; added tooltip to "Dialog Width" input; updated parent container IDs.
shesha-reactjs/src/designer-components/inputComponent/index.tsx Replaced useFormData hook with useShaFormInstance; updated form data destructuring accordingly.
shesha-reactjs/src/designer-components/settingsInput/settingsInput.tsx Added evaluation of modelType string using evaluateString with form data context; passed evaluated value to MetadataProvider.
shesha-reactjs/src/components/storedFilesRendererBase/styles/styles.ts Enhanced container height constraints and scrollbar styling; added !important to width/height styles for upload list items; added padding to upload list container.

Possibly related PRs

  • Thulasizwe/f/entity type #3245: Modifies modelType property in settings forms (including entityPicker) from static strings to dynamic expressions, related to dynamic evaluation of modelType used here.

Suggested reviewers

  • James-Baloyi

Poem

In the tabs, the fields now hop,
From "Common" to "Data" they swap.
Dialog widths explained anew,
With tooltips clear as morning dew.
A dropdown choice now takes the stage,
And queries gain a wiser page.
Rabbits cheer this tidy feat! 🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e6395c5 and 16e50d1.

📒 Files selected for processing (3)
  • shesha-reactjs/src/components/storedFilesRendererBase/styles/styles.ts (4 hunks)
  • shesha-reactjs/src/designer-components/inputComponent/index.tsx (2 hunks)
  • shesha-reactjs/src/designer-components/settingsInput/settingsInput.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • shesha-reactjs/src/designer-components/inputComponent/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (4)
shesha-reactjs/src/designer-components/settingsInput/settingsInput.tsx (1)

14-14: LGTM! Excellent enhancement for dynamic model type evaluation.

The implementation correctly evaluates the modelType string using the current form data context before passing it to MetadataProvider. This enables dynamic model type configuration while maintaining backwards compatibility through proper conditional handling.

Also applies to: 21-21

shesha-reactjs/src/components/storedFilesRendererBase/styles/styles.ts (3)

60-68: Good enhancement for container sizing and scrolling behavior.

The addition of height constraints with !important priority and custom scrollbar styling improves the component's visual consistency and user experience. The thin scrollbar with transparent background provides a clean, modern appearance.


83-84: Enhanced CSS specificity for layout consistency.

Adding !important to width and height properties when layout is true ensures reliable sizing behavior. While extensive use of !important can make future overrides challenging, this appears necessary for component isolation in a design system context.

Also applies to: 207-208


183-183: Minor spacing improvement.

The 2px padding addition to the upload list container provides better visual spacing without impacting the overall layout.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e25dac4 and 3421714.

📒 Files selected for processing (1)
  • shesha-reactjs/src/designer-components/entityPicker/settingsForm.ts (2 hunks)
🔇 Additional comments (3)
shesha-reactjs/src/designer-components/entityPicker/settingsForm.ts (3)

109-109: LGTM! Dynamic container ID generation is appropriate.

Using nanoid() for the container ID is a good practice for ensuring unique identifiers.


112-148: Good logical reorganization of data-related inputs.

Moving the Selection Type and Entity Type inputs to the Data tab makes logical sense as these are core data configuration settings.


352-352: Excellent UX improvement with helpful tooltip.

The tooltip clearly explains the CSS unit options and default behavior, which will help users configure the dialog width correctly.

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)
shesha-reactjs/src/designer-components/inputComponent/index.tsx (1)

201-205: Dynamic modelType evaluation implemented correctly.

The QueryBuilder case now properly evaluates the modelType string expression using the current form data and passes it as a prop. The implementation follows the same pattern as other string evaluations in the component.

Consider adding error handling for the modelType evaluation to make it more robust:

 case 'queryBuilder': {
-    const modelType = props.modelType ? evaluateString(props.modelType, { data: formData }) : undefined;
+    const modelType = props.modelType 
+        ? evaluateString(props.modelType, { data: formData }) 
+        : undefined;

     return <QueryBuilder {...props} hideLabel={true} defaultValue={defaultValue} readOnly={props.readOnly} modelType={modelType} />;
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3421714 and e6395c5.

📒 Files selected for processing (2)
  • shesha-reactjs/src/designer-components/entityPicker/settingsForm.ts (7 hunks)
  • shesha-reactjs/src/designer-components/inputComponent/index.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • shesha-reactjs/src/designer-components/entityPicker/settingsForm.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (2)
shesha-reactjs/src/designer-components/inputComponent/index.tsx (2)

47-47: Form data access pattern updated correctly.

The destructuring pattern change from { data: formData } to { formData } aligns with the new hook implementation. The usage throughout the component correctly wraps formData in { data: formData } when needed for evaluation functions.


6-6:

Details

❓ Verification inconclusive

Verify the hook replacement is properly implemented.

The import has been updated to replace useFormData with useShaFormInstance. Ensure that this hook replacement is consistent across the codebase and that useShaFormInstance provides the same functionality.


🏁 Script executed:

#!/bin/bash
# Description: Verify that useShaFormInstance hook is properly implemented and used consistently
# Expected: Find the hook definition and check for any remaining useFormData usage

# Check if useShaFormInstance is properly exported from the index
rg -A 5 "export.*useShaFormInstance" 

# Check for any remaining useFormData imports that might have been missed
rg "useFormData" --type tsx --type ts

# Find the implementation of useShaFormInstance to understand its interface
ast-grep --pattern 'export const useShaFormInstance = $_'

Length of output: 164


🏁 Script executed:

#!/bin/bash
set -e

# Search all occurrences of the new hook to verify its definition and usage
echo "=== Searching for useShaFormInstance definitions and usage ==="
grep -R -n "useShaFormInstance" .

# Search for any remaining references to the old hook
echo "=== Searching for useFormData references ==="
grep -R -n "useFormData" .

Length of output: 177


Missing useShaFormInstance Hook Definition

I wasn’t able to locate any definition or export of useShaFormInstance in the codebase. Please verify the following before merging:

• Confirm that useShaFormInstance is implemented and exported (e.g., in your root index.ts or equivalent entry point).
• Remove any remaining useFormData references to avoid accidental imports.
• Ensure the new hook’s API matches the old one (i.e., it returns formData and any other expected fields).

@James-Baloyi James-Baloyi merged commit 09f1da8 into shesha-io:main Jun 2, 2025
2 checks passed
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.

2 participants