From 2a2fb5b05829f8473e27f1def39ad498ba09ab38 Mon Sep 17 00:00:00 2001 From: Patrick Ear Date: Tue, 20 Aug 2024 16:01:17 +0200 Subject: [PATCH] save --- src/react/queries.ts | 2 +- src/react/workflow/ConfigurationTab.tsx | 6 ++++++ src/react/workflow/CreateWorkflow.tsx | 7 ++++++- src/react/workflow/ReplicationForm.tsx | 8 +++++--- src/react/workflow/Workflows.tsx | 4 +++- src/react/workflow/useDeleteWorkflow.ts | 4 +++- 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/react/queries.ts b/src/react/queries.ts index 37cad6cae..79424411a 100644 --- a/src/react/queries.ts +++ b/src/react/queries.ts @@ -72,9 +72,9 @@ export const workflowListQuery = ( accountId: string, instanceId: string, rolePathName: string, + getToken: () => Promise, onStart?: () => void, filters?: string[], - getToken: Promise, ) => { return { queryKey: ['workflowList', accountId, instanceId, rolePathName, filters], diff --git a/src/react/workflow/ConfigurationTab.tsx b/src/react/workflow/ConfigurationTab.tsx index 552850a74..d64139597 100644 --- a/src/react/workflow/ConfigurationTab.tsx +++ b/src/react/workflow/ConfigurationTab.tsx @@ -121,6 +121,7 @@ function useReplicationMutations({ accountId, instanceId, rolePathName, + getToken, ).queryKey, ); }, @@ -173,6 +174,7 @@ function useReplicationMutations({ accountId, instanceId, rolePathName, + getToken, ).queryKey, ); }, @@ -228,6 +230,7 @@ function useExpirationMutations({ accountId, instanceId, rolePathName, + getToken, ).queryKey, ); }, @@ -274,6 +277,7 @@ function useExpirationMutations({ accountId, instanceId, rolePathName, + getToken, ).queryKey, ); }, @@ -335,6 +339,7 @@ function useTransitionMutations( accountId, instanceId, rolePathName, + getToken, ).queryKey, ); }, @@ -381,6 +386,7 @@ function useTransitionMutations( accountId, instanceId, rolePathName, + getToken, ).queryKey, ); }, diff --git a/src/react/workflow/CreateWorkflow.tsx b/src/react/workflow/CreateWorkflow.tsx index 4d521c118..b3b553e70 100644 --- a/src/react/workflow/CreateWorkflow.tsx +++ b/src/react/workflow/CreateWorkflow.tsx @@ -40,7 +40,7 @@ import { } from '../next-architecture/domain/business/buckets'; import { useLocationAndStorageInfos } from '../next-architecture/domain/business/locations'; import { useAccountsLocationsEndpointsAdapter } from '../next-architecture/ui/AccountsLocationsEndpointsAdapterProvider'; -import { useInstanceId } from '../next-architecture/ui/AuthProvider'; +import { useAuth, useInstanceId } from '../next-architecture/ui/AuthProvider'; import { workflowListQuery } from '../queries'; import { useQueryParams, useRolePathName } from '../utils/hooks'; import { @@ -94,6 +94,7 @@ const CreateWorkflow = () => { const mgnt = useManagementClient(); const queryClient = useQueryClient(); const instanceId = useInstanceId(); + const { getToken } = useAuth(); const { versionning } = useBucketVersionning({ bucketName }); const isBucketVersioningEnabled = @@ -111,6 +112,7 @@ const CreateWorkflow = () => { accountId, instanceId, rolePathName, + getToken, ), select: (workflows) => workflows.filter((w) => w.replication).map((w) => w.replication), @@ -210,6 +212,7 @@ const CreateWorkflow = () => { notFalsyTypeGuard(accountId), notFalsyTypeGuard(instanceId), rolePathName, + getToken, ).queryKey, ); if (bucketName !== '') { @@ -258,6 +261,7 @@ const CreateWorkflow = () => { notFalsyTypeGuard(accountId), notFalsyTypeGuard(instanceId), rolePathName, + getToken, ).queryKey, ); if (bucketName !== '') { @@ -305,6 +309,7 @@ const CreateWorkflow = () => { notFalsyTypeGuard(accountId), notFalsyTypeGuard(instanceId), rolePathName, + getToken, ).queryKey, ); if (bucketName !== '') { diff --git a/src/react/workflow/ReplicationForm.tsx b/src/react/workflow/ReplicationForm.tsx index 22121585b..c5bef21ed 100644 --- a/src/react/workflow/ReplicationForm.tsx +++ b/src/react/workflow/ReplicationForm.tsx @@ -54,7 +54,7 @@ import { flattenFormTouchedFields, renderDestination, } from './utils'; -import { useInstanceId } from '../next-architecture/ui/AuthProvider'; +import { useAuth, useInstanceId } from '../next-architecture/ui/AuthProvider'; type Props = { isCreateMode?: boolean; @@ -160,12 +160,14 @@ const useReplicationStreams = (account?: Account) => { const accountId = account?.id; const rolePathName = useRolePathName(); const mgnt = useManagementClient(); + const { getToken } = useAuth(); const replicationsQuery = useQuery({ ...workflowListQuery( notFalsyTypeGuard(mgnt), - accountId!, - instanceId!, + accountId, + instanceId, rolePathName, + getToken, ), select: (workflows) => workflows.filter((w) => w.replication).map((w) => w.replication), diff --git a/src/react/workflow/Workflows.tsx b/src/react/workflow/Workflows.tsx index 35d3dd39c..f3a3c7749 100644 --- a/src/react/workflow/Workflows.tsx +++ b/src/react/workflow/Workflows.tsx @@ -28,7 +28,7 @@ import { networkStart, } from '../actions'; import { useListBucketsForCurrentAccount } from '../next-architecture/domain/business/buckets'; -import { useInstanceId } from '../next-architecture/ui/AuthProvider'; +import { useAuth, useInstanceId } from '../next-architecture/ui/AuthProvider'; import { useMetricsAdapter } from '../next-architecture/ui/MetricsAdapterProvider'; import { makeWorkflows, workflowListQuery } from '../queries'; import { Breadcrumb } from '../ui-elements/Breadcrumb'; @@ -53,6 +53,7 @@ export function useWorkflowsWithSelect( const accountId = account?.id; const rolePathName = useRolePathName(); const dispatch = useDispatch(); + const { getToken } = useAuth(); const workflowsQuery = useQuery({ ...workflowListQuery( @@ -60,6 +61,7 @@ export function useWorkflowsWithSelect( accountId, instanceId, rolePathName, + getToken, () => { dispatch(networkStart('Loading workflows...')); }, diff --git a/src/react/workflow/useDeleteWorkflow.ts b/src/react/workflow/useDeleteWorkflow.ts index 294166b7e..0226a513c 100644 --- a/src/react/workflow/useDeleteWorkflow.ts +++ b/src/react/workflow/useDeleteWorkflow.ts @@ -8,7 +8,7 @@ import { notFalsyTypeGuard } from '../../types/typeGuards'; import { useCurrentAccount } from '../DataServiceRoleProvider'; import { useManagementClient } from '../ManagementProvider'; import { networkEnd, networkStart } from '../actions'; -import { useInstanceId } from '../next-architecture/ui/AuthProvider'; +import { useAuth, useInstanceId } from '../next-architecture/ui/AuthProvider'; import { workflowListQuery } from '../queries'; import { errorParser } from '../utils'; import { useRolePathName } from '../utils/hooks'; @@ -23,6 +23,7 @@ export const useDeleteWorkflow = ( workflowRuleType: WorkflowRule, closeModal?: (isClose: boolean) => void, ) => { + const { getToken } = useAuth(); const dispatch = useDispatch(); const queryClient = useQueryClient(); const managementClient = useManagementClient(); @@ -120,6 +121,7 @@ export const useDeleteWorkflow = ( accountId, instanceId, rolePathName, + getToken, ).queryKey, ); showToast({