Skip to content

Commit f7cdf54

Browse files
authored
fix: [M3-10482] - Add missing firewall_apply event messages (linode#12685)
* firewall event message fixes * Added changeset: Missing `firewall_apply` event messages * other firewall messages * add todo comment * spacing * Added changeset: Temporarily fix Linode Interface `firewall_device_add` event message * update messages based on feedback * address feedback @cpathipa * update type
1 parent 3788573 commit f7cdf54

File tree

3 files changed

+54
-7
lines changed

3 files changed

+54
-7
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+
Missing `firewall_apply` event messages ([#12685](https://github.com/linode/manager/pull/12685))
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+
Temporarily fix Linode Interface `firewall_device_add` event message ([#12685](https://github.com/linode/manager/pull/12685))

packages/manager/src/features/Events/factories/firewall.tsx

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,55 @@
1+
import { capitalize } from '@linode/utilities';
12
import * as React from 'react';
23

34
import { formattedTypes } from 'src/features/Firewalls/FirewallDetail/Devices/constants';
45

56
import { EventLink } from '../EventLink';
67

78
import type { PartialEventMap } from '../types';
9+
import type { Event } from '@linode/api-v4';
810
import type { FirewallDeviceEntityType } from '@linode/api-v4';
911

12+
const entityPrefix = (e: Event) => {
13+
const type = e?.entity?.type ? capitalize(e.entity.type) : null;
14+
15+
return type ? (
16+
<>
17+
{type} <EventLink event={e} to="entity" />{' '}
18+
</>
19+
) : null;
20+
};
21+
1022
export const firewall: PartialEventMap<'firewall'> = {
1123
firewall_apply: {
12-
notification: (e) => (
13-
<>
14-
Firewall <EventLink event={e} to="entity" /> has been{' '}
15-
<strong>applied</strong>.
16-
</>
17-
),
24+
failed: (e) => {
25+
return (
26+
<>
27+
{entityPrefix(e)} Firewall update could <strong>not</strong> be{' '}
28+
<strong>applied</strong>.
29+
</>
30+
);
31+
},
32+
finished: (e) => {
33+
return (
34+
<>
35+
{entityPrefix(e)} Firewall update has been <strong>applied</strong>.
36+
</>
37+
);
38+
},
39+
scheduled: (e) => {
40+
return (
41+
<>
42+
{entityPrefix(e)} Firewall update is <strong>scheduled</strong>.
43+
</>
44+
);
45+
},
46+
started: (e) => {
47+
return (
48+
<>
49+
{entityPrefix(e)} Firewall update has <strong>started</strong>.
50+
</>
51+
);
52+
},
1853
},
1954
firewall_create: {
2055
notification: (e) => (
@@ -34,8 +69,10 @@ export const firewall: PartialEventMap<'firewall'> = {
3469
firewall_device_add: {
3570
notification: (e) => {
3671
if (e.secondary_entity?.type) {
72+
// TODO - Linode Interfaces [M3-10447] - clean this up when API ticket [VPC-3359] is completed
3773
const secondaryEntityName =
38-
formattedTypes[e.secondary_entity.type as FirewallDeviceEntityType];
74+
formattedTypes[e.secondary_entity.type as FirewallDeviceEntityType] ??
75+
'Linode Interface';
3976
return (
4077
<>
4178
{secondaryEntityName} <EventLink event={e} to="secondaryEntity" />{' '}

0 commit comments

Comments
 (0)