forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[App Search] Updates to results on the documents view (elastic#86181)
- Loading branch information
1 parent
22a8360
commit df2eb59
Showing
15 changed files
with
235 additions
and
50 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...ications/app_search/components/documents/search_experience/build_search_ui_config.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { SchemaTypes } from '../../../../shared/types'; | ||
|
||
import { buildSearchUIConfig } from './build_search_ui_config'; | ||
|
||
describe('buildSearchUIConfig', () => { | ||
it('builds a configuration object for Search UI', () => { | ||
const connector = {}; | ||
const schema = { | ||
foo: 'text' as SchemaTypes, | ||
bar: 'number' as SchemaTypes, | ||
}; | ||
|
||
const config = buildSearchUIConfig(connector, schema); | ||
expect(config.apiConnector).toEqual(connector); | ||
expect(config.searchQuery.result_fields).toEqual({ | ||
bar: { | ||
raw: {}, | ||
snippet: { | ||
fallback: true, | ||
size: 300, | ||
}, | ||
}, | ||
foo: { | ||
raw: {}, | ||
snippet: { | ||
fallback: true, | ||
size: 300, | ||
}, | ||
}, | ||
}); | ||
}); | ||
}); |
34 changes: 34 additions & 0 deletions
34
.../applications/app_search/components/documents/search_experience/build_search_ui_config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { Schema } from '../../../../shared/types'; | ||
|
||
export const buildSearchUIConfig = (apiConnector: object, schema: Schema) => { | ||
return { | ||
alwaysSearchOnInitialLoad: true, | ||
apiConnector, | ||
trackUrlState: false, | ||
initialState: { | ||
sortDirection: 'desc', | ||
sortField: 'id', | ||
}, | ||
searchQuery: { | ||
result_fields: Object.keys(schema || {}).reduce( | ||
(acc: { [key: string]: object }, key: string) => { | ||
acc[key] = { | ||
snippet: { | ||
size: 300, | ||
fallback: true, | ||
}, | ||
raw: {}, | ||
}; | ||
return acc; | ||
}, | ||
{} | ||
), | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
width: 100%; | ||
padding: $euiSize; | ||
overflow: hidden; | ||
color: $euiTextColor; | ||
} | ||
|
||
&__hiddenFieldsIndicator { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.