Skip to content

Commit

Permalink
fixed license error message
Browse files Browse the repository at this point in the history
  • Loading branch information
YulNaumenko committed Dec 14, 2020
1 parent a1815da commit b5e8b8e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
5 changes: 3 additions & 2 deletions x-pack/plugins/alerts/server/lib/license_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { PLUGIN } from '../constants/plugin';
import { getAlertTypeFeatureUsageName } from './get_alert_type_feature_usage_name';
import { AlertType } from '../types';
import { AlertTypeDisabledError } from './errors/alert_type_disabled';
import { capitalize } from 'lodash';

export type ILicenseState = PublicMethodsOf<LicenseState>;

Expand Down Expand Up @@ -167,8 +168,8 @@ export class LicenseState {
throw new AlertTypeDisabledError(
i18n.translate('xpack.alerts.serverSideErrors.invalidLicenseErrorMessage', {
defaultMessage:
'Alert {alertTypeId} is disabled because it requires a Gold license. Contact your administrator to upgrade your license.',
values: { alertTypeId: alertType.id, licenseType: this.license!.type },
'Alert {alertTypeId} is disabled because it requires a {licenseType} license. Contact your administrator to upgrade your license.',
values: { alertTypeId: alertType.id, licenseType: capitalize(this.license!.type) },
}),
'license_invalid'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
EuiButton,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { AlertExecutionStatusErrorReasons } from '../../../../../../alerts/common';
import { hasAllPrivilege, hasExecuteActionsCapability } from '../../../lib/capabilities';
import { getAlertingSectionBreadcrumb, getAlertDetailsBreadcrumb } from '../../../lib/breadcrumb';
import { getCurrentDocTitle } from '../../../lib/doc_title';
Expand Down Expand Up @@ -66,6 +67,7 @@ export const AlertDetails: React.FunctionComponent<AlertDetailsProps> = ({
actionTypeRegistry,
setBreadcrumbs,
chrome,
http,
} = useKibana().services;
const [{}, dispatch] = useReducer(alertReducer, { alert });
const setInitialAlert = (value: Alert) => {
Expand Down Expand Up @@ -273,12 +275,31 @@ export const AlertDetails: React.FunctionComponent<AlertDetailsProps> = ({
{alert.executionStatus.error?.message}
</EuiText>
<EuiSpacer size="s" />
<EuiButton color="danger" onClick={() => setDissmissAlertErrors(true)}>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertDetails.dismissButtonTitle"
defaultMessage="Dismiss"
/>
</EuiButton>
<EuiFlexGroup gutterSize="s" wrap={true}>
<EuiFlexItem grow={false}>
<EuiButton color="danger" onClick={() => setDissmissAlertErrors(true)}>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertDetails.dismissButtonTitle"
defaultMessage="Dismiss"
/>
</EuiButton>
</EuiFlexItem>
{alert.executionStatus.error?.reason ===
AlertExecutionStatusErrorReasons.License && (
<EuiFlexItem grow={false}>
<EuiButtonEmpty
href={`${http.basePath.get()}/app/management/stack/license_management`}
color="danger"
target="_blank"
>
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertDetails.manageLicensePlanBannerLinkTitle"
defaultMessage="Manage license"
/>
</EuiButtonEmpty>
</EuiFlexItem>
)}
</EuiFlexGroup>
</EuiCallOut>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down

0 comments on commit b5e8b8e

Please sign in to comment.