Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breadcrumbfix for datasource management #2066

Merged
merged 4 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

mpabba3003 marked this conversation as resolved.
Show resolved Hide resolved
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
mpabba3003 marked this conversation as resolved.
Show resolved Hide resolved

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

export function getListBreadcrumbs() {
return [
{
text: i18n.translate('indexPatternManagement.dataSources.listBreadcrumb', {
defaultMessage: 'Data Sources',
}),
href: `/`,
},
];
}
Comment on lines +6 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add Breadcrumbs for other pages as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will be done as I create new pages and they are ready for user to navigate to.

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