You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "gabotorresruiz (via GitHub)" <gi...@apache.org> on 2025/09/03 17:37:00 UTC
[PR] fix(dashboard): normalize spacings and background colors [superset]
gabotorresruiz opened a new pull request, #35001:
URL: https://github.com/apache/superset/pull/35001
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
Normalized dashboard layout spacings and improved background colors consistency. Key changes include:
- **Simplified margin logic**: Changed dashboard content margin calculation from complex conditional logic to a simpler editMode-based approach
- **Consistent background colors**: Added proper background colors (`colorBgContainer` for filters panel, `colorBgLayout` for main content)
- **Fixed tab navigation padding**: Made tab navigation padding responsive to dashboard filter state
- **Unified grid container margins**: Simplified grid container margins from separate top/right/bottom/left values to a unified margin approach
### BEFORE/AFTER SCREENSHOTS
<!--- Skip this if not applicable -->
Before:
<img width="1512" height="824" alt="Screenshot 2025-09-03 at 13 29 22" src="https://github.com/user-attachments/assets/bebb2a2a-1736-486a-9c7c-161cb501d69e" />
<img width="1512" height="735" alt="Screenshot 2025-09-03 at 13 28 35" src="https://github.com/user-attachments/assets/59466b73-71fa-4c2f-b1a8-b55ce2dee07f" />
After:
<img width="1512" height="824" alt="Screenshot 2025-09-03 at 14 01 35" src="https://github.com/user-attachments/assets/7e1b5a8c-aa40-4742-9773-c4228bc4d8f6" />
<img width="1512" height="673" alt="Screenshot 2025-09-03 at 13 21 56" src="https://github.com/user-attachments/assets/b30ae192-d467-4764-86d1-cfa60bb2037e" />
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
1. Open any dashboard in Superset
2. Verify consistent background colors across the dashboard interface
3. Toggle between edit mode and view mode - observe proper spacing adjustments
4. Open/close the native filters panel - verify tab navigation padding adjusts correctly
5. Test with different filter bar orientations (horizontal/vertical)
6. Ensure no visual regressions in grid layout and component spacing
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #35001:
URL: https://github.com/apache/superset/pull/35001#discussion_r2322640820
##########
superset-frontend/src/dashboard/components/gridComponents/TabsRenderer/TabsRenderer.test.tsx:
##########
@@ -0,0 +1,201 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { fireEvent, render, screen } from 'spec/helpers/testing-library';
+import TabsRenderer, { TabItem, TabsRendererProps } from './TabsRenderer';
+
+const mockTabItems: TabItem[] = [
+ {
+ key: 'tab-1',
+ label: <div>Tab 1</div>,
+ closeIcon: <div>Γ</div>,
+ children: <div>Tab 1 Content</div>,
+ },
+ {
+ key: 'tab-2',
+ label: <div>Tab 2</div>,
+ closeIcon: <div>Γ</div>,
+ children: <div>Tab 2 Content</div>,
+ },
+];
+
+const mockProps: TabsRendererProps = {
+ tabItems: mockTabItems,
+ editMode: false,
+ renderHoverMenu: true,
+ tabsDragSourceRef: undefined,
+ handleDeleteComponent: jest.fn(),
+ tabsComponent: { id: 'test-tabs-id' },
+ activeKey: 'tab-1',
+ tabIds: ['tab-1', 'tab-2'],
+ handleClickTab: jest.fn(),
+ handleEdit: jest.fn(),
+ tabBarPaddingLeft: 16,
+};
+
+describe('TabsRenderer', () => {
+ beforeEach(() => {
+ jest.clearAllMocks();
+ });
+
+ test('renders tabs container with correct test attributes', () => {
+ render(<TabsRenderer {...mockProps} />);
+
+ const tabsContainer = screen.getByTestId('dashboard-component-tabs');
+
+ expect(tabsContainer).toBeInTheDocument();
+ expect(tabsContainer).toHaveClass('dashboard-component-tabs');
+ });
+
+ test('renders LineEditableTabs with correct props', () => {
+ render(<TabsRenderer {...mockProps} />);
+
+ const editableTabs = screen.getByTestId('nav-list');
+ expect(editableTabs).toBeInTheDocument();
+ });
+
+ test('applies correct tab bar padding', () => {
+ const { rerender } = render(<TabsRenderer {...mockProps} />);
+
+ let editableTabs = screen.getByTestId('nav-list');
+ expect(editableTabs).toBeInTheDocument();
+
+ rerender(<TabsRenderer {...mockProps} tabBarPaddingLeft={0} />);
+ editableTabs = screen.getByTestId('nav-list');
+
+ expect(editableTabs).toBeInTheDocument();
+ });
+
+ test('calls handleClickTab when tab is clicked', () => {
+ const handleClickTabMock = jest.fn();
+ const propsWithTab2Active = {
+ ...mockProps,
+ activeKey: 'tab-2',
+ handleClickTab: handleClickTabMock,
+ };
+ render(<TabsRenderer {...propsWithTab2Active} />);
+
+ const tabElement = screen.getByText('Tab 1').closest('[role="tab"]');
+ expect(tabElement).not.toBeNull();
+
+ fireEvent.click(tabElement!);
+
+ expect(handleClickTabMock).toHaveBeenCalledWith(0);
+ expect(handleClickTabMock).toHaveBeenCalledTimes(1);
+ });
+
+ test('shows hover menu in edit mode', () => {
+ const mockRef = { current: null };
+ const editModeProps: TabsRendererProps = {
+ ...mockProps,
+ editMode: true,
+ renderHoverMenu: true,
+ tabsDragSourceRef: mockRef,
+ };
+
+ render(<TabsRenderer {...editModeProps} />);
+
+ const hoverMenu = document.querySelector('.hover-menu');
+
+ expect(hoverMenu).toBeInTheDocument();
+ });
+
+ test('hides hover menu when not in edit mode', () => {
+ const viewModeProps: TabsRendererProps = {
+ ...mockProps,
+ editMode: false,
+ renderHoverMenu: true,
+ };
+
+ render(<TabsRenderer {...viewModeProps} />);
+
+ const hoverMenu = document.querySelector('.hover-menu');
+
+ expect(hoverMenu).not.toBeInTheDocument();
+ });
+
+ test('hides hover menu when renderHoverMenu is false', () => {
+ const mockRef = { current: null };
+ const noHoverMenuProps: TabsRendererProps = {
+ ...mockProps,
+ editMode: true,
+ renderHoverMenu: false,
+ tabsDragSourceRef: mockRef,
+ };
+
+ render(<TabsRenderer {...noHoverMenuProps} />);
+
+ const hoverMenu = document.querySelector('.hover-menu');
+
+ expect(hoverMenu).not.toBeInTheDocument();
+ });
+
+ test('renders with correct tab type based on edit mode', () => {
+ const { rerender } = render(
+ <TabsRenderer {...mockProps} editMode={false} />,
+ );
+
+ let editableTabs = screen.getByTestId('nav-list');
+ expect(editableTabs).toBeInTheDocument();
+
+ rerender(<TabsRenderer {...mockProps} editMode />);
+
+ editableTabs = screen.getByTestId('nav-list');
+
+ expect(editableTabs).toBeInTheDocument();
+ });
+
+ test('handles default props correctly', () => {
+ const minimalProps: TabsRendererProps = {
+ tabItems: mockProps.tabItems,
+ editMode: false,
+ handleDeleteComponent: mockProps.handleDeleteComponent,
+ tabsComponent: mockProps.tabsComponent,
+ activeKey: mockProps.activeKey,
+ tabIds: mockProps.tabIds,
+ handleClickTab: mockProps.handleClickTab,
+ handleEdit: mockProps.handleEdit,
+ };
+
+ render(<TabsRenderer {...minimalProps} />);
+
+ const tabsContainer = screen.getByTestId('dashboard-component-tabs');
+
+ expect(tabsContainer).toBeInTheDocument();
+ });
+
+ test('calls onEdit when edit action is triggered', () => {
+ const handleEditMock = jest.fn();
+ const editableProps = {
+ ...mockProps,
+ editMode: true,
+ handleEdit: handleEditMock,
+ };
+
+ render(<TabsRenderer {...editableProps} />);
+
+ expect(screen.getByTestId('nav-list')).toBeInTheDocument();
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incomplete test coverage for onEdit callback</b></div>
<div id="fix">
The test 'calls onEdit when edit action is triggered' creates a mock function but never verifies it was called. Add user interaction to trigger the edit action and verify the mock function is called using `fireEvent` and `expect(handleEditMock).toHaveBeenCalled()`.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```suggestion
render(<TabsRenderer {...editableProps} />);
const navList = screen.getByTestId('nav-list');
expect(navList).toBeInTheDocument();
fireEvent.click(navList.querySelector('.ant-tabs-tab-remove') || navList);
expect(handleEditMock).toHaveBeenCalled();
```
</div>
</details>
</div>
<small><i>Code Review Run <a href=https://github.com/apache/superset/pull/35001#issuecomment-3254334755>#06642f</a></i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #35001:
URL: https://github.com/apache/superset/pull/35001#discussion_r2319738079
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx:
##########
@@ -286,14 +288,16 @@ const StyledDashboardContent = styled.div<{
padding-left: 0;
}
+ .grid-container .ant-tabs-nav {
+ padding-left: 0 !important;
+ }
+
.grid-container {
/* without this, the grid will not get smaller upon toggling the builder panel on */
width: 0;
flex: 1;
position: relative;
- margin-top: ${theme.sizeUnit * 4}px;
- margin-right: ${theme.sizeUnit * 8}px;
- margin-bottom: ${theme.sizeUnit * 4}px;
+ margin: ${theme.sizeUnit * 4}px;
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>CSS margin property change breaks layout</b></div>
<div id="fix">
CSS property order issue: The shorthand `margin` property sets all margins including `margin-left`, but the specific `margin-left: ${marginLeft}px` on line 301 should override it. However, the current implementation may cause inconsistent margin behavior. The shorthand margin property changes the right margin from `${theme.sizeUnit * 8}px` to `${theme.sizeUnit * 4}px`, which could break the dashboard layout spacing.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```suggestion
margin: ${theme.sizeUnit * 4}px ${theme.sizeUnit * 8}px ${theme.sizeUnit * 4}px 0;
```
</div>
</details>
</div>
<small><i>Code Review Run <a href=https://github.com/apache/superset/pull/35001#issuecomment-3250166864>#88102f</a></i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #35001:
URL: https://github.com/apache/superset/pull/35001#discussion_r2319735341
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx:
##########
@@ -286,14 +288,16 @@ const StyledDashboardContent = styled.div<{
padding-left: 0;
}
+ .grid-container .ant-tabs-nav {
+ padding-left: 0 !important;
Review Comment:
Is there a better selector so we can avoid `!important`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #35001:
URL: https://github.com/apache/superset/pull/35001#discussion_r2319737288
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardWrapper.tsx:
##########
@@ -84,6 +84,12 @@ const StyledDiv = styled.div`
background: transparent;
}
+ .dashboard-component-tabs .ant-tabs-nav {
+ padding-left: ${dashboardFiltersOpen
+ ? '0 !important'
Review Comment:
Same here, would love to avoid `!important` wherever possible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #35001:
URL: https://github.com/apache/superset/pull/35001#discussion_r2319723693
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx:
##########
@@ -557,13 +561,10 @@ const DashboardBuilder = () => {
],
);
- const dashboardContentMarginLeft =
- !dashboardFiltersOpen &&
- !editMode &&
- nativeFiltersEnabled &&
- filterBarOrientation !== FilterBarOrientation.Horizontal
- ? 0
- : theme.sizeUnit * 8;
+ const dashboardContentMarginLeft = useMemo(
+ () => (!editMode ? theme.sizeUnit * 4 : theme.sizeUnit * 8),
+ [editMode, theme.sizeUnit],
+ );
Review Comment:
### Unnecessary Memoization of Simple Calculation <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The useMemo hook is being used for a simple calculation that doesn't justify the overhead of memoization.
###### Why this matters
Using useMemo for simple calculations can be less performant than doing the calculation directly, as it requires maintaining the memoization infrastructure in memory.
###### Suggested change β *Feature Preview*
Remove useMemo and perform the calculation directly:
```typescript
const dashboardContentMarginLeft = !editMode ? theme.sizeUnit * 4 : theme.sizeUnit * 8;
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/bec4e7d3-71f6-4b7a-8268-f8ef6ed2979e/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/bec4e7d3-71f6-4b7a-8268-f8ef6ed2979e?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/bec4e7d3-71f6-4b7a-8268-f8ef6ed2979e?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/bec4e7d3-71f6-4b7a-8268-f8ef6ed2979e?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/bec4e7d3-71f6-4b7a-8268-f8ef6ed2979e)
</details>
<sub>
π¬ Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:73da7b3c-e267-48bc-ace7-656857eb8287 -->
[](73da7b3c-e267-48bc-ace7-656857eb8287)
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardWrapper.tsx:
##########
@@ -113,9 +119,12 @@
`}
`;
-type Props = {};
+type Props = {
+ children: ReactNode;
+ dashboardFiltersOpen: boolean;
+};
-const DashboardWrapper: FC<Props> = ({ children }) => {
+const DashboardWrapper: FC<Props> = ({ children, dashboardFiltersOpen }) => {
Review Comment:
### Missing Default Prop Value for Layout Control <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The `dashboardFiltersOpen` prop lacks a default value, which could cause layout issues if not explicitly provided.
###### Why this matters
Without a default value, if a consumer forgets to provide this prop, the component's padding logic could behave unexpectedly, affecting the dashboard's layout.
###### Suggested change β *Feature Preview*
Add a default value to the `dashboardFiltersOpen` prop:
```typescript
const DashboardWrapper: FC<Props> = ({ children, dashboardFiltersOpen = false }) => {
```
Or define the prop type with a default:
```typescript
type Props = {
children: ReactNode;
dashboardFiltersOpen?: boolean;
};
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a410d391-dc9c-4601-ac96-472e697b5d40/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a410d391-dc9c-4601-ac96-472e697b5d40?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a410d391-dc9c-4601-ac96-472e697b5d40?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a410d391-dc9c-4601-ac96-472e697b5d40?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a410d391-dc9c-4601-ac96-472e697b5d40)
</details>
<sub>
π¬ Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:e5fea1a4-b829-42d6-86c4-f91764999c42 -->
[](e5fea1a4-b829-42d6-86c4-f91764999c42)
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardWrapper.tsx:
##########
@@ -26,8 +26,8 @@ import { useDragDropManager } from 'react-dnd';
import classNames from 'classnames';
import { debounce } from 'lodash';
-const StyledDiv = styled.div`
- ${({ theme }) => css`
+const StyledDiv = styled.div<{ dashboardFiltersOpen: boolean }>`
Review Comment:
### Inefficient Dynamic Styled-Component <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The styled-component is recreating CSS rules on every prop change of dashboardFiltersOpen, which can cause unnecessary style recalculations.
###### Why this matters
Dynamic styles based on props in styled-components can lead to stylesheet regeneration and browser reflow, impacting performance when the prop changes frequently.
###### Suggested change β *Feature Preview*
Consider using CSS classes or inline styles for the dynamic padding value instead:
```typescript
const StyledDiv = styled.div`
${({ theme }) => css`
// ... static styles ...
`}
`;
// In component:
<StyledDiv
className={dashboardFiltersOpen ? 'filters-open' : ''}
style={{
'--tab-padding': dashboardFiltersOpen ? '0' : `${theme.sizeUnit * 2}px`
}}
>
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/d9f13e3e-aa09-4570-9c1c-d7c2d5ab3e72/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/d9f13e3e-aa09-4570-9c1c-d7c2d5ab3e72?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/d9f13e3e-aa09-4570-9c1c-d7c2d5ab3e72?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/d9f13e3e-aa09-4570-9c1c-d7c2d5ab3e72?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/d9f13e3e-aa09-4570-9c1c-d7c2d5ab3e72)
</details>
<sub>
π¬ Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:0357cd39-3378-4857-9d7d-7e16487ae988 -->
[](0357cd39-3378-4857-9d7d-7e16487ae988)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #35001:
URL: https://github.com/apache/superset/pull/35001#issuecomment-3254891173
I think we can merge this, since it's already a large PR handling a lot of different concerns (filter bar toggling, gutter adjustment, file re-org, etc.). I think @mistercrunch was also wondering if/how we should handle gutters for charts within tabs (or charts within tabs within tabs). Do you think that's something we should discuss/address here, or just merge all this and then tackle another design/implementation question around gutters within tabs?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #35001:
URL: https://github.com/apache/superset/pull/35001#discussion_r2319737288
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardWrapper.tsx:
##########
@@ -84,6 +84,12 @@ const StyledDiv = styled.div`
background: transparent;
}
+ .dashboard-component-tabs .ant-tabs-nav {
+ padding-left: ${dashboardFiltersOpen
+ ? '0 !important'
Review Comment:
```suggestion
? '0 !important'
```
Same here, would love to avoid `!important` wherever possible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #35001:
URL: https://github.com/apache/superset/pull/35001#issuecomment-3254334755
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Default Agent` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #35001:
URL: https://github.com/apache/superset/pull/35001#issuecomment-3251162838
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Default Agent` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "gabotorresruiz (via GitHub)" <gi...@apache.org>.
gabotorresruiz commented on PR #35001:
URL: https://github.com/apache/superset/pull/35001#issuecomment-3255985886
@rusackas @mistercrunch totally agree, thatβs why when we talked earlier today I called this like a βphase 1β. Still a few things to do here for sure, but I believe this is a nice way to start
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #35001:
URL: https://github.com/apache/superset/pull/35001#issuecomment-3250166864
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Default Agent` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch merged PR #35001:
URL: https://github.com/apache/superset/pull/35001
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "gabotorresruiz (via GitHub)" <gi...@apache.org>.
gabotorresruiz commented on PR #35001:
URL: https://github.com/apache/superset/pull/35001#issuecomment-3251062505
Hey @rusackas, as you mentioned above, I kept looking at the code and found a more elegant way to handle this without using `!important`. I also took the opportunity to refactor the `gridComponents` folder into a structure that should be clearer for anyone who needs to make changes in the future. This makes the PR a bit more challenging to review, but I believe the effort is worthwhile.
I added some tests to make sure that I didn't break anything important. Also we can CC @kasiazjc and @sadpandajoe, just to make sure that everything looks and works as expected.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(dashboard): normalize spacings and background colors [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #35001:
URL: https://github.com/apache/superset/pull/35001#discussion_r2320505530
##########
superset-frontend/src/dashboard/components/gridComponents/TabsRenderer/TabsRenderer.tsx:
##########
@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { memo, ReactElement, RefObject } from 'react';
+import { styled } from '@superset-ui/core';
+import {
+ LineEditableTabs,
+ TabsProps as AntdTabsProps,
+} from '@superset-ui/core/components/Tabs';
+import HoverMenu from '../../menu/HoverMenu';
+import DragHandle from '../../dnd/DragHandle';
+import DeleteComponentButton from '../../DeleteComponentButton';
+
+const StyledTabsContainer = styled.div`
+ width: 100%;
+ background-color: ${({ theme }) => theme.colorBgContainer};
+
+ & .dashboard-component-tabs-content {
+ height: 100%;
+ }
+
+ & > .hover-menu:hover {
+ opacity: 1;
+ }
+
+ &.dragdroppable-row .dashboard-component-tabs-content {
+ height: calc(100% - 47px);
+ }
+`;
+
+export interface TabItem {
+ key: string;
+ label: ReactElement;
+ closeIcon: ReactElement;
+ children: ReactElement;
+}
+
+export interface TabsComponent {
+ id: string;
+}
+
+export interface TabsRendererProps {
+ tabItems: TabItem[];
+ editMode: boolean;
+ renderHoverMenu?: boolean;
+ tabsDragSourceRef?: RefObject<HTMLDivElement>;
+ handleDeleteComponent: () => void;
+ tabsComponent: TabsComponent;
+ activeKey: string;
+ tabIds: string[];
+ handleClickTab: (index: number) => void;
+ handleEdit: AntdTabsProps['onEdit'];
+ tabBarPaddingLeft?: number;
+}
+
+/**
+ * TabsRenderer component handles the rendering of dashboard tabs
+ * Extracted from the main Tabs component for better separation of concerns
+ */
+const TabsRenderer = memo<TabsRendererProps>(
+ ({
+ tabItems,
+ editMode,
+ renderHoverMenu = true,
+ tabsDragSourceRef,
+ handleDeleteComponent,
+ tabsComponent,
+ activeKey,
+ tabIds,
+ handleClickTab,
+ handleEdit,
+ tabBarPaddingLeft = 0,
+ }) => (
+ <StyledTabsContainer
+ className="dashboard-component dashboard-component-tabs"
+ data-test="dashboard-component-tabs"
+ >
+ {editMode && renderHoverMenu && tabsDragSourceRef && (
+ <HoverMenu innerRef={tabsDragSourceRef} position="left">
+ <DragHandle position="left" />
+ <DeleteComponentButton onDelete={handleDeleteComponent} />
+ </HoverMenu>
+ )}
+
+ <LineEditableTabs
+ id={tabsComponent.id}
+ activeKey={activeKey}
+ onChange={key => {
+ if (typeof key === 'string') {
+ handleClickTab(tabIds.indexOf(key));
+ }
+ }}
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing validation for tab key lookup</b></div>
<div id="fix">
The `onChange` handler calls `handleClickTab(tabIds.indexOf(key))` without checking if the key exists in `tabIds`. When `indexOf` returns -1 (key not found), this passes an invalid index to `handleClickTab`, potentially causing runtime errors or unexpected behavior in tab navigation.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```suggestion
onChange={key => {
if (typeof key === 'string') {
const tabIndex = tabIds.indexOf(key);
if (tabIndex !== -1) {
handleClickTab(tabIndex);
}
}
}}
```
</div>
</details>
</div>
<small><i>Code Review Run <a href=https://github.com/apache/superset/pull/35001#issuecomment-3251162838>#5a24f7</a></i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/dashboard/components/BuilderComponentPane/index.tsx:
##########
@@ -37,81 +39,96 @@ const TABS_KEYS = {
LAYOUT_ELEMENTS: 'LAYOUT_ELEMENTS',
};
-const BuilderComponentPane = ({ topOffset = 0 }) => (
- <div
- data-test="dashboard-builder-sidepane"
- css={css`
- position: sticky;
- right: 0;
- top: ${topOffset}px;
- height: calc(100vh - ${topOffset}px);
- width: ${BUILDER_PANE_WIDTH}px;
- `}
- >
+const BuilderComponentPane = ({ topOffset = 0 }) => {
+ const theme = useTheme();
+ const nativeFiltersBarOpen = useSelector(
+ (state: any) => state.dashboardState.nativeFiltersBarOpen ?? false,
+ );
+
+ const tabBarStyle = useMemo(
+ () => ({
+ paddingLeft: nativeFiltersBarOpen ? 0 : theme.sizeUnit * 4,
+ }),
+ [nativeFiltersBarOpen, theme.sizeUnit],
+ );
+
+ return (
<div
- css={(theme: SupersetTheme) => css`
- position: absolute;
- height: 100%;
+ data-test="dashboard-builder-sidepane"
+ css={css`
+ position: sticky;
+ right: 0;
+ top: ${topOffset}px;
+ height: calc(100vh - ${topOffset}px);
width: ${BUILDER_PANE_WIDTH}px;
- box-shadow: -4px 0 4px 0 ${rgba(theme.colorBorder, 0.1)};
- background-color: ${theme.colorBgBase};
`}
>
- <Tabs
- data-test="dashboard-builder-component-pane-tabs-navigation"
- id="tabs"
+ <div
css={(theme: SupersetTheme) => css`
- line-height: inherit;
- margin-top: ${theme.sizeUnit * 2}px;
+ position: absolute;
height: 100%;
-
- & .ant-tabs-content-holder {
+ width: ${BUILDER_PANE_WIDTH}px;
+ box-shadow: -4px 0 4px 0 ${rgba(theme.colorBorder, 0.1)};
+ background-color: ${theme.colorBgBase};
+ `}
+ >
+ <Tabs
+ data-test="dashboard-builder-component-pane-tabs-navigation"
+ id="tabs"
+ tabBarStyle={tabBarStyle}
+ css={(theme: SupersetTheme) => css`
+ line-height: inherit;
+ margin-top: ${theme.sizeUnit * 2}px;
height: 100%;
- & .ant-tabs-content {
+
+ & .ant-tabs-content-holder {
height: 100%;
+ & .ant-tabs-content {
+ height: 100%;
+ }
}
- }
- `}
- items={[
- {
- key: TABS_KEYS.CHARTS,
- label: t('Charts'),
- children: (
- <div
- css={css`
- height: calc(100vh - ${topOffset * 2}px);
- `}
- >
- <SliceAdder />
- </div>
- ),
- },
- {
- key: TABS_KEYS.LAYOUT_ELEMENTS,
- label: t('Layout elements'),
- children: (
- <>
- <NewTabs />
- <NewRow />
- <NewColumn />
- <NewHeader />
- <NewMarkdown />
- <NewDivider />
- {dashboardComponents
- .getAll()
- .map(({ key: componentKey, metadata }) => (
- <NewDynamicComponent
- metadata={metadata}
- componentKey={componentKey}
- />
- ))}
- </>
- ),
- },
- ]}
- />
+ `}
+ items={[
+ {
+ key: TABS_KEYS.CHARTS,
+ label: t('Charts'),
+ children: (
+ <div
+ css={css`
+ height: calc(100vh - ${topOffset * 2}px);
+ `}
+ >
+ <SliceAdder />
+ </div>
+ ),
+ },
+ {
+ key: TABS_KEYS.LAYOUT_ELEMENTS,
+ label: t('Layout elements'),
+ children: (
+ <>
+ <NewTabs />
+ <NewRow />
+ <NewColumn />
+ <NewHeader />
+ <NewMarkdown />
+ <NewDivider />
+ {dashboardComponents
+ .getAll()
+ .map(({ key: componentKey, metadata }) => (
+ <NewDynamicComponent
+ metadata={metadata}
+ componentKey={componentKey}
+ />
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing React key prop in map</b></div>
<div id="fix">
Missing `key` prop in React map function. Add `key={componentKey}` to `NewDynamicComponent` to prevent React warnings and ensure proper component reconciliation during re-renders.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```suggestion
{dashboardComponents
.getAll()
.map(({ key: componentKey, metadata }) => (
<NewDynamicComponent
key={componentKey}
metadata={metadata}
componentKey={componentKey}
/>
```
</div>
</details>
</div>
<small><i>Code Review Run <a href=https://github.com/apache/superset/pull/35001#issuecomment-3251162838>#5a24f7</a></i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/dashboard/components/gridComponents/TabsRenderer/TabsRenderer.test.tsx:
##########
@@ -0,0 +1,169 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { render, screen } from 'spec/helpers/testing-library';
+import TabsRenderer, { TabItem, TabsRendererProps } from './TabsRenderer';
+
+const mockTabItems: TabItem[] = [
+ {
+ key: 'tab-1',
+ label: <div>Tab 1</div>,
+ closeIcon: <div>Γ</div>,
+ children: <div>Tab 1 Content</div>,
+ },
+ {
+ key: 'tab-2',
+ label: <div>Tab 2</div>,
+ closeIcon: <div>Γ</div>,
+ children: <div>Tab 2 Content</div>,
+ },
+];
+
+const mockProps: TabsRendererProps = {
+ tabItems: mockTabItems,
+ editMode: false,
+ renderHoverMenu: true,
+ tabsDragSourceRef: undefined,
+ handleDeleteComponent: jest.fn(),
+ tabsComponent: { id: 'test-tabs-id' },
+ activeKey: 'tab-1',
+ tabIds: ['tab-1', 'tab-2'],
+ handleClickTab: jest.fn(),
+ handleEdit: jest.fn(),
+ tabBarPaddingLeft: 16,
+};
+
+describe('TabsRenderer', () => {
+ beforeEach(() => {
+ jest.clearAllMocks();
+ });
+
+ test('renders tabs container with correct test attributes', () => {
+ render(<TabsRenderer {...mockProps} />);
+
+ const tabsContainer = screen.getByTestId('dashboard-component-tabs');
+
+ expect(tabsContainer).toBeInTheDocument();
+ expect(tabsContainer).toHaveClass('dashboard-component-tabs');
+ });
+
+ test('renders LineEditableTabs with correct props', () => {
+ render(<TabsRenderer {...mockProps} />);
+
+ const editableTabs = screen.getByTestId('nav-list');
+ expect(editableTabs).toBeInTheDocument();
+ });
+
+ test('applies correct tab bar padding', () => {
+ const { rerender } = render(<TabsRenderer {...mockProps} />);
+
+ expect(screen.getByTestId('nav-list')).toBeInTheDocument();
+
+ rerender(<TabsRenderer {...mockProps} tabBarPaddingLeft={0} />);
+ expect(screen.getByTestId('nav-list')).toBeInTheDocument();
+ });
+
+ test('calls handleClickTab when tab is clicked', () => {
+ render(<TabsRenderer {...mockProps} />);
+ expect(mockProps.handleClickTab).not.toHaveBeenCalled();
+ });
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incomplete tab click test implementation</b></div>
<div id="fix">
Test claims to verify tab click behavior but doesn't actually click any tab. It only checks that the handler wasn't called, which doesn't test the intended functionality. Add actual tab click simulation using `fireEvent.click()` and verify the handler is called with correct arguments.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```suggestion
test('calls handleClickTab when tab is clicked', () => {
render(<TabsRenderer {...mockProps} />);
const tabElement = screen.getByRole('tab', { name: /tab 1/i });
fireEvent.click(tabElement);
expect(mockProps.handleClickTab).toHaveBeenCalledWith(0);
});
```
</div>
</details>
</div>
<small><i>Code Review Run <a href=https://github.com/apache/superset/pull/35001#issuecomment-3251162838>#5a24f7</a></i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org