@@ -24,6 +24,7 @@ import { ACCOUNT_TYPES } from './EditMembers.tsx';
2424import { ResourceObject } from '../../lib/api/types/crate/resourceObject.ts' ;
2525import { useApiResource } from '../../lib/api/useApiResource.ts' ;
2626import { useTranslation } from 'react-i18next' ;
27+ import IllustratedError from '../Shared/IllustratedError.tsx' ;
2728
2829type ParentType = 'Workspace' | 'Project' ;
2930
@@ -65,7 +66,7 @@ export const ImportMembersDialog: FC<ImportMembersDialogProps> = ({
6566 [ t ] ,
6667 ) ;
6768
68- const { handleSubmit, setValue, watch, reset, getValues } = useForm < ImportMembersFormData > ( {
69+ const { handleSubmit, setValue, watch, reset } = useForm < ImportMembersFormData > ( {
6970 resolver : zodResolver ( formSchema ) ,
7071 mode : 'onChange' ,
7172 defaultValues : {
@@ -97,8 +98,8 @@ export const ImportMembersDialog: FC<ImportMembersDialogProps> = ({
9798 < Select
9899 data-testid = "parent-select"
99100 value = { parentType }
100- onChange = { ( e : any ) => {
101- const selected = ( e . detail . selectedOption as any ) ?. value as ParentType ;
101+ onChange = { ( e : CustomEvent < { selectedOption : { dataset ?: { value ?: string } } } > ) => {
102+ const selected = e . detail . selectedOption ?. dataset ?. value as ParentType ;
102103 setValue ( 'parentType' , selected , { shouldValidate : true , shouldDirty : true , shouldTouch : true } ) ;
103104 } }
104105 >
@@ -179,7 +180,11 @@ const ImportMembersSelectionTable: FC<{
179180 projectName ?: string ;
180181} > = ( { onCancel, onImport, parentType, workspaceName, projectName, includeMembers, includeServiceAccounts } ) => {
181182 const { t } = useTranslation ( ) ;
182- const { isLoading, data : parentResourceData } = useApiResource (
183+ const {
184+ isLoading,
185+ data : parentResourceData ,
186+ error,
187+ } = useApiResource (
183188 parentType === 'Project'
184189 ? ResourceObject < SpecMembers > ( '' , 'projects' , projectName ?? '' )
185190 : ResourceObject < SpecMembers > ( projectName ?? '' , 'workspaces' , workspaceName ?? '' ) ,
@@ -262,18 +267,25 @@ const ImportMembersSelectionTable: FC<{
262267
263268 return (
264269 < FlexBox direction = "Column" gap = { 8 } style = { { padding : '1rem' } } >
265- < FlexBox justifyContent = "End" gap = { 8 } style = { { marginBottom : '0.5rem' } } >
266- < Button
267- design = "Transparent"
268- onClick = { ( ) => setSelectedEmails ( new Set ( filteredMockedMembers . map ( ( m ) => m . name ) ) ) }
269- >
270- { t ( 'ImportMembersDialog.selectAllButton' ) }
271- </ Button >
272- < Button design = "Transparent" onClick = { ( ) => setSelectedEmails ( new Set ( ) ) } >
273- { t ( 'ImportMembersDialog.deselectAllButton' ) }
274- </ Button >
275- </ FlexBox >
276- < AnalyticalTable scaleWidthMode = "Smart" columns = { columns } data = { data } className = { styles . table } />
270+ { error ? (
271+ < IllustratedError />
272+ ) : (
273+ < div >
274+ < FlexBox justifyContent = "Start" gap = { 8 } style = { { marginBottom : '0.5rem' } } >
275+ < Button
276+ design = "Transparent"
277+ onClick = { ( ) => setSelectedEmails ( new Set ( filteredMockedMembers . map ( ( m ) => m . name ) ) ) }
278+ >
279+ { t ( 'ImportMembersDialog.selectAllButton' ) }
280+ </ Button >
281+ < Button design = "Transparent" onClick = { ( ) => setSelectedEmails ( new Set ( ) ) } >
282+ { t ( 'ImportMembersDialog.deselectAllButton' ) }
283+ </ Button >
284+ </ FlexBox >
285+
286+ < AnalyticalTable scaleWidthMode = "Smart" columns = { columns } data = { data } className = { styles . table } />
287+ </ div >
288+ ) }
277289
278290 < FlexBox justifyContent = "End" gap = { 8 } style = { { marginTop : '1rem' } } >
279291 < Button design = "Transparent" onClick = { onCancel } >
0 commit comments