From bba75b6b862e785b288a477cbaf3f8279ae899cb Mon Sep 17 00:00:00 2001
From: Ankit keshari <86347578+Ankit-Keshari-Vituity@users.noreply.github.com>
Date: Sat, 2 Jul 2022 01:00:06 +0530
Subject: [PATCH] feat(ui): Modified the drop down of Menu Items (#5301)
---
.../src/app/glossary/BusinessGlossaryPage.tsx | 91 +++++++++++--------
.../src/app/shared/ManageAccount.tsx | 40 +++++---
2 files changed, 82 insertions(+), 49 deletions(-)
diff --git a/datahub-web-react/src/app/glossary/BusinessGlossaryPage.tsx b/datahub-web-react/src/app/glossary/BusinessGlossaryPage.tsx
index 8c6f7f3c9b..868dad3f37 100644
--- a/datahub-web-react/src/app/glossary/BusinessGlossaryPage.tsx
+++ b/datahub-web-react/src/app/glossary/BusinessGlossaryPage.tsx
@@ -1,16 +1,18 @@
import React, { useState } from 'react';
-import { Typography } from 'antd';
+import { Button, Typography } from 'antd';
+import { PlusOutlined } from '@ant-design/icons';
import styled from 'styled-components/macro';
+
import { useGetRootGlossaryNodesQuery, useGetRootGlossaryTermsQuery } from '../../graphql/glossary.generated';
import TabToolbar from '../entity/shared/components/styled/TabToolbar';
import { SearchablePage } from '../search/SearchablePage';
-import EntityDropdown, { EntityMenuItems } from '../entity/shared/EntityDropdown/EntityDropdown';
import GlossaryEntitiesPath from './GlossaryEntitiesPath';
import GlossaryEntitiesList from './GlossaryEntitiesList';
import GlossaryBrowser from './GlossaryBrowser/GlossaryBrowser';
import GlossarySearch from './GlossarySearch';
import { ProfileSidebarResizer } from '../entity/shared/containers/profile/sidebar/ProfileSidebarResizer';
import EmptyGlossarySection from './EmptyGlossarySection';
+import CreateGlossaryEntityModal from '../entity/shared/EntityDropdown/CreateGlossaryEntityModal';
import { EntityType } from '../../types.generated';
export const HeaderWrapper = styled(TabToolbar)`
@@ -48,42 +50,59 @@ function BusinessGlossaryPage() {
const hasTermsOrNodes = !!nodes?.length || !!terms?.length;
+ const [isCreateTermModalVisible, setIsCreateTermModalVisible] = useState(false);
+ const [isCreateNodeModalVisible, setIsCreateNodeModalVisible] = useState(false);
+
return (
-
-
-
-
-
-
-
- setBrowserWidth(Math.min(Math.max(width, MIN_BROWSWER_WIDTH), MAX_BROWSER_WIDTH))
- }
- initialSize={browserWidth}
- isSidebarOnLeft
- />
-
-
-
- Glossary
- {
- // This is a hack -- TODO: Generalize EntityDropdown to support non-entity related items.
+ <>
+
+
+
+
+
+
+
+ setBrowserWidth(Math.min(Math.max(width, MIN_BROWSWER_WIDTH), MAX_BROWSER_WIDTH))
}
-
-
- {hasTermsOrNodes && }
- {!hasTermsOrNodes && (
-
- )}
-
-
-
+ initialSize={browserWidth}
+ isSidebarOnLeft
+ />
+
+
+
+ Glossary
+
+
+
+
+
+ {hasTermsOrNodes && }
+ {!hasTermsOrNodes && (
+
+ )}
+
+
+
+ {isCreateTermModalVisible && (
+ setIsCreateTermModalVisible(false)}
+ refetchData={refetchForTerms}
+ />
+ )}
+ {isCreateNodeModalVisible && (
+ setIsCreateNodeModalVisible(false)}
+ refetchData={refetchForNodes}
+ />
+ )}
+ >
);
}
diff --git a/datahub-web-react/src/app/shared/ManageAccount.tsx b/datahub-web-react/src/app/shared/ManageAccount.tsx
index 4663d2fb68..4bc704c1ea 100644
--- a/datahub-web-react/src/app/shared/ManageAccount.tsx
+++ b/datahub-web-react/src/app/shared/ManageAccount.tsx
@@ -2,7 +2,6 @@ import React from 'react';
import Cookies from 'js-cookie';
import { Menu, Dropdown } from 'antd';
import { CaretDownOutlined } from '@ant-design/icons';
-import { Link } from 'react-router-dom';
import styled, { useTheme } from 'styled-components';
import { EntityType } from '../../types.generated';
import { useEntityRegistry } from '../useEntityRegistry';
@@ -14,6 +13,9 @@ import { ANTD_GRAY } from '../entity/shared/constants';
import { useAppConfig } from '../useAppConfig';
const MenuItem = styled(Menu.Item)`
+ display: flex;
+ justify-content: start;
+ align-items: center;
&& {
margin-top: 2px;
}
@@ -32,10 +34,6 @@ const DownArrow = styled(CaretDownOutlined)`
color: ${ANTD_GRAY[7]};
`;
-const StyledLink = styled(Link)`
- white-space: nowrap;
-`;
-
interface Props {
urn: string;
pictureLink?: string;
@@ -57,8 +55,23 @@ export const ManageAccount = ({ urn: _urn, pictureLink: _pictureLink, name }: Pr
};
const version = config?.appVersion;
const menu = (
-