Skip to content

refactor date field and form settings #3396

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 3 commits into from
Jun 17, 2025

Conversation

HackGenesis
Copy link
Contributor

@HackGenesis HackGenesis commented Jun 12, 2025

refactor form settings and date field

Summary by CodeRabbit

  • New Features

    • Added a new "Security" tab in form settings with access and permissions options.
  • Enhancements

    • Restored the property autocomplete input for data loader settings in form configuration.
    • Improved organization and clarity of form settings panels and inputs.
    • Increased the minimum and maximum width of the form settings editor modal for better usability.
    • Updated styling for form settings editor to enhance layout consistency.
    • Replaced fixed IDs with dynamically generated unique IDs in form settings inputs to improve reliability.
  • Style

    • Adjusted spacing and formatting within form settings for improved readability.
  • Refactor

    • Renamed properties in date field settings for clarity (e.g., disabled date/time function properties).

Copy link
Contributor

coderabbitai bot commented Jun 12, 2025

Walkthrough

The changes restore a previously removed input for additional fields to fetch in the data load settings, replace hardcoded string IDs with dynamically generated IDs using nanoid() for certain input rows, update property names in the date field settings form, and adjust modal width and styling in the form settings editor. No exported function signatures or core logic are altered.

Changes

File(s) Change Summary
.../formDesigner/formSettings.ts Restored fieldsToFetch input row; replaced hardcoded input row IDs with dynamic nanoid() IDs.
.../formDesigner/formSettingsEditor.tsx Increased modal min/max width; added CSS class to ConfigurableForm component.
.../mainLayout/styles/indexStyles.ts Added CSS rules to adjust margin and inline display for form item rows in settings editor modal.
.../designer-components/dateField/settingsForm.ts Renamed properties: isDateDisableddisabledDateFunc, isTimeDisableddisabledTimeFunc.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SettingsEditor
    participant FormSettingsConfig

    User->>SettingsEditor: Open form settings modal
    SettingsEditor->>FormSettingsConfig: Load updated settings configuration
    FormSettingsConfig-->>SettingsEditor: Return settings with restored input and dynamic IDs
    User->>SettingsEditor: Modify settings and save
Loading

Possibly related PRs

Suggested reviewers

  • AlexStepantsov
  • James-Baloyi

Poem

🐇 In code’s green fields I leap and play,
Restoring inputs swept away.
IDs unique now dance and spin,
Modal’s wider, styles fit in.
With names aligned and forms made bright,
This rabbit hops with pure delight! 🌿✨


📜 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 9a3b74b and 552cfc7.

📒 Files selected for processing (1)
  • shesha-reactjs/src/components/formDesigner/formSettings.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • shesha-reactjs/src/components/formDesigner/formSettings.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
✨ 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

🔭 Outside diff range comments (1)
shesha-reactjs/src/components/formDesigner/formSettings.ts (1)

81-86: ⚠️ Potential issue

Hard-coded parentId looks wrong

parentId: 'qzAhO4Zbgao4mbi7CPJsAbJ5Hw7brZ' isn’t defined anywhere and differs from the dataLoaderTypeId nanoid declared above. Using an orphan ID will break the component tree. Replace with dataLoaderTypeId.

- parentId: "qzAhO4Zbgao4mbi7CPJsAbJ5Hw7brZ",
+ parentId: dataLoaderTypeId,
🧹 Nitpick comments (2)
shesha-reactjs/src/components/mainLayout/styles/indexStyles.ts (1)

92-98: Risky !important overrides – tighten the selector

!important on core Ant classes inside .sha-form-settings-editor can unexpectedly affect any future component that re-uses this wrapper. Prefer limiting the scope (e.g. target a specific form item with an additional class) or replace display: inline with more granular flex/grid styling to avoid breaking multiline inputs.

shesha-reactjs/src/components/formDesigner/formSettingsEditor.tsx (1)

43-44: Min-width 590 px may break mobile UX

The modal now fails to fit ≤ 576 px viewports. Consider keeping the old 320 px floor or switch to Ant’s responsive wrapClassName/responsive props so that settings remain reachable on phones.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fb82c79 and 9a3b74b.

📒 Files selected for processing (4)
  • shesha-reactjs/src/components/formDesigner/formSettings.ts (1 hunks)
  • shesha-reactjs/src/components/formDesigner/formSettingsEditor.tsx (2 hunks)
  • shesha-reactjs/src/components/mainLayout/styles/indexStyles.ts (1 hunks)
  • shesha-reactjs/src/designer-components/dateField/settingsForm.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (4)
shesha-reactjs/src/components/formDesigner/formSettingsEditor.tsx (1)

58-58: Good move adding a scoping class

Tagging the form with sha-form-settings-editor enables targeted styling and avoids global leakage.

shesha-reactjs/src/designer-components/dateField/settingsForm.ts (2)

246-250:

❓ Verification inconclusive

Renamed disabledDateFunc – ensure backward-compat

Existing saved layouts still persist isDateDisabled. Provide a migration step or fallback (e.g. read old key if new one is absent) to avoid silently dropping user logic.


🏁 Script executed:

#!/bin/bash
# Find remaining references to the old key
rg -n "isDateDisabled"

Length of output: 22


Ensure legacy isDateDisabled settings are handled

I ran a search for the old key but found no references to isDateDisabled in the codebase. Please manually verify that any persisted layouts using this legacy property are correctly migrated or that the loader falls back to the old key when disabledDateFunc is absent.


292-295:

✅ Verification successful

Same concern for disabledTimeFunc

Double-check that no runtime code still expects isTimeDisabled, and consider auto-migration logic.


🏁 Script executed:

#!/bin/bash
rg -n "isTimeDisabled"

Length of output: 22


No occurrences of isTimeDisabled found – rename is safe
A global search returned no references to isTimeDisabled in the codebase, so the switch to disabledTimeFunc won’t break any runtime logic. You can remove the old property and proceed without adding migration code.

shesha-reactjs/src/components/formDesigner/formSettings.ts (1)

154-173: 👍 Nice restoration of fieldsToFetch

Re-adding the autocomplete for extra GraphQL fields closes a long-standing gap.

@James-Baloyi James-Baloyi merged commit 4c6fcce into shesha-io:main Jun 17, 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