Skip to content

Commit

Permalink
Refactor SelectAccountIAMRole component and utils/hooks.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
hervedombya committed Oct 21, 2024
1 parent b8daae5 commit 563265a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/react/ui-elements/SelectAccountIAMRole.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
Form,
FormGroup,
FormSection,
Stack,
useToast,
} from '@scality/core-ui';
import { Form, FormGroup, FormSection, useToast } from '@scality/core-ui';
import { Select } from '@scality/core-ui/dist/next';
import { IAM } from 'aws-sdk';
import { Bucket } from 'aws-sdk/clients/s3';
Expand All @@ -26,7 +20,7 @@ import {
} from '../next-architecture/ui/AccessibleAccountsAdapterProvider';
import { AccountsLocationsEndpointsAdapterProvider } from '../next-architecture/ui/AccountsLocationsEndpointsAdapterProvider';
import { getListRolesQuery } from '../queries';
import { SCALITY_INTERNAL_ROLES, regexArn } from '../utils/hooks';
import { SCALITY_IAM_ROLES, regexArn } from '../utils/hooks';

class NoOpMetricsAdapter implements IMetricsAdapter {
async listBucketsLatestUsedCapacity(
Expand Down Expand Up @@ -234,7 +228,7 @@ const SelectAccountIAMRoleWithAccount = (
const roles = props.filterOutInternalRoles
? allRolesExceptHiddenOnes.filter((role) => {
return (
SCALITY_INTERNAL_ROLES.includes(role.RoleName) ||
SCALITY_IAM_ROLES.includes(role.RoleName) ||
!role.Arn.includes('role/scality-internal')
);
})
Expand Down
6 changes: 6 additions & 0 deletions src/react/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ export const STORAGE_ACCOUNT_OWNER_ROLE = 'storage-account-owner-role';
const DATA_CONSUMER_ROLE = 'data-consumer-role';
const DATA_ACCESSOR_ROLE = 'data-accessor-role';
export const SCALITY_INTERNAL_ROLES = [
STORAGE_MANAGER_ROLE,
STORAGE_ACCOUNT_OWNER_ROLE,
DATA_CONSUMER_ROLE,
DATA_ACCESSOR_ROLE,
];
export const SCALITY_IAM_ROLES = [
STORAGE_ACCOUNT_OWNER_ROLE,
DATA_CONSUMER_ROLE,
DATA_ACCESSOR_ROLE,
Expand Down

0 comments on commit 563265a

Please sign in to comment.