mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -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', () => {
|
describe('SuggestedCurationsCallout', () => {
|
||||||
|
@ -56,4 +58,14 @@ describe('SuggestedCurationsCallout', () => {
|
||||||
|
|
||||||
expect(wrapper.isEmptyRender()).toBe(true);
|
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 { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
|
import { LicensingLogic } from '../../../../shared/licensing';
|
||||||
import { ENGINE_CURATIONS_PATH } from '../../../routes';
|
import { ENGINE_CURATIONS_PATH } from '../../../routes';
|
||||||
import { SuggestionsCallout } from '../../curations/components/suggestions_callout';
|
import { SuggestionsCallout } from '../../curations/components/suggestions_callout';
|
||||||
import { EngineLogic, generateEnginePath } from '../../engine';
|
import { EngineLogic, generateEnginePath } from '../../engine';
|
||||||
|
@ -18,10 +19,15 @@ export const SuggestedCurationsCallout: React.FC = () => {
|
||||||
const {
|
const {
|
||||||
engine: { search_relevance_suggestions: searchRelevanceSuggestions },
|
engine: { search_relevance_suggestions: searchRelevanceSuggestions },
|
||||||
} = useValues(EngineLogic);
|
} = useValues(EngineLogic);
|
||||||
|
const { hasPlatinumLicense } = useValues(LicensingLogic);
|
||||||
|
|
||||||
const pendingCount = searchRelevanceSuggestions?.curation.pending;
|
const pendingCount = searchRelevanceSuggestions?.curation.pending;
|
||||||
|
|
||||||
if (typeof searchRelevanceSuggestions === 'undefined' || pendingCount === 0) {
|
if (
|
||||||
|
typeof searchRelevanceSuggestions === 'undefined' ||
|
||||||
|
pendingCount === 0 ||
|
||||||
|
hasPlatinumLicense === false
|
||||||
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue