[App Search] Fixed Documents view for Editor and Analyst roles (#103113) (#103204)

* Updated search-ui version

1.6.0 adds the ability to authenticate without a search key, which
we need for this fix.

* Updated Documents page to not use a search key

This change updates the page to rely on basic authentication rather
than a search key.

As part of that, we needed to create a proxy endpoint for search-ui
to post to, rather than going directly to the ent-search API.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
This commit is contained in:
Kibana Machine 2021-06-28 13:23:40 -04:00 committed by GitHub
parent c13c32af4b
commit 5b0be93cff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 30 deletions

View file

@ -106,10 +106,10 @@
"@elastic/maki": "6.3.0",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
"@elastic/react-search-ui": "^1.5.1",
"@elastic/react-search-ui": "^1.6.0",
"@elastic/request-crypto": "1.1.4",
"@elastic/safer-lodash-set": "link:bazel-bin/packages/elastic-safer-lodash-set",
"@elastic/search-ui-app-search-connector": "^1.5.0",
"@elastic/search-ui-app-search-connector": "^1.6.0",
"@elastic/ui-ace": "0.2.3",
"@hapi/accept": "^5.0.2",
"@hapi/boom": "^9.1.1",

View file

@ -18,7 +18,7 @@ import { i18n } from '@kbn/i18n';
import './search_experience.scss';
import { externalUrl } from '../../../../shared/enterprise_search_url';
import { HttpLogic } from '../../../../shared/http';
import { useLocalStorage } from '../../../../shared/use_local_storage';
import { EngineLogic } from '../../engine';
@ -52,7 +52,8 @@ const DEFAULT_SORT_OPTIONS: SortOption[] = [
export const SearchExperience: React.FC = () => {
const { engine } = useValues(EngineLogic);
const endpointBase = externalUrl.enterpriseSearchUrl;
const { http } = useValues(HttpLogic);
const endpointBase = http.basePath.prepend('/api/app_search/search-ui');
const [showCustomizationModal, setShowCustomizationModal] = useState(false);
const openCustomizationModal = () => setShowCustomizationModal(true);
@ -72,7 +73,9 @@ export const SearchExperience: React.FC = () => {
cacheResponses: false,
endpointBase,
engineName: engine.name,
searchKey: engine.apiKey,
additionalHeaders: {
'kbn-xsrf': true,
},
});
const searchProviderConfig = buildSearchUIConfig(connector, engine.schema || {}, fields);

View file

@ -14,6 +14,8 @@
import { schema } from '@kbn/config-schema';
import { skipBodyValidation } from '../../lib/route_config_helpers';
import { RouteDependencies } from '../../plugin';
export function registerSearchRoutes({
@ -36,4 +38,25 @@ export function registerSearchRoutes({
path: '/api/as/v1/engines/:engineName/search.json',
})
);
// For the Search UI routes below, Search UI always uses the full API path, like:
// "/api/as/v1/engines/{engineName}/search.json". We only have control over the base path
// in Search UI, so we created a common basepath of "/api/app_search/search-ui" here that
// Search UI can use.
//
// Search UI *also* uses the click tracking and query suggestion endpoints, however, since the
// App Search plugin doesn't use that portion of Search UI, we only set up a proxy for the search endpoint below.
router.post(
skipBodyValidation({
path: '/api/app_search/search-ui/api/as/v1/engines/{engineName}/search.json',
validate: {
params: schema.object({
engineName: schema.string(),
}),
},
}),
enterpriseSearchRequestHandler.createRequest({
path: '/api/as/v1/engines/:engineName/search.json',
})
);
}

View file

@ -1147,7 +1147,7 @@
dependencies:
regenerator-runtime "^0.12.0"
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.5.tgz#665450911c6031af38f81db530f387ec04cd9a98"
integrity sha512-121rumjddw9c3NCQ55KGkyE1h/nzWhU/owjhw0l4mQrkzz4x9SGS1X8gFLraHwX7td3Yo4QTL+qj0NcIzN87BA==
@ -1352,10 +1352,10 @@
dependencies:
"@elastic/apm-rum-core" "^5.11.0"
"@elastic/app-search-javascript@^7.3.0":
version "7.8.0"
resolved "https://registry.yarnpkg.com/@elastic/app-search-javascript/-/app-search-javascript-7.8.0.tgz#cbc7af6bcdd224518f7f595145d6ec744e0b165d"
integrity sha512-EsAa/E/dQwBO72nrQ9YrXudP9KVY0sVUOvqPKZ3hBj9Mr3+MtWMyIKcyMf09bzdayk4qE+moetYDe5ahVbiA+Q==
"@elastic/app-search-javascript@^7.13.1":
version "7.13.1"
resolved "https://registry.yarnpkg.com/@elastic/app-search-javascript/-/app-search-javascript-7.13.1.tgz#07d84daa27e856ad14f3f840683288eab06577f4"
integrity sha512-ShzZtGWykLQ0+wXzfk6lJztv68fRcGa8rsLDxJLH/O/2CGY+PJDnj8Qu5lJPmsAPZlZgaB8u7l26YGVPOoaqSA==
dependencies:
object-hash "^1.3.0"
@ -1539,22 +1539,22 @@
resolved "https://registry.yarnpkg.com/@elastic/numeral/-/numeral-2.5.1.tgz#96acf39c3d599950646ef8ccfd24a3f057cf4932"
integrity sha512-Tby6TKjixRFY+atVNeYUdGr9m0iaOq8230KTwn8BbUhkh7LwozfgKq0U98HRX7n63ZL62szl+cDKTYzh5WPCFQ==
"@elastic/react-search-ui-views@1.5.1":
version "1.5.1"
resolved "https://registry.yarnpkg.com/@elastic/react-search-ui-views/-/react-search-ui-views-1.5.1.tgz#766cd6b6049f7aa8ab711a6a3a4a060ee5fdd0ce"
integrity sha512-x4X2xc/69996IEId3VVBTwPICnx/sschnfQ6YmuU3+myRa+VUPkkAWIK/cBcyBW8TNsLtZHWZrjQYi24+H7YWA==
"@elastic/react-search-ui-views@1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@elastic/react-search-ui-views/-/react-search-ui-views-1.6.0.tgz#7211d47c29ef0636c853721491b9905ac7ae58da"
integrity sha512-VADJ18p8HoSPtxKEWFODzId08j0ahyHmHjXv1vP6O/PvtA+ECvi0gDSh/WgdRF792G0e+4d2Dke8LIhxaEvE+w==
dependencies:
downshift "^3.2.10"
rc-pagination "^1.20.1"
react-select "^2.4.4"
"@elastic/react-search-ui@^1.5.1":
version "1.5.1"
resolved "https://registry.yarnpkg.com/@elastic/react-search-ui/-/react-search-ui-1.5.1.tgz#2c261226d2eda3834b4779fbeea5693958169ff2"
integrity sha512-SI7uOF+jI+Z2D+2otym+4eLBYnocmxa+NA6VPSBrADZXyn8oUEzA4MBtJtxHLtcj64Tj8Riv0tw3t9q3b8iF+w==
"@elastic/react-search-ui@^1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@elastic/react-search-ui/-/react-search-ui-1.6.0.tgz#8d547d5e1f0a8eebe94798b29966f51643aa886f"
integrity sha512-bwSKuCQTQiBWr6QufQtZZGu6rcVYfoiUnyZbwZMS6ojedd5XY7FtMcE+QnR6/IIo0M2IUrxD74XtVNqkUhoCRg==
dependencies:
"@elastic/react-search-ui-views" "1.5.1"
"@elastic/search-ui" "1.5.1"
"@elastic/react-search-ui-views" "1.6.0"
"@elastic/search-ui" "1.6.0"
"@elastic/request-crypto@1.1.4":
version "1.1.4"
@ -1569,18 +1569,17 @@
version "0.0.0"
uid ""
"@elastic/search-ui-app-search-connector@^1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@elastic/search-ui-app-search-connector/-/search-ui-app-search-connector-1.5.0.tgz#d379132c5015775acfaee5322ec019e9c0559ccc"
integrity sha512-lHuXBjaMaN1fsm1taQMR/7gfpAg4XOsvZOi8u1AoufUw9kGr6Xc00Gznj1qTyH0Qebi2aSmY0NBN6pdIEGvvGQ==
"@elastic/search-ui-app-search-connector@^1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@elastic/search-ui-app-search-connector/-/search-ui-app-search-connector-1.6.0.tgz#faf1c4a384285648ef7b5ef9cd0e65de0341d2b0"
integrity sha512-6oNvqzo4nuutmCM0zEzYrV6VwG8j0ML43SkaG6UrFzLUd6DeWUVGNN+SLNAlfQDWBUjc2m5EGvgdk/0GOWDZeA==
dependencies:
"@babel/runtime" "^7.5.4"
"@elastic/app-search-javascript" "^7.3.0"
"@elastic/app-search-javascript" "^7.13.1"
"@elastic/search-ui@1.5.1":
version "1.5.1"
resolved "https://registry.yarnpkg.com/@elastic/search-ui/-/search-ui-1.5.1.tgz#14c66a66f5e937ef5e24d6266620b49d986fb3ed"
integrity sha512-ssfvX1q76X1UwqYASWtBni4PZ+3SYk1PvHmOjpVf9BYai1OqZLGVaj8Sw+cE1ia56zl5In7viCfciC+CP31ovA==
"@elastic/search-ui@1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@elastic/search-ui/-/search-ui-1.6.0.tgz#8b2286cacff44735be96605b2929ca9b469c78de"
integrity sha512-i7htjET9uE4xngyzS8kX3DkSD5XNcr+3FS0Jjx3xRpKVc/dFst4bJyiSeRrQcq+2oBb4mEJJOCFaIrLZg3mdSA==
dependencies:
date-fns "^1.30.1"
deep-equal "^1.0.1"