From 5cb426e7f3f515aca63a5f150e8724232678f78f Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Mon, 23 Jul 2018 16:01:34 -0700 Subject: [PATCH] Add rollupSearchStrategy and SearchError (#20505) * Add /api/rollup/search endpoint and rollupSearchStrategy. * Add SearchError for surfacing courier search errors. - Use toastNotifications to surface errors in visualization editor. - Add call-out react directive and use it to surface rollup errors in the visualization editor sidebar. - Temporarily assign timezone and interval values from rollup job to the search to avoid errors. --- src/ui/public/courier/fetch/fetch_now.js | 6 +- .../public/vis/editors/default/sidebar.html | 9 ++ src/ui/public/vis/editors/default/sidebar.js | 19 +++ .../public/vis/editors/default/sidebar.less | 3 + x-pack/plugins/rollup/index.js | 8 +- x-pack/plugins/rollup/public/search/index.js | 7 ++ .../plugins/rollup/public/search/register.js | 10 ++ .../public/search/rollup_search_strategy.js | 114 ++++++++++++++++++ .../server/client/elasticsearch_rollup.js | 15 +++ .../plugins/rollup/server/routes/api/index.js | 1 + .../rollup/server/routes/api/search.js | 36 ++++++ 11 files changed, 225 insertions(+), 3 deletions(-) create mode 100644 src/ui/public/vis/editors/default/sidebar.less create mode 100644 x-pack/plugins/rollup/public/search/index.js create mode 100644 x-pack/plugins/rollup/public/search/register.js create mode 100644 x-pack/plugins/rollup/public/search/rollup_search_strategy.js create mode 100644 x-pack/plugins/rollup/server/routes/api/search.js diff --git a/src/ui/public/courier/fetch/fetch_now.js b/src/ui/public/courier/fetch/fetch_now.js index adc3635d9e9c0..7bb3890fbf95e 100644 --- a/src/ui/public/courier/fetch/fetch_now.js +++ b/src/ui/public/courier/fetch/fetch_now.js @@ -73,7 +73,11 @@ export function FetchNowProvider(Private, Promise) { return startRequests(searchRequests) .then(function () { replaceAbortedRequests(); - return callClient(searchRequests); + return callClient(searchRequests) + .catch(() => { + // Silently swallow errors that result from search requests so the consumer can surface + // them as notifications instead of courier forcing fatal errors. + }); }) .then(function (responses) { replaceAbortedRequests(); diff --git a/src/ui/public/vis/editors/default/sidebar.html b/src/ui/public/vis/editors/default/sidebar.html index 9460225ff079d..6ca0ad94989b3 100644 --- a/src/ui/public/vis/editors/default/sidebar.html +++ b/src/ui/public/vis/editors/default/sidebar.html @@ -19,6 +19,15 @@