From e9d2649107e8ff9f928f71fbda116bf5e47cac8d Mon Sep 17 00:00:00 2001 From: Patrick Ear Date: Tue, 10 Sep 2024 16:23:31 +0200 Subject: [PATCH] fix typescript issues --- src/react/account/AwsPaginatedResourceTable.tsx | 1 - src/react/actions/__tests__/s3object.test.ts | 13 +++++++------ src/react/locations/__tests__/LocationList.test.tsx | 1 + src/react/queries.ts | 5 ++--- src/react/workflow/ReplicationForm.tsx | 3 ++- src/react/workflow/Workflows.tsx | 3 ++- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/react/account/AwsPaginatedResourceTable.tsx b/src/react/account/AwsPaginatedResourceTable.tsx index b9796ec09..eddb9858f 100644 --- a/src/react/account/AwsPaginatedResourceTable.tsx +++ b/src/react/account/AwsPaginatedResourceTable.tsx @@ -138,7 +138,6 @@ const AwsPaginatedResourceTable = ({ disabled={queryResult.status !== 'success'} value={search} placeholder={'Search'} - disableToggle onReset={() => { queryParams.delete(SEARCH_QUERY_PARAM); history.push(`${match.url}?${queryParams.toString()}`); diff --git a/src/react/actions/__tests__/s3object.test.ts b/src/react/actions/__tests__/s3object.test.ts index d01e86bac..0b8dd174e 100644 --- a/src/react/actions/__tests__/s3object.test.ts +++ b/src/react/actions/__tests__/s3object.test.ts @@ -1,3 +1,4 @@ +import { queryClient } from '../../utils/testUtil'; import * as actions from '../s3object'; import { UPLOADING_OBJECT } from '../s3object'; import * as dispatchAction from './utils/dispatchActionsList'; @@ -151,7 +152,7 @@ describe.skip('s3object actions', () => { const asyncTests = [ { it: 'createFolder: should return expected actions -> test without prefix parameter', - fn: actions.createFolder(BUCKET_NAME, '', FOLDER_NAME), + fn: actions.createFolder(BUCKET_NAME, '', FOLDER_NAME, queryClient), storeState: initState, expectedActions: [ createFolderNetworkAction, @@ -170,7 +171,7 @@ describe.skip('s3object actions', () => { }, { it: 'createFolder: should return expected actions -> test with prefix parameter', - fn: actions.createFolder(BUCKET_NAME, PREFIX, FOLDER_NAME), + fn: actions.createFolder(BUCKET_NAME, PREFIX, FOLDER_NAME, queryClient), storeState: initState, expectedActions: [ createFolderNetworkAction, @@ -189,7 +190,7 @@ describe.skip('s3object actions', () => { }, { it: 'createFolder: should handle error -> test without prefix parameter', - fn: actions.createFolder(BUCKET_NAME, '', FOLDER_NAME), + fn: actions.createFolder(BUCKET_NAME, '', FOLDER_NAME, queryClient), storeState: errorZenkoState(), expectedActions: [ createFolderNetworkAction, @@ -200,7 +201,7 @@ describe.skip('s3object actions', () => { }, { it: 'createFolder: should handle error -> test with prefix parameter', - fn: actions.createFolder(BUCKET_NAME, PREFIX, FOLDER_NAME), + fn: actions.createFolder(BUCKET_NAME, PREFIX, FOLDER_NAME, queryClient), storeState: errorZenkoState(), expectedActions: [ createFolderNetworkAction, @@ -211,7 +212,7 @@ describe.skip('s3object actions', () => { }, { it: 'uploadFiles: should return expected actions -> test without prefix parameter', - fn: actions.uploadFiles(BUCKET_NAME, '', []), + fn: actions.uploadFiles(BUCKET_NAME, '', [], queryClient), storeState: initState, expectedActions: [ dispatchAction.CLOSE_OBJECT_UPLOAD_MODAL_ACTION(), @@ -230,7 +231,7 @@ describe.skip('s3object actions', () => { }, { it: 'uploadFiles: should return expected actions -> test with prefix parameter', - fn: actions.uploadFiles(BUCKET_NAME, PREFIX, []), + fn: actions.uploadFiles(BUCKET_NAME, PREFIX, [], queryClient), storeState: initState, expectedActions: [ dispatchAction.CLOSE_OBJECT_UPLOAD_MODAL_ACTION(), diff --git a/src/react/locations/__tests__/LocationList.test.tsx b/src/react/locations/__tests__/LocationList.test.tsx index 4ed48ffc7..89b5350f0 100644 --- a/src/react/locations/__tests__/LocationList.test.tsx +++ b/src/react/locations/__tests__/LocationList.test.tsx @@ -32,6 +32,7 @@ const server = setupServer( (req, res, ctx) => res(ctx.json({})), ), rest.post(`${TEST_API_BASE_URL}/`, (req, res, ctx) => { + //@ts-ignore const params = new URLSearchParams(req.body); console.log(req.body); diff --git a/src/react/queries.ts b/src/react/queries.ts index 79424411a..fe7fc5559 100644 --- a/src/react/queries.ts +++ b/src/react/queries.ts @@ -16,7 +16,6 @@ import { import { ListObjectVersionsOutput } from 'aws-sdk/clients/s3'; import { InfiniteData } from 'react-query'; import IAMClient from '../js/IAMClient'; -import { UiFacingApi } from '../js/managementClient/api'; import { getAccountSeeds } from '../js/vault'; import { notFalsyTypeGuard } from '../types/typeGuards'; import { APIWorkflows, Workflow, Workflows } from '../types/workflow'; @@ -26,7 +25,7 @@ import { generateStreamName, generateTransitionName, } from './workflow/utils'; -import { UiFacingApiWrapper } from 'src/js/managementClient'; +import { UiFacingApiWrapper } from '../js/managementClient'; // Copy paste form legacy redux workflow export const makeWorkflows = (apiWorkflows: APIWorkflows): Workflows => { @@ -78,7 +77,7 @@ export const workflowListQuery = ( ) => { return { queryKey: ['workflowList', accountId, instanceId, rolePathName, filters], - queryFn: async (): Promise => { + queryFn: async () => { if (onStart) { onStart(); } diff --git a/src/react/workflow/ReplicationForm.tsx b/src/react/workflow/ReplicationForm.tsx index c5bef21ed..4093933c1 100644 --- a/src/react/workflow/ReplicationForm.tsx +++ b/src/react/workflow/ReplicationForm.tsx @@ -55,6 +55,7 @@ import { renderDestination, } from './utils'; import { useAuth, useInstanceId } from '../next-architecture/ui/AuthProvider'; +import { ReplicationStreamInternalV1 } from '../../js/managementClient/api'; type Props = { isCreateMode?: boolean; @@ -64,7 +65,7 @@ type Props = { export const disallowedPrefixes = ( bucketName: string, - streams: Replication[], + streams: ReplicationStreamInternalV1[], ) => { return streams .filter((s) => { diff --git a/src/react/workflow/Workflows.tsx b/src/react/workflow/Workflows.tsx index f3a3c7749..c54445e1a 100644 --- a/src/react/workflow/Workflows.tsx +++ b/src/react/workflow/Workflows.tsx @@ -16,6 +16,7 @@ import { BucketWorkflowExpirationV1, BucketWorkflowTransitionV2, ReplicationStreamInternalV1, + SearchWorkflowsListV1, } from '../../js/managementClient/api'; import { notFalsyTypeGuard } from '../../types/typeGuards'; import { APIWorkflows } from '../../types/workflow'; @@ -44,7 +45,7 @@ import { type Filter = string[]; export function useWorkflowsWithSelect( - select: (workflows: APIWorkflows) => T, + select: (workflows: SearchWorkflowsListV1) => T, filters?: Filter, ): UseQueryResult { const mgnt = useManagementClient();