Skip to content

Commit

Permalink
Rename data sources to data connections (#1004)
Browse files Browse the repository at this point in the history
* rename data sources to data connections

Signed-off-by: Derek Ho <dxho@amazon.com>

* final cleanup

Signed-off-by: Derek Ho <dxho@amazon.com>

* update acceleration breadcrumb

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix API call for data connection page

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix integ test and data test subj and snapshot

Signed-off-by: Derek Ho <dxho@amazon.com>

---------

Signed-off-by: Derek Ho <dxho@amazon.com>
  • Loading branch information
derek-ho authored Sep 15, 2023
1 parent 6e42a2b commit 24cdd19
Show file tree
Hide file tree
Showing 20 changed files with 99 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .cypress/integration/10_datasources.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/// <reference types="cypress" />

const moveToDatasourcesHome = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/datasources`);
cy.visit(`${Cypress.env('opensearchDashboards')}/app/dataconnections`);
};

describe('Basic sanity test for datasources plugin', () => {
it('Navigates to datasources plugin and expects the correct header', () => {
moveToDatasourcesHome();
cy.get('[data-test-subj="datasources-header"]').should('exist');
cy.get('[data-test-subj="dataconnections-header"]').should('exist');
});
});

Expand Down
16 changes: 8 additions & 8 deletions common/constants/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const DSL_CAT = '/cat.indices';
export const DSL_MAPPING = '/indices.getFieldMapping';
export const OBSERVABILITY_BASE = '/api/observability';
export const INTEGRATIONS_BASE = '/api/integrations';
export const DATASOURCES_BASE = '/api/datasources';
export const DATACONNECTIONS_BASE = '/api/dataconnections';
export const EVENT_ANALYTICS = '/event_analytics';
export const SAVED_OBJECTS = '/saved_objects';
export const SAVED_QUERY = '/query';
Expand All @@ -24,7 +24,7 @@ export const SAVED_VISUALIZATION = '/vis';
export const PPL_ENDPOINT = '/_plugins/_ppl';
export const SQL_ENDPOINT = '/_plugins/_sql';
export const DSL_ENDPOINT = '/_plugins/_dsl';
export const DATASOURCES_ENDPOINT = '/_plugins/_query/_datasources';
export const DATACONNECTIONS_ENDPOINT = '/_plugins/_query/_datasources';

export const observabilityID = 'observability-logs';
export const observabilityTitle = 'Observability';
Expand Down Expand Up @@ -58,9 +58,9 @@ export const observabilityIntegrationsID = 'integrations';
export const observabilityIntegrationsTitle = 'Integrations';
export const observabilityIntegrationsPluginOrder = 9020;

export const observabilityDatasourcesID = 'datasources';
export const observabilityDatasourcesTitle = 'Datasources';
export const observabilityDatasourcesPluginOrder = 9030;
export const observabilityDataConnectionsID = 'dataconnections';
export const observabilityDataConnectionsTitle = 'Data Connections';
export const observabilityDataConnectionsPluginOrder = 9030;

// Shared Constants
export const SQL_DOCUMENTATION_URL = 'https://opensearch.org/docs/latest/search-plugins/sql/index/';
Expand All @@ -80,12 +80,12 @@ export const PPL_NEWLINE_REGEX = /[\n\r]+/g;

// Observability plugin URI
const BASE_OBSERVABILITY_URI = '/_plugins/_observability';
const BASE_DATASOURCES_URI = '/_plugins/_query/_datasources';
const BASE_DATACONNECTIONS_URI = '/_plugins/_query/_datasources';
export const OPENSEARCH_PANELS_API = {
OBJECT: `${BASE_OBSERVABILITY_URI}/object`,
};
export const OPENSEARCH_DATASOURCES_API = {
DATASOURCE: `${BASE_DATASOURCES_URI}`,
export const OPENSEARCH_DATACONNECTIONS_API = {
DATACONNECTION: `${BASE_DATACONNECTIONS_URI}`,
};

// Saved Objects
Expand Down
4 changes: 2 additions & 2 deletions public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { EventAnalytics } from './event_analytics';
import { Home as MetricsHome } from './metrics/index';
import { Main as NotebooksHome } from './notebooks/components/main';
import { Home as TraceAnalyticsHome } from './trace_analytics/home';
import { Home as DatasourcesHome } from './data_connections/home';
import { Home as DataConnectionsHome } from './data_connections/home';

interface ObservabilityAppDeps {
CoreStartProp: CoreStart;
Expand All @@ -45,7 +45,7 @@ const pages = {
notebooks: NotebooksHome,
dashboards: CustomPanelsHome,
integrations: IntegrationsHome,
datasources: DatasourcesHome,
dataconnections: DataConnectionsHome,
};

export const App = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Datasource Page test Renders datasource page with data 1`] = `
exports[`Data Connection Page test Renders data connection page with data 1`] = `
<div>
<div
class="euiPage euiPage--paddingMedium euiPage--grow"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Manage Datasource Description test Renders manage datasource description 1`] = `
exports[`Manage Data Connections Description test Renders manage data connections description 1`] = `
<Component>
<div>
<EuiTitle
Expand Down Expand Up @@ -33,7 +33,7 @@ exports[`Manage Datasource Description test Renders manage datasource descriptio
<div
className="euiTextColor euiTextColor--subdued"
>
Manage already created data source connections.
Manage already created data connections.
</div>
</EuiTextColor>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Manage Datasource Table test Renders manage datasource table with data 1`] = `
exports[`Manage Data Connections Table test Renders manage data connections table with data 1`] = `
<div>
<div
class="euiPage euiPage--paddingMedium euiPage--grow"
Expand All @@ -17,7 +17,7 @@ exports[`Manage Datasource Table test Renders manage datasource table with data
>
<h1
class="euiTitle euiTitle--large"
data-test-subj="datasources-header"
data-test-subj="dataconnections-header"
>
Data connections
</h1>
Expand All @@ -32,7 +32,7 @@ exports[`Manage Datasource Table test Renders manage datasource table with data
<div
class="euiTextColor euiTextColor--subdued"
>
Connect and manage compatible OpenSearch Dashboard data sources and compute.
Connect and manage compatible OpenSearch and OpenSearch Dashboard data connections.
<a
class="euiLink euiLink--primary"
Expand Down Expand Up @@ -79,7 +79,7 @@ exports[`Manage Datasource Table test Renders manage datasource table with data
<div
class="euiTextColor euiTextColor--subdued"
>
Manage already created data source connections.
Manage already created data connections.
</div>
</div>
<hr
Expand Down Expand Up @@ -308,7 +308,7 @@ exports[`Manage Datasource Table test Renders manage datasource table with data
>
<div
class="euiText euiText--medium"
data-test-subj="undefinedDatasourceConnectionHealth"
data-test-subj="undefinedDataConnectionHealth"
/>
</div>
</td>
Expand Down Expand Up @@ -384,7 +384,7 @@ exports[`Manage Datasource Table test Renders manage datasource table with data
>
<div
class="euiText euiText--medium"
data-test-subj="undefinedDatasourceConnectionHealth"
data-test-subj="undefinedDataConnectionHealth"
/>
</div>
</td>
Expand Down Expand Up @@ -460,7 +460,7 @@ exports[`Manage Datasource Table test Renders manage datasource table with data
>
<div
class="euiText euiText--medium"
data-test-subj="undefinedDatasourceConnectionHealth"
data-test-subj="undefinedDataConnectionHealth"
/>
</div>
</td>
Expand Down Expand Up @@ -536,7 +536,7 @@ exports[`Manage Datasource Table test Renders manage datasource table with data
>
<div
class="euiText euiText--medium"
data-test-subj="undefinedDatasourceConnectionHealth"
data-test-subj="undefinedDataConnectionHealth"
/>
</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ import { configure, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { act, waitFor } from '@testing-library/react';
import React from 'react';
import { DataConnectionsDescription } from '../manage_datasource_description';
import { ManageDatasourcesTable } from '../manage_datasource_table';
import { describeDatasource, showDatasourceData } from './testing_constants';
import { DataSource } from '../datasource';
import { describeDataConnection } from './testing_constants';
import { DataConnection } from '../data_connection';
import ReactDOM from 'react-dom';

describe('Datasource Page test', () => {
describe('Data Connection Page test', () => {
configure({ adapter: new Adapter() });

it('Renders datasource page with data', async () => {
it('Renders data connection page with data', async () => {
const http = {
get: jest.fn().mockResolvedValue(describeDatasource),
get: jest.fn().mockResolvedValue(describeDataConnection),
};
const pplService = {
fetch: jest.fn(),
};
const mockChrome = {
setBreadcrumbs: jest.fn(),
};
const wrapper = mount(<DataSource http={http} pplService={pplService} chrome={mockChrome} />);
const wrapper = mount(
<DataConnection http={http} pplService={pplService} chrome={mockChrome} />
);
const container = document.createElement('div');
await act(() => {
ReactDOM.render(
<DataSource http={http} pplService={pplService} chrome={mockChrome} />,
<DataConnection http={http} pplService={pplService} chrome={mockChrome} />,
container
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { configure, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { waitFor } from '@testing-library/react';
import React from 'react';
import { DataConnectionsDescription } from '../manage_datasource_description';
import { DataConnectionsDescription } from '../manage_data_connections_description';

describe('Manage Datasource Description test', () => {
describe('Manage Data Connections Description test', () => {
configure({ adapter: new Adapter() });

it('Renders manage datasource description', async () => {
it('Renders manage data connections description', async () => {
const wrapper = mount(<DataConnectionsDescription />);

await waitFor(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { act } from '@testing-library/react';
import React from 'react';
import { ManageDatasourcesTable } from '../manage_datasource_table';
import { showDatasourceData } from './testing_constants';
import { ManageDataConnectionsTable } from '../manage_data_connections_table';
import { showDataConnectionsData } from './testing_constants';
import ReactDOM from 'react-dom';

describe('Manage Datasource Table test', () => {
describe('Manage Data Connections Table test', () => {
configure({ adapter: new Adapter() });

it('Renders manage datasource table with data', async () => {
it('Renders manage data connections table with data', async () => {
const http = {
get: jest.fn().mockResolvedValue(showDatasourceData),
get: jest.fn().mockResolvedValue(showDataConnectionsData),
};
const pplService = {
fetch: jest.fn(),
Expand All @@ -27,7 +27,7 @@ describe('Manage Datasource Table test', () => {
const container = document.createElement('div');
await act(() => {
ReactDOM.render(
<ManageDatasourcesTable http={http} pplService={pplService} chrome={mockChrome} />,
<ManageDataConnectionsTable http={http} pplService={pplService} chrome={mockChrome} />,
container
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

export const showDatasourceData = [
export const showDataConnectionsData = [
{
name: 'my_spark3',
connector: 'SPARK',
Expand Down Expand Up @@ -59,7 +59,7 @@ export const showDatasourceData = [
},
];

export const describeDatasource = {
export const describeDataConnection = {
name: 'my_spark3',
connector: 'SPARK',
allowedRoles: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import { AccelerationHeader } from './acceleration_header';
import { AccelerationManagement } from './management/acceleration_management';

interface AccelerationIndicesProps {
dataSource: string;
dataConnection: string;
}

export const AccelerationIndices = ({ dataSource }: AccelerationIndicesProps) => {
export const AccelerationIndices = ({ dataConnection }: AccelerationIndicesProps) => {
useEffect(() => {
coreRefs.chrome?.setBreadcrumbs([
{
text: 'Datasources',
text: 'Data Connections',
href: '#/',
},
{
text: 'Acceleration',
href: '#/manage/acceleration/' + { dataSource },
href: '#/manage/acceleration/' + { dataConnection },
},
]);
}, [dataSource]);
}, [dataConnection]);
return (
<EuiPage>
<EuiPageBody component="div">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import {
EuiTabs,
} from '@elastic/eui';
import React, { useEffect, useState } from 'react';
import { DATASOURCES_BASE } from '../../../../common/constants/shared';
import { DATACONNECTIONS_BASE } from '../../../../common/constants/shared';

interface DatasourceDetails {
allowedRoles: string[];
name: string;
cluster: string;
}

export const DataSource = (props: any) => {
export const DataConnection = (props: any) => {
const { dataSource, pplService, http } = props;
const [datasourceDetails, setDatasourceDetails] = useState<DatasourceDetails>({
allowedRoles: [],
Expand All @@ -38,7 +38,7 @@ export const DataSource = (props: any) => {
});

useEffect(() => {
http.get(`${DATASOURCES_BASE}/${dataSource}`).then((data) =>
http.get(`${DATACONNECTIONS_BASE}/${dataSource}`).then((data) =>
setDatasourceDetails({
allowedRoles: data.allowedRoles,
name: data.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export const DataConnectionsHeader = () => {
<div>
<EuiPageHeader>
<EuiPageHeaderSection>
<EuiTitle size="l" data-test-subj="datasources-header">
<EuiTitle size="l" data-test-subj="dataconnections-header">
<h1>Data connections</h1>
</EuiTitle>
</EuiPageHeaderSection>
</EuiPageHeader>
<EuiSpacer size="s" />
<EuiText size="s" color="subdued">
Connect and manage compatible OpenSearch Dashboard data sources and compute.{' '}
Connect and manage compatible OpenSearch and OpenSearch Dashboard data connections.{' '}
<EuiLink external={true} href={OPENSEARCH_DOCUMENTATION_URL} target="blank">
Learn more
</EuiLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

import { EuiSpacer, EuiText, EuiTitle, EuiHorizontalRule } from '@elastic/eui';
import _ from 'lodash';
import React from 'react';

export const DataConnectionsDescription = () => {
Expand All @@ -16,7 +15,7 @@ export const DataConnectionsDescription = () => {

<EuiSpacer size="s" />
<EuiText size="s" color="subdued">
Manage already created data source connections.
Manage already created data connections.
</EuiText>
<EuiHorizontalRule size="full" />
</div>
Expand Down
Loading

0 comments on commit 24cdd19

Please sign in to comment.