mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-12 15:57:44 +00:00
Remove home text from landing page and disable save for customize pages (#22840)
This commit is contained in:
parent
b35e6a4880
commit
eec39eef79
@ -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<CustomizeMyDataProps>) {
|
||||
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({
|
||||
<Row className="customize-details-page" gutter={[0, 20]}>
|
||||
<Col span={24}>
|
||||
<CustomizablePageHeader
|
||||
disableSave={disableSave}
|
||||
personaName={getEntityName(personaDetails)}
|
||||
onReset={handleReset}
|
||||
onSave={handleSave}
|
||||
|
||||
@ -140,6 +140,10 @@ jest.mock('./CuratedAssetsModal/CuratedAssetsModal', () =>
|
||||
})
|
||||
);
|
||||
|
||||
jest.mock('../../../common/RichTextEditor/RichTextEditorPreviewerV1', () =>
|
||||
jest.fn().mockImplementation(({ markdown }) => <div>{markdown}</div>)
|
||||
);
|
||||
|
||||
const mockHandleRemoveWidget = jest.fn();
|
||||
const mockHandleLayoutUpdate = jest.fn();
|
||||
|
||||
|
||||
@ -439,18 +439,6 @@ const NavBar = () => {
|
||||
navigate(0);
|
||||
}, []);
|
||||
|
||||
const homePageTitle = useMemo(() => {
|
||||
if (isHomePage && isSidebarCollapsed) {
|
||||
return (
|
||||
<Typography.Text className="font-semibold navbar-title">
|
||||
{t('label.home')}
|
||||
</Typography.Text>
|
||||
);
|
||||
}
|
||||
|
||||
return <></>;
|
||||
}, [isHomePage, isSidebarCollapsed]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header>
|
||||
@ -478,7 +466,6 @@ const NavBar = () => {
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
{homePageTitle}
|
||||
{!isHomePage && !isTourPage && (
|
||||
<>
|
||||
<GlobalSearchBar />
|
||||
|
||||
@ -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 (
|
||||
<PageLayoutV1
|
||||
className="bg-grey"
|
||||
@ -87,6 +108,7 @@ const CustomizableDomainPage = ({
|
||||
<Row className="customize-details-page" gutter={[0, 20]}>
|
||||
<Col span={24}>
|
||||
<CustomizablePageHeader
|
||||
disableSave={disableSave}
|
||||
personaName={getEntityName(personaDetails)}
|
||||
onReset={handleReset}
|
||||
onSave={handleSave}
|
||||
|
||||
@ -11,8 +11,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
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 { CustomizeTabWidget } from '../../components/Customization/CustomizeTabWidget/CustomizeTabWidget';
|
||||
import { DataAssetsHeader } from '../../components/DataAssets/DataAssetsHeader/DataAssetsHeader.component';
|
||||
@ -38,7 +39,7 @@ export const CustomizeDetailsPage = ({
|
||||
onSaveLayout,
|
||||
}: CustomizeMyDataProps) => {
|
||||
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 = ({
|
||||
<Row className="customize-details-page" gutter={[0, 20]}>
|
||||
<Col span={24}>
|
||||
<CustomizablePageHeader
|
||||
disableSave={disableSave}
|
||||
personaName={getEntityName(personaDetails)}
|
||||
onReset={handleReset}
|
||||
onSave={handleSave}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user