forked from opensearch-project/dashboards-flow-framework
-
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.
Signed-off-by: Tyler Ohlsen <[email protected]>
- Loading branch information
Showing
9 changed files
with
197 additions
and
26 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
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,8 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { TextField } from './text_field'; | ||
export { JsonField } from './json_field'; | ||
export { SelectField } from './select_field'; |
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,27 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiText, EuiTextArea } from '@elastic/eui'; | ||
|
||
interface JsonFieldProps { | ||
label: string; | ||
placeholder: string; | ||
} | ||
|
||
/** | ||
* An input field for a component where users select manually enter | ||
* in some custom JSON | ||
*/ | ||
export function JsonField(props: JsonFieldProps) { | ||
return ( | ||
<> | ||
<EuiText size="s" className="eui-textLeft"> | ||
{props.label} | ||
</EuiText> | ||
<EuiTextArea placeholder={props.placeholder} /> | ||
</> | ||
); | ||
} |
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,46 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { useState } from 'react'; | ||
import { EuiSuperSelect, EuiSuperSelectOption, EuiText } from '@elastic/eui'; | ||
|
||
// TODO: Should be fetched from global state. | ||
// Need to have a way to determine where to fetch this dynamic data. | ||
const existingIndices = [ | ||
{ | ||
value: 'index-1', | ||
inputDisplay: <EuiText>my-index-1</EuiText>, | ||
disabled: false, | ||
}, | ||
{ | ||
value: 'index-2', | ||
inputDisplay: <EuiText>my-index-2</EuiText>, | ||
disabled: false, | ||
}, | ||
] as Array<EuiSuperSelectOption<string>>; | ||
|
||
/** | ||
* An input field for a component where users select from a list of available | ||
* options. | ||
*/ | ||
export function SelectField() { | ||
const options = existingIndices; | ||
|
||
const [selectedOption, setSelectedOption] = useState<string>( | ||
options[0].value | ||
); | ||
|
||
const onChange = (option: string) => { | ||
setSelectedOption(option); | ||
}; | ||
|
||
return ( | ||
<EuiSuperSelect | ||
options={options} | ||
valueOfSelected={selectedOption} | ||
onChange={(option) => onChange(option)} | ||
/> | ||
); | ||
} |
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,25 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiFieldText } from '@elastic/eui'; | ||
|
||
interface TextFieldProps { | ||
label: string; | ||
placeholder: string; | ||
} | ||
|
||
/** | ||
* An input field for a component where users input plaintext | ||
*/ | ||
export function TextField(props: TextFieldProps) { | ||
return ( | ||
<EuiFieldText | ||
prepend={props.label} | ||
compressed={false} | ||
placeholder={props.placeholder || ''} | ||
/> | ||
); | ||
} |
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