Skip to content

Commit

Permalink
Merge branch 'master' into task/linux-malware-config
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored May 17, 2021
2 parents 84498b6 + 6d4cca2 commit 25e97a9
Show file tree
Hide file tree
Showing 19 changed files with 1,080 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface RichDetector {
excludeFrequent: estypes.ExcludeFrequent | null;
description: string | null;
customRules: CustomRule[] | null;
useNull: boolean | null;
}

export class AdvancedJobCreator extends JobCreator {
Expand All @@ -58,7 +59,8 @@ export class AdvancedJobCreator extends JobCreator {
overField: SplitField,
partitionField: SplitField,
excludeFrequent: estypes.ExcludeFrequent | null,
description: string | null
description: string | null,
useNull: boolean | null
) {
// addDetector doesn't support adding new custom rules.
// this will be added in the future once it's supported in the UI
Expand All @@ -71,7 +73,8 @@ export class AdvancedJobCreator extends JobCreator {
partitionField,
excludeFrequent,
description,
customRules
customRules,
useNull
);

this._addDetector(detector, agg, field);
Expand All @@ -86,7 +89,8 @@ export class AdvancedJobCreator extends JobCreator {
partitionField: SplitField,
excludeFrequent: estypes.ExcludeFrequent | null,
description: string | null,
index: number
index: number,
useNull: boolean | null
) {
const customRules =
this._detectors[index] !== undefined ? this._detectors[index].custom_rules || null : null;
Expand All @@ -99,7 +103,8 @@ export class AdvancedJobCreator extends JobCreator {
partitionField,
excludeFrequent,
description,
customRules
customRules,
useNull
);

this._editDetector(detector, agg, field, index);
Expand All @@ -117,7 +122,8 @@ export class AdvancedJobCreator extends JobCreator {
partitionField: SplitField,
excludeFrequent: estypes.ExcludeFrequent | null,
description: string | null,
customRules: CustomRule[] | null
customRules: CustomRule[] | null,
useNull: boolean | null
): { detector: Detector; richDetector: RichDetector } {
const detector: Detector = createBasicDetector(agg, field);

Expand All @@ -139,6 +145,9 @@ export class AdvancedJobCreator extends JobCreator {
if (customRules !== null) {
detector.custom_rules = customRules;
}
if (useNull !== null) {
detector.use_null = useNull;
}

const richDetector: RichDetector = {
agg,
Expand All @@ -149,6 +158,7 @@ export class AdvancedJobCreator extends JobCreator {
excludeFrequent,
description,
customRules,
useNull,
};

return { detector, richDetector };
Expand Down Expand Up @@ -209,7 +219,8 @@ export class AdvancedJobCreator extends JobCreator {
dtr.overField,
dtr.partitionField,
dtr.excludeFrequent,
dtr.description
dtr.description,
dtr.useNull
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ export function getRichDetectors(
byField,
overField,
partitionField,
excludeFrequent: d.exclude_frequent || null,
description: d.detector_description || null,
excludeFrequent: d.exclude_frequent ?? null,
description: d.detector_description ?? null,
useNull: d.use_null ?? null,
};
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export const AdvancedDetectorModal: FC<Props> = ({
: null,
description: descriptionOption !== '' ? descriptionOption : null,
customRules: null,
useNull: null,
};
setDetector(dtr);
setDescriptionPlaceholder(dtr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const emptyRichDetector: RichDetector = {
excludeFrequent: null,
description: null,
customRules: null,
useNull: null,
};

export const AdvancedDetectors: FC<Props> = ({ setIsValid }) => {
Expand All @@ -51,7 +52,8 @@ export const AdvancedDetectors: FC<Props> = ({ setIsValid }) => {
dtr.overField,
dtr.partitionField,
dtr.excludeFrequent,
dtr.description
dtr.description,
dtr.useNull
);
} else {
jobCreator.editDetector(
Expand All @@ -62,7 +64,8 @@ export const AdvancedDetectors: FC<Props> = ({ setIsValid }) => {
dtr.partitionField,
dtr.excludeFrequent,
dtr.description,
index
index,
dtr.useNull
);
}
jobCreatorUpdate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface Props {
selectedOptions: string[];
}

export const ComboBox = ({ onChange, selectedOptions }: Props) => {
export const ComboBox = ({ onChange, selectedOptions, ...props }: Props) => {
const [formattedSelectedOptions, setSelectedOptions] = useState<
Array<EuiComboBoxOptionOption<string>>
>(selectedOptions.map((option) => ({ label: option, key: option })));
Expand Down Expand Up @@ -66,6 +66,7 @@ export const ComboBox = ({ onChange, selectedOptions }: Props) => {
onChange={onOptionsChange}
onSearchChange={onSearchChange}
isInvalid={isInvalid}
{...props}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const CustomFields = memo<Props>(
defaultMessage="Configure your monitor with the following options."
/>
}
data-test-subj="monitorSettingsSection"
>
<EuiFlexGroup>
<EuiFlexItem>
Expand Down Expand Up @@ -104,6 +105,7 @@ export const CustomFields = memo<Props>(
configKey: ConfigKeys.MONITOR_TYPE,
})
}
data-test-subj="syntheticsMonitorTypeField"
/>
</EuiFormRow>
)}
Expand All @@ -128,6 +130,7 @@ export const CustomFields = memo<Props>(
onChange={(event) =>
handleInputChange({ value: event.target.value, configKey: ConfigKeys.URLS })
}
data-test-subj="syntheticsUrlField"
/>
</EuiFormRow>
)}
Expand Down Expand Up @@ -155,6 +158,7 @@ export const CustomFields = memo<Props>(
configKey: ConfigKeys.HOSTS,
})
}
data-test-subj="syntheticsTCPHostField"
/>
</EuiFormRow>
)}
Expand Down Expand Up @@ -182,6 +186,7 @@ export const CustomFields = memo<Props>(
configKey: ConfigKeys.HOSTS,
})
}
data-test-subj="syntheticsICMPHostField"
/>
</EuiFormRow>
)}
Expand Down Expand Up @@ -268,6 +273,7 @@ export const CustomFields = memo<Props>(
configKey: ConfigKeys.APM_SERVICE_NAME,
})
}
data-test-subj="syntheticsAPMServiceName"
/>
</EuiFormRow>
{isHTTP && (
Expand Down Expand Up @@ -364,6 +370,7 @@ export const CustomFields = memo<Props>(
<ComboBox
selectedOptions={fields[ConfigKeys.TAGS]}
onChange={(value) => handleInputChange({ value, configKey: ConfigKeys.TAGS })}
data-test-subj="syntheticsTags"
/>
</EuiFormRow>
</EuiFlexItem>
Expand All @@ -385,6 +392,7 @@ export const CustomFields = memo<Props>(
defaultMessage="Configure TLS options, including verification mode, certificate authorities, and client certificates."
/>
}
data-test-subj="syntheticsIsTLSEnabled"
>
<EuiCheckbox
id={'uptimeFleetIsTLSEnabled'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
defaultMessage="Advanced HTTP options"
/>
}
data-test-subj="syntheticsHTTPAdvancedFieldsAccordion"
>
<EuiSpacer size="xl" />
<EuiDescribedFormGroup
Expand All @@ -69,6 +70,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
defaultMessage="Configure an optional request to send to the remote host including method, body, and headers."
/>
}
data-test-subj="httpAdvancedFieldsSection"
>
<EuiSpacer size="s" />
<EuiFormRow
Expand All @@ -94,6 +96,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
configKey: ConfigKeys.USERNAME,
})
}
data-test-subj="syntheticsUsername"
/>
</EuiFormRow>
<EuiFormRow
Expand All @@ -119,6 +122,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
configKey: ConfigKeys.PASSWORD,
})
}
data-test-subj="syntheticsPassword"
/>
</EuiFormRow>
<EuiFormRow
Expand All @@ -144,6 +148,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
configKey: ConfigKeys.PROXY_URL,
})
}
data-test-subj="syntheticsProxyUrl"
/>
</EuiFormRow>
<EuiFormRow
Expand All @@ -169,6 +174,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
configKey: ConfigKeys.REQUEST_METHOD_CHECK,
})
}
data-test-subj="syntheticsRequestMethod"
/>
</EuiFormRow>
<EuiFormRow
Expand Down Expand Up @@ -199,6 +205,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
defaultMessage="A dictionary of additional HTTP headers to send. By default the client will set the User-Agent header to identify itself."
/>
}
data-test-subj="syntheticsRequestHeaders"
>
<HeaderField
contentMode={
Expand Down Expand Up @@ -275,6 +282,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
<EuiCode>http.response.body.headers</EuiCode>
</>
}
data-test-subj="syntheticsIndexResponseHeaders"
>
<EuiCheckbox
id={'uptimeFleetIndexResponseHeaders'}
Expand Down Expand Up @@ -363,6 +371,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
configKey: ConfigKeys.RESPONSE_STATUS_CHECK,
})
}
data-test-subj="syntheticsResponseStatusCheck"
/>
</EuiFormRow>
<EuiFormRow
Expand Down Expand Up @@ -397,6 +406,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
defaultMessage="A list of expected response headers."
/>
}
data-test-subj="syntheticsResponseHeaders"
>
<HeaderField
defaultValue={fields[ConfigKeys.RESPONSE_HEADERS_CHECK]}
Expand Down Expand Up @@ -436,6 +446,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
}),
[handleInputChange]
)}
data-test-subj="syntheticsResponseBodyCheckPositive"
/>
</EuiFormRow>
<EuiFormRow
Expand Down Expand Up @@ -464,6 +475,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
}),
[handleInputChange]
)}
data-test-subj="syntheticsResponseBodyCheckNegative"
/>
</EuiFormRow>
</EuiDescribedFormGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const ResponseBodyIndexField = ({ defaultValue, onChange }: Props) => {

return (
<EuiFlexGroup>
<EuiFlexItem>
<EuiFlexItem data-test-subj="syntheticsIndexResponseBody">
<EuiCheckbox
id="uptimeFleetIndexResponseBody"
checked={checked}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const RequestBodyField = ({ onChange, type, value }: Props) => {
{
id: Mode.TEXT,
name: modeLabels[Mode.TEXT],
'data-test-subj': `syntheticsRequestBodyTab__${Mode.TEXT}`,
content: (
<CodeEditor
ariaLabel={i18n.translate(
Expand All @@ -151,6 +152,7 @@ export const RequestBodyField = ({ onChange, type, value }: Props) => {
{
id: Mode.JSON,
name: modeLabels[Mode.JSON],
'data-test-subj': `syntheticsRequestBodyTab__${Mode.JSON}`,
content: (
<CodeEditor
ariaLabel={i18n.translate(
Expand All @@ -171,6 +173,7 @@ export const RequestBodyField = ({ onChange, type, value }: Props) => {
{
id: Mode.XML,
name: modeLabels[Mode.XML],
'data-test-subj': `syntheticsRequestBodyTab__${Mode.XML}`,
content: (
<CodeEditor
ariaLabel={i18n.translate(
Expand All @@ -191,6 +194,7 @@ export const RequestBodyField = ({ onChange, type, value }: Props) => {
{
id: Mode.FORM,
name: modeLabels[Mode.FORM],
'data-test-subj': `syntheticsRequestBodyTab__${Mode.FORM}`,
content: (
<KeyValuePairsField
addPairControlLabel={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export const TCPAdvancedFields = () => {
);

return (
<EuiAccordion id="uptimeFleetTCPAdvancedOptions" buttonContent="Advanced TCP options">
<EuiAccordion
id="uptimeFleetTCPAdvancedOptions"
buttonContent="Advanced TCP options"
data-test-subj="syntheticsTCPAdvancedFieldsAccordion"
>
<EuiSpacer size="m" />
<EuiDescribedFormGroup
title={
Expand Down Expand Up @@ -75,10 +79,11 @@ export const TCPAdvancedFields = () => {
configKey: ConfigKeys.PROXY_URL,
})
}
data-test-subj="syntheticsProxyUrl"
/>
</EuiFormRow>
{!!fields[ConfigKeys.PROXY_URL] && (
<EuiFormRow>
<EuiFormRow data-test-subj="syntheticsUseLocalResolver">
<EuiCheckbox
id={'uptimeFleetUseLocalResolverCheckbox'}
checked={fields[ConfigKeys.PROXY_USE_LOCAL_RESOLVER]}
Expand Down Expand Up @@ -122,6 +127,7 @@ export const TCPAdvancedFields = () => {
}),
[handleInputChange]
)}
data-test-subj="syntheticsTCPRequestSendCheck"
/>
</EuiFormRow>
</EuiDescribedFormGroup>
Expand Down Expand Up @@ -166,6 +172,7 @@ export const TCPAdvancedFields = () => {
}),
[handleInputChange]
)}
data-test-subj="syntheticsTCPResponseReceiveCheck"
/>
</EuiFormRow>
</EuiDescribedFormGroup>
Expand Down
Loading

0 comments on commit 25e97a9

Please sign in to comment.