Skip to content

Commit

Permalink
[ML] don't perform request on adding incomplete agg
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Jun 2, 2020
1 parent f4ef699 commit 2e89683
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {

import { SearchItems } from './use_search_items';
import { useApi } from './use_api';
import { isPivotAggsWithExtendedForm } from '../common/pivot_aggs';

function sortColumns(groupByArr: PivotGroupByConfig[]) {
return (a: string, b: string) => {
Expand Down Expand Up @@ -135,6 +136,14 @@ export const usePivotData = (
return;
}

const isConfigInvalid = aggsArr.some(
(agg) => isPivotAggsWithExtendedForm(agg) && !agg.isValid()
);

if (isConfigInvalid) {
return;
}

setErrorMessage('');
setNoDataMessage('');
setStatus(INDEX_STATUS.LOADING);
Expand Down

0 comments on commit 2e89683

Please sign in to comment.