Skip to content

add tooltips#4028

Merged
James-Baloyi merged 2 commits intoshesha-io:mainfrom
HackGenesis:derik-update/bug/#3001
Oct 21, 2025
Merged

add tooltips#4028
James-Baloyi merged 2 commits intoshesha-io:mainfrom
HackGenesis:derik-update/bug/#3001

Conversation

@HackGenesis
Copy link
Copy Markdown
Contributor

@HackGenesis HackGenesis commented Oct 21, 2025

#3001

Summary by CodeRabbit

  • Refactor
    • Reorganized event configuration layout into a clearer, hierarchical structure for the data list component.
    • Consolidated and relabeled several event handlers (save, delete, click, hover, double-click) for more intuitive configuration.
    • Added a code-editable field for the list-item save handler and improved tooltips/labels for event entries.
    • Grouped selection-related controls with conditional visibility based on selection mode.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 21, 2025

Walkthrough

Rebuilds the Events tab in the dataList settingsForm: constructs a base event component, appends multiple configurators (including a new code editor for On List Item Save), groups selection-related configurables in a conditional container, and finalizes with toJson to produce the hierarchical event settings.

Changes

Cohort / File(s) Summary
DataList settingsForm events
shesha-reactjs/src/designer-components/dataList/settingsForm.ts
Replaced inline addSettingsInputRow/addConfigurableActionConfigurator chains with a base component + appended configurators and final toJson. Added an "On List Item Save" codeEditor input (property: onListItemSave) with hidden label and tooltip. Rewired/renamed several event configurables (e.g., onListItemSaveSuccessAction, onRowSave, onRowDeleteSuccessAction, onListItemClick, onListItemHover). Introduced a conditional container grouping selection actions (onListItemSelect, onSelectionChange) visible only when selectionMode ≠ "none". Reorganized JSON assembly to reflect the new hierarchical/conditional structure.

Sequence Diagram(s)

sequenceDiagram
    participant Designer as Designer UI
    participant Builder as SettingsForm Builder
    participant Config as ConfigurableAction
    rect rgba(100,180,120,0.08)
        Designer->>Builder: open Events tab
        Builder->>Builder: construct base event component
        Builder->>Config: addOnListItemSave (codeEditor) [onListItemSave]
        Builder->>Config: addOnListItemSaveSuccessAction [onListItemSaveSuccessAction]
        Builder->>Config: addRowEvents (save/delete/click/hover)
        Builder->>Builder: create selection container (visible if selectionMode != "none")
        Builder->>Config: addOnListItemSelect & onSelectionChange inside container
        Builder->>Builder: assemble configurators
        Builder->>Builder: toJson() -> final events JSON
    end
    note right of Builder: Result is hierarchical\nand conditionally-visible settings
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • James/en/datalist #3153: Modifies the same settingsForm events configurators, including renaming and restructuring related event entries.
  • James/f/datalist #3275: Adjusts dataList settingsForm event wiring and onListItemSaveSuccessAction handling.

Suggested reviewers

  • James-Baloyi

Poem

🐰
I stitched the events with nimble paws,
Grouped selects and saved with thoughtful laws,
A code-editor nook where saves abide,
Containers hide when selection's set aside,
Hop, click, and hover — now tidy and wide.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "add tooltips" refers to a real aspect of the changes present in the pull request. According to the raw summary, a tooltip was explicitly added to the "On List Item Save" field with hideLabel enabled. However, the primary focus of this changeset is the extensive reworking of the Events tab construction, including restructuring event configurators, consolidating multiple event handlers, and introducing new container groupings with conditional visibility logic. The title captures only a minor detail of the overall refactoring rather than the main objective of the changes.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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

🧹 Nitpick comments (3)
shesha-reactjs/src/designer-components/dataList/settingsForm.ts (3)

444-451: Inconsistent parentId on configurators in Events tab.

Some configurators omit parentId: eventsTabId while others include it. Add for consistency and to avoid layout/ownership quirks in the builder.

 .addConfigurableActionConfigurator({
   id: nanoid(),
   propertyName: 'onListItemSaveSuccessAction',
   label: 'On List Item Save Success',
+  parentId: eventsTabId,
   hideLabel: true,
   description: 'Custom Action configuration executed when saving list items (validation, calculations, etc.)',
 })
 .addConfigurableActionConfigurator({
   id: nanoid(),
   propertyName: 'onRowDeleteSuccessAction',
   label: 'On List Item Delete Success',
   description: 'Custom business logic to be executed after successfull deletion of a list item.',
+  parentId: eventsTabId,
   hideLabel: true,
 })
 .addConfigurableActionConfigurator({
   id: nanoid(),
   propertyName: 'onListItemClick',
   label: 'On List Item Click',
   description: 'Action to execute when a list item is clicked',
+  parentId: eventsTabId,
 })
 .addConfigurableActionConfigurator({
   id: nanoid(),
   propertyName: 'onListItemHover',
   label: 'On List Item Hover',
   description: 'Action to execute when hovering over a list item',
+  parentId: eventsTabId,
 })

Also applies to: 462-468, 469-475, 476-481


17-48: exposedVariables are stringified; align type with other editors.

ROW_SAVE_EXPOSED_VARIABLES builds strings via JSON.stringify, while other places (e.g., Appearance > Group Style) pass objects. Normalize to object[] for consistency unless the runtime explicitly requires strings.

-  const ROW_SAVE_EXPOSED_VARIABLES = [
-    {
-      id: nanoid(),
-      name: 'data',
-      description: 'Current row data',
-      type: 'object',
-    },
-    {
-      id: nanoid(),
-      name: 'formData',
-      description: 'Form values',
-      type: 'object',
-    },
-    {
-      id: nanoid(),
-      name: 'globalState',
-      description: 'The global state of the application',
-      type: 'object',
-    },
-    {
-      id: nanoid(),
-      name: 'http',
-      description: 'axios instance used to make http requests',
-      type: 'object',
-    },
-    {
-      id: nanoid(),
-      name: 'moment',
-      description: 'The moment.js object',
-      type: 'object',
-    },
-  ].map((item) => JSON.stringify(item));
+  const ROW_SAVE_EXPOSED_VARIABLES = [
+    { name: 'data',        description: 'Current row data',                          type: 'object' },
+    { name: 'formData',    description: 'Form values',                               type: 'object' },
+    { name: 'globalState', description: 'The global state of the application',       type: 'object' },
+    { name: 'http',        description: 'axios instance used to make http requests', type: 'object' },
+    { name: 'moment',      description: 'The moment.js object',                      type: 'object' },
+  ];

If the designer intentionally expects string entries, consider converting other usages to be consistent instead. Please confirm the expected shape.


424-435: onListItemSave lacks exposedVariables; add for parity and usability.

Expose the same variables as onRowSave so authors have a consistent API surface.

 .addSettingsInputRow({
   id: nanoid(),
   inputs: [{
     id: nanoid(),
     type: 'codeEditor',
     propertyName: 'onListItemSave',
     label: 'On List Item Save',
     jsSetting: false,
     tooltip: 'Custom business logic executed when saving list items (validation, calculations, etc.)',
+    exposedVariables: ROW_SAVE_EXPOSED_VARIABLES,
   }],
   hideLabel: true,
 })
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91fc300 and 78707fe.

📒 Files selected for processing (1)
  • shesha-reactjs/src/designer-components/dataList/settingsForm.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-attempt
🔇 Additional comments (1)
shesha-reactjs/src/designer-components/dataList/settingsForm.ts (1)

437-443: No action required — migration already implemented.

The review concern about breaking changes from the property rename has already been addressed. The dataListComponent.tsx migration (version 5→6) maps the old actionConfiguration to the new dblClickActionConfiguration, and version 6 applies migrateNavigateAction() transformation. The PR's addition of the settings form entry at line 438 is simply exposing an already-migrated and stable property through the designer UI. No persisted configs will lose wiring.

Copy link
Copy Markdown
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 (2)
shesha-reactjs/src/designer-components/dataList/settingsForm.ts (2)

424-435: Add exposedVariables to help developers understand available context.

The onListItemSave code editor lacks exposed variables documentation, while the similar onRowSave handler (lines 451-461) includes them. Developers would benefit from knowing what variables are available in this context.

Consider adding exposedVariables similar to onRowSave:

   .addSettingsInputRow({
     id: nanoid(),
     inputs: [{
       id: nanoid(),
       type: 'codeEditor',
       propertyName: 'onListItemSave',
       label: 'On List Item Save',
       jsSetting: false,
       tooltip: 'Custom business logic executed when saving list items (validation, calculations, etc.)',
+      exposedVariables: [
+        `{ name: "data", description: "Current row data", type: "object" }`,
+        `{ name: "formData", description: "Form values", type: "object" }`,
+        `{ name: "globalState", description: "The global state of the application", type: "object" }`,
+        `{ name: "http", description: "axios instance used to make http requests", type: "object" }`,
+        `{ name: "moment", description: "The moment.js object", type: "object" }`,
+      ],
     }],
     hideLabel: true,
   })

444-450: Clarify the description to reflect post-save timing.

The description mentions "validation, calculations" which typically occur before saving, but this handler executes after a successful save. Consider clarifying the timing and typical use cases for post-save actions.

Suggested revision:

   .addConfigurableActionConfigurator({
     id: nanoid(),
     propertyName: 'onListItemSaveSuccessAction',
     label: 'On List Item Save Success',
     hideLabel: true,
-    description: 'Custom Action configuration executed when saving list items (validation, calculations, etc.)',
+    description: 'Action to execute after successfully saving a list item (e.g., showing notifications, updating related data, navigation)',
   })
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78707fe and 98420c7.

📒 Files selected for processing (1)
  • shesha-reactjs/src/designer-components/dataList/settingsForm.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-attempt
🔇 Additional comments (6)
shesha-reactjs/src/designer-components/dataList/settingsForm.ts (6)

436-443: LGTM! Good addition of descriptive text.

The double-click action configurator now includes a helpful description, improving the user experience.


451-461: LGTM! Well-documented handler with proper context.

The onRowSave handler includes helpful tooltip, description, exposed variables, and appropriate conditional visibility. The note about returning an object or Promise is particularly useful for developers.


462-468: LGTM! Typo has been corrected.

The typo flagged in the previous review ("successfull" → "successful") has been fixed. The description now correctly reads "successful deletion."


469-474: LGTM! Clear event handler definition.

The click handler is well-defined with a clear description.


475-480: LGTM! Clear event handler definition.

The hover handler is well-defined with a clear description.


481-503: LGTM! Well-structured conditional grouping of selection events.

The approach of building base components with the builder pattern, then appending a conditional container is valid. The conditional visibility logic correctly hides selection-related events when selectionMode is "none", and the descriptions clearly distinguish between onListItemSelect (select only) and onSelectionChange (select and unselect).

@HackGenesis HackGenesis marked this pull request as ready for review October 21, 2025 09:21
@James-Baloyi James-Baloyi merged commit fc0438c into shesha-io:main Oct 21, 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