2022-07-02 13:10:14 -04:00
|
|
|
import React from 'react';
|
|
|
|
import { Switch, Route, Redirect } from 'react-router-dom';
|
|
|
|
import { NoPageFound } from './shared/NoPageFound';
|
|
|
|
import { PageRoutes } from '../conf/Global';
|
|
|
|
import { SearchablePage } from './search/SearchablePage';
|
|
|
|
import { useEntityRegistry } from './useEntityRegistry';
|
|
|
|
import { EntityPage } from './entity/EntityPage';
|
|
|
|
import { BrowseResultsPage } from './browse/BrowseResultsPage';
|
|
|
|
import { SearchPage } from './search/SearchPage';
|
|
|
|
import { AnalyticsPage } from './analyticsDashboard/components/AnalyticsPage';
|
|
|
|
import { ManageIngestionPage } from './ingest/ManageIngestionPage';
|
2023-03-06 12:05:45 -05:00
|
|
|
import GlossaryRoutes from './glossary/GlossaryRoutes';
|
2022-07-02 13:10:14 -04:00
|
|
|
import { SettingsPage } from './settings/SettingsPage';
|
2024-12-11 18:45:46 -05:00
|
|
|
import { useUserContext } from './context/useUserContext';
|
2023-09-18 16:14:33 -04:00
|
|
|
import DomainRoutes from './domain/DomainRoutes';
|
2024-12-11 18:45:46 -05:00
|
|
|
import {
|
|
|
|
useAppConfig,
|
|
|
|
useBusinessAttributesFlag,
|
|
|
|
useIsAppConfigContextLoaded,
|
|
|
|
useIsNestedDomainsEnabled,
|
|
|
|
} from './useAppConfig';
|
2023-09-18 16:14:33 -04:00
|
|
|
import { ManageDomainsPage } from './domain/ManageDomainsPage';
|
2024-04-16 04:49:21 +05:30
|
|
|
import { BusinessAttributes } from './businessAttribute/BusinessAttributes';
|
2024-12-11 18:45:46 -05:00
|
|
|
import StructuredProperties from './govern/structuredProperties/StructuredProperties';
|
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();
|
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);
|
|
|
|
|
2022-07-02 13:10:14 -04:00
|
|
|
return (
|
|
|
|
<SearchablePage>
|
|
|
|
<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`}
|
|
|
|
render={() => <EntityPage entityType={entity.type} />}
|
|
|
|
/>
|
|
|
|
))}
|
|
|
|
<Route path={PageRoutes.SEARCH_RESULTS} render={() => <SearchPage />} />
|
|
|
|
<Route path={PageRoutes.BROWSE_RESULTS} render={() => <BrowseResultsPage />} />
|
|
|
|
<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" />} />
|
2023-09-18 16:14:33 -04:00
|
|
|
{isNestedDomainsEnabled && <Route path={`${PageRoutes.DOMAIN}*`} render={() => <DomainRoutes />} />}
|
|
|
|
{!isNestedDomainsEnabled && <Route path={PageRoutes.DOMAINS} render={() => <ManageDomainsPage />} />}
|
2022-07-02 13:10:14 -04:00
|
|
|
<Route path={PageRoutes.INGESTION} render={() => <ManageIngestionPage />} />
|
|
|
|
<Route path={PageRoutes.SETTINGS} render={() => <SettingsPage />} />
|
2023-04-17 11:29:54 -04:00
|
|
|
<Route path={`${PageRoutes.GLOSSARY}*`} render={() => <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>
|
|
|
|
</SearchablePage>
|
|
|
|
);
|
|
|
|
};
|