Skip to content

Commit

Permalink
[lens] Use top nav in Lens app (#46190)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
Wylie Conlon authored Oct 3, 2019
1 parent 9e8279b commit ab05bbd
Show file tree
Hide file tree
Showing 37 changed files with 1,097 additions and 394 deletions.
39 changes: 39 additions & 0 deletions packages/kbn-es-query/src/es_query/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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 function buildQueryFromFilters(filters: unknown[], indexPattern: unknown): unknown;
export function buildEsQuery(
indexPattern: unknown,
queries: unknown,
filters: unknown,
config?: {
allowLeadingWildcards: boolean;
queryStringOptions: unknown;
ignoreFilterIfFieldNotInIndex: boolean;
dateFormatTZ?: string | null;
}
): unknown;
export function getEsQueryConfig(config: {
get: (name: string) => unknown;
}): {
allowLeadingWildcards: boolean;
queryStringOptions: unknown;
ignoreFilterIfFieldNotInIndex: boolean;
dateFormatTZ?: string | null;
};
1 change: 1 addition & 0 deletions packages/kbn-es-query/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
* under the License.
*/

export * from './es_query';
export * from './kuery';
export * from './filters';
3 changes: 2 additions & 1 deletion src/legacy/core_plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

// /// Define plugin function
import { DataPlugin as Plugin, DataSetup } from './plugin';
import { DataPlugin as Plugin, DataSetup, DataStart } from './plugin';

export function plugin() {
return new Plugin();
Expand All @@ -28,6 +28,7 @@ export function plugin() {

/** @public types */
export type DataSetup = DataSetup;
export type DataStart = DataStart;

export { FilterBar, ApplyFiltersPopover } from './filter';
export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,18 @@ export interface SearchBarOwnProps {
showFilterBar?: boolean;
showDatePicker?: boolean;
showAutoRefreshOnly?: boolean;
showSaveQuery?: boolean;

onRefreshChange?: (options: { isPaused: boolean; refreshInterval: number }) => void;
// Query bar - should be in SearchBarInjectedDeps
query?: Query;
// Show when user has privileges to save
showSaveQuery?: boolean;
savedQuery?: SavedQuery;
onQuerySubmit?: (payload: { dateRange: TimeRange; query?: Query }) => void;
// User has saved the current state as a saved query
onSaved?: (savedQuery: SavedQuery) => void;
// User has modified the saved query, your app should persist the update
onSavedQueryUpdated?: (savedQuery: SavedQuery) => void;
// User has cleared the active query, your app should clear the entire query bar
onClearSavedQuery?: () => void;
}

Expand Down
8 changes: 4 additions & 4 deletions x-pack/legacy/plugins/lens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ export const lens: LegacyPluginInitializer = kibana => {
api: [PLUGIN_ID],
catalogue: [PLUGIN_ID],
savedObject: {
all: [],
read: [],
all: ['search'],
read: ['index-pattern'],
},
ui: ['save', 'show'],
ui: ['save', 'show', 'saveQuery'],
},
read: {
api: [PLUGIN_ID],
catalogue: [PLUGIN_ID],
savedObject: {
all: [],
read: [],
read: ['index-pattern'],
},
ui: ['show'],
},
Expand Down
1 change: 0 additions & 1 deletion x-pack/legacy/plugins/lens/public/app_plugin/_app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
}

.lnsApp__header {
padding: $euiSize;
border-bottom: $euiBorderThin;
}

Expand Down
Loading

0 comments on commit ab05bbd

Please sign in to comment.