diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx
index f7e9f5437fc3f..42d808da6d9ee 100644
--- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx
+++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.test.tsx
@@ -25,6 +25,7 @@ import { CurationsSettings } from './curations_settings';
describe('Curations', () => {
const values = {
+ // CurationsLogic
dataLoading: false,
curations: [
{
@@ -46,6 +47,8 @@ describe('Curations', () => {
},
},
selectedPageTab: 'overview',
+ // LicensingLogic
+ hasPlatinumLicense: true,
};
const actions = {
@@ -75,6 +78,20 @@ describe('Curations', () => {
tabs.at(2).simulate('click');
expect(actions.onSelectPageTab).toHaveBeenNthCalledWith(3, 'settings');
+ // The settings tab should NOT have an icon next to it
+ expect(tabs.at(2).prop('prepend')).toBeUndefined();
+ });
+
+ it('renders less tabs when less than platinum license', () => {
+ setMockValues({ ...values, hasPlatinumLicense: false });
+ const wrapper = shallow();
+
+ expect(getPageTitle(wrapper)).toEqual('Curated results');
+
+ const tabs = getPageHeaderTabs(wrapper).find(EuiTab);
+ expect(tabs.length).toBe(2);
+ // The settings tab should have an icon next to it
+ expect(tabs.at(1).prop('prepend')).not.toBeUndefined();
});
it('renders an overview view', () => {
diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.tsx
index c55fde7626488..7440e0cf42b44 100644
--- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.tsx
+++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/views/curations.tsx
@@ -9,8 +9,10 @@ import React, { useEffect } from 'react';
import { useValues, useActions } from 'kea';
+import { EuiIcon } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
+import { LicensingLogic } from '../../../../shared/licensing';
import { EuiButtonTo } from '../../../../shared/react_router_helpers';
import { ENGINE_CURATIONS_NEW_PATH } from '../../../routes';
@@ -28,39 +30,47 @@ import { CurationsSettings } from './curations_settings';
export const Curations: React.FC = () => {
const { dataLoading, curations, meta, selectedPageTab } = useValues(CurationsLogic);
const { loadCurations, onSelectPageTab } = useActions(CurationsLogic);
+ const { hasPlatinumLicense } = useValues(LicensingLogic);
- const pageTabs = [
- {
- label: i18n.translate(
- 'xpack.enterpriseSearch.appSearch.engine.curations.overviewPageTabLabel',
- {
- defaultMessage: 'Overview',
- }
- ),
- isSelected: selectedPageTab === 'overview',
- onClick: () => onSelectPageTab('overview'),
- },
- {
- label: i18n.translate(
- 'xpack.enterpriseSearch.appSearch.engine.curations.historyPageTabLabel',
- {
- defaultMessage: 'History',
- }
- ),
- isSelected: selectedPageTab === 'history',
- onClick: () => onSelectPageTab('history'),
- },
- {
- label: i18n.translate(
- 'xpack.enterpriseSearch.appSearch.engine.curations.settingsPageTabLabel',
+ const OVERVIEW_TAB = {
+ label: i18n.translate(
+ 'xpack.enterpriseSearch.appSearch.engine.curations.overviewPageTabLabel',
+ {
+ defaultMessage: 'Overview',
+ }
+ ),
+ isSelected: selectedPageTab === 'overview',
+ onClick: () => onSelectPageTab('overview'),
+ };
+
+ const HISTORY_TAB = {
+ label: i18n.translate('xpack.enterpriseSearch.appSearch.engine.curations.historyPageTabLabel', {
+ defaultMessage: 'History',
+ }),
+ isSelected: selectedPageTab === 'history',
+ onClick: () => onSelectPageTab('history'),
+ };
+
+ const SETTINGS_TAB = {
+ label: i18n.translate(
+ 'xpack.enterpriseSearch.appSearch.engine.curations.settingsPageTabLabel',
+ {
+ defaultMessage: 'Settings',
+ }
+ ),
+ isSelected: selectedPageTab === 'settings',
+ onClick: () => onSelectPageTab('settings'),
+ };
+
+ const pageTabs = hasPlatinumLicense
+ ? [OVERVIEW_TAB, HISTORY_TAB, SETTINGS_TAB]
+ : [
+ OVERVIEW_TAB,
{
- defaultMessage: 'Settings',
- }
- ),
- isSelected: selectedPageTab === 'settings',
- onClick: () => onSelectPageTab('settings'),
- },
- ];
+ ...SETTINGS_TAB,
+ prepend: ,
+ },
+ ];
useEffect(() => {
loadCurations();