-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Discover] Inline shard failures warnings (#161271)
- Closes #155216 ## Summary This PR replaces shard falures toasts with inline warnings in Discover. - [x] Intercept shard failures in Discover main app - [x] Show inline warnings above the grid instead - [x] Handle NoResultsFound case too - [x] Implement for Discover context app - [x] Implement for saved search embeddable on Dashboard - [x] Can we inline timeouts too? - [x] Check SQL view - [x] Add tests Discover view with shard failures <img width="400" alt="Screenshot 2023-07-06 at 14 23 48" src="https://github.com/elastic/kibana/assets/1415710/a0799aa0-9d2e-42ee-b89b-e0e1180220a5"> Discover view with shard failures (and no results) <img width="400" alt="Screenshot 2023-07-07 at 13 24 50" src="https://github.com/elastic/kibana/assets/1415710/28dc2bad-9776-4aa9-8f51-219d1c87487a"> Dashboard view with shard failures <img width="400" alt="Screenshot 2023-07-06 at 16 15 49" src="https://github.com/elastic/kibana/assets/1415710/2a68c19a-1ca8-4f10-a9f5-4aa56f9160b0"> Surrounding documents view with shard failures <img width="400" alt="Screenshot 2023-07-10 at 17 26 31" src="https://github.com/elastic/kibana/assets/1415710/ade63cfe-a1c2-4c22-8823-58dcfef9357f"> Discover view with timeouts <img width="400" alt="Screenshot 2023-07-07 at 16 47 27" src="https://github.com/elastic/kibana/assets/1415710/0101be19-a555-4f96-b963-7fe418d51fb5"> Dashboard view with timeouts <img width="400" alt="Screenshot 2023-07-07 at 16 48 18" src="https://github.com/elastic/kibana/assets/1415710/82979365-4129-4385-8a13-9c139e1acbf1"> Surrounding documents view with timeouts <img width="400" alt="Screenshot 2023-07-11 at 15 03 41" src="https://github.com/elastic/kibana/assets/1415710/0ea41b79-ac6b-4456-9cfa-0d038b10da7d"> ## Testing For testing please uncomment https://github.com/elastic/kibana/blob/3f102cf688dbfe87fd901cf7f8b59680ff62e5b8/src/plugins/data/common/search/search_source/search_source.ts#L922 or https://github.com/elastic/kibana/blob/3f102cf688dbfe87fd901cf7f8b59680ff62e5b8/src/plugins/data/common/search/search_source/search_source.ts#L547 and switch to `kibana*` data view. ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: Davis McPhee <[email protected]> Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
48b7acf
commit c97d496
Showing
56 changed files
with
2,037 additions
and
184 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @kbn/search-response-warnings | ||
|
||
Components and utils to render warnings which happen when executing search request. For example, shard failures and time outs. |
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,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
export type { SearchResponseInterceptedWarning } from './src/types'; | ||
|
||
export { | ||
SearchResponseWarnings, | ||
type SearchResponseWarningsProps, | ||
} from './src/components/search_response_warnings'; | ||
|
||
export { | ||
getSearchResponseInterceptedWarnings, | ||
removeInterceptedWarningDuplicates, | ||
} from './src/utils/get_search_response_intercepted_warnings'; |
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,13 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
module.exports = { | ||
preset: '@kbn/test', | ||
rootDir: '../..', | ||
roots: ['<rootDir>/packages/kbn-search-response-warnings'], | ||
}; |
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,5 @@ | ||
{ | ||
"type": "shared-common", | ||
"id": "@kbn/search-response-warnings", | ||
"owner": "@elastic/kibana-data-discovery" | ||
} |
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,6 @@ | ||
{ | ||
"name": "@kbn/search-response-warnings", | ||
"private": true, | ||
"version": "1.0.0", | ||
"license": "SSPL-1.0 OR Elastic License 2.0" | ||
} |
50 changes: 50 additions & 0 deletions
50
packages/kbn-search-response-warnings/src/__mocks__/search_response_warnings.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,50 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { SearchResponseWarning } from '@kbn/data-plugin/public'; | ||
|
||
export const searchResponseTimeoutWarningMock: SearchResponseWarning = { | ||
type: 'timed_out', | ||
message: 'Data might be incomplete because your request timed out', | ||
reason: undefined, | ||
}; | ||
|
||
export const searchResponseShardFailureWarningMock: SearchResponseWarning = { | ||
type: 'shard_failure', | ||
message: '3 of 4 shards failed', | ||
text: 'The data might be incomplete or wrong.', | ||
reason: { | ||
type: 'illegal_argument_exception', | ||
reason: 'Field [__anonymous_] of type [boolean] does not support custom formats', | ||
}, | ||
}; | ||
|
||
export const searchResponseWarningsMock: SearchResponseWarning[] = [ | ||
searchResponseTimeoutWarningMock, | ||
searchResponseShardFailureWarningMock, | ||
{ | ||
type: 'shard_failure', | ||
message: '3 of 4 shards failed', | ||
text: 'The data might be incomplete or wrong.', | ||
reason: { | ||
type: 'query_shard_exception', | ||
reason: | ||
'failed to create query: [.ds-kibana_sample_data_logs-2023.07.11-000001][0] Testing shard failures!', | ||
}, | ||
}, | ||
{ | ||
type: 'shard_failure', | ||
message: '1 of 4 shards failed', | ||
text: 'The data might be incomplete or wrong.', | ||
reason: { | ||
type: 'query_shard_exception', | ||
reason: | ||
'failed to create query: [.ds-kibana_sample_data_logs-2023.07.11-000001][0] Testing shard failures!', | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.