Skip to content

Commit

Permalink
Pass reason from the alert fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Fernández Gómez committed Jul 27, 2021
1 parent 8087662 commit 1b2e712
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@
* 2.0.
*/

import { i18n } from '@kbn/i18n';
import { ALERT_ID } from '@kbn/rule-data-utils';
import { ALERT_REASON } from '@kbn/rule-data-utils';
import { ObservabilityRuleTypeFormatter } from '../../../../observability/public';

export const formatReason: ObservabilityRuleTypeFormatter = ({ fields }) => {
const groupName = fields[ALERT_ID];
const reason = i18n.translate('xpack.infra.metrics.alerting.inventory.alertReasonDescription', {
defaultMessage: 'Inventory alert for {groupName}.', // TEMP reason message, will be deleted once we index the reason field
values: {
groupName,
},
});

const link = '/app/metrics/inventory';
const reason = fields[ALERT_REASON] ?? '';
const link = '/app/metrics/inventory'; // FIXME? Not sure if we need to do something with this link

return {
reason,
Expand Down

0 comments on commit 1b2e712

Please sign in to comment.