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

[ML] Transforms: Fix handling of default and advanced search on step summary view. #61799

Merged
merged 3 commits into from
Apr 1, 2020
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
2 changes: 1 addition & 1 deletion x-pack/plugins/transform/public/app/common/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function getPreviewRequestBody(
},
};

if (!isDefaultQuery(query)) {
if (!isDefaultQuery(query) && !isMatchAllQuery(query)) {
request.source.query = query;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ export const StepDefineForm: FC<Props> = React.memo(({ overrides = {}, onChange,
width="100%"
value={advancedEditorSourceConfig}
onChange={(d: string) => {
setSearchString(undefined);
setAdvancedEditorSourceConfig(d);

// Disable the "Apply"-Button if the config hasn't changed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
EuiText,
} from '@elastic/eui';

import { getPivotQuery } from '../../../../common';
import { getPivotQuery, isDefaultQuery, isMatchAllQuery } from '../../../../common';
import { PivotPreview } from '../../../../components/pivot_preview';
import { SearchItems } from '../../../../hooks/use_search_items';

Expand Down Expand Up @@ -60,24 +60,29 @@ export const StepDefineSummary: FC<Props> = ({
<span>{searchString}</span>
</EuiFormRow>
)}
{typeof searchString === 'undefined' && (
<EuiFormRow
label={i18n.translate('xpack.transform.stepDefineSummary.queryCodeBlockLabel', {
defaultMessage: 'Query',
})}
>
<EuiCodeBlock
language="js"
fontSize="s"
paddingSize="s"
color="light"
overflowHeight={300}
isCopyable
{typeof searchString === 'undefined' &&
!isDefaultQuery(pivotQuery) &&
!isMatchAllQuery(pivotQuery) && (
<EuiFormRow
label={i18n.translate(
'xpack.transform.stepDefineSummary.queryCodeBlockLabel',
{
defaultMessage: 'Query',
}
)}
>
{JSON.stringify(searchQuery, null, 2)}
</EuiCodeBlock>
</EuiFormRow>
)}
<EuiCodeBlock
language="js"
fontSize="s"
paddingSize="s"
color="light"
overflowHeight={300}
isCopyable
>
{JSON.stringify(pivotQuery, null, 2)}
</EuiCodeBlock>
</EuiFormRow>
)}
</Fragment>
)}

Expand Down