Skip to content

Commit

Permalink
fix(ui): Add missing SearchRoutes component (#5321)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjoyce0510 authored Jul 2, 2022
1 parent bb3208d commit 86070d7
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions datahub-web-react/src/app/SearchRoutes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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 { ManageDomainsPage } from './domain/ManageDomainsPage';
import { ManageIngestionPage } from './ingest/ManageIngestionPage';
import BusinessGlossaryPage from './glossary/BusinessGlossaryPage';
import { SettingsPage } from './settings/SettingsPage';

/**
* Container for all searchable page routes
*/
export const SearchRoutes = (): JSX.Element => {
const entityRegistry = useEntityRegistry();
return (
<SearchablePage>
<Switch>
{entityRegistry.getEntities().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/policies" />} />
<Route path={PageRoutes.IDENTITIES} render={() => <Redirect to="/settings/identities" />} />
<Route path={PageRoutes.DOMAINS} render={() => <ManageDomainsPage />} />
<Route path={PageRoutes.INGESTION} render={() => <ManageIngestionPage />} />
<Route path={PageRoutes.SETTINGS} render={() => <SettingsPage />} />
<Route path={PageRoutes.GLOSSARY} render={() => <BusinessGlossaryPage />} />
<Route component={NoPageFound} />
</Switch>
</SearchablePage>
);
};

0 comments on commit 86070d7

Please sign in to comment.