Skip to content

Commit

Permalink
breadcrumbfix for datasource management (opensearch-project#2066)
Browse files Browse the repository at this point in the history
* breadcrumbfix for datasource management

Signed-off-by: mpabba3003 <[email protected]>

* breadcrumbfix for datasource management - refactoring code

Signed-off-by: mpabba3003 <[email protected]>

* using services to update breadcrumb on data sources management page

Signed-off-by: mpabba3003 <[email protected]>

* Changing the license header on breadcrumbs.ts datasource management

Signed-off-by: Kristen Tian <[email protected]>
  • Loading branch information
mpabba3003 authored and kristenTian committed Sep 15, 2022
1 parent 3870b7d commit 85906d9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { i18n } from '@osd/i18n';

export function getListBreadcrumbs() {
return [
{
text: i18n.translate('indexPatternManagement.dataSources.listBreadcrumb', {
defaultMessage: 'Data Sources',
}),
href: `/`,
},
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@
import { EuiTitle } from '@elastic/eui';
import React from 'react';
import { withRouter } from 'react-router-dom';
import { getListBreadcrumbs } from '../breadcrumbs';
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';
import { DataSourceManagementContext } from '../../types';

export const DataSourceTable = () => {
const { setBreadcrumbs } = useOpenSearchDashboards<DataSourceManagementContext>().services;

setBreadcrumbs(getListBreadcrumbs());

return (
<EuiTitle>
<h2>{'This is the landing page, going to list data sources here...'}</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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';
Expand All @@ -14,7 +15,7 @@ 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 { DataSourceManagementContext } from '../types';

export async function mountManagementSection(
getStartServices: StartServicesAccessor,
Expand All @@ -24,7 +25,7 @@ export async function mountManagementSection(
{ chrome, application, savedObjects, uiSettings, notifications, overlays, http, docLinks },
] = await getStartServices();

const deps: DataSourceManagmentContext = {
const deps: DataSourceManagementContext = {
chrome,
application,
savedObjects,
Expand All @@ -36,6 +37,13 @@ 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 Down
2 changes: 1 addition & 1 deletion src/plugins/data_source_management/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface DataSourceManagementSetupDependencies {
management: ManagementSetup;
}

export interface DataSourceManagmentContext {
export interface DataSourceManagementContext {
chrome: ChromeStart;
application: ApplicationStart;
savedObjects: SavedObjectsStart;
Expand Down

0 comments on commit 85906d9

Please sign in to comment.