diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/CustomiseGlossaryTermDetailPage/CustomiseGlossaryTermDetailPage.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/CustomiseGlossaryTermDetailPage/CustomiseGlossaryTermDetailPage.tsx index e741bd34248..e720f6b3424 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/CustomiseGlossaryTermDetailPage/CustomiseGlossaryTermDetailPage.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/CustomiseGlossaryTermDetailPage/CustomiseGlossaryTermDetailPage.tsx @@ -12,8 +12,9 @@ */ import { Col, Row } from 'antd'; +import { compare } from 'fast-json-patch'; import { kebabCase } from 'lodash'; -import { useCallback } from 'react'; +import { useCallback, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { Page } from '../../../../generated/system/ui/page'; import { useGridLayoutDirection } from '../../../../hooks/useGridLayoutDirection'; @@ -32,7 +33,7 @@ function CustomizeGlossaryTermDetailPage({ isGlossary, }: Readonly) { const { t } = useTranslation(); - const { currentPage, currentPageType } = useCustomizeStore(); + const { currentPage, currentPageType, getPage } = useCustomizeStore(); const handleReset = useCallback(async () => { await onSaveLayout(); @@ -47,6 +48,22 @@ function CustomizeGlossaryTermDetailPage({ // call the hook to set the direction of the grid layout useGridLayoutDirection(); + const disableSave = useMemo(() => { + if (!currentPageType) { + return true; + } + + const originalPage = + getPage(currentPageType) ?? ({ pageType: currentPageType } as Page); + + const editedPage = (currentPage ?? + ({ pageType: currentPageType } as Page)) as Page; + + const jsonPatch = compare(originalPage, editedPage); + + return jsonPatch.length === 0; + }, [currentPage, currentPageType, getPage]); + if (!currentPageType) { return null; } @@ -60,6 +77,7 @@ function CustomizeGlossaryTermDetailPage({ }) ); +jest.mock('../../../common/RichTextEditor/RichTextEditorPreviewerV1', () => + jest.fn().mockImplementation(({ markdown }) =>
{markdown}
) +); + const mockHandleRemoveWidget = jest.fn(); const mockHandleLayoutUpdate = jest.fn(); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/NavBar/NavBar.tsx b/openmetadata-ui/src/main/resources/ui/src/components/NavBar/NavBar.tsx index 56cd8d8c3f6..1b787eddf90 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/NavBar/NavBar.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/NavBar/NavBar.tsx @@ -439,18 +439,6 @@ const NavBar = () => { navigate(0); }, []); - const homePageTitle = useMemo(() => { - if (isHomePage && isSidebarCollapsed) { - return ( - - {t('label.home')} - - ); - } - - return <>; - }, [isHomePage, isSidebarCollapsed]); - return ( <>
@@ -478,7 +466,6 @@ const NavBar = () => { } /> - {homePageTitle} {!isHomePage && !isTourPage && ( <> diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/CustomizableDomainPage/CustomizableDomainPage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/CustomizableDomainPage/CustomizableDomainPage.tsx index 532858d7dfc..77b2add6b2b 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/CustomizableDomainPage/CustomizableDomainPage.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/CustomizableDomainPage/CustomizableDomainPage.tsx @@ -12,6 +12,7 @@ */ import { Col, Row } from 'antd'; +import { compare } from 'fast-json-patch'; import { useCallback, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { ReactComponent as DomainIcon } from '../../assets/svg/ic-domain.svg'; @@ -38,7 +39,7 @@ const CustomizableDomainPage = ({ onSaveLayout, }: CustomizeMyDataProps) => { const { t } = useTranslation(); - const { currentPage, currentPageType } = useCustomizeStore(); + const { currentPage, currentPageType, getPage } = useCustomizeStore(); const handleReset = useCallback(async () => { await onSaveLayout(); @@ -78,6 +79,26 @@ const CustomizableDomainPage = ({ ]; }, [entityDummyData.fullyQualifiedName]); + const disableSave = useMemo(() => { + if (!currentPageType) { + return true; + } + + const originalPage = + getPage(currentPageType as string) ?? + ({ + pageType: currentPageType, + } as Page); + const editedPage = (currentPage ?? + ({ + pageType: currentPageType, + } as Page)) as Page; + + const jsonPatch = compare(originalPage, editedPage); + + return jsonPatch.length === 0; + }, [currentPage, currentPageType, getPage]); + return ( { const { t } = useTranslation(); - const { currentPage, currentPageType } = useCustomizeStore(); + const { currentPage, currentPageType, getPage } = useCustomizeStore(); const handleReset = useCallback(async () => { await onSaveLayout(); @@ -55,6 +56,22 @@ export const CustomizeDetailsPage = ({ // call the hook to set the direction of the grid layout useGridLayoutDirection(); + // Disable save if there are no diffs between original and edited page + const disableSave = useMemo(() => { + if (!currentPageType) { + return true; + } + + const originalPage = + getPage(currentPageType) ?? ({ pageType: currentPageType } as Page); + const editedPage = (currentPage ?? + ({ pageType: currentPageType } as Page)) as Page; + + const jsonPatch = compare(originalPage, editedPage); + + return jsonPatch.length === 0; + }, [currentPageType, currentPage, getPage]); + if (!currentPageType) { return null; } @@ -68,6 +85,7 @@ export const CustomizeDetailsPage = ({