Skip to content

Commit

Permalink
retain query language on step edit (#116227)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 authored Oct 26, 2021
1 parent 38026a8 commit d91bd98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const ConfigurationStepForm: FC<ConfigurationStepProps> = ({
dependentVariable,
includes,
jobConfigQuery,
jobConfigQueryLanguage,
jobConfigQueryString,
jobType,
modelMemoryLimit,
Expand All @@ -150,14 +151,18 @@ export const ConfigurationStepForm: FC<ConfigurationStepProps> = ({

const [query, setQuery] = useState<Query>({
query: jobConfigQueryString ?? '',
language: SEARCH_QUERY_LANGUAGE.KUERY,
language: jobConfigQueryLanguage ?? SEARCH_QUERY_LANGUAGE.KUERY,
});

const toastNotifications = getToastNotifications();

const setJobConfigQuery: ExplorationQueryBarProps['setSearchQuery'] = (update) => {
if (update.query) {
setFormState({ jobConfigQuery: update.query, jobConfigQueryString: update.queryString });
setFormState({
jobConfigQuery: update.query,
jobConfigQueryLanguage: update.language,
jobConfigQueryString: update.queryString,
});
}
setQuery({ query: update.queryString, language: update.language });
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export interface State {
jobType: AnalyticsJobType;
jobConfigQuery: any;
jobConfigQueryString: string | undefined;
jobConfigQueryLanguage: string | undefined;
lambda: number | undefined;
lossFunction: string | undefined;
lossFunctionParameter: number | undefined;
Expand Down Expand Up @@ -162,6 +163,7 @@ export const getInitialState = (): State => ({
jobType: undefined,
jobConfigQuery: defaultSearchQuery,
jobConfigQueryString: undefined,
jobConfigQueryLanguage: undefined,
lambda: undefined,
lossFunction: undefined,
lossFunctionParameter: undefined,
Expand Down

0 comments on commit d91bd98

Please sign in to comment.