Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.11] Fix dropdown display behavior #1116

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading