forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MD] Datasource Management - creation & listing - UI only (opensearch…
…-project#2128) * data source management - creation & Listing UI only * data source management - creation & Listing UI only * Create/edit data source feature * toggling default value * refactoring code as per review comments * toggling server flag to false Signed-off-by: mpabba3003 <amazonmanideep@gmail.com>
- Loading branch information
1 parent
aec8c26
commit 61f8725
Showing
20 changed files
with
1,297 additions
and
110 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
30 changes: 30 additions & 0 deletions
30
src/plugins/data_source_management/public/components/create_button/create_button.tsx
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,30 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { History } from 'history'; | ||
|
||
import { EuiButton } from '@elastic/eui'; | ||
import { FormattedMessage } from '@osd/i18n/react'; | ||
|
||
interface Props { | ||
history: History; | ||
} | ||
|
||
export const CreateButton = ({ history }: Props) => { | ||
return ( | ||
<EuiButton | ||
data-test-subj="createDataSourceButton" | ||
fill={true} | ||
onClick={() => history.push('/create')} | ||
iconType="plusInCircle" | ||
> | ||
<FormattedMessage | ||
id="dataSourcesManagement.dataSourcesTable.createBtn" | ||
defaultMessage="Create Data Source" | ||
/> | ||
</EuiButton> | ||
); | ||
}; |
6 changes: 6 additions & 0 deletions
6
src/plugins/data_source_management/public/components/create_button/index.tsx
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,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { CreateButton } from './create_button'; |
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
49 changes: 49 additions & 0 deletions
49
...reate_edit_data_source_wizard/components/credentials_combox_box/credentials_combo_box.tsx
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,49 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import React from 'react'; | ||
import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; | ||
import { CredentialsComboBoxItem } from '../../../../types'; | ||
|
||
interface CredentialsComboBoxProps { | ||
selectedCredentials: CredentialsComboBoxItem[]; | ||
availableCredentials: CredentialsComboBoxItem[]; | ||
setSelectedCredentials: (selectedOptions: CredentialsComboBoxItem[]) => void; | ||
} | ||
|
||
export const CredentialsComboBox: React.FunctionComponent<CredentialsComboBoxProps> = ({ | ||
availableCredentials, | ||
selectedCredentials, | ||
setSelectedCredentials, | ||
}: CredentialsComboBoxProps) => { | ||
const onOptionsChanged = (options: EuiComboBoxOptionOption[]) => { | ||
const opts = new Set(); | ||
const selectedCredentialsOptions: CredentialsComboBoxItem[] = []; | ||
if (options?.length) { | ||
options.forEach((rec) => { | ||
opts.add(rec.id); | ||
}); | ||
|
||
availableCredentials.forEach((cred: CredentialsComboBoxItem) => { | ||
if (opts.has(cred.id)) { | ||
selectedCredentialsOptions.push(cred); | ||
} | ||
}); | ||
} | ||
setSelectedCredentials(selectedCredentialsOptions); | ||
}; | ||
|
||
return ( | ||
<EuiComboBox | ||
aria-label="Search for Stored Credential" | ||
placeholder="Search for Stored Credential" | ||
key="id" | ||
options={availableCredentials} | ||
singleSelection={true} | ||
selectedOptions={selectedCredentials} | ||
onChange={(options: EuiComboBoxOptionOption[]) => onOptionsChanged(options)} | ||
isClearable={true} | ||
/> | ||
); | ||
}; |
6 changes: 6 additions & 0 deletions
6
...blic/components/create_edit_data_source_wizard/components/credentials_combox_box/index.ts
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,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { CredentialsComboBox } from './credentials_combo_box'; |
Oops, something went wrong.