Browse Source

type comparisonDelta can be null in saved incidents (#29308)

Taylan Gocmen 3 years ago
parent
commit
7ad44b549e

+ 1 - 1
static/app/actionCreators/events.tsx

@@ -46,7 +46,7 @@ type Options = {
  * @param {String[]} options.team List of teams to query for
  * @param {String} options.period Time period to query for, in the format: <integer><units> where units are "d" or "h"
  * @param {String} options.interval Time interval to group results in, in the format: <integer><units> where units are "d", "h", "m", "s"
- * @param {String} options.comparisonDelta Comparison delta
+ * @param {Number} options.comparisonDelta Comparison delta for change alert event stats to include comparison stats
  * @param {Boolean} options.includePrevious Should request also return reqsults for previous period?
  * @param {Number} options.limit The number of rows to return
  * @param {String} options.query Search query

+ 4 - 5
static/app/views/alerts/incidentRules/ruleForm/index.tsx

@@ -122,11 +122,10 @@ class RuleFormContainer extends AsyncComponent<Props, State> {
       triggers: triggersClone,
       resolveThreshold: rule.resolveThreshold,
       thresholdType: rule.thresholdType,
-      comparisonDelta: rule.comparisonDelta,
-      comparisonType:
-        rule.comparisonDelta === undefined || rule.comparisonDelta === null
-          ? AlertRuleComparisonType.COUNT
-          : AlertRuleComparisonType.CHANGE,
+      comparisonDelta: rule.comparisonDelta ?? undefined,
+      comparisonType: !rule.comparisonDelta
+        ? AlertRuleComparisonType.COUNT
+        : AlertRuleComparisonType.CHANGE,
       projects: [this.props.project],
       owner: rule.owner,
     };

+ 1 - 1
static/app/views/alerts/incidentRules/types.tsx

@@ -77,7 +77,7 @@ export type UnsavedIncidentRule = {
   aggregate: string;
   thresholdType: AlertRuleThresholdType;
   resolveThreshold: number | '' | null;
-  comparisonDelta?: number;
+  comparisonDelta?: number | null;
   eventTypes?: EventTypes[];
   owner?: string | null;
 };