Skip to content

Commit

Permalink
Refactoring code as per review part 2
Browse files Browse the repository at this point in the history
Signed-off-by: mpabba3003 <[email protected]>
  • Loading branch information
mpabba3003 committed Aug 11, 2022
1 parent 0d052d4 commit 6bf0c39
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export interface IDataSource {
title: string;
id?: string;
type?: string;
endpoint: string; // todo: url type
// todo: fucntions???
endpoint: string;
}

export interface IDataSourceAttributes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const Header = ({
prompt?: React.ReactNode;
dataSourceName?: string;
isBeta?: boolean;
docLinks?: DocLinksStart; // todo: ck
docLinks: DocLinksStart;
}) => {
const changeTitle = useOpenSearchDashboards<DataSourceManagementContext>().services.chrome
.docTitle.change;
Expand Down Expand Up @@ -64,7 +64,7 @@ export const Header = ({
/>
<br />
<EuiLink
href={'https://www.youtube.com/'} // todo
href={docLinks.links.noDocumentation.indexPatterns.introduction}
target="_blank"
external
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const CreateDataSourceWizard: React.FunctionComponent<CreateDataSourceWizardProp
props: CreateDataSourceWizardProps
) => {
/* Initialization */
const { uiSettings, savedObjects, setBreadcrumbs } = useOpenSearchDashboards<
const { uiSettings, savedObjects, setBreadcrumbs, docLinks } = useOpenSearchDashboards<
DataSourceManagementContext
>().services;

Expand All @@ -62,15 +62,14 @@ const CreateDataSourceWizard: React.FunctionComponent<CreateDataSourceWizardProp
/* TODO: Handle Create data source option*/
};

// todo: consistent name
const onSearchSelected = (id: string, selectedType: string, name: string) => {
const onSelectExistingCredential = (id: string, selectedType: string, name: string) => {
const selected = [{ id, type: selectedType, name }];
setSelectedCredential(selected);
};

/* Render header*/
const renderHeader = () => {
return <Header />;
return <Header docLinks={docLinks} />;
};

/* Render Section header*/
Expand All @@ -94,7 +93,7 @@ const CreateDataSourceWizard: React.FunctionComponent<CreateDataSourceWizardProp
<EuiFormRow>
<SavedObjectFinderUi
key="searchSavedObjectFinder"
onChoose={onSearchSelected} // todo
onChoose={onSelectExistingCredential}
showFilter={false}
noItemsMessage={i18n.translate(
'dataSources.newDataSource.searchSelection.notFoundLabel',
Expand All @@ -114,8 +113,8 @@ const CreateDataSourceWizard: React.FunctionComponent<CreateDataSourceWizardProp
),
},
]}
fixedPageSize={5} // todo
uiSettings={uiSettings} // todo
fixedPageSize={5}
uiSettings={uiSettings}
savedObjects={savedObjects}
/>
</EuiFormRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export async function mountManagementSection(
) {
const [
{ chrome, application, savedObjects, uiSettings, notifications, overlays, http, docLinks },
{ data, dataSource },
dataSourceManagementStart,
] = await getStartServices();

const deps: DataSourceManagementContext = {
Expand All @@ -43,9 +41,6 @@ export async function mountManagementSection(
overlays,
http,
docLinks,
data,
dataSource,
dataSourceManagementStart,
setBreadcrumbs: params.setBreadcrumbs,
};

Expand Down
6 changes: 0 additions & 6 deletions src/plugins/data_source_management/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ import {
HttpSetup,
} from 'src/core/public';
import { ManagementAppMountParams, ManagementSetup } from 'src/plugins/management/public';
import { DataPublicPluginStart } from 'src/plugins/data/public';
import { DataSourceStart } from 'src/plugins/data_source/public';
import { DataSourceManagementStart } from './index';

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface DataSourceManagementPluginStart {}
Expand All @@ -41,9 +38,6 @@ export interface DataSourceManagementContext {
overlays: OverlayStart;
http: HttpSetup;
docLinks: DocLinksStart;
data: DataPublicPluginStart;
dataSource: DataSourceStart;
dataSourceManagementStart: DataSourceManagementStart;
setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs'];
}

Expand Down

0 comments on commit 6bf0c39

Please sign in to comment.