mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Management] Improve messaging with no index patterns (#16718)
* Improve messaging with no index patterns * Updated copy * Adjust messaging
This commit is contained in:
parent
7164adb282
commit
dd7241a501
4 changed files with 78 additions and 8 deletions
|
@ -87,3 +87,31 @@ exports[`StatusMessage should render without a query 1`] = `
|
|||
</EuiTextColor>
|
||||
</EuiText>
|
||||
`;
|
||||
|
||||
exports[`StatusMessage should show that no indices exist 1`] = `
|
||||
<EuiText
|
||||
size="s"
|
||||
>
|
||||
<EuiTextColor
|
||||
color="default"
|
||||
>
|
||||
<span>
|
||||
No Elasticsearch indices match your pattern.
|
||||
</span>
|
||||
</EuiTextColor>
|
||||
</EuiText>
|
||||
`;
|
||||
|
||||
exports[`StatusMessage should show that system indices exist 1`] = `
|
||||
<EuiText
|
||||
size="s"
|
||||
>
|
||||
<EuiTextColor
|
||||
color="default"
|
||||
>
|
||||
<span>
|
||||
No Elasticsearch indices match your pattern. To view the matching system indices, toggle the switch in the upper right.
|
||||
</span>
|
||||
</EuiTextColor>
|
||||
</EuiText>
|
||||
`;
|
||||
|
|
|
@ -69,4 +69,28 @@ describe('StatusMessage', () => {
|
|||
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should show that system indices exist', () => {
|
||||
const component = shallow(
|
||||
<StatusMessage
|
||||
matchedIndices={[]}
|
||||
isIncludingSystemIndices={false}
|
||||
query={''}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should show that no indices exist', () => {
|
||||
const component = shallow(
|
||||
<StatusMessage
|
||||
matchedIndices={[]}
|
||||
isIncludingSystemIndices={true}
|
||||
query={''}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,10 +8,11 @@ import {
|
|||
|
||||
export const StatusMessage = ({
|
||||
matchedIndices: {
|
||||
allIndices,
|
||||
exactMatchedIndices,
|
||||
partialMatchedIndices
|
||||
allIndices = [],
|
||||
exactMatchedIndices = [],
|
||||
partialMatchedIndices = []
|
||||
},
|
||||
isIncludingSystemIndices,
|
||||
query,
|
||||
}) => {
|
||||
let statusIcon;
|
||||
|
@ -21,13 +22,29 @@ export const StatusMessage = ({
|
|||
if (query.length === 0) {
|
||||
statusIcon = null;
|
||||
statusColor = 'default';
|
||||
statusMessage = allIndices.length > 1
|
||||
? (
|
||||
|
||||
if (allIndices.length > 1) {
|
||||
statusMessage = (
|
||||
<span>
|
||||
Your index pattern can match any of your <strong>{allIndices.length} indices</strong>, below.
|
||||
</span>
|
||||
)
|
||||
: (<span>You only have a single index. You can create an index pattern to match it.</span>);
|
||||
);
|
||||
}
|
||||
else if (!isIncludingSystemIndices) {
|
||||
statusMessage = (
|
||||
<span>
|
||||
No Elasticsearch indices match your pattern. To view the matching system indices, toggle the switch in the upper right.
|
||||
</span>
|
||||
);
|
||||
}
|
||||
else {
|
||||
// This should never really happen but let's handle it just in case
|
||||
statusMessage = (
|
||||
<span>
|
||||
No Elasticsearch indices match your pattern.
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (exactMatchedIndices.length) {
|
||||
statusIcon = 'check';
|
||||
|
|
|
@ -112,7 +112,7 @@ export class StepIndexPattern extends Component {
|
|||
}
|
||||
|
||||
renderStatusMessage(matchedIndices) {
|
||||
const { query, isLoadingIndices, indexPatternExists } = this.state;
|
||||
const { query, isLoadingIndices, indexPatternExists, isIncludingSystemIndices } = this.state;
|
||||
|
||||
if (isLoadingIndices || indexPatternExists) {
|
||||
return null;
|
||||
|
@ -121,6 +121,7 @@ export class StepIndexPattern extends Component {
|
|||
return (
|
||||
<StatusMessage
|
||||
matchedIndices={matchedIndices}
|
||||
isIncludingSystemIndices={isIncludingSystemIndices}
|
||||
query={query}
|
||||
/>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue