Skip to content

Commit 4bfc77e

Browse files
Merge branch 'develop' into UIE-9910
2 parents 7bc85dc + 1ba4648 commit 4bfc77e

File tree

17 files changed

+151
-22
lines changed

17 files changed

+151
-22
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+
ACLP-Alerting: Notification Channel types to support API changes and backward compatibility ([#13227](https://github.com/linode/manager/pull/13227))

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

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ type AlertNotificationEmail = 'email';
4646
type AlertNotificationSlack = 'slack';
4747
type AlertNotificationPagerDuty = 'pagerduty';
4848
type AlertNotificationWebHook = 'webhook';
49+
type EmailRecipientType =
50+
| 'admin_users'
51+
| 'read_users'
52+
| 'read_write_users'
53+
| 'user';
4954
export interface Dashboard {
5055
created: string;
5156
group_by?: string[];
@@ -298,29 +303,48 @@ interface NotificationChannelBase {
298303

299304
interface NotificationChannelEmail extends NotificationChannelBase {
300305
channel_type: AlertNotificationEmail;
301-
content: {
306+
content?: {
302307
email: {
303308
email_addresses: string[];
304309
message: string;
305310
subject: string;
306311
};
307312
};
313+
details?: {
314+
email: {
315+
recipient_type: EmailRecipientType;
316+
usernames: string[];
317+
};
318+
};
308319
}
309320

310321
interface NotificationChannelSlack extends NotificationChannelBase {
311322
channel_type: AlertNotificationSlack;
312-
content: {
323+
content?: {
313324
slack: {
314325
message: string;
315326
slack_channel: string;
316327
slack_webhook_url: string;
317328
};
318329
};
330+
details?: {
331+
slack: {
332+
slack_channel: string;
333+
slack_webhook_url: string;
334+
};
335+
};
319336
}
320337

321338
interface NotificationChannelPagerDuty extends NotificationChannelBase {
322339
channel_type: AlertNotificationPagerDuty;
323-
content: {
340+
content?: {
341+
pagerduty: {
342+
attributes: string[];
343+
description: string;
344+
service_api_key: string;
345+
};
346+
};
347+
details?: {
324348
pagerduty: {
325349
attributes: string[];
326350
description: string;
@@ -330,12 +354,27 @@ interface NotificationChannelPagerDuty extends NotificationChannelBase {
330354
}
331355
interface NotificationChannelWebHook extends NotificationChannelBase {
332356
channel_type: AlertNotificationWebHook;
333-
content: {
357+
content?: {
358+
webhook: {
359+
http_headers: {
360+
header_key: string;
361+
header_value: string;
362+
}[];
363+
webhook_url: string;
364+
};
365+
};
366+
details?: {
334367
webhook: {
368+
alert_body: {
369+
body: string;
370+
subject: string;
371+
};
335372
http_headers: {
336373
header_key: string;
337374
header_value: string;
338375
}[];
376+
method: 'GET' | 'POST' | 'PUT';
377+
request_body: string;
339378
webhook_url: string;
340379
};
341380
};
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+
Exclude newly added unsaved Rule Sets from dropdown for the given Firewall ([#13226](https://github.com/linode/manager/pull/13226))
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+
Null and Undefined checks in components and tests to support ACLP-Alerting: Notification Channel Type changes ([#13227](https://github.com/linode/manager/pull/13227))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Added
3+
---
4+
5+
New feature marker in navigation menu and primary breadcrumbs of `CloudPulse metrics` ([#13230](https://github.com/linode/manager/pull/13230))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const isEmailContent = (
101101
message: string;
102102
subject: string;
103103
};
104-
} => 'email' in content;
104+
} => content !== undefined && 'email' in content;
105105
const mockProfile = profileFactory.build({
106106
timezone: 'gmt',
107107
});

packages/manager/cypress/e2e/core/cloudpulse/cloudpulse-navigation.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ describe('Moniter navigation', () => {
2222
it('can navigate to metrics landing page', () => {
2323
mockAppendFeatureFlags({
2424
aclp: {
25-
beta: true,
25+
beta: false,
2626
enabled: true,
27+
new: true,
2728
},
2829
}).as('getFeatureFlags');
2930

3031
cy.visitWithLogin('/linodes');
3132
cy.wait('@getFeatureFlags');
32-
33+
cy.get('[data-testid="menu-item-Metrics"]').within(() => {
34+
cy.get('[data-testid="newFeatureChip"]').should('be.visible'); // check for new feature chip
35+
});
3336
cy.get('[data-testid="menu-item-Metrics"]').should('be.visible').click();
3437
cy.url().should('endWith', '/metrics');
3538
});

packages/manager/src/components/PrimaryNav/PrimaryNav.test.tsx

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ describe('PrimaryNav', () => {
228228
aclp: {
229229
beta: true,
230230
enabled: true,
231+
new: true,
231232
},
232233
aclpAlerting: {
233234
accountAlertLimit: 10,
@@ -239,7 +240,7 @@ describe('PrimaryNav', () => {
239240
},
240241
};
241242

242-
const { findAllByTestId, findByText } = renderWithTheme(
243+
const { findAllByTestId, findByText, queryByTestId } = renderWithTheme(
243244
<PrimaryNav {...props} />,
244245
{
245246
flags,
@@ -249,12 +250,57 @@ describe('PrimaryNav', () => {
249250
const monitorMetricsDisplayItem = await findByText('Metrics');
250251
const monitorAlertsDisplayItem = await findByText('Alerts');
251252
const betaChip = await findAllByTestId('betaChip');
253+
const newFeatureChip = queryByTestId('newFeatureChip');
254+
expect(newFeatureChip).toBeNull(); // when beta is true, only beta chip is shown not new chip
252255

253256
expect(monitorMetricsDisplayItem).toBeVisible();
254257
expect(monitorAlertsDisplayItem).toBeVisible();
255258
expect(betaChip).toHaveLength(2);
256259
});
257260

261+
it('shoud show beta chip next to Metrics menu item if the user has the account capability and aclp feature flag has new true', async () => {
262+
const account = accountFactory.build({
263+
capabilities: ['Akamai Cloud Pulse'],
264+
});
265+
266+
queryMocks.useAccount.mockReturnValue({
267+
data: account,
268+
isLoading: false,
269+
error: null,
270+
});
271+
272+
const flags = {
273+
aclp: {
274+
beta: false,
275+
enabled: true,
276+
new: true,
277+
},
278+
aclpAlerting: {
279+
accountAlertLimit: 10,
280+
accountMetricLimit: 10,
281+
alertDefinitions: true,
282+
beta: true,
283+
notificationChannels: false,
284+
recentActivity: false,
285+
},
286+
};
287+
288+
const { findByText, findByTestId } = renderWithTheme(
289+
<PrimaryNav {...props} />,
290+
{
291+
flags,
292+
}
293+
);
294+
295+
const monitorMetricsDisplayItem = await findByText('Metrics');
296+
const monitorAlertsDisplayItem = await findByText('Alerts');
297+
const newFeatureChip = await findByTestId('newFeatureChip');
298+
299+
expect(monitorMetricsDisplayItem).toBeVisible();
300+
expect(monitorAlertsDisplayItem).toBeVisible();
301+
expect(newFeatureChip).toBeVisible();
302+
});
303+
258304
it('should not show Metrics and Alerts menu items if the user has the account capability but the aclp feature flag is not enabled', async () => {
259305
const account = accountFactory.build({
260306
capabilities: ['Akamai Cloud Pulse'],

packages/manager/src/components/PrimaryNav/PrimaryNav.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ export const PrimaryNav = (props: PrimaryNavProps) => {
243243
hide: !isACLPEnabled,
244244
to: '/metrics',
245245
isBeta: flags.aclp?.beta,
246+
isNew: !flags.aclp?.beta && flags.aclp?.new,
246247
},
247248
{
248249
display: 'Alerts',

packages/manager/src/featureFlags.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ interface AclpFlag {
104104
*/
105105
humanizableUnits?: string[];
106106

107+
/**
108+
* This property indicates whether the feature is new or not
109+
*/
110+
new?: boolean;
111+
107112
/**
108113
* This property indicates whether to show widget dimension filters or not
109114
*/

0 commit comments

Comments
 (0)