Skip to content

Commit c63d15b

Browse files
upcoming: [DPS-34879] - Delivery bugfixes after devcloud release (#12898)
1 parent 0c73abb commit c63d15b

21 files changed

Lines changed: 170 additions & 81 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/api-v4": Upcoming Features
3+
---
4+
5+
Logs Delivery Stream details type update and UpdateDestinationPayload update according to API docs ([#12898](https://github.com/linode/manager/pull/12898))

packages/api-v4/src/delivery/destinations.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { destinationSchema } from '@linode/validation';
1+
import {
2+
createDestinationSchema,
3+
updateDestinationSchema,
4+
} from '@linode/validation';
25

36
import { BETA_API_ROOT } from '../constants';
47
import Request, {
@@ -49,7 +52,7 @@ export const getDestinations = (params?: Params, filter?: Filter) =>
4952
*/
5053
export const createDestination = (data: CreateDestinationPayload) =>
5154
Request<Destination>(
52-
setData(data, destinationSchema),
55+
setData(data, createDestinationSchema),
5356
setURL(`${BETA_API_ROOT}/monitor/streams/destinations`),
5457
setMethod('POST'),
5558
);
@@ -65,7 +68,7 @@ export const updateDestination = (
6568
data: UpdateDestinationPayload,
6669
) =>
6770
Request<Destination>(
68-
setData(data, destinationSchema),
71+
setData(data, updateDestinationSchema),
6972
setURL(
7073
`${BETA_API_ROOT}/monitor/streams/destinations/${encodeURIComponent(destinationId)}`,
7174
),
@@ -92,7 +95,7 @@ export const deleteDestination = (destinationId: number) =>
9295
*/
9396
export const verifyDestination = (data: CreateDestinationPayload) =>
9497
Request<Destination>(
95-
setData(data, destinationSchema),
98+
setData(data, createDestinationSchema),
9699
setURL(`${BETA_API_ROOT}/monitor/streams/destinations/verify`),
97100
setMethod('POST'),
98101
);

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface AuditData {
2121

2222
export interface Stream extends AuditData {
2323
destinations: Destination[];
24-
details: StreamDetails;
24+
details: StreamDetailsType;
2525
id: number;
2626
label: string;
2727
primary_destination_id: number;
@@ -36,6 +36,8 @@ export interface StreamDetails {
3636
is_auto_add_all_clusters_enabled?: boolean;
3737
}
3838

39+
export type StreamDetailsType = null | StreamDetails;
40+
3941
export const destinationType = {
4042
CustomHttps: 'custom_https',
4143
LinodeObjectStorage: 'linode_object_storage',
@@ -103,18 +105,17 @@ interface CustomHeader {
103105

104106
export interface CreateStreamPayload {
105107
destinations: number[];
106-
details: StreamDetails;
108+
details?: StreamDetailsType;
107109
label: string;
108110
status?: StreamStatus;
109111
type: StreamType;
110112
}
111113

112114
export interface UpdateStreamPayload {
113115
destinations: number[];
114-
details: StreamDetails;
116+
details?: StreamDetailsType;
115117
label: string;
116118
status: StreamStatus;
117-
type: StreamType;
118119
}
119120

120121
export interface UpdateStreamPayloadWithId extends UpdateStreamPayload {
@@ -136,7 +137,7 @@ export interface CreateDestinationPayload {
136137
type: DestinationType;
137138
}
138139

139-
export type UpdateDestinationPayload = CreateDestinationPayload;
140+
export type UpdateDestinationPayload = Omit<CreateDestinationPayload, 'type'>;
140141

141142
export interface UpdateDestinationPayloadWithId
142143
extends UpdateDestinationPayload {
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+
Logs Delivery fixes after devcloud release ([#12898](https://github.com/linode/manager/pull/12898))

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export type NavEntity =
4040
| 'Cloud Load Balancers'
4141
| 'Dashboard'
4242
| 'Databases'
43-
| 'Delivery'
4443
| 'Domains'
4544
| 'Firewalls'
4645
| 'Help & Support'
@@ -49,6 +48,7 @@ export type NavEntity =
4948
| 'Kubernetes'
5049
| 'Linodes'
5150
| 'Login History'
51+
| 'Logs'
5252
| 'Longview'
5353
| 'Maintenance'
5454
| 'Managed'
@@ -240,7 +240,7 @@ export const PrimaryNav = (props: PrimaryNavProps) => {
240240
to: '/longview',
241241
},
242242
{
243-
display: 'Delivery',
243+
display: 'Logs',
244244
hide: !flags.aclpLogs?.enabled,
245245
to: '/logs/delivery',
246246
isBeta: flags.aclpLogs?.beta,

packages/manager/src/factories/delivery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const streamFactory = Factory.Sync.makeFactory<Stream>({
2727
destinations: Factory.each(() => [
2828
{ ...destinationFactory.build(), id: 123 },
2929
]),
30-
details: {},
30+
details: null,
3131
updated: '2025-07-30',
3232
updated_by: 'username',
3333
id: Factory.each((id) => id),

packages/manager/src/features/Delivery/Destinations/DestinationForm/DestinationEdit.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
useDestinationQuery,
55
useUpdateDestinationMutation,
66
} from '@linode/queries';
7-
import { Box, CircleProgress, ErrorState } from '@linode/ui';
7+
import { Box, CircleProgress, ErrorState, omitProps } from '@linode/ui';
88
import { destinationFormSchema } from '@linode/validation';
99
import { useNavigate, useParams } from '@tanstack/react-router';
1010
import { enqueueSnackbar } from 'notistack';
@@ -80,7 +80,7 @@ export const DestinationEdit = () => {
8080
const onSubmit = () => {
8181
const destination: UpdateDestinationPayloadWithId = {
8282
id: destinationId,
83-
...form.getValues(),
83+
...omitProps(form.getValues(), ['type']),
8484
};
8585

8686
updateDestination(destination)

packages/manager/src/features/Delivery/Streams/StreamForm/Delivery/StreamFormDelivery.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ describe('StreamFormDelivery', () => {
8686
label: '',
8787
type: destinationType.LinodeObjectStorage,
8888
},
89+
stream: {
90+
destinations: [],
91+
},
8992
},
9093
},
9194
});

packages/manager/src/features/Delivery/Streams/StreamForm/Delivery/StreamFormDelivery.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,19 @@ export const StreamFormDelivery = () => {
6767
name: 'stream.destinations',
6868
});
6969

70-
const destinationNameFilterOptions = createFilterOptions<DestinationName>();
70+
const destinationNameFilterOptions = createFilterOptions<DestinationName>({
71+
stringify: (destination) => destination.label,
72+
});
7173

7274
const findDestination = (id: number) =>
7375
destinations?.find((destination) => destination.id === id);
7476

77+
const restDestinationForm = () => {
78+
Object.values(controlPaths).forEach((controlPath) =>
79+
setValue(controlPath, '')
80+
);
81+
};
82+
7583
const getDestinationForm = () => (
7684
<>
7785
<Controller
@@ -121,6 +129,10 @@ export const StreamFormDelivery = () => {
121129
onChange={(_, newValue) => {
122130
const id = newValue?.id;
123131

132+
if (id === undefined && selectedDestinations.length > 0) {
133+
restDestinationForm();
134+
}
135+
124136
setValue('stream.destinations', id ? [id] : []);
125137
const selectedDestination = id ? findDestination(id) : undefined;
126138
if (selectedDestination) {

packages/manager/src/features/Delivery/Streams/StreamForm/StreamCreate.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export const StreamCreate = () => {
3333
defaultValues: {
3434
stream: {
3535
type: streamType.AuditLogs,
36-
details: {},
36+
details: null,
37+
destinations: [],
3738
},
3839
destination: {
3940
type: destinationType.LinodeObjectStorage,

0 commit comments

Comments
 (0)