Skip to content

Commit 7454a4e

Browse files
authored
show remote cluster in data connections view when name is same as local (#1007)
Signed-off-by: Amit Galitzky <[email protected]>
1 parent b853bdf commit 7454a4e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

public/pages/DefineDetector/components/Datasource/DataSource.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,15 @@ export function DataSource(props: DataSourceProps) {
146146
const localCluster: ClusterInfo[] = getLocalCluster(
147147
opensearchState.clusters
148148
);
149-
setFieldValue('clusters', getVisibleClusterOptions(localCluster));
149+
if (props.formikProps.values.clusters && props.formikProps.values.clusters.length > 0) {
150+
const clusterInfoList: ClusterInfo[] = props.formikProps.values.clusters.map(option => ({
151+
name: option.cluster,
152+
localCluster: option.localcluster === 'true',
153+
}));
154+
setFieldValue('clusters', getVisibleClusterOptions(clusterInfoList));
155+
} else {
156+
setFieldValue('clusters', getVisibleClusterOptions(localCluster));
157+
}
150158
}
151159
}, [opensearchState.clusters]);
152160

public/pages/ReviewAndCreate/components/DataConnectionFlyout/DataConnectionFlyout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const getIndexItemsToDisplay = (props: DataConnectionFlyoutProps) => {
5353
const splitIndex = index.split(':');
5454
let clusterName = shouldSplit ? splitIndex[0] : props.localClusterName;
5555
clusterName =
56-
clusterName === props.localClusterName
56+
clusterName === props.localClusterName && !shouldSplit
5757
? `${clusterName} (Local)`
5858
: `${clusterName} (Remote)`;
5959
const indexName = shouldSplit ? splitIndex[1] : index;

0 commit comments

Comments
 (0)