Skip to content

Commit ab05bbd

Browse files
author
Wylie Conlon
authored
[lens] Use top nav in Lens app (#46190)
* [lens] Use top nav in Lens app * Add tests for saved query, pass filters around more places * Fix filter passing * Add unit test for field popover making correct queries * Respond to review feedback * Fix type errors * Respond to all review comments * Remove commented code * Top nav should be compatible as angular directive * Fix rendering issue with filter updates * Respond to review comments and add onChange test * Add specific test for the index pattern bug from Tina
1 parent 9e8279b commit ab05bbd

File tree

37 files changed

+1097
-394
lines changed

37 files changed

+1097
-394
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
export function buildQueryFromFilters(filters: unknown[], indexPattern: unknown): unknown;
21+
export function buildEsQuery(
22+
indexPattern: unknown,
23+
queries: unknown,
24+
filters: unknown,
25+
config?: {
26+
allowLeadingWildcards: boolean;
27+
queryStringOptions: unknown;
28+
ignoreFilterIfFieldNotInIndex: boolean;
29+
dateFormatTZ?: string | null;
30+
}
31+
): unknown;
32+
export function getEsQueryConfig(config: {
33+
get: (name: string) => unknown;
34+
}): {
35+
allowLeadingWildcards: boolean;
36+
queryStringOptions: unknown;
37+
ignoreFilterIfFieldNotInIndex: boolean;
38+
dateFormatTZ?: string | null;
39+
};

packages/kbn-es-query/src/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
* under the License.
1818
*/
1919

20+
export * from './es_query';
2021
export * from './kuery';
2122
export * from './filters';

src/legacy/core_plugins/data/public/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
// /// Define plugin function
21-
import { DataPlugin as Plugin, DataSetup } from './plugin';
21+
import { DataPlugin as Plugin, DataSetup, DataStart } from './plugin';
2222

2323
export function plugin() {
2424
return new Plugin();
@@ -28,6 +28,7 @@ export function plugin() {
2828

2929
/** @public types */
3030
export type DataSetup = DataSetup;
31+
export type DataStart = DataStart;
3132

3233
export { FilterBar, ApplyFiltersPopover } from './filter';
3334
export {

src/legacy/core_plugins/data/public/search/search_bar/components/search_bar.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,18 @@ export interface SearchBarOwnProps {
6666
showFilterBar?: boolean;
6767
showDatePicker?: boolean;
6868
showAutoRefreshOnly?: boolean;
69-
showSaveQuery?: boolean;
70-
69+
onRefreshChange?: (options: { isPaused: boolean; refreshInterval: number }) => void;
7170
// Query bar - should be in SearchBarInjectedDeps
7271
query?: Query;
72+
// Show when user has privileges to save
73+
showSaveQuery?: boolean;
7374
savedQuery?: SavedQuery;
7475
onQuerySubmit?: (payload: { dateRange: TimeRange; query?: Query }) => void;
76+
// User has saved the current state as a saved query
7577
onSaved?: (savedQuery: SavedQuery) => void;
78+
// User has modified the saved query, your app should persist the update
7679
onSavedQueryUpdated?: (savedQuery: SavedQuery) => void;
80+
// User has cleared the active query, your app should clear the entire query bar
7781
onClearSavedQuery?: () => void;
7882
}
7983

x-pack/legacy/plugins/lens/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@ export const lens: LegacyPluginInitializer = kibana => {
6565
api: [PLUGIN_ID],
6666
catalogue: [PLUGIN_ID],
6767
savedObject: {
68-
all: [],
69-
read: [],
68+
all: ['search'],
69+
read: ['index-pattern'],
7070
},
71-
ui: ['save', 'show'],
71+
ui: ['save', 'show', 'saveQuery'],
7272
},
7373
read: {
7474
api: [PLUGIN_ID],
7575
catalogue: [PLUGIN_ID],
7676
savedObject: {
7777
all: [],
78-
read: [],
78+
read: ['index-pattern'],
7979
},
8080
ui: ['show'],
8181
},

x-pack/legacy/plugins/lens/public/app_plugin/_app.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
}
1212

1313
.lnsApp__header {
14-
padding: $euiSize;
1514
border-bottom: $euiBorderThin;
1615
}
1716

0 commit comments

Comments
 (0)