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

chore: Replacing the entity group list component on state inspector and data side pane with new ADS component #38621

Merged
merged 9 commits into from
Jan 14, 2025

Conversation

ankitakinger
Copy link
Contributor

@ankitakinger ankitakinger commented Jan 13, 2025

Description

Replacing the entity group list component on state inspector and data side pane with new ADS component

Fixes #38290

Automation

/ok-to-test tags="@tag.Datasource"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12763738469
Commit: a4b7172
Cypress dashboard.
Tags: @tag.Datasource
Spec:


Tue, 14 Jan 2025 09:50:48 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced list item styling with configurable height.
    • Added support for dynamic item count in entity groups.
    • Improved icon rendering with customizable dimensions.
    • Introduced a new constant for default group list size.
  • Improvements

    • Simplified rendering of grouped items in various components.
    • Refined type safety for boolean assignments.
    • Updated state management for entity groups.
    • Enhanced control over item visibility in modals and lists.
  • Technical Updates

    • Introduced new data attributes for enhanced component interactions.
    • Modernized component rendering logic.
    • Replaced custom styled list with a dedicated EntityGroupsList component for better maintainability.
    • Expanded story examples for the ListItem component to showcase various configurations.

Copy link
Contributor

coderabbitai bot commented Jan 13, 2025

Walkthrough

The pull request introduces comprehensive changes to the design system and entity explorer components, focusing on enhancing list item rendering and group management. The modifications span multiple files, introducing a new EntityGroupsList component, updating styling for list items, and refactoring how entity groups are displayed in the Data Side Pane and State Inspector. The changes aim to standardize and simplify the rendering of grouped items across different parts of the application.

Changes

File Change Summary
app/client/packages/design-system/ads/src/List/List.styles.tsx Added max-height styling for StyledListItem with conditional rendering based on data-isblockdescription attribute. Modified BottomContentWrapper padding and added conditional styles. Updated TooltipTextWrapper with a new rule.
app/client/packages/design-system/ads/src/List/List.tsx Updated boolean type conversion using Boolean constructor and added data-isblockdescription and data-isiconpresent attributes to respective components.
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/... Introduced visibleItems prop and updated component signatures for EntityGroup and EntityGroupsList. Enhanced item visibility management.
app/client/src/ce/selectors/entitiesSelector.ts Modified getQuerySegmentItems selector to include width and height parameters in ActionUrlIcon.
app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx Updated ActionUrlIcon function signature to accept height and width parameters.
app/client/src/components/editorComponents/Debugger/StateInspector/StateInspector.tsx Replaced custom list rendering with EntityGroupsList component.
app/client/src/pages/Editor/IDE/LeftPane/DataSidePane.tsx Refactored datasource list rendering to utilize EntityGroupsList, removing the previous custom styled list.
app/client/packages/design-system/ads/src/List/List.stories.tsx Modified story definitions for ListItem component, including new stories for variations of block descriptions.

Assessment against linked issues

Objective Addressed Explanation
Replace Group listing with EntityGroupedList
Retain test ids
Update State Inspector

Possibly related PRs

Suggested Labels

Enhancement

Suggested Reviewers

  • hetunandu

Poem

Code flows like rivers, smooth and bright
List items dancing with newfound might
Groups assembled, components align
In this digital design, we shine! 🌟
Refactoring magic, pure delight! 🚀


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between abb4d62 and a4b7172.

📒 Files selected for processing (3)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.tsx (3 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/Add.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/Add.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/Add.tsx
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.tsx
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
🔇 Additional comments (2)
app/client/src/pages/Editor/IDE/EditorPane/JS/Add.tsx (2)

24-24: LGTM! Good practice using a constant.

Using DEFAULT_GROUP_LIST_SIZE constant instead of a magic number improves maintainability.


102-109: Verify the impact of visibleItems on user experience.

The addition of visibleItems={DEFAULT_GROUP_LIST_SIZE} will limit the number of visible items. Please ensure this doesn't negatively impact users who need to see more items.

Run this script to check the constant's value and its usage across the codebase:

Also, the bottom padding addition looks good and maintains consistency with the design system.


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.

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.

@github-actions github-actions bot added IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Low An issue that is neither critical nor breaks a user flow Task A simple Todo skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Jan 13, 2025
@ankitakinger ankitakinger added the ok-to-test Required label for CI label Jan 13, 2025
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: 2

🧹 Nitpick comments (6)
app/client/packages/design-system/ads/src/List/List.tsx (1)

90-95: Consider simplifying boolean conversions

The Boolean constructor is unnecessary here as the expressions already evaluate to boolean values.

-  const isBlockDescription = Boolean(
-    descriptionType === "block" && description,
-  );
-  const isInlineDescription = Boolean(
-    descriptionType === "inline" && description,
-  );
+  const isBlockDescription = descriptionType === "block" && description;
+  const isInlineDescription = descriptionType === "inline" && description;
app/client/packages/design-system/ads/src/List/List.styles.tsx (1)

94-94: Consider using CSS custom property for max-height value.

The hardcoded max-height value could be moved to the Variables CSS block for consistency with other dimensional values in the design system.

- max-height: 32px;
+ max-height: var(--ads-v2-list-item-height);
app/client/src/components/editorComponents/Debugger/StateInspector/StateInspector.tsx (1)

53-65: Consider simplifying the group mapping.

The group mapping could be simplified by removing the empty className property since it's not being used.

 groups={filteredItemGroups.map((item) => ({
   groupTitle: item.group,
   items: item.items,
-  className: "",
 }))}
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.tsx (1)

37-39: Consider using a callback for setState.

Initialize state using a function to avoid unnecessary calculations during component initialization.

-const [visibleItems, setVisibleItems] = React.useState(
-  visibleItemsCount || group.items.length,
-);
+const [visibleItems, setVisibleItems] = React.useState(() =>
+  visibleItemsCount || group.items.length
+);
app/client/src/pages/Editor/IDE/LeftPane/DataSidePane.tsx (2)

127-153: Remove redundant empty className property.

The empty className property at line 150 is redundant and can be removed.

 return {
   groupTitle: key,
   items: value.map((data) => ({
     // ... other properties
   })),
-  className: "",
 };

133-149: Consider extracting the item mapping logic.

The item mapping logic is complex and could be extracted into a separate function for better maintainability.

+const mapDatasourceToListItem = (data: any, dsUsageMap: any, groupedPlugins: any, currentSelectedDatasource: string, goToDatasource: Function) => ({
+  id: data.id,
+  title: data.name,
+  startIcon: (
+    <DatasourceIcon
+      src={getAssetUrl(groupedPlugins[data.pluginId].iconLocation)}
+    />
+  ),
+  description: get(dsUsageMap, data.id, ""),
+  descriptionType: "block",
+  className: "t--datasource",
+  isSelected: currentSelectedDatasource === data.id,
+  onClick: () => goToDatasource(data.id),
+});

 items: value.map((data) => 
-  return {
-    id: data.id,
-    // ... rest of the properties
-  }
+  mapDatasourceToListItem(data, dsUsageMap, groupedPlugins, currentSelectedDatasource, goToDatasource)
 ),
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd5a6d6 and 0763fa3.

📒 Files selected for processing (8)
  • app/client/packages/design-system/ads/src/List/List.styles.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/List/List.tsx (2 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.tsx (2 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.types.ts (1 hunks)
  • app/client/src/ce/selectors/entitiesSelector.ts (1 hunks)
  • app/client/src/components/editorComponents/Debugger/StateInspector/StateInspector.tsx (2 hunks)
  • app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/LeftPane/DataSidePane.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/ce/selectors/entitiesSelector.ts
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: storybook-tests
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment
🔇 Additional comments (3)
app/client/packages/design-system/ads/src/List/List.tsx (1)

121-121: LGTM! Good use of data attribute for styling

The data attribute provides a clean way to apply conditional styles based on the description type.

app/client/packages/design-system/ads/src/List/List.styles.tsx (1)

98-100: Verify height accommodation for block descriptions.

The increased max-height of 54px for block descriptions needs verification to ensure it adequately accommodates:

  1. Multi-line descriptions
  2. Various font sizes (especially in lg size mode)
  3. Line height and padding combinations
✅ Verification successful

Block description height of 54px is correctly configured

The max-height is sufficient as block descriptions are intentionally constrained to a single line with text overflow handling. This works for all font sizes, including the large size mode.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of block descriptions to verify height requirements
ast-grep --pattern 'StyledListItem $props isBlockDescription={true}'

Length of output: 70


Script:

#!/bin/bash
# Search for List component usage with block descriptions
rg -U "isBlockDescription.*?true" -g "*.{tsx,jsx}"

# Search for style definitions related to List and block descriptions
rg "data-isblockdescription" -g "*.{tsx,jsx,ts,css,scss}"

# Search for font-size and line-height definitions in the List styles
cat app/client/packages/design-system/ads/src/List/List.styles.tsx

# Look for any height-related properties in List component
rg "height|lineHeight" app/client/packages/design-system/ads/src/List/

Length of output: 5496

app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.types.ts (1)

19-19: LGTM! Clean type definition addition.

The optional visibleItemsCount property is well-typed and maintains backward compatibility.

@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12744729296.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38621.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-38621.dp.appsmith.com

@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12745692622.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38621.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-38621.dp.appsmith.com

@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12746282278.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38621.
recreate: .

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 (2)
app/client/packages/design-system/ads/src/List/List.stories.tsx (2)

214-215: Use a more realistic example for the overflow title.

Consider using a natural text example that better represents real-world scenarios, such as "This is a very long action item name that demonstrates text overflow behavior".

-  title:
-    "Action_item_1_with_a_very_long_name_that_should_show_ellipsis_in_the_same_line",
+  title:
+    "This is a very long action item name that demonstrates text overflow behavior",

219-231: Enhance the block description example.

The current description "block" doesn't effectively demonstrate the block description feature. Consider using a more meaningful example.

   startIcon: <Icon name="file-list-2-line" size={"md"} />,
   title: "Action item 1",
-  description: "block",
+  description: "This is a detailed description that appears below the title, demonstrating the block layout.",
   descriptionType: "block",
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d67fc6f and ba36851.

📒 Files selected for processing (3)
  • app/client/packages/design-system/ads/src/List/List.stories.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/List/List.styles.tsx (4 hunks)
  • app/client/packages/design-system/ads/src/List/List.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/client/packages/design-system/ads/src/List/List.tsx
  • app/client/packages/design-system/ads/src/List/List.styles.tsx
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
🔇 Additional comments (1)
app/client/packages/design-system/ads/src/List/List.stories.tsx (1)

232-242: LGTM! Well-structured story definition.

The story effectively demonstrates the block description variant without an icon, using clear and meaningful examples.

Copy link

Deploy-Preview-URL: https://ce-38621.dp.appsmith.com

hetunandu
hetunandu previously approved these changes Jan 13, 2025
@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12747815044.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38621.
recreate: .

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)
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.stories.tsx (1)

22-27: Consider using story controls for visibleItems.

Instead of hardcoding the value 5, consider:

  1. Using story controls to allow dynamic testing of different values
  2. Importing the same constant used by the application
- visibleItems={5}
+ visibleItems={args.visibleItems}

And add to the story's argTypes:

argTypes: {
  visibleItems: {
    control: { type: 'number', min: 1 },
    defaultValue: 5,
  },
},

Also applies to: 91-91

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba36851 and abb4d62.

📒 Files selected for processing (5)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EntityGroupsList/EntityGroupsList.stories.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/Add.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/Add.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/RightPane/components/CreateNewQueryModal.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/constants.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/pages/Editor/IDE/constants.ts
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
🔇 Additional comments (3)
app/client/src/pages/Editor/IDE/RightPane/components/CreateNewQueryModal.tsx (1)

40-44: LGTM! Good UX improvement.

The addition of visibleItems prop helps maintain consistency in list item visibility across the application.

app/client/src/pages/Editor/IDE/EditorPane/Query/Add.tsx (1)

63-67: LGTM! Consistent with modal implementation.

The visibleItems prop implementation aligns with the pattern used in CreateNewQueryModal.

app/client/src/pages/Editor/IDE/EditorPane/JS/Add.tsx (1)

102-106: LGTM! Maintains consistency across components.

The implementation follows the same pattern as Query and Modal components, ensuring a consistent user experience.

Copy link

Deploy-Preview-URL: https://ce-38621.dp.appsmith.com

@ankitakinger ankitakinger added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jan 13, 2025
@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12755373216.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38621.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-38621.dp.appsmith.com

@ankitakinger ankitakinger added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jan 14, 2025
@ankitakinger ankitakinger merged commit d187854 into release Jan 14, 2025
120 of 124 checks passed
@ankitakinger ankitakinger deleted the chore/replace-group-list-implementation branch January 14, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Low An issue that is neither critical nor breaks a user flow ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace Group listing of entity items in Data side pane
2 participants