Skip to content

Commit

Permalink
Autofill and lock data source name in install flyout
Browse files Browse the repository at this point in the history
Signed-off-by: Simeon Widdis <[email protected]>
  • Loading branch information
Swiddis committed Mar 19, 2024
1 parent eb11efe commit ba34469
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`Installed Integrations Table test Renders the empty installed integrations table 1`] = `
<InstalledIntegrationsTable
datasourceName="test"
datasourceType="S3GLUE"
integrations={Array []}
>
Expand Down Expand Up @@ -928,6 +929,7 @@ exports[`Installed Integrations Table test Renders the installed integrations ta
}
}
closeFlyout={[Function]}
datasourceName="test"
datasourceType="S3GLUE"
setAvailableIntegrations={[Function]}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ describe('Installed Integrations Table test', () => {
});

it('Renders the empty installed integrations table', async () => {
const wrapper = mount(<InstalledIntegrationsTable integrations={[]} datasourceType="S3GLUE" />);
const wrapper = mount(
<InstalledIntegrationsTable integrations={[]} datasourceType="S3GLUE" datasourceName="test" />
);

expect(wrapper).toMatchSnapshot();
});
Expand All @@ -42,6 +44,7 @@ describe('Installed Integrations Table test', () => {
setAvailableIntegrations={() => {}}
closeFlyout={() => {}}
datasourceType="S3GLUE"
datasourceName="test"
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export const DataConnection = (props: any) => {
<InstalledIntegrationsTable
integrations={dataSourceIntegrations}
datasourceType={datasourceDetails.connector}
datasourceName={datasourceDetails.name}
/>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,13 @@ export const InstallIntegrationFlyout = ({
setAvailableIntegrations,
closeFlyout,
datasourceType,
datasourceName,
}: {
availableIntegrations: AvailableIntegrationsList;
setAvailableIntegrations: (value: AvailableIntegrationsList) => void;
closeFlyout: () => void;
datasourceType: DatasourceType;
datasourceName: string;
}) => {
useEffect(() => {
if (!coreRefs.http) {
Expand Down Expand Up @@ -165,7 +167,14 @@ export const InstallIntegrationFlyout = ({
integration={installingIntegration}
unsetIntegration={() => setInstallingIntegration(null)}

Check warning on line 168 in public/components/datasources/components/manage/integrations/installed_integrations_table.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/integrations/installed_integrations_table.tsx#L168

Added line #L168 was not covered by tests
renderType="flyout"
forceConnectionType={datasourceType === 'S3GLUE' ? 's3' : undefined}
forceConnection={
datasourceType === 'S3GLUE'
? {

Check warning on line 172 in public/components/datasources/components/manage/integrations/installed_integrations_table.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/integrations/installed_integrations_table.tsx#L172

Added line #L172 was not covered by tests
name: datasourceName,
type: 's3',
}
: undefined

Check warning on line 176 in public/components/datasources/components/manage/integrations/installed_integrations_table.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/integrations/installed_integrations_table.tsx#L176

Added line #L176 was not covered by tests
}
/>
)}
</EuiFlyout>
Expand All @@ -175,9 +184,11 @@ export const InstallIntegrationFlyout = ({
export const InstalledIntegrationsTable = ({
integrations,
datasourceType,
datasourceName,
}: {
integrations: IntegrationInstanceResult[];
datasourceType: DatasourceType;
datasourceName: string;
}) => {
const [query, setQuery] = useState('');
const filteredIntegrations = integrations
Expand Down Expand Up @@ -232,6 +243,7 @@ export const InstalledIntegrationsTable = ({
setAvailableIntegrations={setAvailableIntegrations}
closeFlyout={() => setShowAvailableFlyout(false)}
datasourceType={datasourceType}
datasourceName={datasourceName}
/>
) : null}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
fullWidth={false}
id="random_html_id"
isClearable={true}
isDisabled={false}
isLoading={true}
onBlur={[Function]}
onChange={[Function]}
Expand Down Expand Up @@ -426,6 +427,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
hasSelectedOptions={true}
id="random_html_id"
inputRef={[Function]}
isDisabled={false}
isListOpen={false}
isLoading={true}
noIcon={false}
Expand Down Expand Up @@ -467,7 +469,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
Object {
"aria-label": "Open list of options",
"data-test-subj": "comboBoxToggleListButton",
"disabled": undefined,
"disabled": false,
"onClick": [Function],
"ref": [Function],
"side": "right",
Expand Down Expand Up @@ -506,6 +508,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
aria-controls=""
className="euiComboBox__input"
data-test-subj="comboBoxSearchInput"
disabled={false}
id="random_html_id"
injectStyles={true}
inputRef={[Function]}
Expand Down Expand Up @@ -533,6 +536,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
<input
aria-controls=""
data-test-subj="comboBoxSearchInput"
disabled={false}
id="random_html_id"
onBlur={[Function]}
onChange={[Function]}
Expand Down Expand Up @@ -574,7 +578,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
Object {
"aria-label": "Open list of options",
"data-test-subj": "comboBoxToggleListButton",
"disabled": undefined,
"disabled": false,
"onClick": [Function],
"ref": [Function],
"side": "right",
Expand Down Expand Up @@ -643,6 +647,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
<EuiFormControlLayoutCustomIcon
aria-label="Open list of options"
data-test-subj="comboBoxToggleListButton"
disabled={false}
iconRef={[Function]}
onClick={[Function]}
size="m"
Expand All @@ -652,6 +657,7 @@ exports[`Integration Setup Page Renders integration setup page as expected 1`] =
aria-label="Open list of options"
className="euiFormControlLayoutCustomIcon euiFormControlLayoutCustomIcon--clickable"
data-test-subj="comboBoxToggleListButton"
disabled={false}
onClick={[Function]}
type="button"
>
Expand Down
16 changes: 10 additions & 6 deletions public/components/integrations/components/setup_integration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ export function SetupIntegrationFormInputs({
}}
customOptionText={`Select {searchValue} as your ${connectionType.lower}`}
data-test-subj="data-source-name"
isDisabled={lockConnectionType}
/>
</EuiFormRow>
{config.connectionType === 's3' ? (
Expand Down Expand Up @@ -614,17 +615,20 @@ export function SetupIntegrationForm({
integration,
renderType = 'page',
unsetIntegration,
forceConnectionType,
forceConnection,
}: {
integration: string;
renderType: 'page' | 'flyout';
unsetIntegration?: () => void;
forceConnectionType?: string;
forceConnection?: {
name: string;
type: string;
};
}) {
const [integConfig, setConfig] = useState({
displayName: `${integration} Integration`,
connectionType: forceConnectionType ?? 'index',
connectionDataSource: '',
connectionType: forceConnection?.type ?? 'index',
connectionDataSource: forceConnection?.name ?? '',
connectionLocation: '',
checkpointLocation: '',
connectionTableName: integration,
Expand Down Expand Up @@ -668,7 +672,7 @@ export function SetupIntegrationForm({
updateConfig={updateConfig}
integration={template}
setupCallout={setupCallout}
lockConnectionType={forceConnectionType !== undefined}
lockConnectionType={forceConnection !== undefined}
/>
)}
</EuiPageContentBody>
Expand Down Expand Up @@ -697,7 +701,7 @@ export function SetupIntegrationForm({
updateConfig={updateConfig}
integration={template}
setupCallout={setupCallout}
lockConnectionType={forceConnectionType !== undefined}
lockConnectionType={forceConnection !== undefined}
/>
)}
</EuiFlyoutBody>
Expand Down

0 comments on commit ba34469

Please sign in to comment.