2022-07-02 13:10:14 -04:00
|
|
|
import React from 'react';
|
2025-01-29 20:42:01 -05:00
|
|
|
import { Redirect, Route, Switch } from 'react-router-dom';
|
2025-04-16 16:55:38 -07:00
|
|
|
|
|
|
|
import { AnalyticsPage } from '@app/analyticsDashboard/components/AnalyticsPage';
|
|
|
|
import { BrowseResultsPage } from '@app/browse/BrowseResultsPage';
|
|
|
|
import { BusinessAttributes } from '@app/businessAttribute/BusinessAttributes';
|
|
|
|
import { useUserContext } from '@app/context/useUserContext';
|
|
|
|
import DomainRoutes from '@app/domain/DomainRoutes';
|
|
|
|
import { ManageDomainsPage } from '@app/domain/ManageDomainsPage';
|
|
|
|
import DomainRoutesV2 from '@app/domainV2/DomainRoutes';
|
|
|
|
import { ManageDomainsPage as ManageDomainsPageV2 } from '@app/domainV2/ManageDomainsPage';
|
|
|
|
import { EntityPage } from '@app/entity/EntityPage';
|
|
|
|
import { EntityPage as EntityPageV2 } from '@app/entityV2/EntityPage';
|
|
|
|
import GlossaryRoutes from '@app/glossary/GlossaryRoutes';
|
|
|
|
import GlossaryRoutesV2 from '@app/glossaryV2/GlossaryRoutes';
|
|
|
|
import StructuredProperties from '@app/govern/structuredProperties/StructuredProperties';
|
|
|
|
import { ManageIngestionPage } from '@app/ingest/ManageIngestionPage';
|
|
|
|
import { SearchPage } from '@app/search/SearchPage';
|
|
|
|
import { SearchablePage } from '@app/search/SearchablePage';
|
|
|
|
import { SearchPage as SearchPageV2 } from '@app/searchV2/SearchPage';
|
|
|
|
import { SearchablePage as SearchablePageV2 } from '@app/searchV2/SearchablePage';
|
|
|
|
import { SettingsPage } from '@app/settings/SettingsPage';
|
|
|
|
import { SettingsPage as SettingsPageV2 } from '@app/settingsV2/SettingsPage';
|
|
|
|
import { NoPageFound } from '@app/shared/NoPageFound';
|
|
|
|
import { ManageTags } from '@app/tags/ManageTags';
|
2024-12-11 18:45:46 -05:00
|
|
|
import {
|
|
|
|
useAppConfig,
|
|
|
|
useBusinessAttributesFlag,
|
|
|
|
useIsAppConfigContextLoaded,
|
|
|
|
useIsNestedDomainsEnabled,
|
2025-04-16 16:55:38 -07:00
|
|
|
} from '@app/useAppConfig';
|
|
|
|
import { useEntityRegistry } from '@app/useEntityRegistry';
|
|
|
|
import { useIsThemeV2 } from '@app/useIsThemeV2';
|
|
|
|
import { PageRoutes } from '@conf/Global';
|
2025-01-29 20:42:01 -05:00
|
|
|
|
2022-07-02 13:10:14 -04:00
|
|
|
/**
|
|
|
|
* Container for all searchable page routes
|
|
|
|
*/
|
|
|
|
export const SearchRoutes = (): JSX.Element => {
|
|
|
|
const entityRegistry = useEntityRegistry();
|
2024-12-11 18:45:46 -05:00
|
|
|
const me = useUserContext();
|
2023-09-18 16:14:33 -04:00
|
|
|
const isNestedDomainsEnabled = useIsNestedDomainsEnabled();
|
|
|
|
const entities = isNestedDomainsEnabled
|
|
|
|
? entityRegistry.getEntitiesForSearchRoutes()
|
|
|
|
: entityRegistry.getNonGlossaryEntities();
|
2024-12-11 18:45:46 -05:00
|
|
|
const { config } = useAppConfig();
|
2025-01-29 20:42:01 -05:00
|
|
|
const isThemeV2 = useIsThemeV2();
|
|
|
|
const FinalSearchablePage = isThemeV2 ? SearchablePageV2 : SearchablePage;
|
2023-09-18 16:14:33 -04:00
|
|
|
|
2024-04-16 04:49:21 +05:30
|
|
|
const businessAttributesFlag = useBusinessAttributesFlag();
|
|
|
|
const appConfigContextLoaded = useIsAppConfigContextLoaded();
|
|
|
|
|
2024-12-11 18:45:46 -05:00
|
|
|
const showStructuredProperties =
|
|
|
|
config?.featureFlags?.showManageStructuredProperties &&
|
|
|
|
(me.platformPrivileges?.manageStructuredProperties || me.platformPrivileges?.viewStructuredPropertiesPage);
|
|
|
|
|
2025-03-31 15:30:51 -07:00
|
|
|
const showTags =
|
|
|
|
config?.featureFlags?.showManageTags &&
|
|
|
|
(me.platformPrivileges?.manageTags || me.platformPrivileges?.viewManageTags);
|
|
|
|
|
2022-07-02 13:10:14 -04:00
|
|
|
return (
|
2025-01-29 20:42:01 -05:00
|
|
|
<FinalSearchablePage>
|
2022-07-02 13:10:14 -04:00
|
|
|
<Switch>
|
2023-09-18 16:14:33 -04:00
|
|
|
{entities.map((entity) => (
|
2022-07-02 13:10:14 -04:00
|
|
|
<Route
|
|
|
|
key={entity.getPathName()}
|
|
|
|
path={`/${entity.getPathName()}/:urn`}
|
2025-01-29 20:42:01 -05:00
|
|
|
render={() =>
|
|
|
|
isThemeV2 ? (
|
|
|
|
<EntityPageV2 entityType={entity.type} />
|
|
|
|
) : (
|
|
|
|
<EntityPage entityType={entity.type} />
|
|
|
|
)
|
|
|
|
}
|
2022-07-02 13:10:14 -04:00
|
|
|
/>
|
|
|
|
))}
|
2025-01-29 20:42:01 -05:00
|
|
|
<Route
|
|
|
|
path={PageRoutes.SEARCH_RESULTS}
|
|
|
|
render={() => (isThemeV2 ? <SearchPageV2 /> : <SearchPage />)}
|
|
|
|
/>
|
2022-07-02 13:10:14 -04:00
|
|
|
<Route path={PageRoutes.BROWSE_RESULTS} render={() => <BrowseResultsPage />} />
|
2025-03-31 15:30:51 -07:00
|
|
|
{showTags ? <Route path={PageRoutes.MANAGE_TAGS} render={() => <ManageTags />} /> : null}
|
2022-07-02 13:10:14 -04:00
|
|
|
<Route path={PageRoutes.ANALYTICS} render={() => <AnalyticsPage />} />
|
2022-08-30 18:31:34 -07:00
|
|
|
<Route path={PageRoutes.POLICIES} render={() => <Redirect to="/settings/permissions/policies" />} />
|
|
|
|
<Route
|
|
|
|
path={PageRoutes.SETTINGS_POLICIES}
|
|
|
|
render={() => <Redirect to="/settings/permissions/policies" />}
|
|
|
|
/>
|
|
|
|
<Route path={PageRoutes.PERMISSIONS} render={() => <Redirect to="/settings/permissions" />} />
|
2022-07-02 13:10:14 -04:00
|
|
|
<Route path={PageRoutes.IDENTITIES} render={() => <Redirect to="/settings/identities" />} />
|
2025-01-29 20:42:01 -05:00
|
|
|
{isNestedDomainsEnabled && (
|
|
|
|
<Route
|
|
|
|
path={`${PageRoutes.DOMAIN}*`}
|
|
|
|
render={() => (isThemeV2 ? <DomainRoutesV2 /> : <DomainRoutes />)}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{!isNestedDomainsEnabled && (
|
|
|
|
<Route
|
|
|
|
path={PageRoutes.DOMAINS}
|
|
|
|
render={() => (isThemeV2 ? <ManageDomainsPageV2 /> : <ManageDomainsPage />)}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
|
2022-07-02 13:10:14 -04:00
|
|
|
<Route path={PageRoutes.INGESTION} render={() => <ManageIngestionPage />} />
|
2025-01-29 20:42:01 -05:00
|
|
|
<Route path={PageRoutes.SETTINGS} render={() => (isThemeV2 ? <SettingsPageV2 /> : <SettingsPage />)} />
|
|
|
|
<Route
|
|
|
|
path={`${PageRoutes.GLOSSARY}*`}
|
|
|
|
render={() => (isThemeV2 ? <GlossaryRoutesV2 /> : <GlossaryRoutes />)}
|
|
|
|
/>
|
2024-12-11 18:45:46 -05:00
|
|
|
{showStructuredProperties && (
|
|
|
|
<Route path={PageRoutes.STRUCTURED_PROPERTIES} render={() => <StructuredProperties />} />
|
|
|
|
)}
|
2024-06-21 11:03:56 -07:00
|
|
|
<Route
|
|
|
|
path={PageRoutes.BUSINESS_ATTRIBUTE}
|
|
|
|
render={() => {
|
|
|
|
if (!appConfigContextLoaded) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
if (businessAttributesFlag) {
|
|
|
|
return <BusinessAttributes />;
|
|
|
|
}
|
|
|
|
return <NoPageFound />;
|
|
|
|
}}
|
|
|
|
/>
|
2022-07-02 13:10:14 -04:00
|
|
|
<Route component={NoPageFound} />
|
|
|
|
</Switch>
|
2025-01-29 20:42:01 -05:00
|
|
|
</FinalSearchablePage>
|
2022-07-02 13:10:14 -04:00
|
|
|
);
|
|
|
|
};
|