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 1 commit
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
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 } from '../../../../common';
import { PivotPreview } from '../../../../components/pivot_preview';
import { SearchItems } from '../../../../hooks/use_search_items';

Expand Down Expand Up @@ -60,7 +60,7 @@ export const StepDefineSummary: FC<Props> = ({
<span>{searchString}</span>
</EuiFormRow>
)}
{typeof searchString === 'undefined' && (
{typeof searchString === 'undefined' && !isDefaultQuery(pivotQuery) && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add a query, move to the next step of the wizard, then back and delete the query, you can end up with e.g.

image

Is the check rerun in this scenario?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a check for match_all queries in 3664138.

<EuiFormRow
label={i18n.translate('xpack.transform.stepDefineSummary.queryCodeBlockLabel', {
defaultMessage: 'Query',
Expand All @@ -74,7 +74,7 @@ export const StepDefineSummary: FC<Props> = ({
overflowHeight={300}
isCopyable
>
{JSON.stringify(searchQuery, null, 2)}
{JSON.stringify(pivotQuery, null, 2)}
</EuiCodeBlock>
</EuiFormRow>
)}
Expand Down