Skip to content

Commit fa5cb78

Browse files
upcoming: [UIE-10505] IAM Parent/Child - pendo tags (#13537)
* upcoming: [UIE-10505] IAM Parent/Child - pendo tags * Added changeset: IAM: Add Pendo IDs for Parent/Child
1 parent 09b1b08 commit fa5cb78

5 files changed

Lines changed: 49 additions & 19 deletions

File tree

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+
IAM: Add Pendo IDs for Parent/Child ([#13537](https://github.com/linode/manager/pull/13537))

packages/manager/src/features/IAM/Roles/RolesTable/AssignSelectedRolesDrawer.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { Link } from 'src/components/Link';
2323
import { StyledLinkButtonBox } from 'src/components/SelectFirewallPanel/SelectFirewallPanel';
2424
import { AssignSingleSelectedRole } from 'src/features/IAM/Roles/RolesTable/AssignSingleSelectedRole';
2525

26-
import { useDelegationRole } from '../../hooks/useDelegationRole';
2726
import { usePermissions } from '../../hooks/usePermissions';
2827
import {
2928
IAM_ROLES_PENDO_IDS,
@@ -51,8 +50,6 @@ export const AssignSelectedRolesDrawer = ({
5150
}: Props) => {
5251
const theme = useTheme();
5352

54-
const { isParentUserType } = useDelegationRole();
55-
5653
const values = {
5754
roles: selectedRoles.map((r) => ({
5855
role: {
@@ -201,6 +198,9 @@ export const AssignSelectedRolesDrawer = ({
201198
name={`username`}
202199
render={({ field: { onChange }, fieldState }) => (
203200
<Autocomplete
201+
data-pendo-id={
202+
IAM_ROLES_PENDO_IDS.assignSelectedRolesToUserOpen
203+
}
204204
errorText={fieldState.error?.message}
205205
getOptionLabel={(option) => option.label}
206206
label="Select a User"
@@ -222,9 +222,11 @@ export const AssignSelectedRolesDrawer = ({
222222
<li
223223
{...props}
224224
data-pendo-id={
225-
option.userType === 'delegate'
226-
? IAM_ROLES_PENDO_IDS.assignSelectedRoleToUserDelegate
227-
: IAM_ROLES_PENDO_IDS.assignSelectedRoleToChildUser
225+
option.userType === 'parent'
226+
? IAM_ROLES_PENDO_IDS.assignSelectedRoleToUserParent
227+
: option.userType === 'child'
228+
? IAM_ROLES_PENDO_IDS.assignSelectedRoleToUserChild
229+
: IAM_ROLES_PENDO_IDS.assignSelectedRoleToUserDelegate
228230
}
229231
key={option.value}
230232
>
@@ -237,10 +239,6 @@ export const AssignSelectedRolesDrawer = ({
237239
slotProps={{
238240
listbox: {
239241
onScroll: handleScroll,
240-
// @ts-expect-error - MUI doesn't have a built in way to add data attributes to the options in Autocomplete, so we need to add it to the listboxProps and then check for it in the onChange handler
241-
'data-pendo-id': isParentUserType
242-
? IAM_ROLES_PENDO_IDS.assignSelectedRoleToUserParent
243-
: IAM_ROLES_PENDO_IDS.assignSelectedRoleToUserDelegate,
244242
},
245243
}}
246244
textFieldProps={{

packages/manager/src/features/IAM/Roles/RolesTable/RolesTable.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
} from 'src/features/IAM/Shared/utilities';
2929
import { usePaginationV2 } from 'src/hooks/usePaginationV2';
3030

31+
import { useDelegationRole } from '../../hooks/useDelegationRole';
3132
import { usePermissions } from '../../hooks/usePermissions';
3233
import { IAM_ROLES_PENDO_IDS } from '../../Shared/constants';
3334
import {
@@ -77,7 +78,7 @@ export const RolesTable = ({ roles = [] }: Props) => {
7778

7879
const { data: permissions } = usePermissions('account', ['is_account_admin']);
7980
const isAccountAdmin = permissions?.is_account_admin;
80-
81+
const { isDelegateUserType, isChildUserType } = useDelegationRole();
8182
// Filtering
8283
const getFilteredRows = (
8384
text: string,
@@ -214,7 +215,13 @@ export const RolesTable = ({ roles = [] }: Props) => {
214215
</Grid>
215216
<Button
216217
buttonType="primary"
217-
data-pendo-id={IAM_ROLES_PENDO_IDS.assignSelectedRoles}
218+
data-pendo-id={
219+
isDelegateUserType
220+
? IAM_ROLES_PENDO_IDS.assignSelectedRolesAsDelegate
221+
: isChildUserType
222+
? IAM_ROLES_PENDO_IDS.assignSelectedRolesAsChild
223+
: IAM_ROLES_PENDO_IDS.assignSelectedRolesAsParent
224+
}
218225
disabled={selectedRows.length === 0 || !isAccountAdmin}
219226
onClick={() => handleAssignSelectedRoles()}
220227
sx={{ height: 34 }}
@@ -300,10 +307,13 @@ export const RolesTable = ({ roles = [] }: Props) => {
300307
selected={selectedRows.includes(roleRow)}
301308
>
302309
<TableCell
303-
// data-pendo-id={IAM_ROLES_PENDO_IDS.rolesChecked}
304-
{...(selectedRows.includes(roleRow) && {
305-
'data-pendo-id': IAM_ROLES_PENDO_IDS.rolesChecked,
306-
})}
310+
{...(selectedRows.includes(roleRow)
311+
? {
312+
'data-pendo-id': IAM_ROLES_PENDO_IDS.rolesChecked,
313+
}
314+
: {
315+
'data-pendo-id': IAM_ROLES_PENDO_IDS.rolesUnchecked,
316+
})}
307317
disabled={!isAccountAdmin}
308318
style={{
309319
wordBreak: 'break-word',

packages/manager/src/features/IAM/Roles/RolesTable/RolesTableActionMenu.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22

33
import { InlineMenuAction } from 'src/components/InlineMenuAction/InlineMenuAction';
44

5+
import { useDelegationRole } from '../../hooks/useDelegationRole';
56
import { IAM_ROLES_PENDO_IDS } from '../../Shared/constants';
67

78
interface Props {
@@ -13,12 +14,19 @@ export const RolesTableActionMenu = ({
1314
canUpdateUserGrants,
1415
onClick,
1516
}: Props) => {
17+
const { isParentUserType, isChildUserType } = useDelegationRole();
1618
// This menu has evolved over time to where it isn't much of a menu at all, but rather a single action.
1719
return (
1820
<InlineMenuAction
1921
actionText={'Assign Role'}
2022
buttonHeight={40}
21-
data-pendo-id={IAM_ROLES_PENDO_IDS.assignRole}
23+
data-pendo-id={
24+
isParentUserType
25+
? IAM_ROLES_PENDO_IDS.assignRoleAsParent
26+
: isChildUserType
27+
? IAM_ROLES_PENDO_IDS.assignRoleAsChild
28+
: IAM_ROLES_PENDO_IDS.assignRoleAsDelegate
29+
}
2230
disabled={!canUpdateUserGrants}
2331
onClick={onClick}
2432
sx={{

packages/manager/src/features/IAM/Shared/constants.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,25 @@ export const IAM_ROLES_PENDO_IDS = {
3030
addNewDefaultRolesDrawer:
3131
'IAM Roles for Delegate Users Add New Default Roles-Add',
3232
rolesChecked: 'IAM Roles-Roles checked',
33+
rolesUnchecked: 'IAM Roles-Roles unchecked',
3334
assignSelectedRoles: 'IAM Roles-Assign Selected Roles',
35+
assignSelectedRolesToUserOpen:
36+
'IAM Roles Assign Selected Role to a User-User:open',
37+
assignSelectedRolesAsDelegate: 'IAM Roles-Assign Selected Roles as Delegate',
38+
assignSelectedRolesAsChild: 'IAM Roles-Assign Selected Roles as Child',
39+
assignSelectedRolesAsParent: 'IAM Roles-Assign Selected Roles as Parent',
40+
3441
assignSelectedRoleToUserDelegate:
3542
'IAM Roles Assign Selected Role to a User-Delegate User',
3643
assignSelectedRoleToUserParent:
3744
'IAM Roles Assign Selected Role to a User-Parent User',
38-
assignSelectedRoleToChildUser:
45+
assignSelectedRoleToUserChild:
3946
'IAM Roles Assign Selected Role to a User-Child User',
4047
assignSelectedRoleToUserAssign:
4148
'IAM Roles Assign Selected Role to a User-Assign',
42-
assignRole: 'IAM Roles-Assign Role',
49+
assignRoleAsParent: 'IAM Roles-Assign Role as Parent',
50+
assignRoleAsChild: 'IAM Roles-Assign Role as Child',
51+
assignRoleAsDelegate: 'IAM Roles-Assign Role as Delegate',
4352
};
4453
// Various constants for the IAM package
4554

0 commit comments

Comments
 (0)