Skip to content

Commit

Permalink
breadcrumbfix for datasource management
Browse files Browse the repository at this point in the history
Signed-off-by: mpabba3003 <[email protected]>
  • Loading branch information
mpabba3003 committed Aug 3, 2022
1 parent 25a97cb commit b0a745f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,30 @@
*/

import { EuiTitle } from '@elastic/eui';
import React from 'react';
import { withRouter } from 'react-router-dom';
import React, { useEffect } from 'react';
import { i18n } from '@osd/i18n';
import { ChromeBreadcrumb } from 'src/core/public';

export const DataSourceTable = () => {
export interface DataSourceTableProps {
setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void;
}

export const DataSourceTable = ({setBreadcrumbs}: DataSourceTableProps) => {
useEffect(() => {
setBreadcrumbs([
{
text: i18n.translate('dataSourceManagement.breadcrumb.index', {
defaultMessage: 'Data Sources',
}),
href: '/',
},
]);
}, [setBreadcrumbs]);
return (
<EuiTitle>
<h2>{'This is the landing page, going to list data sources here...'}</h2>
</EuiTitle>
);
};

export const DataSourceTableWithRouter = withRouter(DataSourceTable);
export {DataSourceTable as default}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export { DataSourceTableWithRouter } from './data_source_table';
export { DataSourceTable } from './data_source_table';
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@
import { StartServicesAccessor } from 'src/core/public';

import { I18nProvider } from '@osd/i18n/react';
import { i18n } from '@osd/i18n';
import React from 'react';
import ReactDOM from 'react-dom';
import { Route, Router, Switch } from 'react-router-dom';
import { ManagementAppMountParams } from '../../../management/public';

import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public';
import { CreateDataSourceWizardWithRouter } from '../components/create_data_source_wizard';
import { DataSourceTableWithRouter } from '../components/data_source_table';
import { DataSourceManagmentContext } from '../types';
import DataSourceTable from '../components/data_source_table/data_source_table';


export async function mountManagementSection(
getStartServices: StartServicesAccessor,
params: ManagementAppMountParams
) {
const [
{ chrome, application, savedObjects, uiSettings, notifications, overlays, http, docLinks },
{chrome, application, savedObjects, uiSettings, notifications, overlays, http, docLinks }
] = await getStartServices();

const deps: DataSourceManagmentContext = {
Expand All @@ -36,6 +38,14 @@ export async function mountManagementSection(
setBreadcrumbs: params.setBreadcrumbs,
};

/* Browser - Page Title */
const title = i18n.translate('dataSourcesManagement.objects.dataSourcesTitle', {
defaultMessage: 'Data Sources',
});

chrome.docTitle.change(title);


ReactDOM.render(
<OpenSearchDashboardsContextProvider services={deps}>
<I18nProvider>
Expand All @@ -45,7 +55,8 @@ export async function mountManagementSection(
<CreateDataSourceWizardWithRouter />
</Route>
<Route path={['/']}>
<DataSourceTableWithRouter />
<DataSourceTable
setBreadcrumbs={deps.setBreadcrumbs} />
</Route>
</Switch>
</Router>
Expand Down

0 comments on commit b0a745f

Please sign in to comment.