[Management] Show internal indices when toggled even if there are no other indices (#19618)

* Ensure we only show the empty state component if they have no data indices AND the include system indices is not checked

* Add snapshot test for bug find
This commit is contained in:
Chris Roberson 2018-06-04 09:11:51 -04:00 committed by GitHub
parent 92c9ad7276
commit ff601039b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 1 deletions

View file

@ -59,3 +59,26 @@ exports[`CreateIndexPatternWizard renders time field step when step is set to 2
/>
</div>
`;
exports[`CreateIndexPatternWizard shows system indices even if there are no other indices if the include system indices is toggled 1`] = `
<div>
<Header
isIncludingSystemIndices={true}
onChangeIncludingSystemIndices={[Function]}
/>
<StepIndexPattern
allIndices={
Array [
Object {
"name": ".kibana ",
},
]
}
esService={Object {}}
goToNextStep={[Function]}
initialQuery=""
isIncludingSystemIndices={true}
savedObjectsClient={Object {}}
/>
</div>
`;

View file

@ -77,6 +77,25 @@ describe('CreateIndexPatternWizard', () => {
expect(component).toMatchSnapshot();
});
it('shows system indices even if there are no other indices if the include system indices is toggled', async () => {
const component = shallow(
<CreateIndexPatternWizard
loadingDataDocUrl={loadingDataDocUrl}
initialQuery={initialQuery}
services={services}
/>
);
component.setState({
isInitiallyLoadingIndices: false,
isIncludingSystemIndices: true,
allIndices: [{ name: '.kibana ' }]
});
await component.update();
expect(component).toMatchSnapshot();
});
it('renders index pattern step when there are indices', async () => {
const component = shallow(
<CreateIndexPatternWizard

View file

@ -125,7 +125,7 @@ export class CreateIndexPatternWizard extends Component {
}
const hasDataIndices = allIndices.some(({ name }) => !name.startsWith('.'));
if (!hasDataIndices) {
if (!hasDataIndices && !isIncludingSystemIndices) {
return <EmptyState onRefresh={this.fetchIndices} />;
}