Skip to content

Commit

Permalink
upcoming: [DI-22132] - Refactor alert criteria component
Browse files Browse the repository at this point in the history
  • Loading branch information
vmangalr committed Jan 6, 2025
1 parent 776f305 commit e3c57c9
Showing 1 changed file with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ interface CriteriaProps {
}

export const AlertDetailCriteria = React.memo((props: CriteriaProps) => {
const { alertDetails: alert } = props;
const { alertDetails } = props;

const {
evaluation_period_seconds: evaluationPeriod,
polling_interval_seconds: pollingIntervalSeconds,
trigger_occurrences: triggerOccurrences,
} = alert.trigger_conditions;
} = alertDetails.trigger_conditions;

const { rule_criteria: ruleCriteria = { rules: [] } } = alert;
const { rule_criteria: ruleCriteria = { rules: [] } } = alertDetails;

const theme = useTheme();

Expand Down Expand Up @@ -77,22 +77,20 @@ export const AlertDetailCriteria = React.memo((props: CriteriaProps) => {
<Typography marginBottom={2} variant="h2">
Criteria
</Typography>
{Boolean(ruleCriteria.rules.length) && (
<Grid alignItems="center" container spacing={1}>
<RenderAlertMetricsAndDimensions ruleCriteria={ruleCriteria} />
<DisplayAlertDetailChips // label chip for polling interval
label="Polling Interval"
mergeChips
values={[convertSecondsToMinutes(pollingIntervalSeconds)]}
/>
<DisplayAlertDetailChips // label chip for evaluation period
label="Evaluation Periods"
mergeChips
values={[convertSecondsToMinutes(evaluationPeriod)]}
/>
{renderTriggerCriteria} {/** Render the trigger criteria */}
</Grid>
)}
<Grid alignItems="center" container spacing={1}>
<RenderAlertMetricsAndDimensions ruleCriteria={ruleCriteria} />
<DisplayAlertDetailChips // label chip for polling interval
label="Polling Interval"
mergeChips
values={[convertSecondsToMinutes(pollingIntervalSeconds)]}
/>
<DisplayAlertDetailChips // label chip for evaluation period
label="Evaluation Periods"
mergeChips
values={[convertSecondsToMinutes(evaluationPeriod)]}
/>
{renderTriggerCriteria} {/** Render the trigger criteria */}
</Grid>
</>
);
});

0 comments on commit e3c57c9

Please sign in to comment.