[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:
parent
92c9ad7276
commit
ff601039b0
|
@ -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>
|
||||
`;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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} />;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue