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

Add applicable_data_sources field to workflows definition #1868

Merged
merged 9 commits into from
Jun 10, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,17 @@ exports[`Integration Setup Inputs Renders the S3 connector form as expected 1`]
</EuiFormRow>
<EuiSpacer />
<IntegrationWorkflowsInputs
config={
Object {
"checkpointLocation": "",
"connectionDataSource": "ss4o_logs-nginx-test",
"connectionLocation": "",
"connectionTableName": "",
"connectionType": "s3",
"displayName": "Test Instance Name",
"enabledWorkflows": Array [],
}
}
integration={
Object {
"assets": Array [
Expand Down Expand Up @@ -443,6 +454,17 @@ exports[`Integration Setup Inputs Renders the S3 connector form without workflow
</EuiFormRow>
<EuiSpacer />
<IntegrationWorkflowsInputs
config={
Object {
"checkpointLocation": "",
"connectionDataSource": "ss4o_logs-nginx-test",
"connectionLocation": "",
"connectionTableName": "",
"connectionType": "s3",
"displayName": "Test Instance Name",
"enabledWorkflows": Array [],
}
}
integration={
Object {
"assets": Array [
Expand Down Expand Up @@ -2165,6 +2187,256 @@ exports[`Integration Setup Inputs Renders the query inputs 1`] = `

exports[`Integration Setup Inputs Renders the workflows inputs 1`] = `
<IntegrationWorkflowsInputs
config={
Object {
"checkpointLocation": "",
"connectionDataSource": "ss4o_logs-nginx-test",
"connectionLocation": "",
"connectionTableName": "",
"connectionType": "index",
"displayName": "Test Instance Name",
"enabledWorkflows": Array [],
}
}
integration={
Object {
"assets": Array [
Object {
"extension": "ndjson",
"name": "sample",
"type": "savedObjectBundle",
"version": "1.0.1",
},
],
"components": Array [
Object {
"name": "logs",
"version": "1.0.0",
},
],
"license": "Apache-2.0",
"name": "sample",
"type": "logs",
"version": "2.0.0",
"workflows": Array [
Object {
"description": "This is a test workflow.",
"enabled_by_default": true,
"label": "Workflow 1",
"name": "workflow1",
},
],
}
}
updateConfig={[Function]}
>
<EuiFormRow
describedByIds={Array []}
display="row"
error={
Array [
"Must select at least one workflow.",
]
}
fullWidth={false}
hasChildLabel={true}
hasEmptyLabelSpace={false}
isInvalid={false}
labelType="label"
>
<div
className="euiFormRow"
id="random_html_id-row"
>
<div
className="euiFormRow__fieldWrapper"
>
<SetupWorkflowSelector
config={
Object {
"checkpointLocation": "",
"connectionDataSource": "ss4o_logs-nginx-test",
"connectionLocation": "",
"connectionTableName": "",
"connectionType": "index",
"displayName": "Test Instance Name",
"enabledWorkflows": Array [],
}
}
id="random_html_id"
integration={
Object {
"assets": Array [
Object {
"extension": "ndjson",
"name": "sample",
"type": "savedObjectBundle",
"version": "1.0.1",
},
],
"components": Array [
Object {
"name": "logs",
"version": "1.0.0",
},
],
"license": "Apache-2.0",
"name": "sample",
"type": "logs",
"version": "2.0.0",
"workflows": Array [
Object {
"description": "This is a test workflow.",
"enabled_by_default": true,
"label": "Workflow 1",
"name": "workflow1",
},
],
}
}
onBlur={[Function]}
onFocus={[Function]}
toggleWorkflow={[Function]}
useWorkflows={
Array [
Array [
"workflow1",
true,
],
]
}
>
<EuiCheckableCard
checkableType="checkbox"
checked={true}
id="workflow-checkbox-workflow1"
key="workflow1"
label="Workflow 1"
onChange={[Function]}
value="workflow1"
>
<_EuiSplitPanelOuter
className="euiCheckableCard euiCheckableCard-isChecked"
direction="row"
hasBorder={true}
responsive={false}
>
<EuiPanel
className="euiSplitPanel euiSplitPanel--row euiCheckableCard euiCheckableCard-isChecked"
grow={false}
hasBorder={true}
paddingSize="none"
>
<div
className="euiPanel euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiPanel--hasBorder euiPanel--flexGrowZero euiSplitPanel euiSplitPanel--row euiCheckableCard euiCheckableCard-isChecked"
>
<_EuiSplitPanelInner
color="primary"
grow={false}
onClick={[Function]}
>
<EuiPanel
borderRadius="none"
className="euiSplitPanel__inner"
color="primary"
element="div"
grow={false}
hasBorder={false}
hasShadow={false}
onClick={[Function]}
>
<div
className="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusNone euiPanel--primary euiPanel--noShadow euiPanel--noBorder euiPanel--flexGrowZero euiPanel--isClickable euiSplitPanel__inner"
onClick={[Function]}
>
<EuiCheckbox
checked={true}
compressed={false}
disabled={false}
id="workflow-checkbox-workflow1"
indeterminate={false}
onChange={[Function]}
value="workflow1"
>
<div
className="euiCheckbox euiCheckbox--noLabel"
>
<input
checked={true}
className="euiCheckbox__input"
disabled={false}
id="workflow-checkbox-workflow1"
onChange={[Function]}
type="checkbox"
value="workflow1"
/>
<div
className="euiCheckbox__square"
/>
</div>
</EuiCheckbox>
</div>
</EuiPanel>
</_EuiSplitPanelInner>
<_EuiSplitPanelInner>
<EuiPanel
borderRadius="none"
className="euiSplitPanel__inner"
color="transparent"
element="div"
hasBorder={false}
hasShadow={false}
>
<div
className="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusNone euiPanel--transparent euiPanel--noShadow euiPanel--noBorder euiSplitPanel__inner"
>
<label
aria-describedby="workflow-checkbox-workflow1-details"
className="euiCheckableCard__label"
htmlFor="workflow-checkbox-workflow1"
>
Workflow 1
</label>
<div
className="euiCheckableCard__children"
id="workflow-checkbox-workflow1-details"
>
This is a test workflow.
</div>
</div>
</EuiPanel>
</_EuiSplitPanelInner>
</div>
</EuiPanel>
</_EuiSplitPanelOuter>
</EuiCheckableCard>
<EuiSpacer
size="s"
>
<div
className="euiSpacer euiSpacer--s"
/>
</EuiSpacer>
</SetupWorkflowSelector>
</div>
</div>
</EuiFormRow>
</IntegrationWorkflowsInputs>
`;

exports[`Integration Setup Inputs Renders the workflows inputs with conditional workflows 1`] = `
<IntegrationWorkflowsInputs
config={
Object {
"checkpointLocation": "",
"connectionDataSource": "ss4o_logs-nginx-test",
"connectionLocation": "",
"connectionTableName": "",
"connectionType": "s3",
"displayName": "Test Instance Name",
"enabledWorkflows": Array [],
}
}
integration={
Object {
"assets": Array [
Expand Down Expand Up @@ -2192,6 +2464,15 @@ exports[`Integration Setup Inputs Renders the workflows inputs 1`] = `
"label": "Workflow 1",
"name": "workflow1",
},
Object {
"applicable_data_sources": Array [
"index",
],
"description": "This should not render.",
"enabled_by_default": true,
"label": "Workflow 2",
"name": "workflow2",
},
],
}
}
Expand Down Expand Up @@ -2219,6 +2500,17 @@ exports[`Integration Setup Inputs Renders the workflows inputs 1`] = `
className="euiFormRow__fieldWrapper"
>
<SetupWorkflowSelector
config={
Object {
"checkpointLocation": "",
"connectionDataSource": "ss4o_logs-nginx-test",
"connectionLocation": "",
"connectionTableName": "",
"connectionType": "s3",
"displayName": "Test Instance Name",
"enabledWorkflows": Array [],
}
}
id="random_html_id"
integration={
Object {
Expand Down Expand Up @@ -2247,6 +2539,15 @@ exports[`Integration Setup Inputs Renders the workflows inputs 1`] = `
"label": "Workflow 1",
"name": "workflow1",
},
Object {
"applicable_data_sources": Array [
"index",
],
"description": "This should not render.",
"enabled_by_default": true,
"label": "Workflow 2",
"name": "workflow2",
},
],
}
}
Expand All @@ -2259,6 +2560,10 @@ exports[`Integration Setup Inputs Renders the workflows inputs 1`] = `
"workflow1",
true,
],
Array [
"workflow2",
true,
],
]
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,42 @@ describe('Integration Setup Inputs', () => {

it('Renders the workflows inputs', async () => {
const wrapper = mount(
<IntegrationWorkflowsInputs updateConfig={() => {}} integration={TEST_INTEGRATION_CONFIG} />
<IntegrationWorkflowsInputs
config={TEST_INTEGRATION_SETUP_INPUTS}
updateConfig={() => {}}
integration={TEST_INTEGRATION_CONFIG}
/>
);

await waitFor(() => {
expect(wrapper).toMatchSnapshot();
});
});

it('Renders the workflows inputs with conditional workflows', async () => {
const wrapper = mount(
<IntegrationWorkflowsInputs
config={{ ...TEST_INTEGRATION_SETUP_INPUTS, connectionType: 's3' }}
updateConfig={() => {}}
integration={{
...TEST_INTEGRATION_CONFIG,
workflows: [
{
name: 'workflow1',
label: 'Workflow 1',
description: 'This is a test workflow.',
enabled_by_default: true,
},
{
name: 'workflow2',
label: 'Workflow 2',
description: 'This should not render.',
enabled_by_default: true,
applicable_data_sources: ['index'],
},
],
}}
/>
);

await waitFor(() => {
Expand Down
Loading
Loading