diff --git a/public/pages/Alerts/components/CorrelationAlertFlyout/CorrelationAlertFlyout.tsx b/public/pages/Alerts/components/CorrelationAlertFlyout/CorrelationAlertFlyout.tsx index 1a0fd731..8217c8de 100644 --- a/public/pages/Alerts/components/CorrelationAlertFlyout/CorrelationAlertFlyout.tsx +++ b/public/pages/Alerts/components/CorrelationAlertFlyout/CorrelationAlertFlyout.tsx @@ -32,13 +32,13 @@ import { import { parseAlertSeverityToOption } from '../../../CreateDetector/components/ConfigureAlerts/utils/helpers'; import { NotificationsStart } from 'opensearch-dashboards/public'; import { DataStore } from '../../../../store/DataStore'; - import { CorrelationAlertColumns, Finding } from '../../../../../types'; + import { CorrelationAlertTableItem, Finding } from '../../../../../types'; export interface CorrelationAlertFlyoutProps { - alertItem: CorrelationAlertColumns; + alertItem: CorrelationAlertTableItem; notifications: NotificationsStart; onClose: () => void; - onAcknowledge: (selectedItems: CorrelationAlertColumns[]) => void; + onAcknowledge: (selectedItems: CorrelationAlertTableItem[]) => void; } export interface CorrelationAlertFlyoutState { diff --git a/public/pages/Alerts/containers/Alerts/Alerts.tsx b/public/pages/Alerts/containers/Alerts/Alerts.tsx index eb36e6b8..7137a55d 100644 --- a/public/pages/Alerts/containers/Alerts/Alerts.tsx +++ b/public/pages/Alerts/containers/Alerts/Alerts.tsx @@ -59,7 +59,7 @@ import { import { NotificationsStart } from 'opensearch-dashboards/public'; import { match, RouteComponentProps, withRouter } from 'react-router-dom'; import { ChartContainer } from '../../../../components/Charts/ChartContainer'; -import { AlertItem, CorrelationAlertColumns, DataSourceProps, DateTimeFilter, Detector } from '../../../../../types'; +import { AlertItem, CorrelationAlertTableItem, DataSourceProps, DateTimeFilter, Detector } from '../../../../../types'; import { DurationRange } from '@elastic/eui/src/components/date_picker/types'; import { DataStore } from '../../../../store/DataStore'; @@ -80,13 +80,13 @@ export interface AlertsState { groupBy: string; recentlyUsedRanges: DurationRange[]; selectedItems: AlertItem[]; - correlatedItems: CorrelationAlertColumns[]; + correlatedItems: CorrelationAlertTableItem[]; alerts: AlertItem[]; - correlationAlerts: CorrelationAlertColumns[]; + correlationAlerts: CorrelationAlertTableItem[]; flyoutData?: { alertItem: AlertItem }; - flyoutCorrelationData?: { alertItem: CorrelationAlertColumns }; + flyoutCorrelationData?: { alertItem: CorrelationAlertTableItem }; alertsFiltered: boolean; - filteredCorrelationAlerts: CorrelationAlertColumns[]; + filteredCorrelationAlerts: CorrelationAlertTableItem[]; filteredAlerts: AlertItem[]; detectors: { [key: string]: Detector }; loading: boolean; @@ -328,7 +328,7 @@ export class Alerts extends Component { ]; } - getCorrelationColumns(): EuiBasicTableColumn[] { + getCorrelationColumns(): EuiBasicTableColumn[] { return [ { field: 'start_time', @@ -349,7 +349,7 @@ export class Alerts extends Component { name: 'Correlation Rule Name', sortable: true, dataType: 'string', - render: (correlationRulename: string, alertItem: CorrelationAlertColumns) => ( + render: (correlationRulename: string, alertItem: CorrelationAlertTableItem) => ( this.setCorrelationFlyout(alertItem)}>{correlationRulename} ), }, @@ -380,7 +380,7 @@ export class Alerts extends Component { sortable: false, actions: [ { - render: (alertItem: CorrelationAlertColumns) => { + render: (alertItem: CorrelationAlertTableItem) => { const disableAcknowledge = alertItem.state !== ALERT_STATE.ACTIVE; return ( { }, }, { - render: (alertItem: CorrelationAlertColumns) => ( + render: (alertItem: CorrelationAlertTableItem) => ( { this.setState({ flyoutData: alertItem ? { alertItem } : undefined }); } - setCorrelationFlyout(alertItem?: CorrelationAlertColumns): void { + setCorrelationFlyout(alertItem?: CorrelationAlertTableItem): void { this.setState({ flyoutCorrelationData: alertItem ? { alertItem } : undefined }); } @@ -452,7 +452,7 @@ export class Alerts extends Component { }); } - generateCorrelationVisualizationSpec(alerts: CorrelationAlertColumns[]) { + generateCorrelationVisualizationSpec(alerts: CorrelationAlertTableItem[]) { const visData = alerts.map((alert) => { const time = new Date(alert.start_time); time.setMilliseconds(0); @@ -632,7 +632,7 @@ export class Alerts extends Component { this.setState({ selectedItems }); }; - onCorrelationSelectionChange = (correlatedItems: CorrelationAlertColumns[]) => { + onCorrelationSelectionChange = (correlatedItems: CorrelationAlertTableItem[]) => { this.setState({ correlatedItems }); }; @@ -674,7 +674,7 @@ export class Alerts extends Component { this.onRefresh(); }; - onAcknowledgeCorrelationAlert = async (selectedItems: CorrelationAlertColumns[] = []) => { + onAcknowledgeCorrelationAlert = async (selectedItems: CorrelationAlertTableItem[] = []) => { const { correlationService, notifications } = this.props; let successCount = 0; try { @@ -806,9 +806,9 @@ export class Alerts extends Component { selectableMessage: (selectable) => (selectable ? '' : DISABLE_ACKNOWLEDGED_ALERT_HELP_TEXT), }; - const correlationSelection: EuiTableSelectionType = { + const correlationSelection: EuiTableSelectionType = { onSelectionChange: this.onCorrelationSelectionChange, - selectable: (item: CorrelationAlertColumns) => item.state === ALERT_STATE.ACTIVE, + selectable: (item: CorrelationAlertTableItem) => item.state === ALERT_STATE.ACTIVE, selectableMessage: (selectable) => (selectable ? '' : DISABLE_ACKNOWLEDGED_ALERT_HELP_TEXT), }; diff --git a/public/pages/Correlations/containers/CreateCorrelationRule.tsx b/public/pages/Correlations/containers/CreateCorrelationRule.tsx index 9c914fb4..c6810fd4 100644 --- a/public/pages/Correlations/containers/CreateCorrelationRule.tsx +++ b/public/pages/Correlations/containers/CreateCorrelationRule.tsx @@ -979,11 +979,12 @@ export const CreateCorrelationRule: React.FC = ( > {createForm(queries, touched, errors, props)} - + +

Alert Trigger

diff --git a/types/Alert.ts b/types/Alert.ts index fb575d7d..2d3b56ef 100644 --- a/types/Alert.ts +++ b/types/Alert.ts @@ -105,7 +105,7 @@ export interface CorrelationAlertItem { acknowledged_time: string | null; } -export interface CorrelationAlertColumns extends CorrelationAlertItem{ +export interface CorrelationAlertTableItem extends CorrelationAlertItem{ correlation_rule_categories: string[]; }