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

Revert "Add Enable Flattened custom result index checkbox (#830) (#833)" #862

Merged
merged 2 commits into from
Sep 3, 2024
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
1 change: 0 additions & 1 deletion public/models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ export type Detector = {
resultIndexMinAge?: number;
resultIndexMinSize?: number;
resultIndexTtl?: number;
flattenCustomResultIndex?: boolean;
filterQuery: { [key: string]: any };
featureAttributes: FeatureAttributes[];
windowDelay: { period: Schedule };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,6 @@ function CustomResultIndex(props: CustomResultIndexProps) {
}
},[customResultIndexConditionsEnabled])

const hintTextStyle = {
color: '#69707d',
fontSize: '12px',
lineHeight: '16px',
fontWeight: 'normal',
fontFamily: 'Helvetica, sans-serif',
textAlign: 'left',
width: '400px',
};

return (
<ContentPanel
title={
Expand Down Expand Up @@ -146,48 +136,25 @@ function CustomResultIndex(props: CustomResultIndexProps) {
</EuiCompressedFormRow>
</EuiFlexItem>
) : null}

{enabled ? (
<EuiFlexItem>
<EuiCheckbox
id={'resultIndexConditionCheckbox'}
label="Enable custom result index lifecycle management"
checked={customResultIndexConditionsEnabled}
onChange={() => {
setCustomResultIndexConditionsEnabled(!customResultIndexConditionsEnabled);
}}
/>
</EuiFlexItem>
) : null}
</EuiFlexGroup>
)}
</Field>

<EuiFlexGroup direction="column">
<EuiFlexItem>
{ enabled ? (
<Field
name="flattenCustomResultIndex">
{({ field, form }: FieldProps) => (
<EuiFlexGroup>
<EuiFlexItem>
<EuiCompressedCheckbox
id={'flattenCustomResultIndex'}
label="Enable flattened custom result index"
checked={field.value ? field.value : get(props.formikProps, 'values.flattenCustomResultIndex')}
{...field}
/>
<p style={hintTextStyle}>Flattening the custom result index will make it easier to query them on the dashboard. It also allows you to perform term aggregations on categorical fields.</p>
</EuiFlexItem>
</EuiFlexGroup>
)}
</Field>) : null}
</EuiFlexItem>
<EuiFlexItem>
{enabled ? (
<EuiFlexItem>
<EuiCompressedCheckbox
id={'resultIndexConditionCheckbox'}
label="Enable custom result index lifecycle management"
checked={customResultIndexConditionsEnabled}
onChange={() => {
setCustomResultIndexConditionsEnabled(!customResultIndexConditionsEnabled);
}}
/>
</EuiFlexItem>
) : null}
</EuiFlexItem>
</EuiFlexGroup>

{ (enabled && customResultIndexConditionsEnabled) ? (<Field
name="resultIndexMinAge"
{ (enabled && customResultIndexConditionsEnabled) ? (<Field
name="resultIndexMinAge"
validate={(enabled && customResultIndexConditionsEnabled) ? validateEmptyOrPositiveInteger : null}
>
{({ field, form }: FieldProps) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ export const DefineDetector = (props: DefineDetectorProps) => {
formikProps.setFieldTouched('resultIndexMinAge');
formikProps.setFieldTouched('resultIndexMinSize');
formikProps.setFieldTouched('resultIndexTtl');
formikProps.setFieldTouched('flattenCustomResultIndex');
formikProps.validateForm().then((errors) => {
if (isEmpty(errors)) {
if (props.isEdit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -974,16 +974,6 @@ exports[`<DefineDetector /> Full creating detector definition renders the compon
</div>
</div>
</div>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--directionColumn euiFlexGroup--responsive"
>
<div
class="euiFlexItem"
/>
<div
class="euiFlexItem"
/>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -1963,16 +1953,6 @@ exports[`<DefineDetector /> empty creating detector definition renders the compo
</div>
</div>
</div>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--directionColumn euiFlexGroup--responsive"
>
<div
class="euiFlexItem"
/>
<div
class="euiFlexItem"
/>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -2985,16 +2965,6 @@ exports[`<DefineDetector /> empty editing detector definition renders the compon
</div>
</div>
</div>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--directionColumn euiFlexGroup--responsive"
>
<div
class="euiFlexItem"
/>
<div
class="euiFlexItem"
/>
</div>
</div>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion public/pages/DefineDetector/models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ export interface DetectorDefinitionFormikValues {
resultIndexMinAge?: number | string;
resultIndexMinSize?: number | string;
resultIndexTtl?:number | string;
flattenCustomResultIndex?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe('detectorDefinitionToFormik', () => {
resultIndexMinAge: randomDetector.resultIndexMinAge,
resultIndexMinSize: randomDetector.resultIndexMinSize,
resultIndexTtl: randomDetector.resultIndexTtl,
flattenCustomResultIndex: randomDetector.flattenCustomResultIndex,
});
});
test('should return if detector does not have metadata', () => {
Expand All @@ -65,7 +64,6 @@ describe('detectorDefinitionToFormik', () => {
resultIndexMinAge: randomDetector.resultIndexMinAge,
resultIndexMinSize: randomDetector.resultIndexMinSize,
resultIndexTtl: randomDetector.resultIndexTtl,
flattenCustomResultIndex: randomDetector.flattenCustomResultIndex,
});
});
test("upgrade old detector's filters to include filter type", () => {
Expand Down
3 changes: 1 addition & 2 deletions public/pages/DefineDetector/utils/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@ export const INITIAL_DETECTOR_DEFINITION_VALUES: DetectorDefinitionFormikValues
resultIndex: undefined,
resultIndexMinAge: 7,
resultIndexMinSize: 51200,
resultIndexTtl: 60,
flattenCustomResultIndex: false,
resultIndexTtl: 60
};
2 changes: 0 additions & 2 deletions public/pages/DefineDetector/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export function detectorDefinitionToFormik(
resultIndexMinAge: get(ad, 'resultIndexMinAge', undefined),
resultIndexMinSize:get(ad, 'resultIndexMinSize', undefined),
resultIndexTtl: get(ad, 'resultIndexTtl', undefined),
flattenCustomResultIndex: get(ad, 'flattenCustomResultIndex', false),
};
}

Expand Down Expand Up @@ -126,7 +125,6 @@ export function formikToDetectorDefinition(
resultIndexMinAge: values.resultIndexMinAge,
resultIndexMinSize: values.resultIndexMinSize,
resultIndexTtl: values.resultIndexTtl,
flattenCustomResultIndex: values.flattenCustomResultIndex,
} as Detector;

return detectorBody;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,40 +432,6 @@ exports[`<DetectorConfig /> spec renders rules 1`] = `
</div>
</div>
</div>
<div
class="euiFlexItem"
>
<div
class="euiFormRow euiFormRow--compressed"
id="random_html_id-row"
style="width: 250px;"
>
<div
class="euiFormRow__labelWrapper"
>
<label
class="euiFormLabel euiFormRow__label"
for="random_html_id"
>
Flatten custom result index
</label>
</div>
<div
class="euiFormRow__fieldWrapper"
>
<div
class="euiText euiText--medium"
id="random_html_id"
>
<p
class="enabled"
>
-
</p>
</div>
</div>
</div>
</div>
<div
class="euiFlexItem"
>
Expand Down Expand Up @@ -1890,40 +1856,6 @@ exports[`<DetectorConfig /> spec renders the component 1`] = `
</div>
</div>
</div>
<div
class="euiFlexItem"
>
<div
class="euiFormRow euiFormRow--compressed"
id="random_html_id-row"
style="width: 250px;"
>
<div
class="euiFormRow__labelWrapper"
>
<label
class="euiFormLabel euiFormRow__label"
for="random_html_id"
>
Flatten custom result index
</label>
</div>
<div
class="euiFormRow__fieldWrapper"
>
<div
class="euiText euiText--medium"
id="random_html_id"
>
<p
class="enabled"
>
Yes
</p>
</div>
</div>
</div>
</div>
<div
class="euiFlexItem"
>
Expand Down Expand Up @@ -3321,40 +3253,6 @@ exports[`<DetectorConfig /> spec renders the component with 2 custom and 1 simpl
</div>
</div>
</div>
<div
class="euiFlexItem"
>
<div
class="euiFormRow euiFormRow--compressed"
id="random_html_id-row"
style="width: 250px;"
>
<div
class="euiFormRow__labelWrapper"
>
<label
class="euiFormLabel euiFormRow__label"
for="random_html_id"
>
Flatten custom result index
</label>
</div>
<div
class="euiFormRow__fieldWrapper"
>
<div
class="euiText euiText--medium"
id="random_html_id"
>
<p
class="enabled"
>
Yes
</p>
</div>
</div>
</div>
</div>
<div
class="euiFlexItem"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ export const DetectorDefinitionFields = (
const minSize = (minSizeValue === undefined) ? '-' : minSizeValue + " MB";
const ttlValue = get(props, 'detector.resultIndexTtl', undefined);
const ttl = (ttlValue === undefined) ? '-' : ttlValue + " Days";
const flattenCustomResultIndex = get(props, 'detector.flattenCustomResultIndex', undefined);
const flatten = (flattenCustomResultIndex === undefined) ? '-' : flattenCustomResultIndex ? 'Yes' : 'No';


return (
<ContentPanel
Expand Down Expand Up @@ -226,12 +225,6 @@ export const DetectorDefinitionFields = (
description={get(props, 'detector.resultIndex', '-')}
/>
</EuiFlexItem>
<EuiFlexItem>
<ConfigCell
title="Flatten custom result index"
description={flatten}
/>
</EuiFlexItem>
<EuiFlexItem>
<ConfigCell
title="Custom result index min age"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const testDetector = {
resultIndexMinAge: 7,
resultIndexMinSize: 51200,
resultIndexTtl: 60,
flattenCustomResultIndex: true,
} as Detector;

describe('<AdditionalSettings /> spec', () => {
Expand Down Expand Up @@ -86,7 +85,6 @@ describe('<AdditionalSettings /> spec', () => {
getByText('test-timefield');
getByText('1 Minutes');
getByText('opensearch-ad-plugin-result-test');
getByText('Yes')
getByText('7 Days');
getByText('51200 MB');
getByText('60 Days');
Expand Down
Loading
Loading