Skip to content
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

Fixes index pattern wizard when there are remote clusters but no local indices #24339

Merged
Merged
Show file tree
Hide file tree
Changes from all 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 Oct 22, 2018
4c4e4ba
revert mistaken commit
mattkime Oct 22, 2018
d2eb357
minor cleanup
mattkime Oct 22, 2018
1a966bf
add test
mattkime Oct 22, 2018
dfb3f37
fix http request
mattkime Oct 22, 2018
c5d48b5
Merge branch 'master' into index-pattern-wizard-cluster-fix-mattk
mattkime Oct 22, 2018
f4259ac
Merge remote-tracking branch 'elastic/master' into index-pattern-wiza…
mattkime Oct 22, 2018
75b0ee5
fix tests, add snapshot
mattkime Oct 22, 2018
885843a
add timeout to functional test
mattkime Oct 23, 2018
9427dcd
Update doc_level_security_roles.js
mattkime Oct 23, 2018
ae572ad
Merge branch 'master' into index-pattern-wizard-cluster-fix-mattk
mattkime Oct 24, 2018
871ee5c
fix typos
mattkime Oct 24, 2018
833b987
Merge branch 'index-pattern-wizard-cluster-fix-mattk' of github.com:m…
mattkime Oct 24, 2018
bbb3732
revert unneeded changes
mattkime Oct 24, 2018
9705784
Merge branch 'master' into index-pattern-wizard-cluster-fix-mattk
mattkime Oct 25, 2018
631274f
Merge branch 'index-pattern-wizard-cluster-fix-mattk' of github.com:m…
mattkime Oct 25, 2018
67fa885
merge
mattkime Oct 25, 2018
ef26dbd
snap snap
mattkime Oct 25, 2018
e3e78f5
Merge branch 'master' of github.com:elastic/kibana into index-pattern…
mattkime Oct 29, 2018
de94309
cross cluster search is oos
mattkime Oct 29, 2018
3f4002e
Merge branch 'master' into index-pattern-wizard-cluster-fix-mattk
mattkime Nov 8, 2018
ed7a6f2
catch errors
mattkime Nov 8, 2018
b768e73
add toast notifs if unable to load data
mattkime Nov 9, 2018
811ae9a
Merge branch 'master' into index-pattern-wizard-cluster-fix-mattk
mattkime Nov 10, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/core_plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { managementApi } from './server/routes/api/management';
import { scriptsApi } from './server/routes/api/scripts';
import { registerSuggestionsApi } from './server/routes/api/suggestions';
import { registerKqlTelemetryApi } from './server/routes/api/kql_telemetry';
import { registerClustersRoute } from './server/routes/api/remote_info';
import { registerFieldFormats } from './server/field_formats/register';
import { registerTutorials } from './server/tutorials/register';
import * as systemApi from './server/lib/system_api';
Expand Down Expand Up @@ -167,6 +168,7 @@ export default function (kibana) {
registerFieldFormats(server);
registerTutorials(server);
makeKQLUsageCollector(server);
registerClustersRoute(server);
server.expose('systemApi', systemApi);
server.expose('handleEsError', handleEsError);
server.injectUiAppVars('kibana', () => injectVars(server));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,132 +1,205 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CreateIndexPatternWizard defaults to the loading state 1`] = `
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
<React.Fragment>
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<LoadingState />
</div>
<EuiGlobalToastList
dismissToast={[Function]}
toastLifeTimeMs={6000}
toasts={Array []}
/>
<LoadingState />
</div>
</React.Fragment>
`;

exports[`CreateIndexPatternWizard renders index pattern step when there are indices 1`] = `
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<StepIndexPattern
allIndices={
Array [
<React.Fragment>
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<StepIndexPattern
allIndices={
Array [
Object {
"name": "myIndexPattern",
},
]
}
esService={Object {}}
goToNextStep={[Function]}
indexPatternCreationType={
Object {
"name": "myIndexPattern",
},
]
}
esService={Object {}}
goToNextStep={[Function]}
indexPatternCreationType={
Object {
"checkIndicesForErrors": [Function],
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getIsBeta": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
"checkIndicesForErrors": [Function],
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getIsBeta": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
}
}
}
initialQuery=""
isIncludingSystemIndices={false}
savedObjectsClient={Object {}}
initialQuery=""
isIncludingSystemIndices={false}
savedObjectsClient={Object {}}
/>
</div>
<EuiGlobalToastList
dismissToast={[Function]}
toastLifeTimeMs={6000}
toasts={Array []}
/>
</div>
</React.Fragment>
`;

exports[`CreateIndexPatternWizard renders the empty state when there are no indices 1`] = `
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<EmptyState
onRefresh={[Function]}
<React.Fragment>
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<EmptyState
onRefresh={[Function]}
/>
</div>
<EuiGlobalToastList
dismissToast={[Function]}
toastLifeTimeMs={6000}
toasts={Array []}
/>
</div>
</React.Fragment>
`;

exports[`CreateIndexPatternWizard renders time field step when step is set to 2 1`] = `
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
<React.Fragment>
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<StepTimeField
createIndexPattern={[Function]}
goToPreviousStep={[Function]}
indexPattern=""
indexPatternCreationType={
Object {
"checkIndicesForErrors": [Function],
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getIsBeta": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
}
}
indexPatternsService={Object {}}
/>
</div>
<EuiGlobalToastList
dismissToast={[Function]}
toastLifeTimeMs={6000}
toasts={Array []}
/>
<StepTimeField
createIndexPattern={[Function]}
goToPreviousStep={[Function]}
indexPattern=""
indexPatternCreationType={
Object {
"checkIndicesForErrors": [Function],
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getIsBeta": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
</React.Fragment>
`;

exports[`CreateIndexPatternWizard renders when there are no indices but there are remote clusters 1`] = `
<React.Fragment>
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<StepIndexPattern
allIndices={Array []}
esService={Object {}}
goToNextStep={[Function]}
indexPatternCreationType={
Object {
"checkIndicesForErrors": [Function],
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getIsBeta": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
}
}
}
indexPatternsService={Object {}}
initialQuery=""
isIncludingSystemIndices={false}
savedObjectsClient={Object {}}
/>
</div>
<EuiGlobalToastList
dismissToast={[Function]}
toastLifeTimeMs={6000}
toasts={Array []}
/>
</div>
</React.Fragment>
`;

exports[`CreateIndexPatternWizard shows system indices even if there are no other indices if the include system indices is toggled 1`] = `
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={true}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<StepIndexPattern
allIndices={
Array [
<React.Fragment>
<div>
<Header
indexPatternName="name"
isBeta={false}
isIncludingSystemIndices={true}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<StepIndexPattern
allIndices={
Array [
Object {
"name": ".kibana ",
},
]
}
esService={Object {}}
goToNextStep={[Function]}
indexPatternCreationType={
Object {
"name": ".kibana ",
},
]
}
esService={Object {}}
goToNextStep={[Function]}
indexPatternCreationType={
Object {
"checkIndicesForErrors": [Function],
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getIsBeta": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
"checkIndicesForErrors": [Function],
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getIsBeta": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
}
}
}
initialQuery=""
isIncludingSystemIndices={true}
savedObjectsClient={Object {}}
initialQuery=""
isIncludingSystemIndices={true}
savedObjectsClient={Object {}}
/>
</div>
<EuiGlobalToastList
dismissToast={[Function]}
toastLifeTimeMs={6000}
toasts={Array []}
/>
</div>
</React.Fragment>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jest.mock('../lib/get_indices', () => ({
];
},
}));
jest.mock('ui/chrome', () => ({
addBasePath: () => { },
}));

const loadingDataDocUrl = '';
const initialQuery = '';
Expand Down Expand Up @@ -80,6 +83,26 @@ describe('CreateIndexPatternWizard', () => {
component.setState({
isInitiallyLoadingIndices: false,
allIndices: [],
remoteClustersExist: false
});

await component.update();
expect(component).toMatchSnapshot();
});

it('renders when there are no indices but there are remote clusters', async () => {
const component = shallow(
<CreateIndexPatternWizard
loadingDataDocUrl={loadingDataDocUrl}
initialQuery={initialQuery}
services={services}
/>
);

component.setState({
isInitiallyLoadingIndices: false,
allIndices: [],
remoteClustersExist: true
});

await component.update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jest.mock('ui/chrome', () => ({
getUiSettingsClient: () => ({
get: () => '',
}),
addBasePath: () => { },
}));

const { renderCreateIndexPatternWizard, destroyCreateIndexPatternWizard } = require('../render');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jest.mock('ui/chrome', () => ({
getUiSettingsClient: () => ({
get: () => '',
}),
addBasePath: () => { },
}));

jest.mock('../../../lib/get_indices', () => ({
Expand All @@ -62,7 +63,7 @@ const esService = {};
const savedObjectsClient = {
find: () => ({ savedObjects: [] })
};
const goToNextStep = () => {};
const goToNextStep = () => { };

const createComponent = props => {
return shallowWithIntl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jest.mock('../components/action_buttons', () => ({ ActionButtons: 'ActionButtons
jest.mock('../../../lib/extract_time_fields', () => ({
extractTimeFields: fields => fields,
}));
jest.mock('ui/chrome', () => ({
addBasePath: () => { },
}));

const mockIndexPatternCreationType = {
getIndexPatternType: () => 'default',
Expand Down
Loading