Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/elastic/kibana into metri…
Browse files Browse the repository at this point in the history
…cs-alerting
  • Loading branch information
phillipb committed Mar 18, 2020
2 parents 15d02fa + f93ec79 commit eab78ca
Show file tree
Hide file tree
Showing 39 changed files with 6,094 additions and 213 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ esFilters: {
getPhraseFilterField: (filter: import("../common").PhraseFilter) => string;
getPhraseFilterValue: (filter: import("../common").PhraseFilter) => string | number | boolean;
getDisplayValueFromFilter: typeof getDisplayValueFromFilter;
compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("./query/filter_manager/lib/compare_filters").FilterCompareOptions) => boolean;
COMPARE_ALL_OPTIONS: import("./query/filter_manager/lib/compare_filters").FilterCompareOptions;
compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean;
COMPARE_ALL_OPTIONS: import("../common").FilterCompareOptions;
generateFilters: typeof generateFilters;
onlyDisabledFiltersChanged: (newFilters?: import("../common").Filter[] | undefined, oldFilters?: import("../common").Filter[] | undefined) => boolean;
changeTimeFilter: typeof changeTimeFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export { IInjector } from 'ui/chrome';
export { absoluteToParsedUrl } from 'ui/url/absolute_to_parsed_url';
export {
configureAppAngularModule,
ensureDefaultIndexPattern,
IPrivate,
migrateLegacyQuery,
PrivateProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import dashboardTemplate from './dashboard_app.html';
import dashboardListingTemplate from './listing/dashboard_listing_ng_wrapper.html';
import { createHashHistory } from 'history';

import { ensureDefaultIndexPattern } from '../legacy_imports';
import { initDashboardAppDirective } from './dashboard_app';
import { createDashboardEditUrl, DashboardConstants } from './dashboard_constants';
import {
createKbnUrlStateStorage,
ensureDefaultIndexPattern,
redirectWhenMissing,
InvalidJSONProperty,
SavedObjectNotFound,
Expand Down Expand Up @@ -137,8 +137,8 @@ export function initDashboardApp(app, deps) {
});
},
resolve: {
dash: function($rootScope, $route, kbnUrl, history) {
return ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl).then(() => {
dash: function($route, history) {
return ensureDefaultIndexPattern(deps.core, deps.data, history).then(() => {
const savedObjectsClient = deps.savedObjectsClient;
const title = $route.current.params.title;
if (title) {
Expand Down Expand Up @@ -172,11 +172,9 @@ export function initDashboardApp(app, deps) {
controller: createNewDashboardCtrl,
requireUICapability: 'dashboard.createNew',
resolve: {
dash: function($rootScope, kbnUrl, history) {
return ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl)
.then(() => {
return deps.savedDashboards.get();
})
dash: history =>
ensureDefaultIndexPattern(deps.core, deps.data, history)
.then(() => deps.savedDashboards.get())
.catch(
redirectWhenMissing({
history,
Expand All @@ -185,22 +183,19 @@ export function initDashboardApp(app, deps) {
},
toastNotifications: deps.core.notifications.toasts,
})
);
},
),
},
})
.when(createDashboardEditUrl(':id'), {
...defaults,
template: dashboardTemplate,
controller: createNewDashboardCtrl,
resolve: {
dash: function($rootScope, $route, kbnUrl, history) {
dash: function($route, kbnUrl, history) {
const id = $route.current.params.id;

return ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl)
.then(() => {
return deps.savedDashboards.get(id);
})
return ensureDefaultIndexPattern(deps.core, deps.data, history)
.then(() => deps.savedDashboards.get(id))
.then(savedDashboard => {
deps.chrome.recentlyAccessed.add(
savedDashboard.getFullPath(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ import { search } from '../../../../../plugins/data/public';
export const { getRequestInspectorStats, getResponseInspectorStats, tabifyAggResponse } = search;
// @ts-ignore
export { intervalOptions } from 'ui/agg_types';
export { subscribeWithScope } from '../../../../../plugins/kibana_legacy/public';
// @ts-ignore
export { timezoneProvider } from 'ui/vis/lib/timezone';
export { unhashUrl, redirectWhenMissing } from '../../../../../plugins/kibana_utils/public';
export {
unhashUrl,
redirectWhenMissing,
ensureDefaultIndexPattern,
} from '../../../../../plugins/kibana_utils/public';
export {
formatMsg,
formatStack,
subscribeWithScope,
} from '../../../../../plugins/kibana_legacy/public';

// EXPORT types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ app.config($routeProvider => {
template: indexTemplate,
reloadOnSearch: false,
resolve: {
savedObjects: function($route, kbnUrl, Promise, $rootScope) {
savedObjects: function($route, Promise) {
const savedSearchId = $route.current.params.id;
return ensureDefaultIndexPattern(core, data, $rootScope, kbnUrl).then(() => {
return ensureDefaultIndexPattern(core, data, history).then(() => {
const { appStateContainer } = getState({ history });
const { index } = appStateContainer.getState();
return Promise.props({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export { DashboardConstants } from '../dashboard/np_ready/dashboard_constants';
export { VisSavedObject, VISUALIZE_EMBEDDABLE_TYPE } from '../../../visualizations/public/';
export {
configureAppAngularModule,
ensureDefaultIndexPattern,
IPrivate,
migrateLegacyQuery,
PrivateProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { createHashHistory } from 'history';
import {
createKbnUrlStateStorage,
redirectWhenMissing,
ensureDefaultIndexPattern,
} from '../../../../../../plugins/kibana_utils/public';

import editorTemplate from './editor/editor.html';
Expand All @@ -32,7 +33,6 @@ import visualizeListingTemplate from './listing/visualize_listing.html';
import { initVisualizeAppDirective } from './visualize_app';
import { VisualizeConstants } from './visualize_constants';
import { VisualizeListingController } from './listing/visualize_listing';
import { ensureDefaultIndexPattern } from '../legacy_imports';

import {
getLandingBreadcrumbs,
Expand Down Expand Up @@ -82,8 +82,7 @@ export function initVisualizeApp(app, deps) {
controllerAs: 'listingController',
resolve: {
createNewVis: () => false,
hasDefaultIndex: ($rootScope, kbnUrl) =>
ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl),
hasDefaultIndex: history => ensureDefaultIndexPattern(deps.core, deps.data, history),
},
})
.when(VisualizeConstants.WIZARD_STEP_1_PAGE_PATH, {
Expand All @@ -94,16 +93,15 @@ export function initVisualizeApp(app, deps) {
controllerAs: 'listingController',
resolve: {
createNewVis: () => true,
hasDefaultIndex: ($rootScope, kbnUrl) =>
ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl),
hasDefaultIndex: history => ensureDefaultIndexPattern(deps.core, deps.data, history),
},
})
.when(VisualizeConstants.CREATE_PATH, {
...defaults,
template: editorTemplate,
k7Breadcrumbs: getCreateBreadcrumbs,
resolve: {
savedVis: function($route, $rootScope, kbnUrl, history) {
savedVis: function($route, history) {
const { core, data, savedVisualizations, visualizations, toastNotifications } = deps;
const visTypes = visualizations.all();
const visType = find(visTypes, { name: $route.current.params.type });
Expand All @@ -121,7 +119,7 @@ export function initVisualizeApp(app, deps) {
);
}

return ensureDefaultIndexPattern(core, data, $rootScope, kbnUrl)
return ensureDefaultIndexPattern(core, data, history)
.then(() => savedVisualizations.get($route.current.params))
.then(savedVis => {
if (savedVis.vis.type.setup) {
Expand All @@ -144,9 +142,9 @@ export function initVisualizeApp(app, deps) {
template: editorTemplate,
k7Breadcrumbs: getEditBreadcrumbs,
resolve: {
savedVis: function($route, $rootScope, kbnUrl, history) {
savedVis: function($route, history) {
const { chrome, core, data, savedVisualizations, toastNotifications } = deps;
return ensureDefaultIndexPattern(core, data, $rootScope, kbnUrl)
return ensureDefaultIndexPattern(core, data, history)
.then(() => savedVisualizations.get($route.current.params.id))
.then(savedVis => {
chrome.recentlyAccessed.add(savedVis.getFullPath(), savedVis.title, savedVis.id);
Expand Down
5 changes: 1 addition & 4 deletions src/legacy/ui/public/legacy_compat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@
* under the License.
*/

export {
configureAppAngularModule,
ensureDefaultIndexPattern,
} from '../../../../plugins/kibana_legacy/public';
export { configureAppAngularModule } from '../../../../plugins/kibana_legacy/public';
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { compareFilters, COMPARE_ALL_OPTIONS } from './compare_filters';
import { buildEmptyFilter, buildQueryFilter, FilterStateStore } from '../../../../common';
import { buildEmptyFilter, buildQueryFilter, FilterStateStore } from '../../es_query';

describe('filter manager utilities', () => {
describe('compare filters', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { defaults, isEqual, omit, map } from 'lodash';
import { FilterMeta, Filter } from '../../../../common';
import { FilterMeta, Filter } from '../../es_query';

export interface FilterCompareOptions {
disabled?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@
*/

import { dedupFilters } from './dedup_filters';
import {
Filter,
IIndexPattern,
IFieldType,
buildRangeFilter,
buildQueryFilter,
FilterStateStore,
} from '../../../../common';
import { Filter, buildRangeFilter, buildQueryFilter, FilterStateStore } from '../../es_query';
import { IIndexPattern, IFieldType } from '../../index_patterns';

describe('filter manager utilities', () => {
let indexPattern: IIndexPattern;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { filter, find } from 'lodash';
import { compareFilters, FilterCompareOptions } from './compare_filters';
import { Filter } from '../../../../common';
import { Filter } from '../../es_query';

/**
* Combine 2 filter collections, removing duplicates
Expand Down
22 changes: 22 additions & 0 deletions src/plugins/data/common/query/filter_manager/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export { dedupFilters } from './dedup_filters';
export { uniqFilters } from './uniq_filters';
export { compareFilters, COMPARE_ALL_OPTIONS, FilterCompareOptions } from './compare_filters';
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { uniqFilters } from './uniq_filters';
import { buildQueryFilter, Filter, FilterStateStore } from '../../../../common';
import { buildQueryFilter, Filter, FilterStateStore } from '../../es_query';

describe('filter manager utilities', () => {
describe('niqFilter', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/
import { each, union } from 'lodash';
import { Filter } from '../../es_query';
import { dedupFilters } from './dedup_filters';
import { Filter } from '../../../../common';

/**
* Remove duplicate filters from an array of filters
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/common/query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
* under the License.
*/

export * from './filter_manager';
export * from './types';
4 changes: 2 additions & 2 deletions src/plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ import {
isQueryStringFilter,
isRangeFilter,
toggleFilterNegated,
compareFilters,
COMPARE_ALL_OPTIONS,
} from '../common';

import { FilterLabel } from './ui/filter_bar';

import {
compareFilters,
COMPARE_ALL_OPTIONS,
generateFilters,
onlyDisabledFiltersChanged,
changeTimeFilter,
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ export const esFilters: {
getPhraseFilterField: (filter: import("../common").PhraseFilter) => string;
getPhraseFilterValue: (filter: import("../common").PhraseFilter) => string | number | boolean;
getDisplayValueFromFilter: typeof getDisplayValueFromFilter;
compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("./query/filter_manager/lib/compare_filters").FilterCompareOptions) => boolean;
COMPARE_ALL_OPTIONS: import("./query/filter_manager/lib/compare_filters").FilterCompareOptions;
compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean;
COMPARE_ALL_OPTIONS: import("../common").FilterCompareOptions;
generateFilters: typeof generateFilters;
onlyDisabledFiltersChanged: (newFilters?: import("../common").Filter[] | undefined, oldFilters?: import("../common").Filter[] | undefined) => boolean;
changeTimeFilter: typeof changeTimeFilter;
Expand Down Expand Up @@ -1843,8 +1843,8 @@ export type TSearchStrategyProvider<T extends TStrategyTypes> = (context: ISearc
// src/plugins/data/public/index.ts:405:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:406:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:409:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:34:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:38:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:33:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:37:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/types.ts:52:5 - (ae-forgotten-export) The symbol "createFiltersFromEvent" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/types.ts:60:5 - (ae-forgotten-export) The symbol "IndexPatternSelectProps" needs to be exported by the entry point index.d.ts

Expand Down
12 changes: 9 additions & 3 deletions src/plugins/data/public/query/filter_manager/filter_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ import { Subject } from 'rxjs';

import { IUiSettingsClient } from 'src/core/public';

import { COMPARE_ALL_OPTIONS, compareFilters } from './lib/compare_filters';
import { sortFilters } from './lib/sort_filters';
import { mapAndFlattenFilters } from './lib/map_and_flatten_filters';
import { uniqFilters } from './lib/uniq_filters';
import { onlyDisabledFiltersChanged } from './lib/only_disabled';
import { PartitionedFilters } from './types';
import { FilterStateStore, Filter, isFilterPinned } from '../../../common';

import {
FilterStateStore,
Filter,
uniqFilters,
isFilterPinned,
compareFilters,
COMPARE_ALL_OPTIONS,
} from '../../../common';

export class FilterManager {
private filters: Filter[] = [];
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/data/public/query/filter_manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

export { FilterManager } from './filter_manager';

export { uniqFilters } from './lib/uniq_filters';
export { mapAndFlattenFilters } from './lib/map_and_flatten_filters';
export { onlyDisabledFiltersChanged } from './lib/only_disabled';
export { generateFilters } from './lib/generate_filters';
export { compareFilters, COMPARE_ALL_OPTIONS } from './lib/compare_filters';
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
*/

import { filter } from 'lodash';
import { Filter } from '../../../../common';
import { compareFilters, COMPARE_ALL_OPTIONS } from './compare_filters';
import { Filter, compareFilters, COMPARE_ALL_OPTIONS } from '../../../../common';

const isEnabled = (f: Filter) => f && f.meta && !f.meta.disabled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ import { Subscription } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import _ from 'lodash';
import { BaseStateContainer } from '../../../../kibana_utils/public';
import { COMPARE_ALL_OPTIONS, compareFilters } from '../filter_manager/lib/compare_filters';
import { QuerySetup, QueryStart } from '../query_service';
import { QueryState, QueryStateChange } from './types';
import { FilterStateStore } from '../../../common/es_query/filters';
import { FilterStateStore, COMPARE_ALL_OPTIONS, compareFilters } from '../../../common';

/**
* Helper to setup two-way syncing of global data and a state container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import { Observable, Subscription } from 'rxjs';
import { map, tap } from 'rxjs/operators';
import { TimefilterSetup } from '../timefilter';
import { COMPARE_ALL_OPTIONS, compareFilters, FilterManager } from '../filter_manager';
import { FilterManager } from '../filter_manager';
import { QueryState, QueryStateChange } from './index';
import { createStateContainer } from '../../../../kibana_utils/public';
import { isFilterPinned } from '../../../common/es_query/filters';
import { isFilterPinned, compareFilters, COMPARE_ALL_OPTIONS } from '../../../common';

export function createQueryStateObservable({
timefilter: { timefilter },
Expand Down
Loading

0 comments on commit eab78ca

Please sign in to comment.