-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enterprise Search] Rewire overview designs. (#130066)
* Rewire overview page with new designs - Fix issues caused by VS Code - Bind add content button for empty prompt - Add content icons to assets - Add text for icons and tooltip - Add link to Elasticsearch Guide - Add context menu for create button - Add some more css changes that VS Code deleted - Add Header popover to show deployment details - Filter SVG colors * Fix some issues * Review changes * Revert some more changes * Fix i18n issues * Lint fixes for sass file * Re-fix linting * Add render tests * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * Update x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/layout/kibana_header_actions.tsx Co-authored-by: Scotty Bollinger <[email protected]> * Add tests for overview content Also made some changes to reduce the churn when we implement this feature Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Scotty Bollinger <[email protected]>
- Loading branch information
1 parent
43f0312
commit cb48e11
Showing
22 changed files
with
955 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
.../applications/enterprise_search_overview/components/layout/kibana_header_actions.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { mount } from 'enzyme'; | ||
|
||
import { EuiPopover, EuiButtonEmpty } from '@elastic/eui'; | ||
|
||
import { EnterpriseSearchOverviewHeaderActions } from './kibana_header_actions'; | ||
|
||
describe('Enterprise Search overview HeaderActions', () => { | ||
it('renders', () => { | ||
const wrapper = mount(<EnterpriseSearchOverviewHeaderActions />); | ||
const popover = wrapper.find(EuiPopover); | ||
|
||
expect(popover.find(EuiButtonEmpty).text()).toContain('Deployment details'); | ||
expect(popover.prop('isOpen')).toBeFalsy(); | ||
}); | ||
|
||
it('opens popover when clicked', () => { | ||
const wrapper = mount(<EnterpriseSearchOverviewHeaderActions />); | ||
|
||
expect(wrapper.find(EuiPopover).prop('isOpen')).toBeFalsy(); | ||
wrapper.find(EuiPopover).find(EuiButtonEmpty).simulate('click'); | ||
wrapper.update(); | ||
|
||
expect(wrapper.find(EuiPopover).prop('isOpen')).toBeTruthy(); | ||
}); | ||
}); |
115 changes: 115 additions & 0 deletions
115
...ublic/applications/enterprise_search_overview/components/layout/kibana_header_actions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React, { useState } from 'react'; | ||
|
||
import { | ||
EuiHeaderLinks, | ||
EuiIcon, | ||
EuiCopy, | ||
EuiButton, | ||
EuiButtonEmpty, | ||
EuiButtonIcon, | ||
EuiPopover, | ||
EuiFormRow, | ||
EuiFieldText, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiSpacer, | ||
EuiPopoverTitle, | ||
EuiPopoverFooter, | ||
EuiText, | ||
} from '@elastic/eui'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const EnterpriseSearchOverviewHeaderActions: React.FC = () => { | ||
const [isPopoverOpen, setIsPopoverOpen] = useState(false); | ||
// TODO change it with actual value | ||
// TODO make this conditional only for users on cloud, as on-prem users will not have a deployment id to show. | ||
const clientId = 'fgdshjafghj13eshfdjag718yfhjdskf'; | ||
|
||
return ( | ||
<EuiHeaderLinks> | ||
<EuiPopover | ||
button={ | ||
<EuiButtonEmpty onClick={() => setIsPopoverOpen(!isPopoverOpen)}> | ||
<EuiIcon type="iInCircle" /> | ||
| ||
{i18n.translate('xpack.enterpriseSearch.overview.deploymentDetails', { | ||
defaultMessage: 'Deployment details', | ||
})} | ||
</EuiButtonEmpty> | ||
} | ||
isOpen={isPopoverOpen} | ||
closePopover={() => setIsPopoverOpen(false)} | ||
> | ||
<EuiPopoverTitle> | ||
{i18n.translate('xpack.enterpriseSearch.overview.deploymentDetails', { | ||
defaultMessage: 'Deployment details', | ||
})} | ||
</EuiPopoverTitle> | ||
<EuiText grow={false}> | ||
<p> | ||
{i18n.translate('xpack.enterpriseSearch.overview.deploymentDetails.description', { | ||
defaultMessage: | ||
'Send data to Elastic from your applications by referencing your deployment and Elasticsearch information.', | ||
})} | ||
</p> | ||
</EuiText> | ||
<EuiSpacer /> | ||
<EuiFormRow | ||
fullWidth | ||
label={i18n.translate('xpack.enterpriseSearch.overview.deploymentDetails.clientIdLabel', { | ||
defaultMessage: 'Client ID', | ||
})} | ||
> | ||
<EuiFlexGroup alignItems="center"> | ||
<EuiFlexItem grow> | ||
<EuiFieldText readOnly value={clientId} fullWidth /> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiCopy | ||
beforeMessage={i18n.translate( | ||
'xpack.enterpriseSearch.overview.deploymentDetails.copyToClipboard', | ||
{ defaultMessage: 'Copy to clipboard' } | ||
)} | ||
afterMessage={i18n.translate( | ||
'xpack.enterpriseSearch.overview.deploymentDetails.copiedToClipboard', | ||
{ defaultMessage: 'Copied Client ID to clipboard' } | ||
)} | ||
textToCopy={clientId} | ||
> | ||
{(copy) => ( | ||
<EuiButtonIcon | ||
aria-label={i18n.translate( | ||
'xpack.enterpriseSearch.overview.deploymentDetails.copyButtonAriaLabel', | ||
{ defaultMessage: 'Copy to clipboard' } | ||
)} | ||
onClick={copy} | ||
iconType="copyClipboard" | ||
color="primary" | ||
display="base" | ||
size="s" | ||
/> | ||
)} | ||
</EuiCopy> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFormRow> | ||
<EuiPopoverFooter> | ||
{/* TODO need link to Create and manage API keys*/} | ||
<EuiButton> | ||
{i18n.translate('xpack.enterpriseSearch.overview.createAndManageButton', { | ||
defaultMessage: 'Create and manage API keys', | ||
})} | ||
</EuiButton> | ||
</EuiPopoverFooter> | ||
</EuiPopover> | ||
</EuiHeaderLinks> | ||
); | ||
}; |
8 changes: 8 additions & 0 deletions
8
...earch/public/applications/enterprise_search_overview/components/overview_content/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { OverviewContent } from './overview_content'; |
73 changes: 73 additions & 0 deletions
73
...ications/enterprise_search_overview/components/overview_content/overview_content.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { setMockValues } from '../../../__mocks__/kea_logic'; | ||
|
||
import React from 'react'; | ||
|
||
import { shallow } from 'enzyme'; | ||
|
||
import { EuiEmptyPrompt } from '@elastic/eui'; | ||
|
||
import { AddContentEmptyPrompt } from '../../../shared/add_content_empty_prompt'; | ||
import { GettingStartedSteps } from '../../../shared/getting_started_steps'; | ||
|
||
import { LicenseCallout } from '../license_callout'; | ||
import { SetupGuideCta } from '../setup_guide'; | ||
import { TrialCallout } from '../trial_callout'; | ||
|
||
import { OverviewContent } from '.'; | ||
|
||
describe('OverviewContent', () => { | ||
const props = { | ||
access: {}, | ||
isWorkplaceSearchAdmin: true, | ||
}; | ||
|
||
it('renders the overview page, Getting Started steps & setup guide CTAs with no host set', () => { | ||
setMockValues({ config: { host: '' } }); | ||
const wrapper = shallow(<OverviewContent {...props} />); | ||
|
||
expect(wrapper.find(GettingStartedSteps)).toHaveLength(1); | ||
expect(wrapper.find(AddContentEmptyPrompt)).toHaveLength(1); | ||
expect(wrapper.find(SetupGuideCta)).toHaveLength(1); | ||
expect(wrapper.find(LicenseCallout)).toHaveLength(0); | ||
}); | ||
|
||
it('renders the trial callout', () => { | ||
setMockValues({ config: { host: 'localhost' } }); | ||
const wrapper = shallow(<OverviewContent {...props} />); | ||
|
||
expect(wrapper.find(TrialCallout)).toHaveLength(1); | ||
}); | ||
|
||
// TODO Refactor this and other tests according to the search indices permissions | ||
describe('access checks when host is set', () => { | ||
beforeEach(() => { | ||
setMockValues({ config: { host: 'localhost' } }); | ||
}); | ||
|
||
it('renders the license callout when user has access to a product', () => { | ||
setMockValues({ config: { host: 'localhost' } }); | ||
const wrapper = shallow( | ||
<OverviewContent {...props} access={{ hasWorkplaceSearchAccess: true }} /> | ||
); | ||
|
||
expect(wrapper.find(LicenseCallout)).toHaveLength(1); | ||
}); | ||
|
||
it('renders empty prompt and overview or license callout if the user does not have access', () => { | ||
const wrapper = shallow(<OverviewContent {...props} />); | ||
|
||
expect(wrapper.find(EuiEmptyPrompt)).toHaveLength(1); | ||
expect(wrapper.find(GettingStartedSteps)).toHaveLength(0); | ||
expect(wrapper.find(AddContentEmptyPrompt)).toHaveLength(0); | ||
expect(wrapper.find(LicenseCallout)).toHaveLength(0); | ||
expect(wrapper.find(SetupGuideCta)).toHaveLength(0); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.