Skip to content

Commit 7f451c9

Browse files
upcoming: [DPS-34191] - logs delivery pendo tags (linode#13022)
* upcoming: [DPS-34191] - logs delivery pendo tags * Added changeset: Logs Delivery Stream/Destination Pendo tags * Change Edit Destination/Stream button to Save button * update e2e with Edit to Save change
1 parent 30c2181 commit 7f451c9

28 files changed

Lines changed: 236 additions & 62 deletions
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 Stream/Destination Pendo tags ([#13022](https://github.com/linode/manager/pull/13022))

packages/manager/cypress/e2e/core/delivery/edit-destination.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ describe('Edit Destination', () => {
4343
mockDestinationPayload.details as AkamaiObjectStorageDetailsExtended
4444
);
4545

46-
// Create Destination should be disabled before test connection
47-
cy.findByRole('button', { name: 'Edit Destination' }).should('be.disabled');
46+
// Save button should be disabled before test connection
47+
cy.findByRole('button', { name: 'Save' }).should('be.disabled');
4848
// Test connection of the destination form
4949
mockTestConnection(400);
5050
ui.button
@@ -57,8 +57,8 @@ describe('Edit Destination', () => {
5757
'Delivery connection test failed. Verify your delivery settings and try again.'
5858
);
5959

60-
// Create Destination should be disabled after test connection failed
61-
cy.findByRole('button', { name: 'Edit Destination' }).should('be.disabled');
60+
// Save button should be disabled after test connection failed
61+
cy.findByRole('button', { name: 'Save' }).should('be.disabled');
6262
});
6363

6464
it('edit destination with correct data', () => {
@@ -70,8 +70,8 @@ describe('Edit Destination', () => {
7070
mockDestinationPayload.details as AkamaiObjectStorageDetailsExtended
7171
);
7272

73-
// Create Destination should be disabled before test connection
74-
cy.findByRole('button', { name: 'Edit Destination' }).should('be.disabled');
73+
// Save button should be disabled before test connection
74+
cy.findByRole('button', { name: 'Save' }).should('be.disabled');
7575
// Test connection of the destination form
7676
mockTestConnection();
7777
ui.button
@@ -88,7 +88,7 @@ describe('Edit Destination', () => {
8888
mockUpdateDestination(mockDestinationPayloadWithId, updatedDestination);
8989
mockGetDestinations([updatedDestination]);
9090
// Submit the destination edit form
91-
cy.findByRole('button', { name: 'Edit Destination' })
91+
cy.findByRole('button', { name: 'Save' })
9292
.should('be.enabled')
9393
.should('have.attr', 'type', 'button')
9494
.click();

packages/manager/src/components/ActionMenu/ActionMenu.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface Action {
1111
hidden?: boolean;
1212
id?: string;
1313
onClick: () => void;
14+
pendoId?: string;
1415
title: string;
1516
tooltip?: string;
1617
}
@@ -32,6 +33,10 @@ export interface ActionMenuProps {
3233
* A function that is called when the Menu is opened. Useful for analytics.
3334
*/
3435
onOpen?: () => void;
36+
/**
37+
* Pendo ID to be added to ActionMenu IconButton via data-pendo-id attribute
38+
*/
39+
pendoId?: string;
3540
/**
3641
* If true, stop event propagation when handling clicks
3742
* Ex: If the action menu is in an accordion, we don't want the click also opening/closing the accordion
@@ -45,8 +50,14 @@ export interface ActionMenuProps {
4550
* No more than 8 items should be displayed within an action menu.
4651
*/
4752
export const ActionMenu = React.memo((props: ActionMenuProps) => {
48-
const { actionsList, ariaLabel, loading, onOpen, stopClickPropagation } =
49-
props;
53+
const {
54+
actionsList,
55+
ariaLabel,
56+
loading,
57+
onOpen,
58+
pendoId,
59+
stopClickPropagation,
60+
} = props;
5061

5162
const filteredActionsList = actionsList.filter((action) => !action.hidden);
5263

@@ -102,6 +113,7 @@ export const ActionMenu = React.memo((props: ActionMenuProps) => {
102113
aria-haspopup="true"
103114
aria-label={ariaLabel}
104115
color="inherit"
116+
data-pendo-id={pendoId}
105117
id={buttonId}
106118
loading={loading}
107119
loadingIndicator={<CircleProgress noPadding size="xs" />}
@@ -159,6 +171,7 @@ export const ActionMenu = React.memo((props: ActionMenuProps) => {
159171
>
160172
{filteredActionsList.map((a, idx) => (
161173
<MenuItem
174+
data-pendo-id={a.pendoId}
162175
data-qa-action-menu-item={a.title}
163176
data-testid={a.title}
164177
disabled={a.disabled}

packages/manager/src/components/EmptyLandingPageResources/ResourcesSection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import type {
2525

2626
interface ButtonProps {
2727
children: string;
28+
'data-pendo-id'?: string;
2829
disabled?: boolean;
2930
onClick: () => void;
3031
tooltipText?: string;

packages/manager/src/features/Delivery/Destinations/DeleteDestinationDialog.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ export const DeleteDestinationDialog = React.memo((props: Props) => {
5555
loading: isPending,
5656
disabled: false,
5757
onClick: handleDelete,
58+
'data-pendo-id': 'Logs Delivery Destinations Delete-Delete',
59+
}}
60+
secondaryButtonProps={{
61+
label: 'Cancel',
62+
onClick: onClose,
63+
'data-pendo-id': 'Logs Delivery Destinations Delete-Cancel',
5864
}}
59-
secondaryButtonProps={{ label: 'Cancel', onClick: onClose }}
6065
style={{ padding: 0 }}
6166
/>
6267
);

packages/manager/src/features/Delivery/Destinations/DestinationActionMenu.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as React from 'react';
33
import { ActionMenu } from 'src/components/ActionMenu/ActionMenu';
44

55
import type { Destination } from '@linode/api-v4';
6+
import type { Action } from 'src/components/ActionMenu/ActionMenu';
67

78
export interface DestinationHandlers {
89
onDelete: (destination: Destination) => void;
@@ -16,25 +17,28 @@ interface DestinationActionMenuProps extends DestinationHandlers {
1617
export const DestinationActionMenu = (props: DestinationActionMenuProps) => {
1718
const { destination, onDelete, onEdit } = props;
1819

19-
const menuActions = [
20+
const menuActions: Action[] = [
2021
{
2122
onClick: () => {
2223
onEdit(destination);
2324
},
2425
title: 'Edit',
26+
pendoId: 'Logs Delivery Destinations-Edit',
2527
},
2628
{
2729
onClick: () => {
2830
onDelete(destination);
2931
},
3032
title: 'Delete',
33+
pendoId: 'Logs Delivery Destinations-Delete',
3134
},
3235
];
3336

3437
return (
3538
<ActionMenu
3639
actionsList={menuActions}
3740
ariaLabel={`Action menu for Destination ${destination.label}`}
41+
pendoId="Logs Delivery Destinations-Action Menu"
3842
/>
3943
);
4044
};

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('DestinationEdit', () => {
6060

6161
describe('given Test Connection and Edit Destination buttons', () => {
6262
const testConnectionButtonText = 'Test Connection';
63-
const editDestinationButtonText = 'Edit Destination';
63+
const saveDestinationButtonText = 'Save';
6464
const editDestinationSpy = vi.fn();
6565
const verifyDestinationSpy = vi.fn();
6666

@@ -89,23 +89,23 @@ describe('DestinationEdit', () => {
8989
const testConnectionButton = screen.getByRole('button', {
9090
name: testConnectionButtonText,
9191
});
92-
const editDestinationButton = screen.getByRole('button', {
93-
name: editDestinationButtonText,
92+
const saveDestinationButton = screen.getByRole('button', {
93+
name: saveDestinationButtonText,
9494
});
9595

9696
// Enter Secret Access Key
9797
const secretAccessKeyInput = screen.getByLabelText('Secret Access Key');
9898
await userEvent.type(secretAccessKeyInput, 'Test');
9999

100-
expect(editDestinationButton).toBeDisabled();
100+
expect(saveDestinationButton).toBeDisabled();
101101
await userEvent.click(testConnectionButton);
102102
expect(verifyDestinationSpy).toHaveBeenCalled();
103103

104104
await waitFor(() => {
105-
expect(editDestinationButton).toBeEnabled();
105+
expect(saveDestinationButton).toBeEnabled();
106106
});
107107

108-
await userEvent.click(editDestinationButton);
108+
await userEvent.click(saveDestinationButton);
109109
expect(editDestinationSpy).toHaveBeenCalled();
110110
});
111111
});
@@ -131,20 +131,20 @@ describe('DestinationEdit', () => {
131131
const testConnectionButton = screen.getByRole('button', {
132132
name: testConnectionButtonText,
133133
});
134-
const editDestinationButton = screen.getByRole('button', {
135-
name: editDestinationButtonText,
134+
const saveDestinationButton = screen.getByRole('button', {
135+
name: saveDestinationButtonText,
136136
});
137137

138138
// Enter Secret Access Key
139139
const secretAccessKeyInput = screen.getByLabelText('Secret Access Key');
140140
await userEvent.type(secretAccessKeyInput, 'Test');
141141

142-
expect(editDestinationButton).toBeDisabled();
142+
expect(saveDestinationButton).toBeDisabled();
143143
await userEvent.click(testConnectionButton);
144144
expect(verifyDestinationSpy).toHaveBeenCalled();
145145

146146
await waitFor(() => {
147-
expect(editDestinationButton).toBeDisabled();
147+
expect(saveDestinationButton).toBeDisabled();
148148
});
149149
});
150150
});

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { destinationType } from '@linode/api-v4';
22
import { Autocomplete, Paper, TextField } from '@linode/ui';
3+
import { capitalize } from '@linode/utilities';
34
import Grid from '@mui/material/Grid';
45
import * as React from 'react';
56
import { useEffect } from 'react';
@@ -53,6 +54,7 @@ export const DestinationForm = (props: DestinationFormProps) => {
5354
name="type"
5455
render={({ field }) => (
5556
<Autocomplete
57+
data-pendo-id={`Logs Delivery Destinations ${capitalize(mode)}-Destination Type`}
5658
disableClearable
5759
disabled
5860
label="Destination Type"
@@ -71,6 +73,7 @@ export const DestinationForm = (props: DestinationFormProps) => {
7173
render={({ field, fieldState }) => (
7274
<TextField
7375
aria-required
76+
data-pendo-id={`Logs Delivery Destinations ${capitalize(mode)}-Destination Name`}
7477
errorText={fieldState.error?.message}
7578
label="Destination Name"
7679
onBlur={field.onBlur}
@@ -83,7 +86,10 @@ export const DestinationForm = (props: DestinationFormProps) => {
8386
)}
8487
/>
8588
{destination.type === destinationType.AkamaiObjectStorage && (
86-
<DestinationAkamaiObjectStorageDetailsForm />
89+
<DestinationAkamaiObjectStorageDetailsForm
90+
entity="destination"
91+
mode={mode}
92+
/>
8793
)}
8894
</Paper>
8995
</Grid>

packages/manager/src/features/Delivery/Destinations/DestinationTableRow.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ export const DestinationTableRow = React.memo(
2323
return (
2424
<TableRow key={id}>
2525
<TableCell>
26-
<Link to={`/logs/delivery/destinations/${id}/edit`}>
26+
<Link
27+
pendoId="Logs Delivery Destinations-Name"
28+
to={`/logs/delivery/destinations/${id}/edit`}
29+
>
2730
{destination.label}
2831
</Link>
2932
</TableCell>

packages/manager/src/features/Delivery/Destinations/DestinationsLandingEmptyState.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export const DestinationsLandingEmptyState = (
3434
});
3535
navigateToCreate();
3636
},
37+
'data-pendo-id':
38+
'Logs Delivery Destinations Empty-Create Destination',
3739
},
3840
]}
3941
gettingStartedGuidesData={gettingStartedGuides}

0 commit comments

Comments
 (0)