From d25de4f459f302c3d376dbbbae97ddc1e866cbb3 Mon Sep 17 00:00:00 2001 From: Ali <83188384+testA113@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:41:43 +1300 Subject: [PATCH] fix(more-resources): address CE review comments [r8s-103] (#110) --- .../ClusterRoleBindingsDatatable.tsx | 4 ++-- ...leBindings.ts => useDeleteClusterRoleBindingsMutation.ts} | 4 +++- .../ClusterRolesDatatable/ClusterRolesDatatable.tsx | 5 +++-- ...eleteClusterRoles.ts => useDeleteClusterRolesMutation.ts} | 2 +- .../RoleBindingsDatatable/RoleBindingsDatatable.tsx | 5 +++-- ...eleteRoleBindings.ts => useDeleteRoleBindingsMutation.ts} | 2 +- .../RolesView/RolesDatatable/RolesDatatable.tsx | 4 ++-- .../queries/{useDeleteRoles.ts => useDeleteRolesMutation.ts} | 2 +- 8 files changed, 16 insertions(+), 12 deletions(-) rename app/react/kubernetes/more-resources/ClusterRolesView/ClusterRoleBindingsDatatable/queries/{useDeleteClusterRoleBindings.ts => useDeleteClusterRoleBindingsMutation.ts} (91%) rename app/react/kubernetes/more-resources/ClusterRolesView/ClusterRolesDatatable/queries/{useDeleteClusterRoles.ts => useDeleteClusterRolesMutation.ts} (91%) rename app/react/kubernetes/more-resources/RolesView/RoleBindingsDatatable/queries/{useDeleteRoleBindings.ts => useDeleteRoleBindingsMutation.ts} (91%) rename app/react/kubernetes/more-resources/RolesView/RolesDatatable/queries/{useDeleteRoles.ts => useDeleteRolesMutation.ts} (92%) diff --git a/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRoleBindingsDatatable/ClusterRoleBindingsDatatable.tsx b/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRoleBindingsDatatable/ClusterRoleBindingsDatatable.tsx index 1254fa0fa..8fb9d2e79 100644 --- a/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRoleBindingsDatatable/ClusterRoleBindingsDatatable.tsx +++ b/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRoleBindingsDatatable/ClusterRoleBindingsDatatable.tsx @@ -21,7 +21,7 @@ import { DefaultDatatableSettings } from '../../../datatables/DefaultDatatableSe import { ClusterRoleBinding } from './types'; import { columns } from './columns'; import { useClusterRoleBindings } from './queries/useClusterRoleBindings'; -import { useDeleteClusterRoleBindings } from './queries/useDeleteClusterRoleBindings'; +import { useDeleteClusterRoleBindingsMutation } from './queries/useDeleteClusterRoleBindingsMutation'; const storageKey = 'clusterRoleBindings'; const settingsStore = createStore(storageKey); @@ -99,7 +99,7 @@ type TableActionsProps = { function TableActions({ selectedItems }: TableActionsProps) { const environmentId = useEnvironmentId(); const deleteClusterRoleBindingsMutation = - useDeleteClusterRoleBindings(environmentId); + useDeleteClusterRoleBindingsMutation(environmentId); const router = useRouter(); async function handleRemoveClick(roles: SelectedRole[]) { diff --git a/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRoleBindingsDatatable/queries/useDeleteClusterRoleBindings.ts b/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRoleBindingsDatatable/queries/useDeleteClusterRoleBindingsMutation.ts similarity index 91% rename from app/react/kubernetes/more-resources/ClusterRolesView/ClusterRoleBindingsDatatable/queries/useDeleteClusterRoleBindings.ts rename to app/react/kubernetes/more-resources/ClusterRolesView/ClusterRoleBindingsDatatable/queries/useDeleteClusterRoleBindingsMutation.ts index 5724b4fb9..9767f90e3 100644 --- a/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRoleBindingsDatatable/queries/useDeleteClusterRoleBindings.ts +++ b/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRoleBindingsDatatable/queries/useDeleteClusterRoleBindingsMutation.ts @@ -6,7 +6,9 @@ import { EnvironmentId } from '@/react/portainer/environments/types'; import { queryKeys } from './query-keys'; -export function useDeleteClusterRoleBindings(environmentId: EnvironmentId) { +export function useDeleteClusterRoleBindingsMutation( + environmentId: EnvironmentId +) { const queryClient = useQueryClient(); return useMutation(deleteClusterRoleBindings, { ...withInvalidate(queryClient, [queryKeys.list(environmentId)]), diff --git a/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRolesDatatable/ClusterRolesDatatable.tsx b/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRolesDatatable/ClusterRolesDatatable.tsx index c61c79330..1c9b7c552 100644 --- a/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRolesDatatable/ClusterRolesDatatable.tsx +++ b/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRolesDatatable/ClusterRolesDatatable.tsx @@ -23,7 +23,7 @@ import { RoleBinding } from '../../RolesView/RoleBindingsDatatable/types'; import { ClusterRole, ClusterRoleRowData } from './types'; import { columns } from './columns'; import { useClusterRoles } from './queries/useClusterRoles'; -import { useDeleteClusterRoles } from './queries/useDeleteClusterRoles'; +import { useDeleteClusterRolesMutation } from './queries/useDeleteClusterRolesMutation'; const storageKey = 'clusterRoles'; const settingsStore = createStore(storageKey); @@ -101,7 +101,8 @@ type TableActionsProps = { function TableActions({ selectedItems }: TableActionsProps) { const environmentId = useEnvironmentId(); - const deleteClusterRolesMutation = useDeleteClusterRoles(environmentId); + const deleteClusterRolesMutation = + useDeleteClusterRolesMutation(environmentId); const router = useRouter(); async function handleRemoveClick(roles: SelectedRole[]) { diff --git a/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRolesDatatable/queries/useDeleteClusterRoles.ts b/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRolesDatatable/queries/useDeleteClusterRolesMutation.ts similarity index 91% rename from app/react/kubernetes/more-resources/ClusterRolesView/ClusterRolesDatatable/queries/useDeleteClusterRoles.ts rename to app/react/kubernetes/more-resources/ClusterRolesView/ClusterRolesDatatable/queries/useDeleteClusterRolesMutation.ts index 3aaeb8f6c..85167e651 100644 --- a/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRolesDatatable/queries/useDeleteClusterRoles.ts +++ b/app/react/kubernetes/more-resources/ClusterRolesView/ClusterRolesDatatable/queries/useDeleteClusterRolesMutation.ts @@ -6,7 +6,7 @@ import { EnvironmentId } from '@/react/portainer/environments/types'; import { queryKeys } from './query-keys'; -export function useDeleteClusterRoles(environmentId: EnvironmentId) { +export function useDeleteClusterRolesMutation(environmentId: EnvironmentId) { const queryClient = useQueryClient(); return useMutation(deleteClusterRoles, { onSuccess: () => diff --git a/app/react/kubernetes/more-resources/RolesView/RoleBindingsDatatable/RoleBindingsDatatable.tsx b/app/react/kubernetes/more-resources/RolesView/RoleBindingsDatatable/RoleBindingsDatatable.tsx index 6a70c7b68..31240ab56 100644 --- a/app/react/kubernetes/more-resources/RolesView/RoleBindingsDatatable/RoleBindingsDatatable.tsx +++ b/app/react/kubernetes/more-resources/RolesView/RoleBindingsDatatable/RoleBindingsDatatable.tsx @@ -26,7 +26,7 @@ import { import { RoleBinding } from './types'; import { columns } from './columns'; import { useRoleBindings } from './queries/useRoleBindings'; -import { useDeleteRoleBindings } from './queries/useDeleteRoleBindings'; +import { useDeleteRoleBindingsMutation } from './queries/useDeleteRoleBindingsMutation'; const storageKey = 'roleBindings'; interface TableSettings @@ -111,7 +111,8 @@ type TableActionsProps = { function TableActions({ selectedItems }: TableActionsProps) { const environmentId = useEnvironmentId(); - const deleteRoleBindingsMutation = useDeleteRoleBindings(environmentId); + const deleteRoleBindingsMutation = + useDeleteRoleBindingsMutation(environmentId); const router = useRouter(); async function handleRemoveClick(roles: SelectedRole[]) { diff --git a/app/react/kubernetes/more-resources/RolesView/RoleBindingsDatatable/queries/useDeleteRoleBindings.ts b/app/react/kubernetes/more-resources/RolesView/RoleBindingsDatatable/queries/useDeleteRoleBindingsMutation.ts similarity index 91% rename from app/react/kubernetes/more-resources/RolesView/RoleBindingsDatatable/queries/useDeleteRoleBindings.ts rename to app/react/kubernetes/more-resources/RolesView/RoleBindingsDatatable/queries/useDeleteRoleBindingsMutation.ts index 79c153bc5..029ee7e4b 100644 --- a/app/react/kubernetes/more-resources/RolesView/RoleBindingsDatatable/queries/useDeleteRoleBindings.ts +++ b/app/react/kubernetes/more-resources/RolesView/RoleBindingsDatatable/queries/useDeleteRoleBindingsMutation.ts @@ -6,7 +6,7 @@ import { EnvironmentId } from '@/react/portainer/environments/types'; import { queryKeys } from './query-keys'; -export function useDeleteRoleBindings(environmentId: EnvironmentId) { +export function useDeleteRoleBindingsMutation(environmentId: EnvironmentId) { const queryClient = useQueryClient(); return useMutation(deleteRoleBindings, { ...withInvalidate(queryClient, [queryKeys.list(environmentId)]), diff --git a/app/react/kubernetes/more-resources/RolesView/RolesDatatable/RolesDatatable.tsx b/app/react/kubernetes/more-resources/RolesView/RolesDatatable/RolesDatatable.tsx index b24eca7f5..caa98b4c5 100644 --- a/app/react/kubernetes/more-resources/RolesView/RolesDatatable/RolesDatatable.tsx +++ b/app/react/kubernetes/more-resources/RolesView/RolesDatatable/RolesDatatable.tsx @@ -27,7 +27,7 @@ import { RoleBinding } from '../RoleBindingsDatatable/types'; import { columns } from './columns'; import { Role, RoleRowData } from './types'; import { useRoles } from './queries/useRoles'; -import { useDeleteRoles } from './queries/useDeleteRoles'; +import { useDeleteRolesMutation } from './queries/useDeleteRolesMutation'; const storageKey = 'roles'; interface TableSettings @@ -99,7 +99,7 @@ type TableActionsProps = { function TableActions({ selectedItems }: TableActionsProps) { const environmentId = useEnvironmentId(); - const deleteRolesMutation = useDeleteRoles(environmentId); + const deleteRolesMutation = useDeleteRolesMutation(environmentId); const router = useRouter(); return ( diff --git a/app/react/kubernetes/more-resources/RolesView/RolesDatatable/queries/useDeleteRoles.ts b/app/react/kubernetes/more-resources/RolesView/RolesDatatable/queries/useDeleteRolesMutation.ts similarity index 92% rename from app/react/kubernetes/more-resources/RolesView/RolesDatatable/queries/useDeleteRoles.ts rename to app/react/kubernetes/more-resources/RolesView/RolesDatatable/queries/useDeleteRolesMutation.ts index 6b4cc96fc..211ac8a16 100644 --- a/app/react/kubernetes/more-resources/RolesView/RolesDatatable/queries/useDeleteRoles.ts +++ b/app/react/kubernetes/more-resources/RolesView/RolesDatatable/queries/useDeleteRolesMutation.ts @@ -6,7 +6,7 @@ import { EnvironmentId } from '@/react/portainer/environments/types'; import { queryKeys } from './query-keys'; -export function useDeleteRoles(environmentId: EnvironmentId) { +export function useDeleteRolesMutation(environmentId: EnvironmentId) { const queryClient = useQueryClient(); return useMutation(deleteRole, { ...withInvalidate(queryClient, [queryKeys.list(environmentId)]),