-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Fixes index pattern wizard when there are remote clusters but no local indices #24339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mattkime
merged 24 commits into
elastic:master
from
mattkime:index-pattern-wizard-cluster-fix-mattk
Nov 13, 2018
Merged
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
3ac662c
don't hide wizard if clusters exist
mattkime 4c4e4ba
revert mistaken commit
mattkime d2eb357
minor cleanup
mattkime 1a966bf
add test
mattkime dfb3f37
fix http request
mattkime c5d48b5
Merge branch 'master' into index-pattern-wizard-cluster-fix-mattk
mattkime f4259ac
Merge remote-tracking branch 'elastic/master' into index-pattern-wiza…
mattkime 75b0ee5
fix tests, add snapshot
mattkime 885843a
add timeout to functional test
mattkime 9427dcd
Update doc_level_security_roles.js
mattkime ae572ad
Merge branch 'master' into index-pattern-wizard-cluster-fix-mattk
mattkime 871ee5c
fix typos
mattkime 833b987
Merge branch 'index-pattern-wizard-cluster-fix-mattk' of github.com:m…
mattkime bbb3732
revert unneeded changes
mattkime 9705784
Merge branch 'master' into index-pattern-wizard-cluster-fix-mattk
mattkime 631274f
Merge branch 'index-pattern-wizard-cluster-fix-mattk' of github.com:m…
mattkime 67fa885
merge
mattkime ef26dbd
snap snap
mattkime e3e78f5
Merge branch 'master' of github.com:elastic/kibana into index-pattern…
mattkime de94309
cross cluster search is oos
mattkime 3f4002e
Merge branch 'master' into index-pattern-wizard-cluster-fix-mattk
mattkime ed7a6f2
catch errors
mattkime b768e73
add toast notifs if unable to load data
mattkime 811ae9a
Merge branch 'master' into index-pattern-wizard-cluster-fix-mattk
mattkime File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
26 changes: 26 additions & 0 deletions
26
...public/management/sections/indices/create_index_pattern_wizard/lib/get_remote_clusters.js
This file contains hidden or 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,26 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| import chrome from 'ui/chrome'; | ||
| const apiPrefix = chrome.addBasePath('/api/kibana'); | ||
|
|
||
| export async function getRemoteClusters($http) { | ||
| const response = await $http.get(`${apiPrefix}/clusters`); | ||
| return response.data; | ||
| } |
This file contains hidden or 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
37 changes: 37 additions & 0 deletions
37
src/core_plugins/kibana/server/routes/api/remote_info/call_with_request_factory.js
This file contains hidden or 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,37 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| /* | ||
| * 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 { once } from 'lodash'; | ||
|
|
||
| const callWithRequest = once(server => { | ||
| const cluster = server.plugins.elasticsearch.getCluster('data'); | ||
| return cluster.callWithRequest; | ||
| }); | ||
|
|
||
| export const callWithRequestFactory = (server, request) => { | ||
| return (...args) => { | ||
| return callWithRequest(server)(request, ...args); | ||
| }; | ||
| }; |
50 changes: 50 additions & 0 deletions
50
src/core_plugins/kibana/server/routes/api/remote_info/index.js
This file contains hidden or 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 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| /* | ||
| * 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 { callWithRequestFactory } from './call_with_request_factory'; | ||
|
|
||
| async function fetchRemoteClusters(callWithRequest) { | ||
| const options = { | ||
| method: 'GET', | ||
| path: '_remote/info' | ||
| }; | ||
| const remoteInfo = await callWithRequest('transport.request', options); | ||
| return Object.keys(remoteInfo); | ||
| } | ||
|
|
||
| export function registerClustersRoute(server) { | ||
| server.route({ | ||
| path: '/api/kibana/clusters', | ||
| method: 'GET', | ||
| handler: async request => { | ||
| const callWithRequest = callWithRequestFactory(server, request); | ||
| try { | ||
| return await fetchRemoteClusters(callWithRequest); | ||
| } catch (error) { | ||
| return error.body; | ||
|
||
| } | ||
| } | ||
| }); | ||
| } | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into a scenario where I had my remote cluster mis-configured, resulting in a 500 timeout error, but the UI remained stuck on loading. I think this area of the code could benefit from try/catch to handle ES errors from either of the requests, but I won't block the PR on that because the previous version didn't have good error handling either