Skip to content

Commit

Permalink
[7.8] [Metrics UI] Fix default metric alert interval for new conditio…
Browse files Browse the repository at this point in the history
…ns (#66610) (#66677)
  • Loading branch information
Zacqary authored May 15, 2020
1 parent e183896 commit d3da9d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ export const Expressions: React.FC<Props> = props => {

const addExpression = useCallback(() => {
const exp = alertParams.criteria?.slice() || [];
exp.push(defaultExpression);
exp.push({
...defaultExpression,
timeSize: timeSize ?? defaultExpression.timeSize,
timeUnit: timeUnit ?? defaultExpression.timeUnit,
});
setAlertParams('criteria', exp);
}, [setAlertParams, alertParams.criteria]);
}, [setAlertParams, alertParams.criteria, timeSize, timeUnit]);

const removeExpression = useCallback(
(id: number) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ export const Expressions: React.FC<Props> = props => {
);

const addExpression = useCallback(() => {
const exp = alertParams.criteria.slice();
exp.push(defaultExpression);
const exp = alertParams.criteria?.slice() || [];
exp.push({
...defaultExpression,
timeSize: timeSize ?? defaultExpression.timeSize,
timeUnit: timeUnit ?? defaultExpression.timeUnit,
});
setAlertParams('criteria', exp);
}, [setAlertParams, alertParams.criteria]);
}, [setAlertParams, alertParams.criteria, timeSize, timeUnit]);

const removeExpression = useCallback(
(id: number) => {
Expand Down

0 comments on commit d3da9d2

Please sign in to comment.