Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
MonPote committed Aug 20, 2024
1 parent a3581dd commit 2a2fb5b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/react/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ export const workflowListQuery = (
accountId: string,
instanceId: string,
rolePathName: string,
getToken: () => Promise<string | null>,
onStart?: () => void,
filters?: string[],
getToken: Promise<string | null>,
) => {
return {
queryKey: ['workflowList', accountId, instanceId, rolePathName, filters],
Expand Down
6 changes: 6 additions & 0 deletions src/react/workflow/ConfigurationTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ function useReplicationMutations({
accountId,
instanceId,
rolePathName,
getToken,
).queryKey,
);
},
Expand Down Expand Up @@ -173,6 +174,7 @@ function useReplicationMutations({
accountId,
instanceId,
rolePathName,
getToken,
).queryKey,
);
},
Expand Down Expand Up @@ -228,6 +230,7 @@ function useExpirationMutations({
accountId,
instanceId,
rolePathName,
getToken,
).queryKey,
);
},
Expand Down Expand Up @@ -274,6 +277,7 @@ function useExpirationMutations({
accountId,
instanceId,
rolePathName,
getToken,
).queryKey,
);
},
Expand Down Expand Up @@ -335,6 +339,7 @@ function useTransitionMutations(
accountId,
instanceId,
rolePathName,
getToken,
).queryKey,
);
},
Expand Down Expand Up @@ -381,6 +386,7 @@ function useTransitionMutations(
accountId,
instanceId,
rolePathName,
getToken,
).queryKey,
);
},
Expand Down
7 changes: 6 additions & 1 deletion src/react/workflow/CreateWorkflow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -94,6 +94,7 @@ const CreateWorkflow = () => {
const mgnt = useManagementClient();
const queryClient = useQueryClient();
const instanceId = useInstanceId();
const { getToken } = useAuth();

const { versionning } = useBucketVersionning({ bucketName });
const isBucketVersioningEnabled =
Expand All @@ -111,6 +112,7 @@ const CreateWorkflow = () => {
accountId,
instanceId,
rolePathName,
getToken,
),
select: (workflows) =>
workflows.filter((w) => w.replication).map((w) => w.replication),
Expand Down Expand Up @@ -210,6 +212,7 @@ const CreateWorkflow = () => {
notFalsyTypeGuard(accountId),
notFalsyTypeGuard(instanceId),
rolePathName,
getToken,
).queryKey,
);
if (bucketName !== '') {
Expand Down Expand Up @@ -258,6 +261,7 @@ const CreateWorkflow = () => {
notFalsyTypeGuard(accountId),
notFalsyTypeGuard(instanceId),
rolePathName,
getToken,
).queryKey,
);
if (bucketName !== '') {
Expand Down Expand Up @@ -305,6 +309,7 @@ const CreateWorkflow = () => {
notFalsyTypeGuard(accountId),
notFalsyTypeGuard(instanceId),
rolePathName,
getToken,
).queryKey,
);
if (bucketName !== '') {
Expand Down
8 changes: 5 additions & 3 deletions src/react/workflow/ReplicationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 3 additions & 1 deletion src/react/workflow/Workflows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -53,13 +53,15 @@ export function useWorkflowsWithSelect<T>(
const accountId = account?.id;
const rolePathName = useRolePathName();
const dispatch = useDispatch();
const { getToken } = useAuth();

const workflowsQuery = useQuery({
...workflowListQuery(
notFalsyTypeGuard(mgnt),
accountId,
instanceId,
rolePathName,
getToken,
() => {
dispatch(networkStart('Loading workflows...'));
},
Expand Down
4 changes: 3 additions & 1 deletion src/react/workflow/useDeleteWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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();
Expand Down Expand Up @@ -120,6 +121,7 @@ export const useDeleteWorkflow = (
accountId,
instanceId,
rolePathName,
getToken,
).queryKey,
);
showToast({
Expand Down

0 comments on commit 2a2fb5b

Please sign in to comment.