Skip to content

Commit 904a1b8

Browse files
fix: [UIE-9943], [UIE-9944], [UIE-9950], [UIE-9951], [UIE-9954] - IAM: UI fix for Parent/Child (linode#13275)
* fix: [UIE-9943], [UIE-9944], [UIE-9951], [UIE-9954] - Parent/Child UI fix * fix: [UIE-9950] - Parent/Child dialog fix * e2e fix * changeset
1 parent cd23757 commit 904a1b8

File tree

8 files changed

+52
-31
lines changed

8 files changed

+52
-31
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+
IAM Delegation: UI issues in Default Entity Access table, Default Roles labels/messages, and missing Make a Payment tooltip ([#13275](https://github.com/linode/manager/pull/13275))

packages/manager/cypress/e2e/core/billing/restricted-user-billing.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ describe('restricted user billing flows', () => {
259259
assertEditBillingInfoDisabled(restrictedUserTooltip);
260260
assertAddPaymentMethodDisabled(restrictedUserTooltip);
261261
assertMakeAPaymentDisabled(
262-
restrictedUserTooltip +
263-
` Please contact your ${ADMINISTRATOR} to request the necessary permissions.`
262+
`You don't have permissions to make a payment. Please contact your ${ADMINISTRATOR} to request the necessary permissions.`
264263
);
265264
});
266265

@@ -289,8 +288,7 @@ describe('restricted user billing flows', () => {
289288
assertEditBillingInfoDisabled(restrictedUserTooltip);
290289
assertAddPaymentMethodDisabled(restrictedUserTooltip);
291290
assertMakeAPaymentDisabled(
292-
restrictedUserTooltip +
293-
` Please contact your ${PARENT_USER} to request the necessary permissions.`
291+
`You don't have permissions to make a payment. Please contact your ${PARENT_USER} to request the necessary permissions.`
294292
);
295293
});
296294

packages/manager/src/features/Billing/BillingLanding/BillingLanding.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { DocumentTitleSegment } from 'src/components/DocumentTitle';
66
import { LandingHeader } from 'src/components/LandingHeader';
77
import { MaintenanceBannerV2 } from 'src/components/MaintenanceBanner/MaintenanceBannerV2';
88
import { switchAccountSessionContext } from 'src/context/switchAccountSessionContext';
9+
import { ADMINISTRATOR, PARENT_USER } from 'src/features/Account/constants';
910
import { useIsParentTokenExpired } from 'src/features/Account/SwitchAccounts/useIsParentTokenExpired';
10-
import { getRestrictedResourceText } from 'src/features/Account/utils';
1111
import { useIsIAMDelegationEnabled } from 'src/features/IAM/hooks/useIsIAMEnabled';
1212
import { useRestrictedGlobalGrantCheck } from 'src/hooks/useRestrictedGlobalGrantCheck';
1313
import { sendSwitchAccountEvent } from 'src/utilities/analytics/customEventAnalytics';
@@ -38,6 +38,7 @@ export const BillingLanding = () => {
3838
const isChildUser = profile?.user_type === 'child';
3939
const isParentUser = profile?.user_type === 'parent';
4040

41+
const contactPerson = isChildUser ? PARENT_USER : ADMINISTRATOR;
4142
const isChildAccountAccessRestricted = useRestrictedGlobalGrantCheck({
4243
globalGrantType: 'child_account_access',
4344
});
@@ -70,10 +71,7 @@ export const BillingLanding = () => {
7071
disabled: isReadOnly || isAkamaiAccount,
7172
tooltipText: isAkamaiAccount
7273
? 'This feature is not available for Akamai accounts.'
73-
: getRestrictedResourceText({
74-
isChildUser,
75-
resourceType: 'Account',
76-
}),
74+
: `You don't have permissions to make a payment. Please contact your ${contactPerson} to request the necessary permissions.`,
7775
},
7876
createButtonText: 'Make a Payment',
7977
docsLabel: 'How Linode Billing Works',

packages/manager/src/features/IAM/Roles/Defaults/DefaultEntityAccess.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const DefaultEntityAccess = () => {
2222
<Paper>
2323
{hasAssignedEntities ? (
2424
<>
25-
<Stack marginBottom={2.5}>
25+
<Stack marginBottom={2}>
2626
<Typography variant="h2">
2727
Default Entity Access for Delegate Users
2828
</Typography>

packages/manager/src/features/IAM/Shared/AssignedEntitiesTable/AssignedEntitiesTable.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export const AssignedEntitiesTable = ({ username }: Props) => {
215215
}
216216

217217
if (!entities || !assignedRoles || filteredRoles.length === 0) {
218-
return <TableRowEmpty colSpan={3} message={'No items to display.'} />;
218+
return <TableRowEmpty colSpan={4} message={'No items to display.'} />;
219219
}
220220

221221
if (assignedRoles && entities) {
@@ -243,7 +243,9 @@ export const AssignedEntitiesTable = ({ username }: Props) => {
243243
onClick: () => {
244244
handleRemoveAssignment(el);
245245
},
246-
title: 'Remove Assignment',
246+
title: isDefaultDelegationRolesForChildAccount
247+
? 'Remove'
248+
: 'Remove Assignment',
247249
tooltip: !permissionToCheck
248250
? 'You do not have permission to remove this assignment.'
249251
: undefined,

packages/manager/src/features/IAM/Shared/AssignedRolesTable/AssignedRolesActionMenu.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ export const AssignedRolesActionMenu = ({
3535
? permissions?.update_default_delegate_access
3636
: permissions?.is_account_admin;
3737

38+
const removeTooltip = !permissionToCheck
39+
? isDefaultDelegationRolesForChildAccount
40+
? 'You do not have permission to remove this role.'
41+
: 'You do not have permission to unassign this role.'
42+
: undefined;
43+
3844
const accountMenu: Action[] = [
3945
{
4046
disabled: !permissionToCheck,
@@ -51,10 +57,10 @@ export const AssignedRolesActionMenu = ({
5157
onClick: () => {
5258
handleUnassignRole(role);
5359
},
54-
title: 'Unassign Role',
55-
tooltip: !permissionToCheck
56-
? 'You do not have permission to unassign this role.'
57-
: undefined,
60+
title: isDefaultDelegationRolesForChildAccount
61+
? 'Remove'
62+
: 'Unassign Role',
63+
tooltip: removeTooltip,
5864
},
5965
];
6066

@@ -91,7 +97,9 @@ export const AssignedRolesActionMenu = ({
9197
onClick: () => {
9298
handleUnassignRole(role);
9399
},
94-
title: 'Unassign Role',
100+
title: isDefaultDelegationRolesForChildAccount
101+
? 'Remove'
102+
: 'Unassign Role',
95103
},
96104
];
97105

packages/manager/src/features/IAM/Shared/AssignedRolesTable/UnassignRoleConfirmationDialog.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,24 @@ export const UnassignRoleConfirmationDialog = (props: Props) => {
100100
error={getErrorMessage(error)}
101101
onClose={onClose}
102102
open={open}
103-
title={`Unassign the ${role?.name} role?`}
103+
title={
104+
isDefaultDelegationRolesForChildAccount
105+
? `Remove the ${role?.name} role from the list?`
106+
: `Unassign the ${role?.name} role?`
107+
}
104108
>
105-
<Notice variant="warning">
109+
{isDefaultDelegationRolesForChildAccount ? (
106110
<Typography>
107-
You’re about to remove the <strong>{role?.name}</strong> role from{' '}
108-
<strong>{username}</strong>. The change will be applied immediately.
111+
The role won’t be added to delegate users by default.
109112
</Typography>
110-
</Notice>
113+
) : (
114+
<Notice variant="warning">
115+
<Typography>
116+
You’re about to remove the <strong>{role?.name}</strong> role from{' '}
117+
<strong>{username}</strong>. The change will be applied immediately.
118+
</Typography>
119+
</Notice>
120+
)}
111121
</ConfirmationDialog>
112122
);
113123
};

packages/manager/src/features/IAM/Shared/RemoveAssignmentConfirmationDialog/RemoveAssignmentConfirmationDialog.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,21 @@ export const RemoveAssignmentConfirmationDialog = (props: Props) => {
113113
: `Remove the ${role?.entity_name} entity from the ${role?.role_name} role assignment?`
114114
}
115115
>
116-
<Notice variant="warning">
117-
{isDefaultDelegationRolesForChildAccount ? (
118-
<Typography>
119-
Delegate users won’t get the {role?.role_name} access on the{' '}
120-
{role?.entity_name} entity by default.
121-
</Typography>
122-
) : (
116+
{isDefaultDelegationRolesForChildAccount ? (
117+
<Typography>
118+
Delegate users won’t get the {role?.role_name} access on the{' '}
119+
{role?.entity_name} entity by default.
120+
</Typography>
121+
) : (
122+
<Notice variant="warning">
123123
<Typography>
124124
You’re about to remove the <strong>{role?.entity_name}</strong>{' '}
125125
entity from the <strong>{role?.role_name}</strong> role for{' '}
126126
<strong>{username}</strong>. This change will be applied
127127
immediately.
128128
</Typography>
129-
)}
130-
</Notice>
129+
</Notice>
130+
)}
131131
</ConfirmationDialog>
132132
);
133133
};

0 commit comments

Comments
 (0)