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: entity tabs replacement #38989

Merged
merged 41 commits into from
Feb 6, 2025

Conversation

alex-golovanov
Copy link
Contributor

@alex-golovanov alex-golovanov commented Feb 3, 2025

Description

Replacing entity tab bar and components with ADS templates.

Fixes #37647
Fixes #37775

Automation

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

🔍 Cypress test results

Tip

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


Thu, 06 Feb 2025 07:56:59 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced tab interaction: The add button now supports dynamic visibility and a loading indicator when new tabs are being created.
    • Improved editing: Tab labels now feature refined controls for entering and exiting edit mode, offering a more flexible user experience.
    • New EntityTabsHeader component added to enhance tab management.
    • Updated tab structure to utilize DismissibleTab for improved functionality.
    • Introduced new props for DismissibleTabBar to allow for additional styling and control over add button visibility.
    • New properties added to DismissibleTab for greater interactivity and customization.
    • Additional properties introduced to EditableDismissibleTab for enhanced editing capabilities.
  • Refactor

    • Streamlined the tab interface by replacing legacy components with modern, responsive alternatives, simplifying the overall design and interaction.
    • Enhanced event handling and state management for better performance and user experience.
    • Updated import paths and component structures for clarity and maintainability.

alex-golovanov and others added 30 commits January 15, 2025 16:57
# Conflicts:
#	app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTab.tsx
#	app/client/packages/design-system/ads/src/DismissibleTab/index.ts
…ssibleTabBar.styles.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
# Conflicts:
#	app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.stories.tsx
#	app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.styles.ts
#	app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.tsx
# Conflicts:
#	app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/EntityTabsHeader.mdx
- Delete AddButton, Container, FileTab, and their associated tests and styles.
- Replace them with DismissibleTab and EntityTabsHeader components for improved tab management.
- Adjust logic to manage tab visibility and interactions, simplifying the code structure.
- Ensure seamless integration of newly added components into the EditorTabs functionality.
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/DismissibleTab/DismissibleTabBar.tsx (1)

104-119: Good loading state implementation.

The conditional rendering between Spinner and PlusButton provides clear user feedback. However, consider adding aria-label to the Spinner for better accessibility.

-            <Spinner size="md" />
+            <Spinner aria-label="Adding new tab" size="md" />
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c92bef9 and 4c80891.

📒 Files selected for processing (5)
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.tsx (3 hunks)
  • app/client/src/pages/Editor/IDE/EditorTabs/AddTab.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/EditorTabs/EditableTab.tsx (3 hunks)
  • app/client/src/pages/Editor/IDE/EditorTabs/Editortabs.test.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/EditorTabs/index.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/src/pages/Editor/IDE/EditorTabs/EditableTab.tsx
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
🔇 Additional comments (7)
app/client/src/pages/Editor/IDE/EditorTabs/AddTab.tsx (2)

2-4: Good use of useEventCallback for event handler optimization!

The event handler is now memoized properly, which helps prevent unnecessary re-renders.

Also applies to: 24-27


34-41: Clean migration to DismissibleTab component.

The component migration maintains all necessary functionality while aligning with the new design system.

app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.tsx (1)

24-25: Well-structured prop additions.

The new props enhance component flexibility while maintaining clean defaults.

app/client/src/pages/Editor/IDE/EditorTabs/index.tsx (3)

54-68: Well-organized effect hooks with clear naming.

The effects are now properly named and focused, improving code readability and maintainability.


76-83: TODO comment needs attention.

The comment indicates that handleTabClick returns a new function every time. Consider implementing the suggested recomposition.

Would you like me to help implement a memoized version of this handler?


102-132: Clean implementation of DismissibleTabBar with proper prop handling.

The tab rendering logic is well-structured and maintains all necessary functionality.

app/client/src/pages/Editor/IDE/EditorTabs/Editortabs.test.tsx (1)

47-48: Improved test assertions with clear documentation.

The updated assertions and comments clearly explain the expected behavior with sentinel divs.

Also applies to: 73-74

Copy link

github-actions bot commented Feb 4, 2025

🔴🔴🔴 Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 4, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

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

🔭 Outside diff range comments (1)
app/client/src/pages/Editor/IDE/EditorTabs/index.tsx (1)

76-83: Optimize tab click handler to prevent unnecessary recreations.

The TODO comment indicates a performance concern. Consider using useCallback with a dependency array or moving the handler to a custom hook.

+const useTabClickHandler = (
+  dispatch: Dispatch,
+  tabClickHandler: (tab: EntityItem) => void,
+) =>
+  useCallback(
+    (tab: EntityItem) => {
+      dispatch(setListViewActiveState(false));
+      tabClickHandler(tab);
+    },
+    [dispatch, tabClickHandler],
+  );

 // In component:
-const handleTabClick = useCallback(
-  (tab: EntityItem) => () => {
-    dispatch(setListViewActiveState(false));
-    tabClickHandler(tab);
-  },
-  [dispatch, tabClickHandler],
-);
+const handleTabClick = useTabClickHandler(dispatch, tabClickHandler);
🧹 Nitpick comments (11)
app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.styles.ts (2)

22-23: Consider using a single height property.

Since both min-height and max-height are set to 32px, this effectively creates a fixed height. Consider using just height: 32px for simplicity.

-  max-height: 32px;
-  min-height: 32px;
+  height: 32px;

45-45: Consider consistency with height properties.

For consistency with the root component's height constraints, consider whether this should also use both min and max height properties.

app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.types.ts (1)

4-14: Add JSDoc comments for better documentation.

The interface is well-structured with proper types. Consider adding JSDoc comments to document the purpose of each prop, especially the new ones.

 export interface DismissibleTabBarProps {
+  /** Children can be DismissibleTab elements or any valid React node */
   children:
     | React.ReactElement<DismissibleTabProps>
     | React.ReactElement<DismissibleTabProps>[]
     | React.ReactNode;
+  /** Additional CSS class name */
   className?: string;
+  /** Whether to disable the add button */
   disableAdd?: boolean;
+  /** Whether to hide the add button */
   hideAdd?: boolean;
+  /** Whether a new tab is currently being added */
   isAddingNewTab?: boolean;
+  /** Callback when add button is clicked */
   onTabAdd: () => void;
 }
app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/EntityTabsHeader.styles.ts (1)

24-26: LGTM! Consider documenting the negative margin.

The negative margin is used to handle border overlap. Consider adding a comment to explain this visual adjustment for future maintainers.

 export const TabBar = styled(DismissibleTabBar)`
+  /* Negative margin compensates for the border overlap with the container */
   margin-bottom: -1px;
 `;
app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/EntityTabsHeader.tsx (1)

32-34: Add component documentation.

The implementation is clean. Consider adding JSDoc documentation to describe the component's purpose and usage.

+/**
+ * EntityTabBar is a wrapper around DismissibleTabBar with custom styling
+ * from the Appsmith Design System.
+ */
 export const EntityTabBar = (props: DismissibleTabBarProps) => {
   return <Styled.TabBar {...props} />;
 };
app/client/packages/design-system/ads/src/Templates/EditableDismissibleTab/EditableDismissibleTab.tsx (2)

28-36: Consider using a custom hook for state management.

The state management logic could be extracted into a custom hook to improve reusability and reduce complexity in the component.

+const useEditableState = (
+  propIsEditing?: boolean,
+  propOnEnterEditMode?: () => void,
+  propOnExitEditMode?: () => void,
+) => {
+  const {
+    setFalse: localOnExitEditMode,
+    setTrue: localOnEnterEditMode,
+    value: localIsEditing,
+  } = useBoolean(false);
+
+  return {
+    isEditing: propIsEditing ?? localIsEditing,
+    handleEnterEditMode: propOnEnterEditMode ?? localOnEnterEditMode,
+    handleExitEditMode: propOnExitEditMode ?? localOnExitEditMode,
+  };
+};

28-36: Consider using a custom hook for state management.

The state management logic could be extracted into a custom hook to improve reusability and reduce complexity.

+// In a new file: useEditableState.ts
+export const useEditableState = (
+  propIsEditing?: boolean,
+  propOnEnterEditMode?: () => void,
+  propOnExitEditMode?: () => void,
+) => {
+  const {
+    setFalse: localOnExitEditMode,
+    setTrue: localOnEnterEditMode,
+    value: localIsEditing,
+  } = useBoolean(false);
+
+  return {
+    isEditing: propIsEditing ?? localIsEditing,
+    handleEnterEditMode: propOnEnterEditMode ?? localOnEnterEditMode,
+    handleExitEditMode: propOnExitEditMode ?? localOnExitEditMode,
+  };
+};

// In EditableDismissibleTab.tsx
-  const {
-    setFalse: localOnExitEditMode,
-    setTrue: localOnEnterEditMode,
-    value: localIsEditing,
-  } = useBoolean(false);
-
-  const isEditing = propIsEditing ?? localIsEditing;
-  const handleEnterEditMode = propOnEnterEditMode ?? localOnEnterEditMode;
-  const handleExitEditMode = propOnExitEditMode ?? localOnExitEditMode;
+  const { handleEnterEditMode, handleExitEditMode, isEditing } = useEditableState(
+    propIsEditing,
+    propOnEnterEditMode,
+    propOnExitEditMode,
+  );
app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.tsx (2)

18-20: Consider using CSS-in-JS for consistent styling.

The hardcoded height value could be moved to the styled components to maintain consistency with the rest of the codebase.

-const SCROLL_AREA_STYLE = {
-  height: 32,
-};
+const ScrollAreaWrapper = styled(ScrollArea)`
+  height: 32px;
+`;

18-20: Extract magic number into a named constant.

The height value should be defined as a named constant for better maintainability.

+const TAB_BAR_HEIGHT = 32;
+
 const SCROLL_AREA_STYLE = {
-  height: 32,
+  height: TAB_BAR_HEIGHT,
 };
app/client/src/pages/Editor/IDE/EditorTabs/index.tsx (2)

93-134: Consider extracting tab rendering logic.

The tab rendering logic could be extracted into a separate component to improve readability and maintainability.

+const TabList = ({ files, entities, currentEntity, segmentMode, handleTabClick, closeClickHandler }) => (
+  <>
+    {files.map((tab) => {
+      const entity = entities.find((entity) => entity.key === tab.key);
+      return (
+        <EditableTab
+          entity={entity}
+          icon={tab.icon}
+          id={tab.key}
+          isActive={
+            currentEntity.id === tab.key &&
+            segmentMode !== EditorEntityTabState.Add &&
+            !isListViewActive
+          }
+          key={tab.key}
+          onClick={handleTabClick(tab)}
+          onClose={closeClickHandler}
+          title={tab.title}
+        />
+      );
+    })}
+  </>
+);

115-119: Extract complex boolean condition into a descriptive variable.

The isActive prop contains multiple conditions that could be more readable if extracted.

+const isTabActive = (
+  currentEntityId: string,
+  tabKey: string,
+  segmentMode: EditorEntityTabState,
+  isListViewActive: boolean,
+) =>
+  currentEntityId === tabKey &&
+  segmentMode !== EditorEntityTabState.Add &&
+  !isListViewActive;

// In JSX:
-isActive={
-  currentEntity.id === tab.key &&
-  segmentMode !== EditorEntityTabState.Add &&
-  !isListViewActive
-}
+isActive={isTabActive(
+  currentEntity.id,
+  tab.key,
+  segmentMode,
+  isListViewActive,
+)}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4c80891 and b01b66c.

📒 Files selected for processing (24)
  • app/client/cypress/e2e/Regression/ClientSide/IDE/Focus_retentions_inputs_spec.js (1 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/IDE/Tabs_Navigation_spec.ts (3 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectBug38207_spec.ts (2 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts (2 hunks)
  • app/client/cypress/support/ApiCommands.js (1 hunks)
  • app/client/cypress/support/Objects/CommonLocators.ts (1 hunks)
  • app/client/cypress/support/Pages/AggregateHelper.ts (2 hunks)
  • app/client/cypress/support/Pages/ApiPage.ts (1 hunks)
  • app/client/cypress/support/Pages/JSEditor.ts (2 hunks)
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTab.stories.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTab.styles.ts (2 hunks)
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTab.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.stories.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.styles.ts (3 hunks)
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.tsx (4 hunks)
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.types.ts (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EditableDismissibleTab/EditableDismissibleTab.stories.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EditableDismissibleTab/EditableDismissibleTab.tsx (3 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/EntityTabsHeader.stories.tsx (3 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/EntityTabsHeader.styles.ts (2 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/EntityTabsHeader.tsx (2 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/EntityTabsHeader.types.ts (2 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/index.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorTabs/index.tsx (3 hunks)
✅ Files skipped from review due to trivial changes (4)
  • app/client/packages/design-system/ads/src/Templates/EditableDismissibleTab/EditableDismissibleTab.stories.tsx
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTab.tsx
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTab.stories.tsx
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.stories.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/client/cypress/support/Pages/JSEditor.ts
  • app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/EntityTabsHeader.types.ts
🧰 Additional context used
📓 Path-based instructions (8)
app/client/cypress/support/ApiCommands.js (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectBug38207_spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/e2e/Regression/ClientSide/IDE/Tabs_Navigation_spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/support/Pages/ApiPage.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/e2e/Regression/ClientSide/IDE/Focus_retentions_inputs_spec.js (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/support/Pages/AggregateHelper.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/support/Objects/CommonLocators.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-build / client-build
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
  • GitHub Check: chromatic-deployment
🔇 Additional comments (22)
app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTab.styles.ts (2)

3-3: LGTM! Import path improvement.

The explicit import path enhances code maintainability and clarity.


23-23: LGTM! Consistent padding using design system variables.

The padding values properly utilize the design system spacing variables and maintain visual consistency.

app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.styles.ts (2)

3-3: LGTM! More explicit import path.

The import path is now more specific, which is better for maintainability.


19-19: Verify vertical overflow behavior.

Changing from overflow: hidden to overflow-x: hidden allows vertical overflow. Ensure this doesn't cause any layout issues with the tab bar's container.

app/client/cypress/e2e/Regression/ClientSide/JSObject/RenameJSObjectBug38207_spec.ts (1)

15-15: LGTM! Selector updates align with the new tab system.

The changes correctly update the selectors to use the new dismissible tabs system, maintaining the test's functionality while adapting to the new UI components.

Also applies to: 27-27

app/client/cypress/e2e/Regression/ClientSide/IDE/Tabs_Navigation_spec.ts (1)

56-57: LGTM! Consistent selector updates across tab navigation tests.

The changes systematically update all query name selectors to use the new active entity tab selectors, maintaining test integrity while adapting to the new UI structure.

Also applies to: 62-63, 96-97, 102-103, 111-112, 117-118

app/client/cypress/e2e/Regression/ClientSide/IDE/Focus_retentions_inputs_spec.js (1)

113-113: LGTM! Updated selector for focus retention test.

The change correctly updates the selector to use the new active entity tab system while maintaining the test's focus retention verification.

app/client/cypress/support/ApiCommands.js (1)

184-191: LGTM! Updated API command selectors.

The changes correctly update the selectors in the createAndFillApi command to use the new active entity tab system while maintaining the command's functionality.

app/client/cypress/support/Objects/CommonLocators.ts (1)

13-14: LGTM! Improved selector flexibility.

The change from direct child selector to descendant selector makes the locators more resilient to UI structure changes.

app/client/cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts (1)

449-450: LGTM! Consistent locator usage.

The test assertions have been correctly updated to use the new _activeEntityTab locator.

Also applies to: 459-460

app/client/cypress/support/Pages/ApiPage.ts (1)

108-108: LGTM! Improved maintainability.

Using the shared locator from CommonLocators reduces duplication and improves maintainability.

app/client/cypress/support/Pages/AggregateHelper.ts (1)

273-274: LGTM! Consistent locator updates.

The methods have been correctly updated to use the new _activeEntityTab and _activeEntityTabInput locators.

Also applies to: 1163-1163

app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/index.ts (1)

1-6: LGTM! Clean export addition.

The EntityTabBar component is properly exported alongside other related components.

app/client/packages/design-system/ads/src/Templates/EditableDismissibleTab/EditableDismissibleTab.tsx (3)

17-23: LGTM! Props interface enhancement looks good.

The new props provide better external control over the editing state while maintaining backward compatibility.


38-38: LGTM! Event handler implementation is correct.

The handleDoubleClick assignment correctly uses the nullish coalescing operator and maintains the expected behavior.


17-23: LGTM! Props follow controlled component pattern.

The new props provide external control over the editing state while maintaining backward compatibility.

app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/EntityTabsHeader.stories.tsx (3)

6-13: LGTM! Import statements are properly organized.

The imports are correctly updated to reflect the new component structure.


33-49: LGTM! Component usage is correctly updated.

The EntityTabBar replacement maintains the same functionality while using the new component structure.


6-13: LGTM! Component updates are properly reflected in the story.

The imports are correctly updated, and the EntityTabBar is properly integrated with the expected props and children structure.

Also applies to: 33-49

app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.tsx (2)

91-126: LGTM! Conditional rendering is well implemented.

The loading state and add button visibility are handled correctly with proper prop types.


109-125: LGTM! Loading state is well implemented.

The conditional rendering of Spinner vs PlusButton provides clear visual feedback during tab addition.

app/client/src/pages/Editor/IDE/EditorTabs/index.tsx (1)

54-69: LGTM! Effect hooks are well organized.

The named effects improve code readability and maintainability.

@alex-golovanov
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented Feb 4, 2025

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

Copy link

github-actions bot commented Feb 4, 2025

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

…type definitions

- Add detailed JSDoc comments for props in DismissibleTab and DismissibleTabBar interfaces.
- Update EditableEntityNameProps to include size, isFixedWidth, and isLoading with descriptions.
- Simplify EditableDismissibleTabProps by adding onEnterEditMode and onExitEditMode callbacks.
- Adjust code in EditableDismissibleTab to use updated props structure for clarity.
@alex-golovanov
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented Feb 5, 2025

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/13153786658.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38989.
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/DismissibleTab/DismissibleTab.types.ts (1)

4-17: LGTM! Well-structured interface with proper TypeScript types.

The interface is well-documented with JSDoc comments and uses appropriate types for React components and event handlers.

Consider adding JSDoc comment for the dataTestId prop to maintain consistency with other props:

+  /** Used for component testing identification. */
   dataTestId?: string;
app/client/packages/design-system/ads/src/Templates/EditableDismissibleTab/EditableDismissibleTab.types.ts (1)

19-30: Consider using enum for validation errors.

The validation function could be more type-safe by using an enum for possible error messages instead of string | null.

+export enum TabNameValidationError {
+  INVALID_CHARS = "Invalid characters in name",
+  TOO_LONG = "Name is too long",
+  EMPTY = "Name cannot be empty"
+}

 export interface EditableDismissibleTabProps {
   // ... other props
-  validateName: (name: string) => string | null;
+  validateName: (name: string) => TabNameValidationError | null;
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b01b66c and 156be69.

📒 Files selected for processing (12)
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTab.types.ts (1 hunks)
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.styles.ts (3 hunks)
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.types.ts (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EditableDismissibleTab/EditableDismissibleTab.stories.tsx (2 hunks)
  • app/client/packages/design-system/ads/src/Templates/EditableDismissibleTab/EditableDismissibleTab.tsx (2 hunks)
  • app/client/packages/design-system/ads/src/Templates/EditableDismissibleTab/EditableDismissibleTab.types.ts (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EditableEntityName/EditableEntityName.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EditableEntityName/EditableEntityName.types.ts (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/EntityTabsHeader.types.ts (2 hunks)
  • app/client/src/pages/Editor/IDE/EditorTabs/AddTab.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/EditorTabs/EditableTab.tsx (3 hunks)
  • app/client/src/pages/Editor/IDE/EditorTabs/Editortabs.test.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • app/client/src/pages/Editor/IDE/EditorTabs/Editortabs.test.tsx
  • app/client/packages/design-system/ads/src/Templates/EditableDismissibleTab/EditableDismissibleTab.stories.tsx
  • app/client/packages/design-system/ads/src/Templates/EditableDismissibleTab/EditableDismissibleTab.tsx
  • app/client/src/pages/Editor/IDE/EditorTabs/EditableTab.tsx
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.types.ts
  • app/client/packages/design-system/ads/src/Templates/EntityTabsHeader/EntityTabsHeader.types.ts
  • app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.styles.ts
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
🔇 Additional comments (8)
app/client/packages/design-system/ads/src/Templates/EditableEntityName/EditableEntityName.types.ts (1)

3-26: Well-structured interface with clear documentation!

The interface is well-organized with comprehensive JSDoc comments for each prop, making it clear and maintainable.

app/client/packages/design-system/ads/src/Templates/EditableEntityName/EditableEntityName.tsx (1)

41-48: Correct dependency array update!

The addition of size to the dependency array is necessary as it affects the Spinner size in the memoized startIcon.

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

4-18: Well-structured props with clear documentation!

The property definitions follow React conventions with appropriate types and clear JSDoc comments.

app/client/src/pages/Editor/IDE/EditorTabs/AddTab.tsx (5)

2-11: LGTM! Import changes align with the component refactoring.

The imports are correctly updated to support the new DismissibleTab implementation.


13-23: LGTM! Props and hook usage are well-structured.

The component interface is clean and the hook usage is appropriate.


24-28: Good use of useEventCallback for performance optimization.

The event handler implementation prevents unnecessary re-renders by maintaining a stable function reference.


29-34: Test ID implementation aligns with previous feedback.

The dataTestId format follows the suggested pattern from previous reviews.


35-44: LGTM! Clean implementation using the new design system.

The DismissibleTab implementation is correctly configured with all necessary props.

@sagar-qa007 sagar-qa007 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Feb 6, 2025
@alex-golovanov alex-golovanov merged commit 858ca47 into release Feb 6, 2025
126 checks passed
@alex-golovanov alex-golovanov deleted the chore/37647-entity-tabs-replacement branch February 6, 2025 08:33
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Feb 7, 2025
## Description
Replacing entity tab bar and components with ADS templates.


Fixes appsmithorg#37647
Fixes appsmithorg#37775

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13172995565>
> Commit: f3db2d9
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13172995565&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Thu, 06 Feb 2025 07:56:59 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
- Enhanced tab interaction: The add button now supports dynamic
visibility and a loading indicator when new tabs are being created.
- Improved editing: Tab labels now feature refined controls for entering
and exiting edit mode, offering a more flexible user experience.
	- New `EntityTabsHeader` component added to enhance tab management.
- Updated tab structure to utilize `DismissibleTab` for improved
functionality.
- Introduced new props for `DismissibleTabBar` to allow for additional
styling and control over add button visibility.
- New properties added to `DismissibleTab` for greater interactivity and
customization.
- Additional properties introduced to `EditableDismissibleTab` for
enhanced editing capabilities.

- **Refactor**
- Streamlined the tab interface by replacing legacy components with
modern, responsive alternatives, simplifying the overall design and
interaction.
- Enhanced event handling and state management for better performance
and user experience.
- Updated import paths and component structures for clarity and
maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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 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.

Tabs End border bug Replace existing tabs implementation with the new ADS components
4 participants