Skip to content

Commit

Permalink
resolved conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <[email protected]>
  • Loading branch information
amsiglan committed May 30, 2024
2 parents a88b676 + c3ab50f commit d4f1b8d
Show file tree
Hide file tree
Showing 51 changed files with 605 additions and 733 deletions.
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Reporting a Vulnerability

If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/) or directly via email to aws-security@amazon.com. Please do **not** create a public GitHub issue.
If you discover a potential security issue in this project we ask that you notify OpenSearch Security directly via email to security@opensearch.org. Please do **not** create a public GitHub issue.
23 changes: 23 additions & 0 deletions common/types/data_connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,26 @@ export interface StartLoadingParams {
databaseName?: string;
tableName?: string;
}

export interface RenderAccelerationFlyoutParams {
dataSource: string;
dataSourceMDSId?: string;
databaseName?: string;
tableName?: string;
handleRefresh?: () => void;
}

export interface RenderAssociatedObjectsDetailsFlyoutParams {
tableDetail: AssociatedObject;
dataSourceName: string;
handleRefresh?: () => void;
dataSourceMDSId?: string;
isS3ConnectionWithLakeFormation?: boolean;
}

export interface RenderAccelerationDetailsFlyoutParams {
acceleration: CachedAcceleration;
dataSourceName: string;
handleRefresh?: () => void;
dataSourceMDSId?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const AccelerationTable = ({
const handleRefresh = useCallback(() => {
if (!isCatalogCacheFetching(accelerationsLoadStatus)) {
setIsRefreshing(true);
startLoadingAccelerations(dataSourceName);
startLoadingAccelerations({ dataSourceName });
}
}, [accelerationsLoadStatus]);

Expand Down Expand Up @@ -250,7 +250,11 @@ export const AccelerationTable = ({
return (
<EuiLink
onClick={() => {
renderAccelerationDetailsFlyout(acceleration, dataSourceName, handleRefresh);
renderAccelerationDetailsFlyout({
acceleration,
dataSourceName,
handleRefresh,
});
}}
>
{displayName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface SelectorLoadDatabasesProps {
}>
>;
tableFieldsLoading: boolean;
dataSourceMDSId?: string;
}

export const SelectorLoadDatabases = ({
Expand All @@ -32,6 +33,7 @@ export const SelectorLoadDatabases = ({
loadingComboBoxes,
setLoadingComboBoxes,
tableFieldsLoading,
dataSourceMDSId,
}: SelectorLoadDatabasesProps) => {
const [isLoading, setIsLoading] = useState(false);
const {
Expand All @@ -42,7 +44,7 @@ export const SelectorLoadDatabases = ({

const onClickRefreshDatabases = () => {
setIsLoading(true);
startDatabasesLoading({ dataSourceName });
startDatabasesLoading({ dataSourceName, dataSourceMDSId });
};

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ interface SelectorLoadDatabasesProps {
}>
>;
tableFieldsLoading: boolean;
dataSourceMDSId?: string;
}

export const SelectorLoadObjects = ({
Expand All @@ -38,6 +39,7 @@ export const SelectorLoadObjects = ({
loadingComboBoxes,
setLoadingComboBoxes,
tableFieldsLoading,
dataSourceMDSId,
}: SelectorLoadDatabasesProps) => {
const { setToast } = useToast();
const [isLoading, setIsLoading] = useState({
Expand Down Expand Up @@ -65,8 +67,8 @@ export const SelectorLoadObjects = ({
tableStatus: true,
accelerationsStatus: true,
});
startLoadingTables({ dataSourceName, databaseName });
startLoadingAccelerations({ dataSourceName });
startLoadingTables({ dataSourceName, databaseName, dataSourceMDSId });
startLoadingAccelerations({ dataSourceName, dataSourceMDSId });
};

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const DataSourceSelector: React.FC<DataSourceSelectorProps> = ({
const loadDataSource = () => {
setLoadingComboBoxes({ ...loadingComboBoxes, dataSource: true });
http
.get(DATACONNECTIONS_BASE + `/dataSourceMDSId=${dataSourceMDSId}`)
.get(`${DATACONNECTIONS_BASE}/dataSourceMDSId=${dataSourceMDSId ?? ''}`)
.then((res) => {
const isValidDataSource = res.some(
(connection: any) =>
Expand Down Expand Up @@ -245,6 +245,7 @@ export const DataSourceSelector: React.FC<DataSourceSelectorProps> = ({
loadingComboBoxes={loadingComboBoxes}
setLoadingComboBoxes={setLoadingComboBoxes}
tableFieldsLoading={tableFieldsLoading}
dataSourceMDSId={dataSourceMDSId}
/>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down Expand Up @@ -294,6 +295,7 @@ export const DataSourceSelector: React.FC<DataSourceSelectorProps> = ({
loadingComboBoxes={loadingComboBoxes}
setLoadingComboBoxes={setLoadingComboBoxes}
tableFieldsLoading={tableFieldsLoading}
dataSourceMDSId={dataSourceMDSId}
/>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import { EuiButton, EuiHealth } from '@elastic/eui';
import React from 'react';
import { DATA_SOURCE_TYPES } from '../../../../../../../common/constants/data_sources';
import { CachedAcceleration } from '../../../../../../../common/types/data_connections';
import {
CachedAcceleration,
RenderAccelerationFlyoutParams,
} from '../../../../../../../common/types/data_connections';
import {
redirectToExplorerOSIdx,
redirectToExplorerWithDataSrc,
} from '../../associated_objects/utils/associated_objects_tab_utils';

export const ACC_PANEL_TITLE = 'Accelerations';
export const ACC_PANEL_DESC =
'Accelerations optimize query performance by indexing external data into OpenSearch.';
Expand Down Expand Up @@ -91,26 +93,23 @@ export const CreateAccelerationFlyoutButton = ({
handleRefresh,
}: {
dataSourceName: string;
renderCreateAccelerationFlyout: (
dataSource: string,
dataSourceMDSId?: string,
databaseName?: string,
tableName?: string,
handleRefresh?: () => void
) => void;
renderCreateAccelerationFlyout: ({
dataSource,
databaseName,
tableName,
handleRefresh,
dataSourceMDSId,
}: RenderAccelerationFlyoutParams) => void;
handleRefresh: () => void;
}) => {
return (
<>
<EuiButton
onClick={() =>
renderCreateAccelerationFlyout(
dataSourceName,
undefined,
undefined,
undefined,
handleRefresh
)
renderCreateAccelerationFlyout({
dataSource: dataSourceName,
handleRefresh,
})
}
fill
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,12 @@ export const AssociatedObjectsDetailsFlyout = ({
};

const onCreateAcceleration = () =>
renderCreateAccelerationFlyout(
datasourceName,
'',
tableDetail.database,
tableDetail.name,
handleRefresh
);
renderCreateAccelerationFlyout({
dataSource: datasourceName,
databaseName: tableDetail.database,
tableName: tableDetail.name,
handleRefresh,
});

const AccelerateButton = () => {
return (
Expand Down Expand Up @@ -164,7 +163,12 @@ export const AssociatedObjectsDetailsFlyout = ({
return (
<EuiLink
onClick={() =>
renderAccelerationDetailsFlyout(item, datasourceName, handleRefresh, dataSourceMDSId)
renderAccelerationDetailsFlyout({
acceleration: item,
dataSourceName: datasourceName,
handleRefresh,
dataSourceMDSId,
})
}
>
{name}
Expand Down Expand Up @@ -204,13 +208,12 @@ export const AssociatedObjectsDetailsFlyout = ({
color="primary"
fill
onClick={() =>
renderCreateAccelerationFlyout(
datasourceName,
'',
tableDetail.database,
tableDetail.name,
handleRefresh
)
renderCreateAccelerationFlyout({
dataSource: datasourceName,
databaseName: tableDetail.database,
tableName: tableDetail.name,
handleRefresh,
})
}
iconType="popout"
iconSide="left"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const AssociatedObjectsTab: React.FC<AssociatedObjectsTabProps> = (props)

const onRefreshButtonClick = () => {
if (!isCatalogCacheFetching(databasesLoadStatus, tablesLoadStatus, accelerationsLoadStatus)) {
startLoadingDatabases({ databaseName: datasource.name });
startLoadingDatabases({ dataSourceName: datasource.name });
setIsRefreshing(true);
}
};
Expand Down Expand Up @@ -178,7 +178,7 @@ export const AssociatedObjectsTab: React.FC<AssociatedObjectsTabProps> = (props)
datasourceCache.status === CachedDataSourceStatus.Failed) &&
!isCatalogCacheFetching(databasesLoadStatus)
) {
startLoadingDatabases(datasource.name);
startLoadingDatabases({ dataSourceName: datasource.name });
} else if (datasourceCache.status === CachedDataSourceStatus.Updated) {
setCachedDatabases(datasourceCache.databases);
setIsFirstTimeLoading(false);
Expand Down Expand Up @@ -235,7 +235,7 @@ export const AssociatedObjectsTab: React.FC<AssociatedObjectsTabProps> = (props)
databaseCache.status === CachedDataSourceStatus.Failed) &&
!isCatalogCacheFetching(tablesLoadStatus)
) {
startLoadingTables(datasource.name, selectedDatabase);
startLoadingTables({ dataSourceName: datasource.name, databaseName: selectedDatabase });
setIsObjectsLoading(true);
} else if (databaseCache.status === CachedDataSourceStatus.Updated) {
setCachedTables(databaseCache.tables);
Expand All @@ -246,7 +246,7 @@ export const AssociatedObjectsTab: React.FC<AssociatedObjectsTabProps> = (props)
isRefreshing) &&
!isCatalogCacheFetching(accelerationsLoadStatus)
) {
startLoadingAccelerations(datasource.name);
startLoadingAccelerations({ dataSourceName: datasource.name });
setIsObjectsLoading(true);
} else if (accelerationsCache.status === CachedDataSourceStatus.Updated) {
setCachedAccelerations(accelerationsCache.accelerations);
Expand Down
Loading

0 comments on commit d4f1b8d

Please sign in to comment.