mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Fixed callouts (#115631)
This commit is contained in:
parent
fe471cea57
commit
1da11dfdc0
2 changed files with 19 additions and 1 deletions
|
@ -26,6 +26,8 @@ const MOCK_VALUES = {
|
|||
},
|
||||
},
|
||||
},
|
||||
// LicensingLogic
|
||||
hasPlatinumLicense: true,
|
||||
};
|
||||
|
||||
describe('SuggestedCurationsCallout', () => {
|
||||
|
@ -56,4 +58,14 @@ describe('SuggestedCurationsCallout', () => {
|
|||
|
||||
expect(wrapper.isEmptyRender()).toBe(true);
|
||||
});
|
||||
|
||||
it('is empty when the user has no platinum license', () => {
|
||||
// This would happen if the user *had* suggestions and then downgraded from platinum to gold or something
|
||||
const values = set('hasPlatinumLicense', false, MOCK_VALUES);
|
||||
setMockValues(values);
|
||||
|
||||
const wrapper = shallow(<SuggestedCurationsCallout />);
|
||||
|
||||
expect(wrapper.isEmptyRender()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,6 +10,7 @@ import { useValues } from 'kea';
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { LicensingLogic } from '../../../../shared/licensing';
|
||||
import { ENGINE_CURATIONS_PATH } from '../../../routes';
|
||||
import { SuggestionsCallout } from '../../curations/components/suggestions_callout';
|
||||
import { EngineLogic, generateEnginePath } from '../../engine';
|
||||
|
@ -18,10 +19,15 @@ export const SuggestedCurationsCallout: React.FC = () => {
|
|||
const {
|
||||
engine: { search_relevance_suggestions: searchRelevanceSuggestions },
|
||||
} = useValues(EngineLogic);
|
||||
const { hasPlatinumLicense } = useValues(LicensingLogic);
|
||||
|
||||
const pendingCount = searchRelevanceSuggestions?.curation.pending;
|
||||
|
||||
if (typeof searchRelevanceSuggestions === 'undefined' || pendingCount === 0) {
|
||||
if (
|
||||
typeof searchRelevanceSuggestions === 'undefined' ||
|
||||
pendingCount === 0 ||
|
||||
hasPlatinumLicense === false
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue