[SIEM] Link ML Rule card CTA to license_management (#63210)

* Link ML Rule card CTA to license_management

Taking the user directly to the license management page within kibana
(where they could immediately start a trial subscription) is much more
actionable than taking them to the subscriptions marketing page.

* Revert translation key change

Neither of these is totally accurate, and there've already been
translations written for the old one.
This commit is contained in:
Ryland Herrick 2020-04-10 14:00:11 -05:00 committed by GitHub
parent aed5253b53
commit d8a295dcbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,9 +19,16 @@ import {
import { isMlRule } from '../../../../../../common/detection_engine/ml_helpers';
import { RuleType } from '../../../../../../common/detection_engine/types';
import { FieldHook } from '../../../../../shared_imports';
import { useKibana } from '../../../../../lib/kibana';
import * as i18n from './translations';
const MlCardDescription = ({ hasValidLicense = false }: { hasValidLicense?: boolean }) => (
const MlCardDescription = ({
subscriptionUrl,
hasValidLicense = false,
}: {
subscriptionUrl: string;
hasValidLicense?: boolean;
}) => (
<EuiText size="s">
{hasValidLicense ? (
i18n.ML_TYPE_DESCRIPTION
@ -31,7 +38,7 @@ const MlCardDescription = ({ hasValidLicense = false }: { hasValidLicense?: bool
defaultMessage="Access to ML requires a {subscriptionsLink}."
values={{
subscriptionsLink: (
<EuiLink href="https://www.elastic.co/subscriptions" target="_blank">
<EuiLink href={subscriptionUrl} target="_blank">
<FormattedMessage
id="xpack.siem.components.stepDefineRule.ruleTypeField.subscriptionsLink"
defaultMessage="Platinum subscription"
@ -69,6 +76,9 @@ export const SelectRuleType: React.FC<SelectRuleTypeProps> = ({
const setMl = useCallback(() => setType('machine_learning'), [setType]);
const setQuery = useCallback(() => setType('query'), [setType]);
const mlCardDisabled = isReadOnly || !hasValidLicense || !isMlAdmin;
const licensingUrl = useKibana().services.application.getUrlForApp('kibana', {
path: '#/management/elasticsearch/license_management',
});
return (
<EuiFormRow
@ -95,7 +105,9 @@ export const SelectRuleType: React.FC<SelectRuleTypeProps> = ({
<EuiCard
data-test-subj="machineLearningRuleType"
title={i18n.ML_TYPE_TITLE}
description={<MlCardDescription hasValidLicense={hasValidLicense} />}
description={
<MlCardDescription subscriptionUrl={licensingUrl} hasValidLicense={hasValidLicense} />
}
icon={<EuiIcon size="l" type="machineLearningApp" />}
isDisabled={mlCardDisabled}
selectable={{