mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-10 16:33:48 +00:00

Allow the ability to now nest domains underneath other domains. This should work much like the business glossary where you can add domains underneath other domains, move domains underneath other domains or at the root, and navigate domains using a nice new navigator.
58 lines
3.0 KiB
TypeScript
58 lines
3.0 KiB
TypeScript
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';
|
|
import GlossaryRoutes from './glossary/GlossaryRoutes';
|
|
import { SettingsPage } from './settings/SettingsPage';
|
|
import DomainRoutes from './domain/DomainRoutes';
|
|
import { useIsNestedDomainsEnabled } from './useAppConfig';
|
|
import { ManageDomainsPage } from './domain/ManageDomainsPage';
|
|
|
|
/**
|
|
* Container for all searchable page routes
|
|
*/
|
|
export const SearchRoutes = (): JSX.Element => {
|
|
const entityRegistry = useEntityRegistry();
|
|
const isNestedDomainsEnabled = useIsNestedDomainsEnabled();
|
|
const entities = isNestedDomainsEnabled
|
|
? entityRegistry.getEntitiesForSearchRoutes()
|
|
: entityRegistry.getNonGlossaryEntities();
|
|
|
|
return (
|
|
<SearchablePage>
|
|
<Switch>
|
|
{entities.map((entity) => (
|
|
<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 />} />
|
|
<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" />} />
|
|
<Route path={PageRoutes.IDENTITIES} render={() => <Redirect to="/settings/identities" />} />
|
|
{isNestedDomainsEnabled && <Route path={`${PageRoutes.DOMAIN}*`} render={() => <DomainRoutes />} />}
|
|
{!isNestedDomainsEnabled && <Route path={PageRoutes.DOMAINS} render={() => <ManageDomainsPage />} />}
|
|
<Route path={PageRoutes.INGESTION} render={() => <ManageIngestionPage />} />
|
|
<Route path={PageRoutes.SETTINGS} render={() => <SettingsPage />} />
|
|
<Route path={`${PageRoutes.GLOSSARY}*`} render={() => <GlossaryRoutes />} />
|
|
<Route component={NoPageFound} />
|
|
</Switch>
|
|
</SearchablePage>
|
|
);
|
|
};
|