Skip to content

Commit

Permalink
Fix dropdown display behavior (#1114)
Browse files Browse the repository at this point in the history
(cherry picked from commit 68d88f3)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Oct 11, 2023
1 parent 9c014db commit 5544c28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
options={
Array [
Object {
"disabled": true,
"text": "S3 Connection",
"value": "s3",
},
Object {
"disabled": true,
"text": "OpenSearch Index",
"value": "index",
},
]
}
options={Array []}
value="index"
>
<EuiFormControlLayout
Expand Down Expand Up @@ -244,22 +231,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
onFocus={[Function]}
onMouseUp={[Function]}
value="index"
>
<option
disabled={true}
key="0"
value="s3"
>
S3 Connection
</option>
<option
disabled={true}
key="1"
value="index"
>
OpenSearch Index
</option>
</select>
/>
</EuiValidatableControl>
<EuiFormControlLayoutIcons
compressed={false}
Expand Down Expand Up @@ -1212,12 +1184,6 @@ exports[`Integration Setup Page Renders the form as expected 1`] = `
options={
Array [
Object {
"disabled": true,
"text": "S3 Connection",
"value": "s3",
},
Object {
"disabled": false,
"text": "OpenSearch Index",
"value": "index",
},
Expand Down Expand Up @@ -1255,15 +1221,7 @@ exports[`Integration Setup Page Renders the form as expected 1`] = `
value="index"
>
<option
disabled={true}
key="0"
value="s3"
>
S3 Connection
</option>
<option
disabled={false}
key="1"
value="index"
>
OpenSearch Index
Expand Down
18 changes: 7 additions & 11 deletions public/components/integrations/components/setup_integration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,13 @@ export function SetupIntegrationForm({
<EuiSpacer />
<EuiFormRow label="Data Source" helpText="Select a data source to connect to.">
<EuiSelect
options={integrationConnectionSelectorItems.map((item) => {
const copy: { value: string; text: string; disabled?: boolean } = { ...item };
switch (item.value) {
case 's3':
copy.disabled = !Object.hasOwn(integration.assets ?? {}, 'queries');
return copy;
case 'index':
copy.disabled = !Object.hasOwn(integration.assets ?? {}, 'savedObjects');
return copy;
default:
return copy;
options={integrationConnectionSelectorItems.filter((item) => {
if (item.value === 's3') {
return Object.hasOwn(integration.assets ?? {}, 'queries');
} else if (item.value === 'index') {
return Object.hasOwn(integration.assets ?? {}, 'savedObjects');
} else {
return false;
}
})}
value={config.connectionType}
Expand Down

0 comments on commit 5544c28

Please sign in to comment.