@@ -2335,37 +1716,6 @@ exports[`
spec click run button, response fills null and missing values
class="euiPageSideBar"
style="max-width: 400px; width: 400px; height: calc(100vh - 254px);"
>
-
@@ -2408,15 +1758,115 @@ exports[`
spec click run button, response fills null and missing values
class="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiPageContent"
role="main"
>
+
-
spec click run button, response fills null and missing values
exports[`
spec click translation button, and response is ok 1`] = `
-
-
-`;
-
-exports[`
spec renders the component and checks if side tree is loaded 1`] = `
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Press Enter to start editing.
-
-
- When you're done, press Escape to stop editing.
-
-
-
-
-
-
-
-
-
-
-
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
-
-
-
-
-
-
-
-
-
-
-
- Run
-
-
-
-
-
-
-
-
- Clear
-
-
-
-
-
-
-
-
- Explain
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- No result
-
-
-
-
- Enter a query in the query editor above to see results.
-
-
-
-
-
-
-
-
-
-
-
-`;
-
-exports[`
spec renders the component and s3 glue component is present 1`] = `
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Press Enter to start editing.
-
-
- When you're done, press Escape to stop editing.
-
-
-
-
-
-
-
-
-
-
-
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
- Run
-
+
+
+
+ .flint-elv-mv
+
+
+
+
-
-
+
+
-
- Clear
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- No result
-
-
-
-
- Enter a query in the query editor above to see results.
-
+
+
+
-
-
-
-`;
-
-exports[`
spec renders the component and toggles ppl 1`] = `
-
-
-
-
-
-
-
spec renders the component and toggles ppl 1`] = `
`;
-exports[`
spec renders the component for s3 glue and check sample query button 1`] = `
+exports[`
spec renders the component and toggles ppl 1`] = `
-
@@ -7187,75 +4452,6 @@ exports[`
spec renders the component for s3 glue and check sample query
class="euiPageSideBar"
style="max-width: 400px; width: 400px; height: calc(100vh - 254px);"
>
-
-
-
-
-
-
-
-
-
-
-
- Create
-
-
-
-
-
-
-
@@ -7283,50 +4479,7 @@ exports[`
spec renders the component for s3 glue and check sample query
- Loading databases
-
-
-
-
-
-
-
- Loading may take over 30 seconds
-
-
-
-
-
-
-
-
- Status:
- Scheduled
-
-
-
-
-
+ Loading indices
@@ -7341,15 +4494,119 @@ exports[`
spec renders the component for s3 glue and check sample query
class="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiPageContent"
role="main"
>
+
-
spec renders the component for s3 glue and check sample query
- Sample Query
+ Explain
-
-
-
-
- Accelerate Table
-
-
-
-
diff --git a/public/components/Main/main.test.tsx b/public/components/Main/main.test.tsx
index 6d50efa..c47ac6f 100644
--- a/public/components/Main/main.test.tsx
+++ b/public/components/Main/main.test.tsx
@@ -6,10 +6,17 @@
import '@testing-library/jest-dom/extend-expect';
import { fireEvent, render, waitFor } from '@testing-library/react';
import React from 'react';
+import { HttpResponse } from '../../../../../src/core/public';
import { httpClientMock } from '../../../test/mocks';
import {
- mockDataSelectQuery,
- mockHttpQuery
+ mockDatasourcesQuery,
+ mockHttpQuery,
+ mockNotOkQueryResultResponse,
+ mockOpenSearchIndicies,
+ mockOpenSearchTreeQuery,
+ mockQueryResultJDBCResponse,
+ mockQueryTranslationResponse,
+ mockResultWithNull
} from '../../../test/mocks/mockData';
import { Main } from './main';
@@ -56,262 +63,163 @@ jest.mock('../../framework/catalog_cache_refs', () => ({
}));
describe('
spec', () => {
- // it('renders the component', async () => {
- // const client = httpClientMock;
- // client.post = jest.fn().mockResolvedValue(mockHttpQuery);
- // client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
- // const asyncTest = () => {
- // render(
);
- // };
- // await asyncTest();
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
- // it('renders the component and toggles ppl', async () => {
- // const client = httpClientMock;
- // client.post = jest.fn().mockResolvedValue(mockHttpQuery);
- // client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
- // const { getByText } = await render(
- //
- // );
- // const pplButton = getByText('PPL');
- // const asyncTest = () => {
- // fireEvent.click(pplButton);
- // };
- // waitFor(() => {
- // asyncTest();
- // });
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
- // it('renders the component and checks if Opensearch is selected', async () => {
- // const client = httpClientMock;
- // client.post = jest.fn().mockResolvedValue(mockHttpQuery);
- // client.get = jest.fn().mockResolvedValue(mockDataSelectQuery);
- // const { getByText } = await render(
- //
- // );
- // expect(getByText('Indexes')).toBeInTheDocument();
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
- // it('renders the component and checks if Opensearch is selected', async () => {
- // const client = httpClientMock;
- // client.post = jest.fn().mockResolvedValue(mockHttpQuery);
- // client.get = jest.fn().mockResolvedValue(mockDataSelectQuery);
- // const { getByText } = await render(
- //
- // );
- // fireEvent.click(getByText('Data source Connections'));
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
- it('renders the component and checks if Data source connections is selected', async () => {
+ it('renders the component', async () => {
const client = httpClientMock;
client.post = jest.fn().mockResolvedValue(mockHttpQuery);
- client.get = jest.fn().mockResolvedValue(mockDataSelectQuery);
+ client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
+ const asyncTest = () => {
+ render( );
+ };
+ await asyncTest();
+ expect(document.body.children[0]).toMatchSnapshot();
+ });
+ it('renders the component and toggles ppl', async () => {
+ const client = httpClientMock;
+ client.post = jest.fn().mockResolvedValue(mockHttpQuery);
+ client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
const { getByText } = await render(
);
-
- // client.get = jest.fn().mockResolvedValue(mockDataSelectQuery);
- const mockOnSelect = jest.fn();
-
- await waitFor(() => {
- expect(getByText('Data source Connections')).toBeInTheDocument();
-
-
- });
-
- const dataSourceButton = getByText('Data source Connections');
- console.log(dataSourceButton, 'button')
+ const pplButton = getByText('PPL');
const asyncTest = () => {
- fireEvent.click(dataSourceButton);
+ fireEvent.click(pplButton);
};
waitFor(() => {
asyncTest();
});
-
- // await waitFor(() => {
- // fireEvent.click(getByText('Data source Connections'));
- // });
-
-
- // fireEvent.click(getByText('Data source Connections'));
- // await waitFor(() => {
- // expect(getByText('OpenSearch Folder Tree')).toBeInTheDocument();
- // });
-
- // expect(getByText('glue_1')).toBeInTheDocument();
- // fireEvent.click(getByText('Select data source Connection'));
expect(document.body.children[0]).toMatchSnapshot();
});
- // it('renders the component and checks if Opensearch is selected', async () => {
- // const client = httpClientMock;
- // client.post = jest.fn().mockResolvedValue(mockHttpQuery);
- // client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
- // const { getByText } = await render(
- //
- // );
- // expect(getByText('OpenSearch')).toBeInTheDocument();
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
- // it('renders the component and s3 glue component is present', async () => {
- // const client = httpClientMock;
- // client.post = jest.fn().mockResolvedValue(mockHttpQuery);
- // client.get = jest.fn().mockResolvedValue(mockDataSelectQuery);
- // const { getByText } = await render(
- //
- // );
- // expect(getByText('OpenSearch')).toBeInTheDocument();
- // fireEvent.click(getByText('OpenSearch'));
- // await waitFor(() => {
- // expect(getByText('glue_1')).toBeInTheDocument();
- // });
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
- // it('renders the component for s3 glue and check sample query button ', async () => {
- // const client = httpClientMock;
- // client.post = jest.fn().mockResolvedValue(mockHttpQuery);
- // client.get = jest.fn().mockResolvedValue(mockDataSelectQuery);
- // const { getByText } = await render(
- //
- // );
- // await waitFor(() => {
- // expect(getByText('OpenSearch')).toBeInTheDocument();
- // });
- // fireEvent.click(getByText('OpenSearch'));
- // fireEvent.click(getByText('glue_1'));
- // await waitFor(() => {
- // expect(getByText('Sample Query')).toBeInTheDocument();
- // });
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
- // it('renders the component and checks if side tree is loaded', async () => {
- // const client = httpClientMock;
- // client.post = jest.fn().mockResolvedValue(mockHttpQuery);
- // client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
+
+
+ it('renders the component and checks if side tree is loaded', async () => {
+ const client = httpClientMock;
+ client.post = jest.fn().mockResolvedValue(mockHttpQuery);
+ client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
- // client.post = jest.fn(() => {
- // return (Promise.resolve(mockOpenSearchIndicies) as unknown) as HttpResponse;
- // });
- // const { getByText } = await render(
- //
- // );
+ client.post = jest.fn(() => {
+ return (Promise.resolve(mockOpenSearchIndicies) as unknown) as HttpResponse;
+ });
+ const { getByText } = await render(
+
+ );
- // await waitFor(() => {
- // expect(getByText('.kibana_1')).toBeInTheDocument();
- // });
+ await waitFor(() => {
+ expect(getByText('.kibana_1')).toBeInTheDocument();
+ });
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
+ expect(document.body.children[0]).toMatchSnapshot();
+ });
- // it('click run button, and response is ok', async () => {
- // const client = httpClientMock;
- // client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
- // client.post = jest.fn().mockResolvedValue(mockQueryResultJDBCResponse);
+ it('click run button, and response is ok', async () => {
+ const client = httpClientMock;
+ client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
+ client.post = jest.fn().mockResolvedValue(mockQueryResultJDBCResponse);
- // const { getByText } = await render(
- //
- // );
- // const onRunButton = getByText('Run');
- // const asyncTest = () => {
- // fireEvent.click(onRunButton);
- // };
- // await asyncTest();
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
+ const { getByText } = await render(
+
+ );
+ const onRunButton = getByText('Run');
+ const asyncTest = () => {
+ fireEvent.click(onRunButton);
+ };
+ await asyncTest();
+ expect(document.body.children[0]).toMatchSnapshot();
+ });
- // it('click run button, response fills null and missing values', async () => {
- // const client = httpClientMock;
- // client.post = jest.fn().mockResolvedValue(mockResultWithNull);
- // client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
+ it('click run button, response fills null and missing values', async () => {
+ const client = httpClientMock;
+ client.post = jest.fn().mockResolvedValue(mockResultWithNull);
+ client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
- // const { getByText } = await render(
- //
- // );
- // const onRunButton = getByText('Run');
- // const asyncTest = () => {
- // fireEvent.click(onRunButton);
- // };
- // await asyncTest();
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
+ const { getByText } = await render(
+
+ );
+ const onRunButton = getByText('Run');
+ const asyncTest = () => {
+ fireEvent.click(onRunButton);
+ };
+ await asyncTest();
+ expect(document.body.children[0]).toMatchSnapshot();
+ });
- // it('click run button, and response causes an error', async () => {
- // const client = httpClientMock;
- // client.post = jest.fn().mockRejectedValue('err');
- // client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
+ it('click run button, and response causes an error', async () => {
+ const client = httpClientMock;
+ client.post = jest.fn().mockRejectedValue('err');
+ client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
- // const { getByText } = await render(
- //
- // );
- // const onRunButton = getByText('Run');
- // const asyncTest = () => {
- // fireEvent.click(onRunButton);
- // };
- // await asyncTest();
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
+ const { getByText } = await render(
+
+ );
+ const onRunButton = getByText('Run');
+ const asyncTest = () => {
+ fireEvent.click(onRunButton);
+ };
+ await asyncTest();
+ expect(document.body.children[0]).toMatchSnapshot();
+ });
- // it('click run button, and response is not ok', async () => {
- // let postRequestFlag = 0;
- // const client = httpClientMock;
- // client.post = jest.fn(() => {
- // if (postRequestFlag > 0)
- // return Promise.resolve((mockNotOkQueryResultResponse as unknown) as HttpResponse);
- // else {
- // postRequestFlag = 1;
- // return Promise.resolve((mockOpenSearchTreeQuery as unknown) as HttpResponse);
- // }
- // });
- // client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
+ it('click run button, and response is not ok', async () => {
+ let postRequestFlag = 0;
+ const client = httpClientMock;
+ client.post = jest.fn(() => {
+ if (postRequestFlag > 0)
+ return Promise.resolve((mockNotOkQueryResultResponse as unknown) as HttpResponse);
+ else {
+ postRequestFlag = 1;
+ return Promise.resolve((mockOpenSearchTreeQuery as unknown) as HttpResponse);
+ }
+ });
+ client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
- // const { getByText } = await render(
- //
- // );
- // const onRunButton = getByText('Run');
- // const asyncTest = () => {
- // fireEvent.click(onRunButton);
- // };
- // await asyncTest();
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
+ const { getByText } = await render(
+
+ );
+ const onRunButton = getByText('Run');
+ const asyncTest = () => {
+ fireEvent.click(onRunButton);
+ };
+ await asyncTest();
+ expect(document.body.children[0]).toMatchSnapshot();
+ });
- // it('click translation button, and response is ok', async () => {
- // let postRequestFlag = 0;
- // const client = httpClientMock;
- // client.post = jest.fn(() => {
- // if (postRequestFlag > 0)
- // return Promise.resolve((mockQueryTranslationResponse as unknown) as HttpResponse);
- // else {
- // postRequestFlag = 1;
- // return Promise.resolve((mockOpenSearchTreeQuery as unknown) as HttpResponse);
- // }
- // });
+ it('click translation button, and response is ok', async () => {
+ let postRequestFlag = 0;
+ const client = httpClientMock;
+ client.post = jest.fn(() => {
+ if (postRequestFlag > 0)
+ return Promise.resolve((mockQueryTranslationResponse as unknown) as HttpResponse);
+ else {
+ postRequestFlag = 1;
+ return Promise.resolve((mockOpenSearchTreeQuery as unknown) as HttpResponse);
+ }
+ });
- // const { getByText } = await render(
- //
- // );
- // const onTranslateButton = getByText('Explain');
- // const asyncTest = () => {
- // fireEvent.click(onTranslateButton);
- // };
- // await asyncTest();
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
+ const { getByText } = await render(
+
+ );
+ const onTranslateButton = getByText('Explain');
+ const asyncTest = () => {
+ fireEvent.click(onTranslateButton);
+ };
+ await asyncTest();
+ expect(document.body.children[0]).toMatchSnapshot();
+ });
- // it('click clear button', async () => {
- // const client = httpClientMock;
- // client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
- // client.post = jest.fn(() => {
- // return Promise.resolve((mockOpenSearchTreeQuery as unknown) as HttpResponse);
- // });
+ it('click clear button', async () => {
+ const client = httpClientMock;
+ client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
+ client.post = jest.fn(() => {
+ return Promise.resolve((mockOpenSearchTreeQuery as unknown) as HttpResponse);
+ });
- // const { getByText } = await render(
- //
- // );
- // const onClearButton = getByText('Clear');
- // const asyncTest = () => {
- // fireEvent.click(onClearButton);
- // };
- // await asyncTest();
- // expect(document.body.children[0]).toMatchSnapshot();
- // });
-});
+ const { getByText } = await render(
+
+ );
+ const onClearButton = getByText('Clear');
+ const asyncTest = () => {
+ fireEvent.click(onClearButton);
+ };
+ await asyncTest();
+ expect(document.body.children[0]).toMatchSnapshot();
+ });
+});
\ No newline at end of file
diff --git a/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_s3_loaded.test.tsx b/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_s3_loaded.test.tsx
index 33745fc..4b75c5e 100644
--- a/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_s3_loaded.test.tsx
+++ b/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_s3_loaded.test.tsx
@@ -66,6 +66,10 @@ describe('Test Catalog tree', () => {
selectedItems={[{ label: 'my_s3' }]}
updateSQLQueries={jest.fn()}
refreshTree={true}
+ dataSourceEnabled={false}
+ dataSourceMDSId={''}
+ clusterTab={'Data source Connections'}
+ language={'SQL'}
/>
);
diff --git a/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_s3_loading.test.tsx b/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_s3_loading.test.tsx
index 461de1b..859c8b7 100644
--- a/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_s3_loading.test.tsx
+++ b/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_s3_loading.test.tsx
@@ -58,7 +58,11 @@ describe('Test Catalog tree', () => {
);
diff --git a/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_tree.test.tsx b/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_tree.test.tsx
index a328c10..895eb25 100644
--- a/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_tree.test.tsx
+++ b/public/components/SQLPage/sql_catalog_tree/__tests__/catalog_tree.test.tsx
@@ -59,6 +59,10 @@ describe('Test Catalog tree', () => {
selectedItems={[{ label: 'OpenSearch' }]}
updateSQLQueries={jest.fn()}
refreshTree={true}
+ dataSourceEnabled={false}
+ dataSourceMDSId={''}
+ clusterTab={'Indexes'}
+ language={'SQL'}
/>
);
@@ -78,6 +82,10 @@ describe('Test Catalog tree', () => {
selectedItems={[{ label: 'my_s3' }]}
updateSQLQueries={jest.fn()}
refreshTree={true}
+ dataSourceEnabled={false}
+ dataSourceMDSId={''}
+ clusterTab={'Data source Connections'}
+ language={'SQL'}
/>
);
diff --git a/public/components/app.tsx b/public/components/app.tsx
index c925bbb..481cd4c 100644
--- a/public/components/app.tsx
+++ b/public/components/app.tsx
@@ -38,7 +38,7 @@ export const WorkbenchApp = ({
dataSourceManagement,
setActionMenu,
}: WorkbenchAppDeps) => {
-
+ console.log(dataSourceEnabled)
return (
diff --git a/public/plugin.ts b/public/plugin.ts
index 89403a2..03480a9 100644
--- a/public/plugin.ts
+++ b/public/plugin.ts
@@ -19,7 +19,7 @@ export interface WorkbenchPluginStartDependencies {
dataSource: DataSourcePluginStart;
}
export class WorkbenchPlugin implements Plugin {
- public setup(core: CoreSetup, {dataSourceManagement} : WorkbenchPluginSetupDependencies): WorkbenchPluginSetup {
+ public setup(core: CoreSetup, {dataSource, dataSourceManagement} : WorkbenchPluginSetupDependencies): WorkbenchPluginSetup {
// Register an application into the side navigation menu
core.application.register({
id: 'opensearch-query-workbench',
diff --git a/public/types.ts b/public/types.ts
index eeb64b6..9ed0ed5 100644
--- a/public/types.ts
+++ b/public/types.ts
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { DataSourcePluginStart } from '../../../src/plugins/data_source/public';
+import { DataSourcePluginStart } from '../../../src/plugins/data_source/public/types';
import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public';
import { ObservabilityStart } from './types';