mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
fix(more resources): fix porting and functionality [r8s-103] (#8)
Co-authored-by: testA113 <aliharriss1995@gmail.com> Co-authored-by: Anthony Lapenna <anthony.lapenna@portainer.io> Co-authored-by: Ali <83188384+testA113@users.noreply.github.com>
This commit is contained in:
parent
e6577ca269
commit
6d31f4876a
48 changed files with 894 additions and 186 deletions
|
@ -20,8 +20,8 @@ import { DefaultDatatableSettings } from '../../../datatables/DefaultDatatableSe
|
|||
|
||||
import { ClusterRoleBinding } from './types';
|
||||
import { columns } from './columns';
|
||||
import { useGetClusterRoleBindingsQuery } from './queries/useGetClusterRoleBindingsQuery';
|
||||
import { useDeleteClusterRoleBindingsMutation } from './queries/useDeleteClusterRoleBindingsMutation';
|
||||
import { useClusterRoleBindings } from './queries/useClusterRoleBindings';
|
||||
import { useDeleteClusterRoleBindings } from './queries/useDeleteClusterRoleBindings';
|
||||
|
||||
const storageKey = 'clusterRoleBindings';
|
||||
const settingsStore = createStore(storageKey);
|
||||
|
@ -29,12 +29,9 @@ const settingsStore = createStore(storageKey);
|
|||
export function ClusterRoleBindingsDatatable() {
|
||||
const environmentId = useEnvironmentId();
|
||||
const tableState = useTableState(settingsStore, storageKey);
|
||||
const clusterRoleBindingsQuery = useGetClusterRoleBindingsQuery(
|
||||
environmentId,
|
||||
{
|
||||
autoRefreshRate: tableState.autoRefreshRate * 1000,
|
||||
}
|
||||
);
|
||||
const clusterRoleBindingsQuery = useClusterRoleBindings(environmentId, {
|
||||
autoRefreshRate: tableState.autoRefreshRate * 1000,
|
||||
});
|
||||
|
||||
const filteredClusterRoleBindings = useMemo(
|
||||
() =>
|
||||
|
@ -102,7 +99,7 @@ type TableActionsProps = {
|
|||
function TableActions({ selectedItems }: TableActionsProps) {
|
||||
const environmentId = useEnvironmentId();
|
||||
const deleteClusterRoleBindingsMutation =
|
||||
useDeleteClusterRoleBindingsMutation(environmentId);
|
||||
useDeleteClusterRoleBindings(environmentId);
|
||||
const router = useRouter();
|
||||
|
||||
async function handleRemoveClick(roles: SelectedRole[]) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import { ClusterRoleBinding } from '../types';
|
|||
|
||||
import { queryKeys } from './query-keys';
|
||||
|
||||
export function useGetClusterRoleBindingsQuery(
|
||||
export function useClusterRoleBindings(
|
||||
environmentId: EnvironmentId,
|
||||
options?: { autoRefreshRate?: number }
|
||||
) {
|
|
@ -6,9 +6,7 @@ import { EnvironmentId } from '@/react/portainer/environments/types';
|
|||
|
||||
import { queryKeys } from './query-keys';
|
||||
|
||||
export function useDeleteClusterRoleBindingsMutation(
|
||||
environmentId: EnvironmentId
|
||||
) {
|
||||
export function useDeleteClusterRoleBindings(environmentId: EnvironmentId) {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation(deleteClusterRoleBindings, {
|
||||
...withInvalidate(queryClient, [queryKeys.list(environmentId)]),
|
|
@ -15,12 +15,8 @@ export type ClusterRoleBinding = {
|
|||
name: string;
|
||||
uid: string;
|
||||
namespace: string;
|
||||
resourceVersion: string;
|
||||
creationDate: string;
|
||||
annotations: Record<string, string> | null;
|
||||
|
||||
roleRef: ClusterRoleRef;
|
||||
subjects: ClusterRoleSubject[] | null;
|
||||
|
||||
creationDate: string;
|
||||
isSystem: boolean;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue