forked from Alex/Pterodactyl-Panel
ui(admin): cleanup table hooks, more...
This commit is contained in:
parent
7524bbe8ee
commit
6879ca4054
@ -1,7 +1,7 @@
|
||||
import http, { FractalResponseData, getPaginationSet, PaginatedResult } from '@/api/http';
|
||||
import { useContext } from 'react';
|
||||
import useSWR from 'swr';
|
||||
import { createContext } from '@/api/admin/admin';
|
||||
import { createContext } from '@/api/admin';
|
||||
|
||||
export interface Database {
|
||||
id: number;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import http, { FractalResponseData, getPaginationSet, PaginatedResult } from '@/api/http';
|
||||
import { useContext } from 'react';
|
||||
import useSWR from 'swr';
|
||||
import { createContext } from '@/api/admin/admin';
|
||||
import { createContext } from '@/api/admin';
|
||||
|
||||
export interface Location {
|
||||
id: number;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import http, { FractalResponseData, FractalResponseList, getPaginationSet, PaginatedResult } from '@/api/http';
|
||||
import { useContext } from 'react';
|
||||
import useSWR from 'swr';
|
||||
import { createContext } from '@/api/admin/admin';
|
||||
import { createContext } from '@/api/admin';
|
||||
import { Egg, rawDataToEgg } from '@/api/admin/eggs/getEgg';
|
||||
import { Node, rawDataToNode } from '@/api/admin/nodes/getNodes';
|
||||
import { Server, rawDataToServer } from '@/api/admin/servers/getServers';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import http, { getPaginationSet, PaginatedResult } from '@/api/http';
|
||||
import { useContext } from 'react';
|
||||
import useSWR from 'swr';
|
||||
import { createContext } from '@/api/admin/admin';
|
||||
import { createContext } from '@/api/admin';
|
||||
import { Egg, rawDataToEgg } from '@/api/admin/eggs/getEgg';
|
||||
|
||||
export interface Filters {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import http, { FractalResponseData, FractalResponseList, getPaginationSet, PaginatedResult } from '@/api/http';
|
||||
import { useContext } from 'react';
|
||||
import useSWR from 'swr';
|
||||
import { createContext } from '@/api/admin/admin';
|
||||
import { createContext } from '@/api/admin';
|
||||
import { Egg, rawDataToEgg } from '@/api/admin/eggs/getEgg';
|
||||
|
||||
export interface Nest {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import http, { FractalResponseData, getPaginationSet, PaginatedResult } from '@/api/http';
|
||||
import { useContext } from 'react';
|
||||
import useSWR from 'swr';
|
||||
import { createContext } from '@/api/admin/admin';
|
||||
import { createContext } from '@/api/admin';
|
||||
import { Database, rawDataToDatabase } from '@/api/admin/databases/getDatabases';
|
||||
import { Location, rawDataToLocation } from '@/api/admin/locations/getLocations';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import http, { FractalResponseData, getPaginationSet, PaginatedResult } from '@/api/http';
|
||||
import { useContext } from 'react';
|
||||
import useSWR from 'swr';
|
||||
import { createContext } from '@/api/admin/admin';
|
||||
import { createContext } from '@/api/admin';
|
||||
|
||||
export interface Role {
|
||||
id: number;
|
||||
|
@ -2,7 +2,7 @@ import { Egg, rawDataToEgg } from '@/api/admin/eggs/getEgg';
|
||||
import http, { FractalResponseData, getPaginationSet, PaginatedResult } from '@/api/http';
|
||||
import { useContext } from 'react';
|
||||
import useSWR from 'swr';
|
||||
import { createContext } from '@/api/admin/admin';
|
||||
import { createContext } from '@/api/admin';
|
||||
import { Node, rawDataToNode } from '@/api/admin/nodes/getNodes';
|
||||
import { User, rawDataToUser } from '@/api/admin/users/getUsers';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import http, { FractalResponseData, getPaginationSet, PaginatedResult } from '@/api/http';
|
||||
import { useContext } from 'react';
|
||||
import useSWR from 'swr';
|
||||
import { createContext } from '@/api/admin/admin';
|
||||
import { createContext } from '@/api/admin';
|
||||
|
||||
export interface User {
|
||||
id: number;
|
||||
|
@ -7,22 +7,9 @@ import Spinner from '@/components/elements/Spinner';
|
||||
import styled from 'styled-components/macro';
|
||||
import tw from 'twin.macro';
|
||||
import { PaginatedResult, PaginationDataSet } from '@/api/http';
|
||||
import { ListContext as TableHooks } from '@/api/admin';
|
||||
|
||||
interface Hooks<T> {
|
||||
page: number;
|
||||
setPage: (page: ((p: number) => number) | number) => void;
|
||||
|
||||
filters: T | null;
|
||||
setFilters: (filters: ((f: T | null) => T | null) | T | null) => void;
|
||||
|
||||
sort: string | null;
|
||||
setSort: (sort: string | null) => void;
|
||||
|
||||
sortDirection: boolean;
|
||||
setSortDirection: (direction: ((p: boolean) => boolean) | boolean) => void;
|
||||
}
|
||||
|
||||
export function useTableHooks<T> (): Hooks<T> {
|
||||
export function useTableHooks<T> (): TableHooks<T> {
|
||||
const [ page, setPage ] = useState<number>(1);
|
||||
const [ filters, setFilters ] = useState<T | null>(null);
|
||||
const [ sort, setSortState ] = useState<string | null>(null);
|
||||
|
Loading…
Reference in New Issue
Block a user