Skip to content

Commit

Permalink
reverted commit 5e80c1a
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <[email protected]>
  • Loading branch information
amsiglan committed Aug 23, 2024
1 parent a371170 commit 91a1989
Show file tree
Hide file tree
Showing 36 changed files with 514 additions and 1,351 deletions.
2 changes: 0 additions & 2 deletions common/types/data_connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export type DatasourceType = 'S3GLUE' | 'PROMETHEUS';
export interface S3GlueProperties {
'glue.indexstore.opensearch.uri': string;
'glue.indexstore.opensearch.region': string;
'glue.lakeformation.enabled'?: boolean;
}

export interface PrometheusProperties {
Expand Down Expand Up @@ -267,7 +266,6 @@ export interface RenderAssociatedObjectsDetailsFlyoutParams {
dataSourceName: string;
handleRefresh?: () => void;
dataSourceMDSId?: string;
isS3ConnectionWithLakeFormation?: boolean;
}

export interface RenderAccelerationDetailsFlyoutParams {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,16 @@ exports[`Data Connection Page test Renders S3 data connection page with data 1`]
class="euiFlexItem"
>
<div
class="euiText euiText--medium overview-title"
>
Query Access
</div>
<div
class="euiFlexGroup euiFlexGroup--gutterExtraSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow euiFlexGroup--responsive"
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--directionColumn euiFlexGroup--responsive"
>
<div
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<div
class="euiText euiText--medium overview-title"
>
Query Access
</div>
<div
class="euiText euiText--small overview-content"
>
Expand Down Expand Up @@ -466,7 +466,7 @@ exports[`Data Connection Page test Renders S3 data connection page with data 1`]
<span
class="euiButtonEmpty__text"
>
Query in Log Explorer
Query in Observability Logs
</span>
</span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ exports[`Manage Data Connections Table test Renders manage data connections tabl
</th>
<th
class="euiTableHeaderCell"
data-test-subj="tableHeaderCell_Type_1"
data-test-subj="tableHeaderCell_status_1"
role="columnheader"
scope="col"
>
Expand All @@ -277,26 +277,9 @@ exports[`Manage Data Connections Table test Renders manage data connections tabl
>
<span
class="euiTableCellContent__text"
title="Type"
title="Status"
>
Type
</span>
</span>
</th>
<th
class="euiTableHeaderCell"
data-test-subj="tableHeaderCell_status_2"
role="columnheader"
scope="col"
>
<span
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
title="Connection status"
>
Connection status
Status
</span>
</span>
</th>
Expand Down Expand Up @@ -324,7 +307,7 @@ exports[`Manage Data Connections Table test Renders manage data connections tabl
>
<td
class="euiTableRowCell euiTableRowCell--isMobileFullWidth"
colspan="4"
colspan="3"
>
<div
class="euiTableCellContent euiTableCellContent--alignCenter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
EuiLoadingSpinner,
EuiPanel,
EuiSpacer,
EuiTableFieldDataColumnType,
EuiText,
EuiBasicTableColumn,
} from '@elastic/eui';
import React, { useCallback, useEffect, useState } from 'react';
import {
Expand Down Expand Up @@ -45,7 +45,6 @@ import {
interface AccelerationTableProps {
dataSourceName: string;
cacheLoadingHooks: any;
isS3ConnectionWithLakeFormation: boolean;
}

interface ModalState {
Expand All @@ -56,7 +55,6 @@ interface ModalState {
export const AccelerationTable = ({
dataSourceName,
cacheLoadingHooks,
isS3ConnectionWithLakeFormation,
}: AccelerationTableProps) => {
const [accelerations, setAccelerations] = useState<CachedAcceleration[]>([]);
const [updatedTime, setUpdatedTime] = useState<string>();
Expand Down Expand Up @@ -238,10 +236,8 @@ export const AccelerationTable = ({
},
];

const accelerationTableColumnsCollection: {
[columnKey: string]: EuiBasicTableColumn<CachedAcceleration>;
} = {
name: {
const accelerationTableColumns = [
{
field: 'indexName',
name: 'Name',
sortable: true,
Expand All @@ -262,13 +258,13 @@ export const AccelerationTable = ({
);
},
},
status: {
{
field: 'status',
name: 'Status',
sortable: true,
render: (status: string) => <AccelerationStatus status={status} />,
},
type: {
{
field: 'type',
name: 'Type',
sortable: true,
Expand All @@ -290,27 +286,27 @@ export const AccelerationTable = ({
return <EuiText size="s">{label}</EuiText>;
},
},
database: {
{
field: 'database',
name: 'Database',
sortable: true,
render: (database: string) => <EuiText size="s">{database}</EuiText>,
},
table: {
{
field: 'table',
name: 'Table',
sortable: true,
render: (table: string) => <EuiText size="s">{table || '-'}</EuiText>,
},
refreshType: {
{
field: 'refreshType',
name: 'Refresh Type',
sortable: true,
render: (autoRefresh: boolean, acceleration: CachedAcceleration) => {
return <EuiText size="s">{acceleration.autoRefresh ? 'Auto refresh' : 'Manual'}</EuiText>;
},
},
flintIndexName: {
{
field: 'flintIndexName',
name: 'Destination Index',
sortable: true,
Expand All @@ -321,17 +317,11 @@ export const AccelerationTable = ({
return flintIndexName || '-';
},
},
actions: {
{
name: 'Actions',
actions: tableActions,
},
};

const accelerationTableColumns = !isS3ConnectionWithLakeFormation
? Object.values(accelerationTableColumnsCollection)
: Object.entries(accelerationTableColumnsCollection)
.filter(([key]) => key !== 'database' && key !== 'table')
.map(([_key, val]) => val);
] as Array<EuiTableFieldDataColumnType<any>>;

const pagination = {
initialPageSize: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ import { IndexAdvancedSettings } from '../selectors/index_advanced_settings';
import { IndexSettingOptions } from '../selectors/index_setting_options';
import { IndexTypeSelector } from '../selectors/index_type_selector';
import { PreviewSQLDefinition } from '../selectors/preview_sql_defintion';
import { DataSourceSelector } from '../selectors/source_selector';
import { AccelerationDataSourceSelector } from '../selectors/source_selector';
import { QueryVisualEditor } from '../visual_editors/query_visual_editor';
import { CreateAccelerationButton } from './create_acceleration_button';
import { CreateAccelerationHeader } from './create_acceleration_header';
import { hasError } from './utils';
import { DATACONNECTIONS_BASE } from '../../../../../../../../common/constants/shared';
import { checkIsConnectionWithLakeFormation } from '../../../../../utils/helpers';

export interface CreateAccelerationProps {
selectedDatasource: string;
Expand All @@ -61,7 +59,6 @@ export const CreateAcceleration = ({
}: CreateAccelerationProps) => {
const { setToast } = useToast();
const http = coreRefs!.http;
const [isS3ConnectionWithLakeFormation, setIsS3ConnectionWithLakeFormation] = useState(false);
const [accelerationFormData, setAccelerationFormData] = useState<CreateAccelerationForm>({
dataSource: selectedDatasource,
database: databaseName ?? '',
Expand Down Expand Up @@ -170,16 +167,6 @@ export const CreateAcceleration = ({
}
};

const updateDataSourceConnectionInfo = () => {
coreRefs.http!.get(`${DATACONNECTIONS_BASE}/${selectedDatasource}`).then((data: any) => {
setIsS3ConnectionWithLakeFormation(checkIsConnectionWithLakeFormation(data));
});
};

useEffect(() => {
updateDataSourceConnectionInfo();
}, [selectedDatasource]);

useEffect(() => {
if (databaseName !== undefined && tableName !== undefined) {
initiateColumnLoad(
Expand Down Expand Up @@ -237,13 +224,10 @@ export const CreateAcceleration = ({
component="div"
id="acceleration-form"
>
<DataSourceSelector
<AccelerationDataSourceSelector
http={http!}
dataSourceFormProps={{
formType: 'CreateAcceleration',
dataSourceFormData: accelerationFormData,
setDataSourceFormData: setAccelerationFormData,
}}
accelerationFormData={accelerationFormData}
setAccelerationFormData={setAccelerationFormData}
selectedDatasource={selectedDatasource}
dataSourcesPreselected={dataSourcesPreselected}
tableFieldsLoading={tableFieldsLoading}
Expand All @@ -252,7 +236,6 @@ export const CreateAcceleration = ({
<EuiSpacer size="xxl" />
<IndexTypeSelector
accelerationFormData={accelerationFormData}
isS3ConnectionWithLakeFormation={isS3ConnectionWithLakeFormation}
setAccelerationFormData={setAccelerationFormData}
initiateColumnLoad={initiateColumnLoad}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const pluralizeTime = (timeWindow: number) => {
return timeWindow > 1 ? 's' : '';
};

export const hasError = (formErrors: Partial<FormErrorsType>, key?: keyof FormErrorsType) => {
export const hasError = (formErrors: FormErrorsType, key?: keyof FormErrorsType) => {
if (!key) return Object.values(formErrors).some((e) => !!e.length);
return !!formErrors[key]?.length;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
createAccelerationEmptyDataMock,
mockDatasourcesQuery,
} from '../../../../../../../../../test/accelerations';
import { DataSourceSelector } from '../source_selector';
import { AccelerationDataSourceSelector } from '../source_selector';

const coreStartMock = coreMock.createStart();

Expand All @@ -29,14 +29,11 @@ describe('Source selector components', () => {
client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);

const wrapper = mount(
<DataSourceSelector
<AccelerationDataSourceSelector
http={client}
selectedDatasource={selectedDatasource}
dataSourceFormProps={{
formType: 'CreateAcceleration',
dataSourceFormData: accelerationFormData,
setDataSourceFormData: setAccelerationFormData,
}}
accelerationFormData={accelerationFormData}
setAccelerationFormData={setAccelerationFormData}
dataSourcesPreselected={false}
tableFieldsLoading={false}
/>
Expand Down Expand Up @@ -65,14 +62,11 @@ describe('Source selector components', () => {
client.get = jest.fn().mockResolvedValue(mockDatasourcesQuery);
client.post = jest.fn().mockResolvedValue([]);
const wrapper = mount(
<DataSourceSelector
<AccelerationDataSourceSelector
selectedDatasource={selectedDatasource}
http={client}
dataSourceFormProps={{
formType: 'CreateAcceleration',
dataSourceFormData: accelerationFormData,
setDataSourceFormData: setAccelerationFormData,
}}
accelerationFormData={accelerationFormData}
setAccelerationFormData={setAccelerationFormData}
dataSourcesPreselected={true}
tableFieldsLoading={false}
/>
Expand Down
Loading

0 comments on commit 91a1989

Please sign in to comment.