Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-13345-fixed-1769696812809.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

Replaced `name` to `label` for ACLP-Alerting CreateNotificationChannelForm interface to keep it consistent with API error message fields ([#13345](https://github.com/linode/manager/pull/13345))
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const overrides: CrumbOverridesProps[] = [

const initialValues: CreateNotificationChannelForm = {
type: null,
name: '',
label: '',
recipients: [],
};

Expand Down Expand Up @@ -105,7 +105,7 @@ export const CreateNotificationChannel = () => {
// Reset the name field when the channel type changes
const handleChannelTypeChange = (value: ChannelType | null) => {
field.onChange(value);
resetField('name', { defaultValue: '' });
resetField('label', { defaultValue: '' });
resetField('recipients', { defaultValue: [] });
};

Expand All @@ -124,7 +124,7 @@ export const CreateNotificationChannel = () => {
<Controller
control={control}
key={channelTypeWatcher}
name="name"
name="label"
render={({ field, fieldState }) => (
<TextField
{...field}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const specialStartRegex = /^[^a-zA-Z0-9]/;
const specialEndRegex = /[^a-zA-Z0-9]$/;

export const createNotificationChannelSchema = object({
name: string()
label: string()
.required(fieldErrorMessage)
.matches(
/^[^*#&+:<>"?@%{}\\/]+$/,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ChannelType } from '@linode/api-v4';

export interface CreateNotificationChannelForm {
name: string;
label: string;
recipients: string[];
type: ChannelType | null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export const filterCreateChannelFormValues = (
usernames: formValues.recipients,
},
},
label: formValues.name,
label: formValues.label,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ describe('EditNotificationChannel component', () => {

it('should show field-specific error when API returns field error', async () => {
queryMocks.mutateAsync.mockRejectedValue([
{ field: 'name', reason: 'Name already exists' },
{ field: 'label', reason: 'Name already exists' },
]);

const user = userEvent.setup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const EditNotificationChannel = (

const formMethods = useForm<CreateNotificationChannelForm>({
defaultValues: {
name: channelData.label,
label: channelData.label,
type: channelData.channel_type,
recipients:
channelData.channel_type === 'email'
Expand Down Expand Up @@ -124,7 +124,7 @@ export const EditNotificationChannel = (
/>
<Controller
control={control}
name="name"
name="label"
render={({ field, fieldState }) => (
<TextField
{...field}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const filterEditChannelFormValues = (
): EditNotificationChannelPayloadWithId => {
return {
channelId,
label: formValues.name,
label: formValues.label,
details: {
email: {
usernames: formValues.recipients,
Expand Down