Skip to content

Commit

Permalink
Add tech preview label for search applications
Browse files Browse the repository at this point in the history
  • Loading branch information
ioanatia committed Apr 24, 2023
1 parent f5034e6 commit 4e6c110
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,44 +127,58 @@ export const CreateEngineFlyout = ({ onClose }: CreateEngineFlyoutProps) => {
)}
</EuiFlyoutHeader>
<EuiFlyoutBody>
<EuiSteps
steps={[
{
children: (
<IndicesSelectComboBox
fullWidth
isDisabled={formDisabled}
onChange={onIndicesChange}
selectedOptions={selectedIndices.map((index: string) => indexToOption(index))}
/>
),
status: indicesStatus,
title: i18n.translate(
'xpack.enterpriseSearch.content.engines.createEngine.selectIndices.title',
{ defaultMessage: 'Select indices' }
),
},
{
children: (
<EuiFieldText
fullWidth
disabled={formDisabled}
placeholder={i18n.translate(
'xpack.enterpriseSearch.content.engines.createEngine.nameEngine.placeholder',
{ defaultMessage: 'Search Application name' }
)}
value={engineName}
onChange={(e) => setEngineName(e.target.value)}
/>
),
status: engineNameStatus,
title: i18n.translate(
'xpack.enterpriseSearch.content.engines.createEngine.nameEngine.title',
{ defaultMessage: 'Name your Search Application' }
),
},
]}
/>
<EuiFlexGroup direction="column">
<EuiFlexItem grow>
<EuiCallOut title="Technical Preview feature" color="warning" iconType="beaker">
<p>
This functionality is in technical preview and may be changed or removed completely
in a future release. Elastic will take a best effort approach to fix any issues, but
features in technical preview are not subject to the support SLA of official GA
features.
</p>
</EuiCallOut>
</EuiFlexItem>
<EuiFlexItem grow>
<EuiSteps
steps={[
{
children: (
<IndicesSelectComboBox
fullWidth
isDisabled={formDisabled}
onChange={onIndicesChange}
selectedOptions={selectedIndices.map((index: string) => indexToOption(index))}
/>
),
status: indicesStatus,
title: i18n.translate(
'xpack.enterpriseSearch.content.engines.createEngine.selectIndices.title',
{ defaultMessage: 'Select indices' }
),
},
{
children: (
<EuiFieldText
fullWidth
disabled={formDisabled}
placeholder={i18n.translate(
'xpack.enterpriseSearch.content.engines.createEngine.nameEngine.placeholder',
{ defaultMessage: 'Search Application name' }
)}
value={engineName}
onChange={(e) => setEngineName(e.target.value)}
/>
),
status: engineNameStatus,
title: i18n.translate(
'xpack.enterpriseSearch.content.engines.createEngine.nameEngine.title',
{ defaultMessage: 'Name your Search Application' }
),
},
]}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlyoutBody>
<EuiFlyoutFooter>
<EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,34 +120,6 @@ describe('EnginesList', () => {

describe('CreateEngineButton', () => {
describe('disabled={true}', () => {
it('renders a disabled button that shows a popover when focused', () => {
const wrapper = mount(<CreateEngineButton disabled />);

const button = wrapper.find(
'button[data-test-subj="enterprise-search-content-engines-creation-button"]'
);

expect(button).toHaveLength(1);
expect(button.prop('disabled')).toBeTruthy();

let popover = wrapper.find('div[data-test-subj="create-engine-button-popover-content"]');

expect(popover).toHaveLength(0);

const hoverTarget = wrapper.find('div[data-test-subj="create-engine-button-hover-target"]');

expect(hoverTarget).toHaveLength(1);

hoverTarget.simulate('focus');

wrapper.update();

popover = wrapper.find('div[data-test-subj="create-engine-button-popover-content"]');

expect(popover).toHaveLength(1);
expect(popover.text()).toMatch('Search Applications require a Platinum license');
});

it('renders a disabled button that shows a popover when hovered', () => {
const wrapper = mount(<CreateEngineButton disabled />);

Expand All @@ -173,37 +145,13 @@ describe('CreateEngineButton', () => {
popover = wrapper.find('div[data-test-subj="create-engine-button-popover-content"]');

expect(popover).toHaveLength(1);
expect(popover.text()).toMatch('Search Applications require a Platinum license');
expect(popover.text()).toMatch(
'This functionality is in technical preview and may be changed or removed completely in a future release.'
);
});
});
describe('disabled={false}', () => {
it('renders a button and does not show a popover when focused', () => {
const wrapper = mount(<CreateEngineButton disabled={false} />);

const button = wrapper.find(
'button[data-test-subj="enterprise-search-content-engines-creation-button"]'
);

expect(button).toHaveLength(1);
expect(button.prop('disabled')).toBeFalsy();

let popover = wrapper.find('div[data-test-subj="create-engine-button-popover-content"]');

expect(popover).toHaveLength(0);

const hoverTarget = wrapper.find('div[data-test-subj="create-engine-button-hover-target"]');

expect(hoverTarget).toHaveLength(1);

hoverTarget.simulate('focus');

wrapper.update();

popover = wrapper.find('div[data-test-subj="create-engine-button-popover-content"]');

expect(popover).toHaveLength(0);
});
it('renders a button and does not show a popover when hovered', () => {
it('renders a button and shows a popover when hovered', () => {
const wrapper = mount(<CreateEngineButton disabled={false} />);

const button = wrapper.find(
Expand All @@ -227,7 +175,10 @@ describe('CreateEngineButton', () => {

popover = wrapper.find('div[data-test-subj="create-engine-button-popover-content"]');

expect(popover).toHaveLength(0);
expect(popover).toHaveLength(1);
expect(popover.text()).toMatch(
'This functionality is in technical preview and may be changed or removed completely in a future release.'
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { docLinks } from '../../../shared/doc_links';

import { KibanaLogic } from '../../../shared/kibana';
import { LicensingLogic } from '../../../shared/licensing';
import { EXPLORE_PLATINUM_FEATURES_LINK } from '../../../workplace_search/constants';
import { ENGINES_PATH, ENGINE_CREATION_PATH } from '../../routes';
import { EnterpriseSearchEnginesPageTemplate } from '../layout/engines_page_template';

Expand All @@ -52,13 +51,13 @@ export const CreateEngineButton: React.FC<CreateEngineButtonProps> = ({ disabled

return (
<EuiPopover
isOpen={disabled && showPopover}
isOpen={showPopover}
closePopover={() => setShowPopover(false)}
button={
<div
data-test-subj="create-engine-button-hover-target"
onMouseEnter={() => setShowPopover(true)}
onFocus={() => setShowPopover(true)}
onMouseLeave={() => setShowPopover(false)}
tabIndex={0}
>
<EuiButton
Expand All @@ -81,21 +80,18 @@ export const CreateEngineButton: React.FC<CreateEngineButtonProps> = ({ disabled
>
<EuiPopoverTitle>
<FormattedMessage
id="xpack.enterpriseSearch.content.searchApplications.createEngineDisabledPopover.title"
defaultMessage="Platinum only feature"
id="xpack.enterpriseSearch.content.searchApplications.createEngineTechnicalPreviewPopover.title"
defaultMessage="Technical Preview"
/>
</EuiPopoverTitle>
<div style={{ width: '300px' }} data-test-subj="create-engine-button-popover-content">
<EuiFlexGroup direction="column" gutterSize="m">
<EuiText size="s">
<FormattedMessage
id="xpack.enterpriseSearch.content.searchApplications.createEngineDisabledPopover.body"
defaultMessage="Search Applications require a Platinum license or higher and are not available to Standard license self-managed deployments."
id="xpack.enterpriseSearch.content.searchApplications.createEngineTechnicalPreviewPopover.body"
defaultMessage="This functionality is in technical preview and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but features in technical preview are not subject to the support SLA of official GA features."
/>
</EuiText>
<EuiLink target="_blank" href={docLinks.licenseManagement}>
{EXPLORE_PLATINUM_FEATURES_LINK}
</EuiLink>
</EuiFlexGroup>
</div>
</EuiPopover>
Expand Down

0 comments on commit 4e6c110

Please sign in to comment.