diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 2d2591f5ee4e..bc48836cda17 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -144,6 +144,15 @@ module.exports = { 'no-empty': 'off', 'no-empty-pattern': 'off', 'no-nested-ternary': 'error', + 'no-restricted-syntax': [ + 'error', + { + 'message': + 'InputGroup no longer renders custom controls. Use SelectField for a labelled Select, or FieldLabel + FieldError for other controls.', + 'selector': + "JSXOpeningElement[name.name='InputGroup'] JSXAttribute[name.name='component']", + }, + ], 'no-unused-vars': 'off', 'no-var': 'error', 'object-curly-spacing': ['error', 'always'], diff --git a/frontend/common/utils/utils.tsx b/frontend/common/utils/utils.tsx index 1d718f5c7d3e..1a1082cbb189 100644 --- a/frontend/common/utils/utils.tsx +++ b/frontend/common/utils/utils.tsx @@ -789,11 +789,11 @@ const Utils = Object.assign({}, BaseUtils, { .replace(/[\s_]+/g, '-') .toLowerCase(), - toSelectedValue: ( - value: string, - options: { label: string; value: string }[], - defaultValue?: string, - ) => { + toSelectedValue: ( + value: unknown, + options: T[] | undefined, + defaultValue?: T, + ): T | undefined => { return options?.find((option) => option.value === value) ?? defaultValue }, diff --git a/frontend/web/components/EditPermissions.tsx b/frontend/web/components/EditPermissions.tsx index 266467d62b79..401c3c26cd1b 100644 --- a/frontend/web/components/EditPermissions.tsx +++ b/frontend/web/components/EditPermissions.tsx @@ -1,4 +1,5 @@ import React, { FC, forwardRef, useCallback, useEffect, useState } from 'react' +import FieldLabel from './base/forms/FieldLabel' import { find } from 'lodash' import { close as closeIcon } from 'ionicons/icons' import { IonIcon } from '@ionic/react' @@ -55,7 +56,6 @@ import { import MyRoleSelect from './MyRoleSelect' import Panel from './base/grid/Panel' -import InputGroup from './base/forms/InputGroup' import classNames from 'classnames' import OrganisationProvider from 'common/providers/OrganisationProvider' import { useHasPermission } from 'common/providers/Permission' @@ -934,47 +934,39 @@ const _EditPermissionsModal: FC = withAdminPermissions( {roles && level === 'organisation' && ( - - - Roles: - {rolesAdded?.map((r) => ( - removeOwner(r.id)} - className='chip' - style={{ marginBottom: 4, marginTop: 4 }} - > - {r.name} - - - - - ))} - - - - } - type='text' - title='Assign roles' - tooltip='Assigns what role the user/group will have' - inputProps={{ - className: 'full-width', - style: { minHeight: 80 }, - }} - className='full-width' - placeholder='Add an optional description...' - /> + {r.name} + + + + + ))} + + + + )} {level !== 'environment' && level !== 'project' && ( diff --git a/frontend/web/components/base/forms/InputGroup.tsx b/frontend/web/components/base/forms/InputGroup.tsx index cb2c6d71a6fd..7dbddbaa6e49 100644 --- a/frontend/web/components/base/forms/InputGroup.tsx +++ b/frontend/web/components/base/forms/InputGroup.tsx @@ -30,8 +30,6 @@ interface InputGroupProps { tooltip?: string tooltipPlace?: TooltipProps['place'] unsaved?: boolean - // Render an arbitrary control instead of the default Input/textarea. - component?: ReactNode textarea?: boolean // Legacy: consumers pass truthy/falsy non-booleans (e.g. `name && name.length`); // coerced to a boolean before it reaches Input. @@ -60,7 +58,6 @@ interface InputGroupProps { const InputGroup: FC = ({ className, - component, 'data-test': dataTest, defaultValue, disabled, @@ -125,54 +122,50 @@ const InputGroup: FC = ({ )}
- {component ? ( - component - ) : ( -
- {textarea ? ( -