Skip to content

Commit ceee986

Browse files
upcoming: [DI-28662] - Notification Channel Listing Action Items (#13203)
* upcoming: [DI-28662] - Notification Channel Listing Action Items * upcoming: [DI-28662] - Minor linting, code comment changes, updated UT * handle fallback, fix type value and factory * update to new type value * add changeset * use params prop for better type-safety * fix type-check failure in recently merged files
1 parent c05fffb commit ceee986

File tree

16 files changed

+207
-19
lines changed

16 files changed

+207
-19
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/api-v4": Changed
3+
---
4+
5+
AlertNotificationType from `custom | default` to `user | system` ([#13203](https://github.com/linode/manager/pull/13203))

packages/api-v4/src/cloudpulse/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export type MetricUnitType =
4141
| 'second';
4242
export type NotificationStatus = 'Disabled' | 'Enabled';
4343
export type ChannelType = 'email' | 'pagerduty' | 'slack' | 'webhook';
44-
export type AlertNotificationType = 'custom' | 'default';
44+
export type AlertNotificationType = 'system' | 'user';
4545
type AlertNotificationEmail = 'email';
4646
type AlertNotificationSlack = 'slack';
4747
type AlertNotificationPagerDuty = 'pagerduty';
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Upcoming Features
3+
---
4+
5+
Enable Action Item for ACLP-Alerting Notification Channel Listing ([#13203](https://github.com/linode/manager/pull/13203))

packages/manager/cypress/e2e/core/cloudpulse/alert-notification-channel-list.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const notificationChannels = notificationChannelFactory
5353
...ch,
5454
id: i + 1,
5555
label: `Channel-${i + 1}`,
56-
type: 'custom',
56+
type: 'user',
5757
created_by: 'user',
5858
updated_by: 'user',
5959
channel_type: 'email',
@@ -72,7 +72,7 @@ const notificationChannels = notificationChannelFactory
7272
...ch,
7373
id: i + 1,
7474
label: `Channel-${i + 1}`,
75-
type: 'default',
75+
type: 'system',
7676
created_by: 'system',
7777
updated_by: 'system',
7878
channel_type: 'webhook',

packages/manager/cypress/e2e/core/cloudpulse/create-user-alert.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const notificationChannels = notificationChannelFactory.build({
8181
channel_type: 'email',
8282
id: 1,
8383
label: 'channel-1',
84-
type: 'custom',
84+
type: 'user',
8585
});
8686

8787
const customAlertDefinition = alertDefinitionFactory.build({

packages/manager/cypress/e2e/core/cloudpulse/edit-user-alert.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const notificationChannels = notificationChannelFactory.build({
118118
channel_type: 'email',
119119
id: 1,
120120
label: 'Channel-1',
121-
type: 'custom',
121+
type: 'user',
122122
});
123123
const mockProfile = profileFactory.build({
124124
timezone: 'gmt',

packages/manager/src/factories/cloudpulse/channels.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const notificationChannelFactory =
2525
id: Factory.each((i) => i),
2626
label: Factory.each((id) => `Channel-${id}`),
2727
status: 'Enabled',
28-
type: 'custom',
28+
type: 'user',
2929
updated: new Date().toISOString(),
3030
updated_by: 'user1',
3131
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Paper } from '@linode/ui';
2+
import { useParams } from '@tanstack/react-router';
3+
import React from 'react';
4+
5+
export const NotificationChannelDetail = () => {
6+
const { channelId } = useParams({
7+
from: '/alerts/notification-channels/detail/$channelId',
8+
});
9+
// Placeholder content for Notification Channel Detail
10+
return <Paper>Notification Channel Details - id: {channelId}</Paper>;
11+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { createLazyRoute } from '@tanstack/react-router';
2+
3+
import { NotificationChannelDetail } from './NotificationChannelDetail';
4+
5+
export const cloudPulseAlertsNotificationChannelDetailLazyRoute =
6+
createLazyRoute('/alerts/notification-channels/detail/$channelId')({
7+
component: NotificationChannelDetail,
8+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React from 'react';
2+
3+
import { ActionMenu } from 'src/components/ActionMenu/ActionMenu';
4+
5+
import { getNotificationChannelActionsList } from '../Utils/utils';
6+
7+
import type { AlertNotificationType } from '@linode/api-v4';
8+
9+
export interface NotificationChannelActionHandlers {
10+
/**
11+
* Callback for show details action
12+
*/
13+
handleDetails: () => void;
14+
}
15+
16+
export interface NotificationChannelActionMenuProps {
17+
/**
18+
* The label of the Notification Channel
19+
*/
20+
channelLabel: string;
21+
/**
22+
* Handlers for actions like delete, show details, etc.,
23+
*/
24+
handlers: NotificationChannelActionHandlers;
25+
/**
26+
* Type of the notification channel
27+
*/
28+
notificationType: AlertNotificationType;
29+
}
30+
export const NotificationChannelActionMenu = (
31+
props: NotificationChannelActionMenuProps
32+
) => {
33+
const { channelLabel, handlers, notificationType } = props;
34+
35+
return (
36+
<ActionMenu
37+
actionsList={
38+
getNotificationChannelActionsList(handlers)[notificationType] || []
39+
}
40+
ariaLabel={`Action menu for Notification Channel ${channelLabel}`}
41+
/>
42+
);
43+
};

0 commit comments

Comments
 (0)