Skip to content

Commit

Permalink
[MDS] Mute the non-mds endpoints for direct query data connections (#…
Browse files Browse the repository at this point in the history
…8537)

* Mute the non-mds  endpoints for direct query data connections when MDS enabled

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Handle the case for local cluster too

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Handle the case for local cluster 2

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Changeset file for PR #8537 created/updated

---------

Signed-off-by: Ryan Liang <jiallian@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 47ae28b)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 8f1c2c2 commit be60d90
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8537.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [MDS] Mute the non-mds endpoints for direct query data connections ([#8537](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8537))
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const getDirectQueryConnections = async (dataSourceId: string, http: Http
};

export const getLocalClusterConnections = async (http: HttpSetup) => {
const res = await http.get(`${DATACONNECTIONS_BASE}`);
const res = await http.get(`${DATACONNECTIONS_BASE}/dataSourceMDSId=`);

Check warning on line 71 in src/plugins/data_source_management/public/components/utils.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data_source_management/public/components/utils.ts#L71

Added line #L71 was not covered by tests
const localClusterConnections: DataSourceTableItem[] = res.map(
(dataConnection: DirectQueryDatasourceDetails) => ({
id: `${dataConnection.name}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
EDIT,
} from '../../framework/utils/shared';

export function registerDataConnectionsRoute(router: IRouter, dataSourceEnabled: boolean) {
export function registerNonMdsDataConnectionsRoute(router: IRouter) {
router.get(
{
path: `${DATACONNECTIONS_BASE}/{name}`,
Expand Down Expand Up @@ -204,7 +204,9 @@ export function registerDataConnectionsRoute(router: IRouter, dataSourceEnabled:
}
}
);
}

export function registerDataConnectionsRoute(router: IRouter, dataSourceEnabled: boolean) {
router.get(
{
path: `${DATACONNECTIONS_BASE}/dataSourceMDSId={dataSourceMDSId?}`,
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/data_source_management/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

import { IRouter, ILegacyClusterClient } from '../../../../core/server';
import { registerDslRoute } from './dsl';
import { registerDataConnectionsRoute } from './data_connections_router';
import {
registerDataConnectionsRoute,
registerNonMdsDataConnectionsRoute,
} from './data_connections_router';
import { registerDatasourcesRoute } from './datasources_router';
import { registerPplRoute } from './ppl';
import { DSLFacet } from '../services/facets/dsl_facet';
Expand Down Expand Up @@ -43,6 +46,9 @@ export function setupRoutes({
// const queryService = new QueryService(client);
// registerSqlRoute(router, queryService);

if (!dataSourceEnabled) {
registerNonMdsDataConnectionsRoute(router);
}
registerDataConnectionsRoute(router, dataSourceEnabled);
registerDatasourcesRoute(router, dataSourceEnabled);
}

0 comments on commit be60d90

Please sign in to comment.