Skip to content

Commit 3b02f6a

Browse files
bug: [DI-25992] - Set scope to optional in cloudpulse schema (#12441)
* upcoming: [DI-25992] - Add default value to edit alert page * bug: [DI-25992] - Update scope value to optional in cloudpulse schema * updated schema * updated schema value * bug: [DI-25992] - Updated CreateAlertDefinition form interface * added changeset
1 parent 01af55f commit 3b02f6a

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Fixed
3+
---
4+
5+
ACLP: change `scope` in `CreateAlertDefinitionForm` to optional ([#12441](https://github.com/linode/manager/pull/12441))

packages/manager/src/features/CloudPulse/Alerts/CreateAlert/GeneralInformation/AlertEntityScopeSelect.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface AlertEntityScopeSelectProps {
2525
formMode?: AlertFormMode;
2626
name: FieldPathByValue<
2727
CreateAlertDefinitionForm,
28-
AlertDefinitionScope | null
28+
AlertDefinitionScope | null | undefined
2929
>;
3030
serviceType: AlertServiceType | null;
3131
}
@@ -124,7 +124,7 @@ export const AlertEntityScopeSelect = (props: AlertEntityScopeSelectProps) => {
124124
textFieldProps={{
125125
labelTooltipText: ALERT_SCOPE_TOOLTIP_TEXT,
126126
}}
127-
value={getSelectedOption(field.value, options)}
127+
value={getSelectedOption(field?.value ?? null, options)}
128128
/>
129129
);
130130
}}

packages/manager/src/features/CloudPulse/Alerts/CreateAlert/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface CreateAlertDefinitionForm
2121
rule_criteria: {
2222
rules: MetricCriteriaForm[];
2323
};
24-
scope: AlertDefinitionScope | null;
24+
scope?: AlertDefinitionScope | null;
2525
serviceType: AlertServiceType | null;
2626
severity: AlertSeverityType | null;
2727
trigger_conditions: TriggerConditionForm;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/validation": Fixed
3+
---
4+
5+
ACLP: update `scope` property in `createAlertDefinitionSchema` and `editAlertDefinitionSchema` to optional and nullable ([#12441](https://github.com/linode/manager/pull/12441))

packages/validation/src/cloudpulse.schema.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,8 @@ export const createAlertDefinitionSchema = object({
7777
.min(1, 'At least one notification channel is required.'),
7878
tags: array().of(string().defined()).optional(),
7979
entity_ids: array().of(string().defined()).optional(),
80-
scope: string()
81-
.oneOf(['entity', 'region', 'account'])
82-
.defined()
83-
.required(fieldErrorMessage),
80+
regions: array().of(string().defined()).optional(),
81+
scope: string().oneOf(['entity', 'region', 'account']).nullable().optional(),
8482
});
8583

8684
export const editAlertDefinitionSchema = object({
@@ -124,5 +122,6 @@ export const editAlertDefinitionSchema = object({
124122
status: string()
125123
.oneOf(['enabled', 'disabled', 'in progress', 'failed'])
126124
.optional(),
127-
scope: string().oneOf(['entity', 'region', 'account']).required(),
125+
scope: string().oneOf(['entity', 'region', 'account']).nullable().optional(),
126+
regions: array().of(string().defined()).optional(),
128127
});

0 commit comments

Comments
 (0)