From 59cc88c3277e4367a627e16d210140b1aa09059c Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Mon, 5 Sep 2022 18:50:36 +0530 Subject: [PATCH] Change deprecated Layout to V1 (#7194) * Change depreacted Layout to V1 * remove unanted dependecy * test fixes * remove scrollbar from layout --- .../integration/Pages/Glossary.spec.js | 10 +-- .../ActivityFeedList/ActivityFeedList.tsx | 6 +- .../src/components/AddWebhook/AddWebhook.tsx | 8 +- .../components/Explore/Explore.component.tsx | 86 +++++++++---------- .../src/components/Explore/Explore.test.tsx | 6 +- .../GlobalSetting/GlobalSettingLeftPanel.tsx | 17 ++-- .../src/components/Glossary/Glossary.test.tsx | 25 ++++++ .../Glossary/GlossaryV1.component.tsx | 31 ++++--- .../components/MyData/MyData.component.tsx | 16 ++-- .../ui/src/components/MyData/MyData.test.tsx | 6 +- .../ui/src/components/Services/Services.tsx | 4 +- .../src/components/Users/Users.component.tsx | 8 +- .../ui/src/components/common/Card/CardV1.tsx | 17 ++-- .../common/facetfilter/FacetFilter.tsx | 8 +- .../components/containers/PageContainerV1.tsx | 4 +- .../src/components/containers/PageLayout.tsx | 3 - .../components/containers/PageLayoutV1.tsx | 28 ++++-- .../pages/GlossaryPage/GlossaryPage.test.tsx | 31 +++++++ .../GlossaryPage/GlossaryPageV1.component.tsx | 2 +- .../src/pages/UserPage/UserPage.component.tsx | 2 +- .../ui/src/pages/tags/index.test.tsx | 4 +- .../resources/ui/src/pages/tags/index.tsx | 8 +- .../src/main/resources/ui/src/styles/app.less | 20 +++++ .../ui/src/styles/layout/page-layout.less | 23 ++++- .../main/resources/ui/src/styles/x-master.css | 4 +- 25 files changed, 242 insertions(+), 135 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/integration/Pages/Glossary.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/integration/Pages/Glossary.spec.js index 47fabdb5f50..e344c92e3f7 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/integration/Pages/Glossary.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/integration/Pages/Glossary.spec.js @@ -51,11 +51,11 @@ const createGlossaryTerm = (term) => { .should('be.visible') .click(); cy.wait(200); - cy.get('#left-panel').contains(term.name).should('be.visible'); + cy.get('#left-panelV1').contains(term.name).should('be.visible'); }; const deleteGlossary = ({ name }) => { - cy.get('#left-panel').contains(name).should('be.visible').click(); + cy.get('#left-panelV1').contains(name).should('be.visible').click(); cy.wait(500); cy.get('[data-testid="inactive-link"]').contains(name).should('be.visible'); @@ -85,7 +85,7 @@ const deleteGlossary = ({ name }) => { }; const goToAssetsTab = (term) => { - cy.get('#left-panel').should('be.visible').contains(term).click(); + cy.get('#left-panelV1').should('be.visible').contains(term).click(); cy.wait(500); cy.get('[data-testid="inactive-link"]').contains(term).should('be.visible'); cy.get('[data-testid="Assets"]').should('be.visible').click(); @@ -212,7 +212,7 @@ describe('Glossary page should work properly', () => { const uSynonyms = 'pick up,take,obtain'; const newRef = { name: 'take', url: 'https://take.com' }; const newDescription = 'Updated description'; - cy.get('#left-panel').should('be.visible').contains(term).click(); + cy.get('#left-panelV1').should('be.visible').contains(term).click(); cy.wait(500); cy.get('[data-testid="inactive-link"]').contains(term).should('be.visible'); @@ -300,7 +300,7 @@ describe('Glossary page should work properly', () => { it.skip('Releted Terms should work properly', () => { const term = NEW_GLOSSARY_TERMS.term_1.name; const term2 = NEW_GLOSSARY_TERMS.term_2.name; - cy.get('#left-panel').should('be.visible').contains(term).click(); + cy.get('#left-panelV1').should('be.visible').contains(term).click(); cy.wait(500); cy.get('[data-testid="inactive-link"]').contains(term).should('be.visible'); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedList/ActivityFeedList.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedList/ActivityFeedList.tsx index 10fca57dda0..3180495ca29 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedList/ActivityFeedList.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedList/ActivityFeedList.tsx @@ -148,10 +148,10 @@ const ActivityFeedList: FC = ({ const getFilterDropDown = () => { return hideFeedFilter && hideThreadFilter ? null : ( -
+
{/* Feed filter */} {!hideFeedFilter && ( -
+
+ ); }; @@ -690,38 +682,38 @@ const Explore: React.FC = ({ !connectionError && Boolean(selectedAdvancedFields.length); return ( - - - {error ? ( - - ) : ( - <> - {!connectionError && getTabs()} - {advanceFieldCheck && ( - - )} - + {error ? ( + + ) : ( +
+ {!connectionError && getTabs()} + {advanceFieldCheck && ( + - - )} - - + )} + +
+ )} + ); }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Explore/Explore.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Explore/Explore.test.tsx index 6e7ac774fe2..bf653710e83 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Explore/Explore.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Explore/Explore.test.tsx @@ -52,7 +52,7 @@ jest.mock('../../components/searched-data/SearchedData', () => { }); jest.mock( - '../containers/PageLayout', + '../containers/PageLayoutV1', () => ({ children, @@ -64,7 +64,7 @@ jest.mock( leftPanel: React.ReactNode; }) => ( -
+
{leftPanel}
{rightPanel}
{children} @@ -115,7 +115,7 @@ describe('Test Explore component', () => { wrapper: MemoryRouter, } ); - const pageContainer = await findByTestId(container, 'PageLayout'); + const pageContainer = await findByTestId(container, 'PageLayoutV1'); const searchData = await findByTestId(container, 'search-data'); const wrappedContent = await findByTestId(container, 'wrapped-content'); const tabs = await findAllByTestId(container, /tab/i); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/GlobalSetting/GlobalSettingLeftPanel.tsx b/openmetadata-ui/src/main/resources/ui/src/components/GlobalSetting/GlobalSettingLeftPanel.tsx index 568edf5ca67..eed96fd4da2 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/GlobalSetting/GlobalSettingLeftPanel.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/GlobalSetting/GlobalSettingLeftPanel.tsx @@ -24,6 +24,7 @@ import { MenuList, } from '../../utils/GlobalSettingsUtils'; import { getSettingPath, getTeamsWithFqnPath } from '../../utils/RouterUtils'; +import LeftPanelCard from '../common/LeftPanelCard/LeftPanelCard'; import { usePermissionProvider } from '../PermissionProvider/PermissionProvider'; const GlobalSettingLeftPanel = () => { @@ -66,13 +67,15 @@ const GlobalSettingLeftPanel = () => { }; return menuItems.length ? ( - + + + ) : ( ); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/Glossary.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/Glossary.test.tsx index fed4076dfce..6bd1b5165f5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/Glossary.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/Glossary.test.tsx @@ -75,6 +75,30 @@ jest.mock('react-router-dom', () => ({ glossaryName: 'GlossaryName', }), })); +jest.mock('antd', () => ({ + Col: jest.fn().mockImplementation(({ children }) =>
{children}
), + Input: jest.fn().mockImplementation(({ children }) =>
{children}
), + Row: jest.fn().mockImplementation(({ children }) =>
{children}
), + Space: jest.fn().mockImplementation(({ children }) =>
{children}
), + Typography: { + Title: jest + .fn() + .mockImplementation(({ children }) =>
{children}
), + }, + Dropdown: jest.fn().mockImplementation(({ children, overlay }) => ( +
+ {children} + {overlay} +
+ )), + Menu: jest.fn().mockImplementation(({ items }) => ( +
+ {items.map((item: { key: string; label: JSX.Element }) => { +
{item.label}
; + })} +
+ )), +})); jest.mock('../../components/GlossaryDetails/GlossaryDetails.component', () => { return jest.fn().mockReturnValue(<>Glossary-Details component); @@ -150,6 +174,7 @@ const mockProps = { onGlossaryTermDelete: jest.fn(), onAssetPaginate: jest.fn(), onRelatedTermClick: jest.fn(), + handleUserRedirection: jest.fn(), }; describe('Test Glossary component', () => { diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryV1.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryV1.component.tsx index 22990741ab0..9212849230e 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryV1.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryV1.component.tsx @@ -48,11 +48,12 @@ import SVGIcons, { Icons } from '../../utils/SvgUtils'; import { showErrorToast } from '../../utils/ToastUtils'; import { Button } from '../buttons/Button/Button'; import ErrorPlaceHolder from '../common/error-with-placeholder/ErrorPlaceHolder'; +import LeftPanelCard from '../common/LeftPanelCard/LeftPanelCard'; import Searchbar from '../common/searchbar/Searchbar'; import TitleBreadcrumb from '../common/title-breadcrumb/title-breadcrumb.component'; import { TitleBreadcrumbProps } from '../common/title-breadcrumb/title-breadcrumb.interface'; import TreeView from '../common/TreeView/TreeView.component'; -import PageLayout from '../containers/PageLayout'; +import PageLayoutV1 from '../containers/PageLayoutV1'; import GlossaryDetails from '../GlossaryDetails/GlossaryDetails.component'; import GlossaryTermsV1 from '../GlossaryTerms/GlossaryTermsV1.component'; import Loader from '../Loader/Loader'; @@ -323,15 +324,15 @@ const GlossaryV1 = ({ const fetchLeftPanel = () => { return ( -
-
+ +
-
Glossary
+
Glossary
{treeData.length ? ( -
+
-
+ ); }; @@ -392,7 +393,7 @@ const GlossaryV1 = ({ }, [selectedData]); return glossaryList.length ? ( - +
@@ -404,7 +405,9 @@ const GlossaryV1 = ({ } />
-
+