-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* added mds changes * added mds changes * added more changes * upadted the group buttons and calls with mds * added changes for and cache management * added changes for PPL page, changes for fetching queries * main test added * added datsource dependency * updated the tests for workbench with snapshots * Update common/utils/fetch_datasources.ts * updated lint checker in async workbench * updated with new comments * added UX changes * added changed for pr comments * added changes for linter * added changes for snapshop * added snapshot for main * updated tests for main --------- Signed-off-by: sumukhswamy <sumukhhs@amazon.com> Signed-off-by: Sumukh Swamy <sumukhhs@amazon.com> Co-authored-by: Joshua Li <joshuali925@gmail.com>
- Loading branch information
1 parent
e653f65
commit 76e18c3
Showing
33 changed files
with
2,089 additions
and
4,525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
|
||
import { CoreStart } from "../../../../src/core/public"; | ||
|
||
export const fetchDataSources = (http: CoreStart['http'], dataSourceMDSId: string, urlDataSource: string, onSuccess, onError) => { | ||
let dataOptions: { label: string; options?: Array<{ label: string }>; }[] = []; | ||
let urlSourceFound = false; | ||
if(!dataSourceMDSId){ | ||
dataSourceMDSId = '' | ||
} | ||
|
||
http.get(`/api/get_datasources/${dataSourceMDSId}`) | ||
.then((res) => { | ||
const data = res.data.resp; | ||
const connectorGroups = {}; | ||
|
||
data.forEach((item) => { | ||
const { connector, name } = item | ||
|
||
if (connector === 'S3GLUE') { | ||
if (!connectorGroups[connector]) { | ||
connectorGroups[connector] = []; | ||
} | ||
|
||
connectorGroups[connector].push(name); | ||
if (name === urlDataSource) { | ||
urlSourceFound = true; | ||
} | ||
} | ||
}); | ||
|
||
for (const connector in connectorGroups) { | ||
if (connectorGroups.hasOwnProperty(connector)) { | ||
const connectorNames = connectorGroups[connector]; | ||
|
||
dataOptions.push({ | ||
label: connector, | ||
options: connectorNames.map((name) => ({ label: name })), | ||
}); | ||
} | ||
} | ||
|
||
onSuccess(dataOptions, urlSourceFound); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
onError(err); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.