Skip to content

Commit 876a616

Browse files
committed
Remove check around crawler button in DocumentCreationButtons
- primarily a UI thing - ideally we always want to show 4 buttons
1 parent 2207a1b commit 876a616

File tree

2 files changed

+28
-53
lines changed

2 files changed

+28
-53
lines changed

x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.test.tsx

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import { DocumentCreationButtons } from './';
1616
describe('DocumentCreationButtons', () => {
1717
const values = {
1818
engineName: 'test-engine',
19-
isSampleEngine: false,
20-
myRole: { canViewEngineCrawler: true },
2119
};
2220
const actions = {
2321
openDocumentCreation: jest.fn(),
@@ -56,25 +54,9 @@ describe('DocumentCreationButtons', () => {
5654
expect(actions.openDocumentCreation).toHaveBeenCalledWith('api');
5755
});
5856

59-
describe('crawler card', () => {
60-
it('renders the crawler button with a link to the crawler page', () => {
61-
const wrapper = shallow(<DocumentCreationButtons />);
62-
63-
expect(wrapper.find(EuiCardTo).prop('to')).toEqual('/engines/test-engine/crawler');
64-
});
65-
66-
it('does not render the crawler button if the user does not have access', () => {
67-
setMockValues({ ...values, myRole: { canViewEngineCrawler: false } });
68-
const wrapper = shallow(<DocumentCreationButtons />);
69-
70-
expect(wrapper.find(EuiCardTo)).toHaveLength(0);
71-
});
72-
73-
it('does not render the crawler button for the sample engine', () => {
74-
setMockValues({ ...values, isSampleEngine: true });
75-
const wrapper = shallow(<DocumentCreationButtons />);
57+
it('renders the crawler button with a link to the crawler page', () => {
58+
const wrapper = shallow(<DocumentCreationButtons />);
7659

77-
expect(wrapper.find(EuiCardTo)).toHaveLength(0);
78-
});
60+
expect(wrapper.find(EuiCardTo).prop('to')).toEqual('/engines/test-engine/crawler');
7961
});
8062
});

x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_buttons.tsx

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222

2323
import { EuiCardTo } from '../../../shared/react_router_helpers';
2424
import { DOCS_PREFIX, getEngineRoute, ENGINE_CRAWLER_PATH } from '../../routes';
25-
import { AppLogic } from '../../app_logic';
2625
import { EngineLogic } from '../engine';
2726

2827
import { DocumentCreationLogic } from './';
@@ -34,11 +33,7 @@ interface Props {
3433
export const DocumentCreationButtons: React.FC<Props> = ({ disabled = false }) => {
3534
const { openDocumentCreation } = useActions(DocumentCreationLogic);
3635

37-
const { engineName, isSampleEngine } = useValues(EngineLogic);
38-
const {
39-
myRole: { canViewEngineCrawler },
40-
} = useValues(AppLogic);
41-
const showCrawlerLink = canViewEngineCrawler && !isSampleEngine;
36+
const { engineName } = useValues(EngineLogic);
4237
const crawlerLink = getEngineRoute(engineName) + ENGINE_CRAWLER_PATH;
4338

4439
return (
@@ -61,7 +56,7 @@ export const DocumentCreationButtons: React.FC<Props> = ({ disabled = false }) =
6156
</p>
6257
</EuiText>
6358
<EuiSpacer />
64-
<EuiFlexGrid columns={showCrawlerLink ? 2 : 3}>
59+
<EuiFlexGrid columns={2}>
6560
<EuiFlexItem>
6661
<EuiCard
6762
title={i18n.translate(
@@ -98,31 +93,29 @@ export const DocumentCreationButtons: React.FC<Props> = ({ disabled = false }) =
9893
isDisabled={disabled}
9994
/>
10095
</EuiFlexItem>
101-
{showCrawlerLink && (
102-
<EuiFlexItem>
103-
<EuiCardTo
104-
title={i18n.translate(
105-
'xpack.enterpriseSearch.appSearch.documentCreation.buttons.crawl',
106-
{ defaultMessage: 'Use the Crawler' }
107-
)}
108-
description=""
109-
icon={<EuiIcon type="globe" size="xxl" color="primary" />}
110-
betaBadgeLabel={i18n.translate(
111-
'xpack.enterpriseSearch.appSearch.documentCreation.buttons.betaTitle',
112-
{ defaultMessage: 'Beta' }
113-
)}
114-
betaBadgeTooltipContent={i18n.translate(
115-
'xpack.enterpriseSearch.appSearch.documentCreation.buttons.betaTooltip',
116-
{
117-
defaultMessage:
118-
'The Elastic Crawler is not GA. Please help us by reporting any bugs.',
119-
}
120-
)}
121-
to={crawlerLink}
122-
isDisabled={disabled}
123-
/>
124-
</EuiFlexItem>
125-
)}
96+
<EuiFlexItem>
97+
<EuiCardTo
98+
title={i18n.translate(
99+
'xpack.enterpriseSearch.appSearch.documentCreation.buttons.crawl',
100+
{ defaultMessage: 'Use the Crawler' }
101+
)}
102+
description=""
103+
icon={<EuiIcon type="globe" size="xxl" color="primary" />}
104+
betaBadgeLabel={i18n.translate(
105+
'xpack.enterpriseSearch.appSearch.documentCreation.buttons.betaTitle',
106+
{ defaultMessage: 'Beta' }
107+
)}
108+
betaBadgeTooltipContent={i18n.translate(
109+
'xpack.enterpriseSearch.appSearch.documentCreation.buttons.betaTooltip',
110+
{
111+
defaultMessage:
112+
'The Elastic Crawler is not GA. Please help us by reporting any bugs.',
113+
}
114+
)}
115+
to={crawlerLink}
116+
isDisabled={disabled}
117+
/>
118+
</EuiFlexItem>
126119
</EuiFlexGrid>
127120
</>
128121
);

0 commit comments

Comments
 (0)