diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/AddWidgetModal/AddWidgetModal.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/AddWidgetModal/AddWidgetModal.test.tsx index 8b67fa28cb5..9e4b1d7955b 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/AddWidgetModal/AddWidgetModal.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/AddWidgetModal/AddWidgetModal.test.tsx @@ -113,6 +113,24 @@ describe('AddWidgetModal component', () => { expect(screen.queryByTestId('TotalAssets-check-icon')).toBeNull(); }); + it('AddWidgetModal should not display check icons in the tab labels only if widget includes EmptyWidgetPlaceholder with it', async () => { + await act(async () => { + render( + + ); + }); + + expect(screen.getByTestId('ActivityFeed-check-icon')).toBeInTheDocument(); + expect(screen.queryByTestId('Following-check-icon')).toBeNull(); + expect(screen.queryByTestId('KPI-check-icon')).toBeNull(); + }); + it('AddWidgetModal should call handleAddWidget when clicked on add widget button', async () => { await act(async () => { render(); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/AddWidgetModal/AddWidgetModal.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/AddWidgetModal/AddWidgetModal.tsx index 0348b721be9..5ed1388822d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/AddWidgetModal/AddWidgetModal.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/AddWidgetModal/AddWidgetModal.tsx @@ -83,8 +83,10 @@ function AddWidgetModal({ label: ( {widget.name} - {addedWidgetsList.some((w) => - w.startsWith(widget.fullyQualifiedName) + {addedWidgetsList.some( + (w) => + w.startsWith(widget.fullyQualifiedName) && + !w.includes('EmptyWidgetPlaceholder') ) && ( { + it('should add new widget at EmptyWidgetPlaceholder place to be in the bottom', () => { + const result = getAddWidgetHandler( + mockWidget, + 'ExtraWidget.EmptyWidgetPlaceholder', + 1, + 3 + )(mockCurrentAddWidget); + + expect(result).toEqual(mockAddWidgetReturnValues); + }); +}); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/CustomizableLandingPageUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/CustomizableLandingPageUtils.tsx index 2770e43ea00..28f0884e98a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/CustomizableLandingPageUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/CustomizableLandingPageUtils.tsx @@ -55,13 +55,17 @@ export const getAddWidgetHandler = if ( placeholderWidgetKey === LandingPageWidgetKeys.EMPTY_WIDGET_PLACEHOLDER ) { + const emptyWidgetPlaceholder = currentLayout.find( + (item) => item.i === LandingPageWidgetKeys.EMPTY_WIDGET_PLACEHOLDER + ) ?? { x: 0, y: 99 }; + return [ ...moveEmptyWidgetToTheEnd(currentLayout), { w: widgetWidth, h: widgetHeight, - x: 0, - y: 0, + x: emptyWidgetPlaceholder.x, + y: emptyWidgetPlaceholder.y, i: widgetFQN, static: false, },