Skip to content

Commit

Permalink
Revert "updating metricvis interpreter func arguments (#34532)"
Browse files Browse the repository at this point in the history
This reverts commit 444bafb.
  • Loading branch information
ppisljar authored Jul 1, 2019
1 parent 4426094 commit c9f334c
Show file tree
Hide file tree
Showing 120 changed files with 1,812 additions and 1,999 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^2.2.1",
"inert": "^5.1.0",
"inline-style": "^2.0.0",
"joi": "^13.5.2",
"jquery": "^3.4.1",
"js-yaml": "3.13.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-es-query/src/filters/lib/meta_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface FilterMeta {
}

export interface Filter {
$state?: FilterState;
$state: FilterState;
meta: FilterMeta;
query?: object;
}
Expand All @@ -62,7 +62,7 @@ export function buildEmptyFilter(isPinned: boolean, index?: string): Filter {
}

export function isFilterPinned(filter: Filter) {
return filter.$state && filter.$state.store === FilterStateStore.GLOBAL_STATE;
return filter.$state.store === FilterStateStore.GLOBAL_STATE;
}

export function toggleFilterDisabled(filter: Filter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import 'ngreact';
import { uiModules } from 'ui/modules';
import template from './directive.html';
import { ApplyFiltersPopover } from './apply_filters_popover';
import { mapAndFlattenFilters } from '../filter_manager/lib/map_and_flatten_filters';
import { mapAndFlattenFilters } from 'ui/filter_manager/lib/map_and_flatten_filters';
import { wrapInI18nContext } from 'ui/i18n';

const app = uiModules.get('app/data', ['react']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,20 +441,17 @@ class FilterEditorUI extends Component<Props, State> {
queryDsl,
} = this.state;

const { $state } = this.props.filter;
if (!$state || !$state.store) {
return; // typescript validation
}
const { store } = this.props.filter.$state;
const alias = useCustomLabel ? customLabel : null;

if (isCustomEditorOpen) {
const { index, disabled, negate } = this.props.filter.meta;
const newIndex = index || this.props.indexPatterns[0].id;
const body = JSON.parse(queryDsl);
const filter = buildCustomFilter(newIndex, body, disabled, negate, alias, $state.store);
const filter = buildCustomFilter(newIndex, body, disabled, negate, alias, store);
this.props.onSubmit(filter);
} else if (indexPattern && field && operator) {
const filter = buildFilter(indexPattern, field, operator, params, alias, $state.store);
const filter = buildFilter(indexPattern, field, operator, params, alias, store);
this.props.onSubmit(filter);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,7 @@ describe('Filter editor utils', () => {
const filter = buildFilter(mockIndexPattern, mockFields[0], isOperator, params, alias, state);
expect(filter.meta.negate).toBe(isOperator.negate);
expect(filter.meta.alias).toBe(alias);

expect(filter.$state).toBeDefined();
if (filter.$state) {
expect(filter.$state.store).toBe(state);
}
expect(filter.$state.store).toBe(state);
});

it('should build phrases filters', () => {
Expand All @@ -261,10 +257,7 @@ describe('Filter editor utils', () => {
expect(filter.meta.type).toBe(isOneOfOperator.type);
expect(filter.meta.negate).toBe(isOneOfOperator.negate);
expect(filter.meta.alias).toBe(alias);
expect(filter.$state).toBeDefined();
if (filter.$state) {
expect(filter.$state.store).toBe(state);
}
expect(filter.$state.store).toBe(state);
});

it('should build range filters', () => {
Expand All @@ -281,10 +274,7 @@ describe('Filter editor utils', () => {
);
expect(filter.meta.negate).toBe(isBetweenOperator.negate);
expect(filter.meta.alias).toBe(alias);
expect(filter.$state).toBeDefined();
if (filter.$state) {
expect(filter.$state.store).toBe(state);
}
expect(filter.$state.store).toBe(state);
});

it('should build exists filters', () => {
Expand All @@ -301,10 +291,7 @@ describe('Filter editor utils', () => {
);
expect(filter.meta.negate).toBe(existsOperator.negate);
expect(filter.meta.alias).toBe(alias);
expect(filter.$state).toBeDefined();
if (filter.$state) {
expect(filter.$state.store).toBe(state);
}
expect(filter.$state.store).toBe(state);
});

it('should negate based on operator', () => {
Expand All @@ -321,10 +308,7 @@ describe('Filter editor utils', () => {
);
expect(filter.meta.negate).toBe(doesNotExistOperator.negate);
expect(filter.meta.alias).toBe(alias);
expect(filter.$state).toBeDefined();
if (filter.$state) {
expect(filter.$state.store).toBe(state);
}
expect(filter.$state.store).toBe(state);
});
});
});
Loading

0 comments on commit c9f334c

Please sign in to comment.