mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-11-30 01:47:51 +01:00
Update frontend packages
- Major update for react-table - Fix Hosts menu staying around after selecting a menu item
This commit is contained in:
1 parent
4e2b052b50
commit
4ecb047299
36 files changed
+1221
-1051
No files matched your search
+73
-90
@@ -1,92 +1,75 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/2.4.15/schema.json",
|
"$schema": "https://biomejs.dev/schemas/2.5.10/schema.json",
|
||||||
"vcs": {
|
"vcs": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"clientKind": "git",
|
"clientKind": "git",
|
||||||
"useIgnoreFile": true
|
"useIgnoreFile": true
|
||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"ignoreUnknown": false,
|
"ignoreUnknown": false,
|
||||||
"includes": [
|
"includes": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "!**/dist/**/*"]
|
||||||
"**/*.ts",
|
},
|
||||||
"**/*.tsx",
|
"formatter": {
|
||||||
"**/*.js",
|
"enabled": true,
|
||||||
"**/*.jsx",
|
"indentStyle": "tab",
|
||||||
"!**/dist/**/*"
|
"indentWidth": 4,
|
||||||
]
|
"lineWidth": 120,
|
||||||
},
|
"formatWithErrors": true
|
||||||
"formatter": {
|
},
|
||||||
"enabled": true,
|
"assist": {
|
||||||
"indentStyle": "tab",
|
"actions": {
|
||||||
"indentWidth": 4,
|
"source": {
|
||||||
"lineWidth": 120,
|
"organizeImports": {
|
||||||
"formatWithErrors": true
|
"level": "on",
|
||||||
},
|
"options": {
|
||||||
"assist": {
|
"groups": [
|
||||||
"actions": {
|
":BUN:",
|
||||||
"source": {
|
":NODE:",
|
||||||
"organizeImports": {
|
["npm:*", "npm:*/**"],
|
||||||
"level": "on",
|
":PACKAGE_WITH_PROTOCOL:",
|
||||||
"options": {
|
":URL:",
|
||||||
"groups": [
|
":PACKAGE:",
|
||||||
":BUN:",
|
["/src/*", "/src/**"],
|
||||||
":NODE:",
|
["/**"],
|
||||||
[
|
["#*", "#*/**"],
|
||||||
"npm:*",
|
":PATH:"
|
||||||
"npm:*/**"
|
]
|
||||||
],
|
}
|
||||||
":PACKAGE_WITH_PROTOCOL:",
|
}
|
||||||
":URL:",
|
}
|
||||||
":PACKAGE:",
|
}
|
||||||
[
|
},
|
||||||
"/src/*",
|
"linter": {
|
||||||
"/src/**"
|
"enabled": true,
|
||||||
],
|
"rules": {
|
||||||
[
|
"preset": "recommended",
|
||||||
"/**"
|
"correctness": {
|
||||||
],
|
"useUniqueElementIds": "off"
|
||||||
[
|
},
|
||||||
"#*",
|
"suspicious": {
|
||||||
"#*/**"
|
"noExplicitAny": "off",
|
||||||
],
|
"noArrayIndexKey": "off"
|
||||||
":PATH:"
|
},
|
||||||
]
|
"performance": {
|
||||||
}
|
"noDelete": "off"
|
||||||
}
|
},
|
||||||
}
|
"nursery": "off",
|
||||||
}
|
"a11y": {
|
||||||
},
|
"useSemanticElements": "off",
|
||||||
"linter": {
|
"useValidAnchor": "off"
|
||||||
"enabled": true,
|
},
|
||||||
"rules": {
|
"style": {
|
||||||
"recommended": true,
|
"noParameterAssign": "error",
|
||||||
"correctness": {
|
"useAsConstAssertion": "error",
|
||||||
"useUniqueElementIds": "off"
|
"useDefaultParameterLast": "error",
|
||||||
},
|
"useEnumInitializers": "error",
|
||||||
"suspicious": {
|
"useSelfClosingElements": "error",
|
||||||
"noExplicitAny": "off",
|
"useSingleVarDeclarator": "error",
|
||||||
"noArrayIndexKey": "off"
|
"noUnusedTemplateLiteral": "error",
|
||||||
},
|
"useNumberNamespace": "error",
|
||||||
"performance": {
|
"noInferrableTypes": "error",
|
||||||
"noDelete": "off"
|
"noUselessElse": "error"
|
||||||
},
|
}
|
||||||
"nursery": "off",
|
}
|
||||||
"a11y": {
|
}
|
||||||
"useSemanticElements": "off",
|
|
||||||
"useValidAnchor": "off"
|
|
||||||
},
|
|
||||||
"style": {
|
|
||||||
"noParameterAssign": "error",
|
|
||||||
"useAsConstAssertion": "error",
|
|
||||||
"useDefaultParameterLast": "error",
|
|
||||||
"useEnumInitializers": "error",
|
|
||||||
"useSelfClosingElements": "error",
|
|
||||||
"useSingleVarDeclarator": "error",
|
|
||||||
"noUnusedTemplateLiteral": "error",
|
|
||||||
"useNumberNamespace": "error",
|
|
||||||
"noInferrableTypes": "error",
|
|
||||||
"noUselessElse": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+25
-25
@@ -17,50 +17,50 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tabler/core": "^1.4.0",
|
"@tabler/core": "^1.4.0",
|
||||||
"@tabler/icons-react": "^3.44.0",
|
"@tabler/icons-react": "^3.46.0",
|
||||||
"@tanstack/react-query": "^5.101.0",
|
"@tanstack/react-query": "^5.101.4",
|
||||||
"@tanstack/react-table": "^8.21.3",
|
"@tanstack/react-table": "^9.1.2",
|
||||||
"@uiw/react-textarea-code-editor": "^3.1.1",
|
"@uiw/react-textarea-code-editor": "^3.1.1",
|
||||||
"classnames": "^2.5.1",
|
"classnames": "^2.5.1",
|
||||||
"country-flag-icons": "^1.6.17",
|
"country-flag-icons": "^1.6.20",
|
||||||
"date-fns": "^4.4.0",
|
"date-fns": "^4.4.0",
|
||||||
"ez-modal-react": "^1.0.5",
|
"ez-modal-react": "^1.0.5",
|
||||||
"formik": "^2.4.9",
|
"formik": "^2.4.9",
|
||||||
"generate-password-browser": "^1.1.0",
|
"generate-password-browser": "^1.1.0",
|
||||||
"humps": "^2.0.1",
|
"humps": "^2.0.1",
|
||||||
"query-string": "^9.4.0",
|
"query-string": "^9.5.0",
|
||||||
"react": "^19.2.7",
|
"react": "^19.2.8",
|
||||||
"react-bootstrap": "^2.10.10",
|
"react-bootstrap": "^2.10.10",
|
||||||
"react-dom": "^19.2.7",
|
"react-dom": "^19.2.8",
|
||||||
"react-intl": "^10.1.11",
|
"react-intl": "^10.1.22",
|
||||||
"react-markdown": "^10.1.0",
|
"react-markdown": "^10.1.0",
|
||||||
"react-router-dom": "^7.16.0",
|
"react-router-dom": "^7.18.2",
|
||||||
"react-select": "^5.10.2",
|
"react-select": "^5.10.2",
|
||||||
"react-toastify": "^11.1.0",
|
"react-toastify": "^11.1.0",
|
||||||
"rooks": "^9.8.0"
|
"rooks": "^9.9.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^2.4.15",
|
"@biomejs/biome": "^2.5.10",
|
||||||
"@formatjs/cli": "^6.16.6",
|
"@formatjs/cli": "^6.16.19",
|
||||||
"@tanstack/react-query-devtools": "^5.100.14",
|
"@tanstack/react-query-devtools": "^5.101.4",
|
||||||
"@testing-library/dom": "^10.4.1",
|
"@testing-library/dom": "^10.4.1",
|
||||||
"@testing-library/jest-dom": "^6.9.1",
|
"@testing-library/jest-dom": "^7.0.1",
|
||||||
"@testing-library/react": "^16.3.2",
|
"@testing-library/react": "^16.3.2",
|
||||||
"@types/country-flag-icons": "^1.2.2",
|
"@types/country-flag-icons": "^1.2.2",
|
||||||
"@types/humps": "^2.0.6",
|
"@types/humps": "^2.0.6",
|
||||||
"@types/node": "^25.9.1",
|
"@types/node": "^26.2.0",
|
||||||
"@types/react": "^19.2.16",
|
"@types/react": "^19.2.18",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.4",
|
||||||
"@types/react-table": "^7.7.20",
|
"@types/react-table": "^7.7.20",
|
||||||
"@vitejs/plugin-react": "^6.0.2",
|
"@vitejs/plugin-react": "^6.1.0",
|
||||||
"happy-dom": "^20.9.0",
|
"happy-dom": "^20.11.6",
|
||||||
"postcss": "^8.5.15",
|
"postcss": "^8.5.26",
|
||||||
"postcss-simple-vars": "^7.0.1",
|
"postcss-simple-vars": "^7.0.1",
|
||||||
"sass": "^1.100.0",
|
"sass": "^1.103.1",
|
||||||
"tmp": "^0.2.7",
|
"tmp": "^0.2.7",
|
||||||
"typescript": "6.0.3",
|
"typescript": "7.0.2",
|
||||||
"vite": "^8.0.16",
|
"vite": "^8.2.2",
|
||||||
"vite-plugin-checker": "^0.14.1",
|
"vite-plugin-checker": "^0.14.5",
|
||||||
"vitest": "^4.1.8"
|
"vitest": "^4.1.11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
import type { Table as ReactTable } from "@tanstack/react-table";
|
import type { Table as ReactTable, RowData } from "@tanstack/react-table";
|
||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import { Button, HasPermission } from "src/components";
|
import { Button, HasPermission } from "src/components";
|
||||||
|
import type { Features } from "src/components/Table/features";
|
||||||
import { T } from "src/locale";
|
import { T } from "src/locale";
|
||||||
import { type ADMIN, MANAGE, type Permission, type Section } from "src/modules/Permissions";
|
import { type ADMIN, MANAGE, type Permission, type Section } from "src/modules/Permissions";
|
||||||
|
|
||||||
interface Props {
|
interface Props<TData extends RowData> {
|
||||||
tableInstance: ReactTable<any>;
|
tableInstance: ReactTable<Features, TData>;
|
||||||
onNew?: () => void;
|
onNew?: () => void;
|
||||||
isFiltered?: boolean;
|
isFiltered?: boolean;
|
||||||
object: string;
|
object: string;
|
||||||
@@ -16,7 +17,7 @@ interface Props {
|
|||||||
permissionSection?: Section | typeof ADMIN;
|
permissionSection?: Section | typeof ADMIN;
|
||||||
permission?: Permission;
|
permission?: Permission;
|
||||||
}
|
}
|
||||||
function EmptyData({
|
function EmptyData<TData extends RowData>({
|
||||||
tableInstance,
|
tableInstance,
|
||||||
onNew,
|
onNew,
|
||||||
isFiltered,
|
isFiltered,
|
||||||
@@ -26,7 +27,7 @@ function EmptyData({
|
|||||||
customAddBtn,
|
customAddBtn,
|
||||||
permissionSection,
|
permissionSection,
|
||||||
permission,
|
permission,
|
||||||
}: Props) {
|
}: Props<TData>) {
|
||||||
return (
|
return (
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
||||||
|
|||||||
@@ -65,8 +65,12 @@ export function AccessClientFields({ initialValues, name = "clients" }: Props) {
|
|||||||
value={client.directive}
|
value={client.directive}
|
||||||
onChange={(e) => handleChange(idx, "directive", e.target.value)}
|
onChange={(e) => handleChange(idx, "directive", e.target.value)}
|
||||||
>
|
>
|
||||||
<option value="allow"><T id="action.allow" /></option>
|
<option value="allow">
|
||||||
<option value="deny"><T id="action.deny" /></option>
|
<T id="action.allow" />
|
||||||
|
</option>
|
||||||
|
<option value="deny">
|
||||||
|
<T id="action.deny" />
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
<input
|
<input
|
||||||
@@ -81,16 +85,13 @@ export function AccessClientFields({ initialValues, name = "clients" }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-1">
|
<div className="col-1">
|
||||||
<a
|
<button
|
||||||
role="button"
|
type="button"
|
||||||
className="btn btn-ghost btn-danger p-0"
|
className="btn btn-ghost btn-danger p-0"
|
||||||
onClick={(e) => {
|
onClick={() => handleRemove(idx)}
|
||||||
e.preventDefault();
|
|
||||||
handleRemove(idx);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<IconX size={16} />
|
<IconX size={16} />
|
||||||
</a>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
@@ -112,7 +113,9 @@ export function AccessClientFields({ initialValues, name = "clients" }: Props) {
|
|||||||
value="deny"
|
value="deny"
|
||||||
disabled
|
disabled
|
||||||
>
|
>
|
||||||
<option value="deny"><T id="action.deny" /></option>
|
<option value="deny">
|
||||||
|
<T id="action.deny" />
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -82,16 +82,13 @@ export function BasicAuthFields({ initialValues, name = "items" }: Props) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-1">
|
<div className="col-1">
|
||||||
<a
|
<button
|
||||||
role="button"
|
type="button"
|
||||||
className="btn btn-ghost btn-danger p-0"
|
className="btn btn-ghost btn-danger p-0"
|
||||||
onClick={(e) => {
|
onClick={() => handleRemove(idx)}
|
||||||
e.preventDefault();
|
|
||||||
handleRemove(idx);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<IconX size={16} />
|
<IconX size={16} />
|
||||||
</a>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -10,7 +10,13 @@ interface Props {
|
|||||||
requireDomainNames?: boolean; // used for streams
|
requireDomainNames?: boolean; // used for streams
|
||||||
color?: string;
|
color?: string;
|
||||||
}
|
}
|
||||||
export function SSLOptionsFields({ forHttp = true, forProxyHost = false, forceDNSForNew, requireDomainNames, color = "bg-cyan" }: Props) {
|
export function SSLOptionsFields({
|
||||||
|
forHttp = true,
|
||||||
|
forProxyHost = false,
|
||||||
|
forceDNSForNew,
|
||||||
|
requireDomainNames,
|
||||||
|
color = "bg-cyan",
|
||||||
|
}: Props) {
|
||||||
const { values, setFieldValue } = useFormikContext();
|
const { values, setFieldValue } = useFormikContext();
|
||||||
const v: any = values || {};
|
const v: any = values || {};
|
||||||
|
|
||||||
@@ -116,10 +122,12 @@ export function SSLOptionsFields({ forHttp = true, forProxyHost = false, forceDN
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const getHttpAdvancedOptions = () =>(
|
const getHttpAdvancedOptions = () => (
|
||||||
<div>
|
<div>
|
||||||
<details>
|
<details>
|
||||||
<summary className="mb-1"><T id="domains.advanced" /></summary>
|
<summary className="mb-1">
|
||||||
|
<T id="domains.advanced" />
|
||||||
|
</summary>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<Field name="trustForwardedProto">
|
<Field name="trustForwardedProto">
|
||||||
|
|||||||
@@ -72,7 +72,10 @@ export function SiteHeader() {
|
|||||||
<div className="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
|
<div className="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
|
||||||
<div className="d-md-none">
|
<div className="d-md-none">
|
||||||
{/* biome-ignore lint/a11y/noStaticElementInteractions lint/a11y/useKeyWithClickEvents: This div is not interactive. */}
|
{/* biome-ignore lint/a11y/noStaticElementInteractions lint/a11y/useKeyWithClickEvents: This div is not interactive. */}
|
||||||
<div className="p-2 pb-1 pe-1 d-flex align-items-center" onClick={e => e.stopPropagation()}>
|
<div
|
||||||
|
className="p-2 pb-1 pe-1 d-flex align-items-center"
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
<div className="ps-2 pe-1 me-auto">
|
<div className="ps-2 pe-1 me-auto">
|
||||||
<div>{currentUser?.nickname}</div>
|
<div>{currentUser?.nickname}</div>
|
||||||
<div className="mt-1 small text-secondary text-nowrap">
|
<div className="mt-1 small text-secondary text-nowrap">
|
||||||
|
|||||||
@@ -143,7 +143,6 @@ const getMenuDropown = (item: MenuItem, onClick?: () => void) => {
|
|||||||
className="nav-link dropdown-toggle"
|
className="nav-link dropdown-toggle"
|
||||||
href={item.to}
|
href={item.to}
|
||||||
data-bs-toggle="dropdown"
|
data-bs-toggle="dropdown"
|
||||||
data-bs-auto-close="outside"
|
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
@@ -176,13 +175,14 @@ const getMenuDropown = (item: MenuItem, onClick?: () => void) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function SiteMenu() {
|
export function SiteMenu() {
|
||||||
const closeMenu = () => setTimeout(() => {
|
const closeMenu = () =>
|
||||||
const navbarToggler = document.querySelector<HTMLElement>(".navbar-toggler");
|
setTimeout(() => {
|
||||||
const navbarMenu = document.querySelector("#navbar-menu");
|
const navbarToggler = document.querySelector<HTMLElement>(".navbar-toggler");
|
||||||
if (navbarToggler && navbarMenu?.classList.contains("show")) {
|
const navbarMenu = document.querySelector("#navbar-menu");
|
||||||
navbarToggler.click();
|
if (navbarToggler && navbarMenu?.classList.contains("show")) {
|
||||||
}
|
navbarToggler.click();
|
||||||
}, 300);
|
}
|
||||||
|
}, 300);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="navbar-expand-md">
|
<header className="navbar-expand-md">
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import type { Table as ReactTable } from "@tanstack/react-table";
|
import type { Table as ReactTable, RowData } from "@tanstack/react-table";
|
||||||
|
import type { Features } from "./features";
|
||||||
|
|
||||||
interface Props {
|
interface Props<TData extends RowData> {
|
||||||
tableInstance: ReactTable<any>;
|
tableInstance: ReactTable<Features, TData>;
|
||||||
}
|
}
|
||||||
function EmptyRow({ tableInstance }: Props) {
|
function EmptyRow<TData extends RowData>({ tableInstance }: Props<TData>) {
|
||||||
return (
|
return (
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { flexRender } from "@tanstack/react-table";
|
import { flexRender, type RowData } from "@tanstack/react-table";
|
||||||
import type { TableLayoutProps } from "src/components";
|
import type { TableLayoutProps } from "src/components";
|
||||||
import { EmptyRow } from "./EmptyRow";
|
import { EmptyRow } from "./EmptyRow";
|
||||||
|
|
||||||
function TableBody<T>(props: TableLayoutProps<T>) {
|
function TableBody<T extends RowData>(props: TableLayoutProps<T>) {
|
||||||
const { tableInstance, extraStyles, emptyState } = props;
|
const { tableInstance, extraStyles, emptyState } = props;
|
||||||
const rows = tableInstance.getRowModel().rows;
|
const rows = tableInstance.getRowModel().rows;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { IconArrowsSort, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
|
import { IconArrowsSort, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
|
||||||
import { flexRender } from "@tanstack/react-table";
|
import { flexRender, type RowData } from "@tanstack/react-table";
|
||||||
import type { TableLayoutProps } from "src/components";
|
import type { TableLayoutProps } from "src/components";
|
||||||
|
|
||||||
function TableHeader<T>(props: TableLayoutProps<T>) {
|
function TableHeader<T extends RowData>(props: TableLayoutProps<T>) {
|
||||||
const { tableInstance } = props;
|
const { tableInstance } = props;
|
||||||
const headerGroups = tableInstance.getHeaderGroups();
|
const headerGroups = tableInstance.getHeaderGroups();
|
||||||
|
|
||||||
|
|||||||
@@ -61,4 +61,4 @@ const tableEventReducer = (state: any, { type, payload }: any) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export { tableEvents, tableEventReducer };
|
export { tableEventReducer, tableEvents };
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
import type { Table as ReactTable } from "@tanstack/react-table";
|
import type { Table as ReactTable, RowData } from "@tanstack/react-table";
|
||||||
|
import type { Features } from "./features";
|
||||||
import { TableBody } from "./TableBody";
|
import { TableBody } from "./TableBody";
|
||||||
import { TableHeader } from "./TableHeader";
|
import { TableHeader } from "./TableHeader";
|
||||||
|
|
||||||
interface TableLayoutProps<TFields> {
|
interface TableLayoutProps<TFields extends RowData> {
|
||||||
tableInstance: ReactTable<TFields>;
|
tableInstance: ReactTable<Features, TFields>;
|
||||||
emptyState?: React.ReactNode;
|
emptyState?: React.ReactNode;
|
||||||
extraStyles?: {
|
extraStyles?: {
|
||||||
row: (rowData: TFields) => any | undefined;
|
row: (rowData: TFields) => any | undefined;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function TableLayout<TFields>(props: TableLayoutProps<TFields>) {
|
function TableLayout<TFields extends RowData>(props: TableLayoutProps<TFields>) {
|
||||||
const hasRows = props.tableInstance.getRowModel().rows.length > 0;
|
const hasRows = props.tableInstance.getRowModel().rows.length > 0;
|
||||||
return (
|
return (
|
||||||
<div className="table-responsive">
|
<div className="table-responsive">
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import {
|
||||||
|
columnVisibilityFeature,
|
||||||
|
createSortedRowModel,
|
||||||
|
metaHelper,
|
||||||
|
rowSortingFeature,
|
||||||
|
tableFeatures,
|
||||||
|
} from "@tanstack/react-table";
|
||||||
|
|
||||||
|
interface ColumnMeta {
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TableMeta {
|
||||||
|
isFetching?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shared TanStack Table v9 feature registration for every table in the app.
|
||||||
|
* Sorting and column visibility are used (or their APIs are called
|
||||||
|
* unconditionally, e.g. `getVisibleFlatColumns`/`getVisibleCells`) by the
|
||||||
|
* shared TableLayout/TableHeader/TableBody/EmptyData components, so every
|
||||||
|
* table instance must register them even when a particular table doesn't
|
||||||
|
* wire up controlled sorting state itself.
|
||||||
|
*/
|
||||||
|
const features = tableFeatures({
|
||||||
|
rowSortingFeature,
|
||||||
|
sortedRowModel: createSortedRowModel(),
|
||||||
|
columnVisibilityFeature,
|
||||||
|
columnMeta: metaHelper<ColumnMeta>(),
|
||||||
|
tableMeta: metaHelper<TableMeta>(),
|
||||||
|
});
|
||||||
|
|
||||||
|
type Features = typeof features;
|
||||||
|
|
||||||
|
export { type ColumnMeta, type Features, features, type TableMeta };
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
export * from "./Formatter";
|
export * from "./Formatter";
|
||||||
|
export * from "./features";
|
||||||
export * from "./TableHeader";
|
export * from "./TableHeader";
|
||||||
export * from "./TableHelpers";
|
export * from "./TableHelpers";
|
||||||
export * from "./TableLayout";
|
export * from "./TableLayout";
|
||||||
@@ -27,73 +27,73 @@ import langList from "./lang/lang-list.json";
|
|||||||
// not the country code
|
// not the country code
|
||||||
// Remember when adding to this list, also update check-locales.js script
|
// Remember when adding to this list, also update check-locales.js script
|
||||||
const localeOptions = [
|
const localeOptions = [
|
||||||
["en", "en-US", langEn],
|
["en", "en-US", langEn],
|
||||||
["de", "de-DE", langDe],
|
["de", "de-DE", langDe],
|
||||||
["es", "es-ES", langEs],
|
["es", "es-ES", langEs],
|
||||||
["et", "et-EE", langEt],
|
["et", "et-EE", langEt],
|
||||||
["pt", "pt-PT", langPt],
|
["pt", "pt-PT", langPt],
|
||||||
["fr", "fr-FR", langFr],
|
["fr", "fr-FR", langFr],
|
||||||
["ga", "ga-IE", langGa],
|
["ga", "ga-IE", langGa],
|
||||||
["ja", "ja-JP", langJa],
|
["ja", "ja-JP", langJa],
|
||||||
["it", "it-IT", langIt],
|
["it", "it-IT", langIt],
|
||||||
["nl", "nl-NL", langNl],
|
["nl", "nl-NL", langNl],
|
||||||
["pl", "pl-PL", langPl],
|
["pl", "pl-PL", langPl],
|
||||||
["ru", "ru-RU", langRu],
|
["ru", "ru-RU", langRu],
|
||||||
["sk", "sk-SK", langSk],
|
["sk", "sk-SK", langSk],
|
||||||
["cs", "cs-CZ", langCs],
|
["cs", "cs-CZ", langCs],
|
||||||
["vi", "vi-VN", langVi],
|
["vi", "vi-VN", langVi],
|
||||||
["zh", "zh-CN", langZh],
|
["zh", "zh-CN", langZh],
|
||||||
["ko", "ko-KR", langKo],
|
["ko", "ko-KR", langKo],
|
||||||
["bg", "bg-BG", langBg],
|
["bg", "bg-BG", langBg],
|
||||||
["id", "id-ID", langId],
|
["id", "id-ID", langId],
|
||||||
["tr", "tr-TR", langTr],
|
["tr", "tr-TR", langTr],
|
||||||
["hu", "hu-HU", langHu],
|
["hu", "hu-HU", langHu],
|
||||||
["no", "no-NO", langNo],
|
["no", "no-NO", langNo],
|
||||||
];
|
];
|
||||||
|
|
||||||
const loadMessages = (locale?: string): typeof langList & typeof langEn => {
|
const loadMessages = (locale?: string): typeof langList & typeof langEn => {
|
||||||
const thisLocale = (locale || "en").slice(0, 2);
|
const thisLocale = (locale || "en").slice(0, 2);
|
||||||
|
|
||||||
// ensure this lang exists in localeOptions above, otherwise fallback to en
|
// ensure this lang exists in localeOptions above, otherwise fallback to en
|
||||||
if (thisLocale === "en" || !localeOptions.some(([code]) => code === thisLocale)) {
|
if (thisLocale === "en" || !localeOptions.some(([code]) => code === thisLocale)) {
|
||||||
return Object.assign({}, langList, langEn);
|
return Object.assign({}, langList, langEn);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object.assign({}, langList, langEn, localeOptions.find(([code]) => code === thisLocale)?.[2]);
|
return Object.assign({}, langList, langEn, localeOptions.find(([code]) => code === thisLocale)?.[2]);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFlagCodeForLocale = (locale?: string) => {
|
const getFlagCodeForLocale = (locale?: string) => {
|
||||||
const thisLocale = (locale || "en").slice(0, 2);
|
const thisLocale = (locale || "en").slice(0, 2);
|
||||||
|
|
||||||
// only add to this if your flag is different from the locale code
|
// only add to this if your flag is different from the locale code
|
||||||
const specialCases: Record<string, string> = {
|
const specialCases: Record<string, string> = {
|
||||||
ja: "jp", // Japan
|
ja: "jp", // Japan
|
||||||
zh: "cn", // China
|
zh: "cn", // China
|
||||||
vi: "vn", // Vietnam
|
vi: "vn", // Vietnam
|
||||||
ko: "kr", // Korea
|
ko: "kr", // Korea
|
||||||
cs: "cz", // Czechia
|
cs: "cz", // Czechia
|
||||||
ga: "ie", // Ireland (Irish)
|
ga: "ie", // Ireland (Irish)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (specialCases[thisLocale]) {
|
if (specialCases[thisLocale]) {
|
||||||
return specialCases[thisLocale].toUpperCase();
|
return specialCases[thisLocale].toUpperCase();
|
||||||
}
|
}
|
||||||
return thisLocale.toUpperCase();
|
return thisLocale.toUpperCase();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getLocale = (short = false) => {
|
const getLocale = (short = false) => {
|
||||||
let loc = window.localStorage.getItem("locale");
|
let loc = window.localStorage.getItem("locale");
|
||||||
if (!loc) {
|
if (!loc) {
|
||||||
loc = document.documentElement.lang;
|
loc = document.documentElement.lang;
|
||||||
}
|
}
|
||||||
if (short) {
|
if (short) {
|
||||||
return loc.slice(0, 2);
|
return loc.slice(0, 2);
|
||||||
}
|
}
|
||||||
// finally, fallback
|
// finally, fallback
|
||||||
if (!loc) {
|
if (!loc) {
|
||||||
loc = "en";
|
loc = "en";
|
||||||
}
|
}
|
||||||
return loc;
|
return loc;
|
||||||
};
|
};
|
||||||
|
|
||||||
const cache = createIntlCache();
|
const cache = createIntlCache();
|
||||||
@@ -102,41 +102,41 @@ const initialMessages = loadMessages(getLocale());
|
|||||||
let intl = createIntl({ locale: getLocale(), messages: initialMessages }, cache);
|
let intl = createIntl({ locale: getLocale(), messages: initialMessages }, cache);
|
||||||
|
|
||||||
const changeLocale = (locale: string): void => {
|
const changeLocale = (locale: string): void => {
|
||||||
const messages = loadMessages(locale);
|
const messages = loadMessages(locale);
|
||||||
intl = createIntl({ locale, messages }, cache);
|
intl = createIntl({ locale, messages }, cache);
|
||||||
window.localStorage.setItem("locale", locale);
|
window.localStorage.setItem("locale", locale);
|
||||||
document.documentElement.lang = locale;
|
document.documentElement.lang = locale;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is a translation component that wraps the translation in a span with a data
|
// This is a translation component that wraps the translation in a span with a data
|
||||||
// attribute so devs can inspect the element to see the translation ID
|
// attribute so devs can inspect the element to see the translation ID
|
||||||
const T = ({
|
const T = ({
|
||||||
id,
|
id,
|
||||||
data,
|
data,
|
||||||
tData,
|
tData,
|
||||||
}: {
|
}: {
|
||||||
id: string;
|
id: string;
|
||||||
data?: Record<string, string | number | undefined>;
|
data?: Record<string, string | number | undefined>;
|
||||||
tData?: Record<string, string>;
|
tData?: Record<string, string>;
|
||||||
}) => {
|
}) => {
|
||||||
const translatedData: Record<string, string> = {};
|
const translatedData: Record<string, string> = {};
|
||||||
if (tData) {
|
if (tData) {
|
||||||
// iterate over tData and translate each value
|
// iterate over tData and translate each value
|
||||||
Object.entries(tData).forEach(([key, value]) => {
|
Object.entries(tData).forEach(([key, value]) => {
|
||||||
translatedData[key] = intl.formatMessage({ id: value });
|
translatedData[key] = intl.formatMessage({ id: value });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<span data-translation-id={id}>
|
<span data-translation-id={id}>
|
||||||
{intl.formatMessage(
|
{intl.formatMessage(
|
||||||
{ id },
|
{ id },
|
||||||
{
|
{
|
||||||
...data,
|
...data,
|
||||||
...translatedData,
|
...translatedData,
|
||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
//console.log("L:", localeOptions);
|
//console.log("L:", localeOptions);
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { fromUnixTime, type IntlFormatFormatOptions, intlFormat, parseISO } from "date-fns";
|
||||||
fromUnixTime,
|
|
||||||
type IntlFormatFormatOptions,
|
|
||||||
intlFormat,
|
|
||||||
parseISO,
|
|
||||||
} from "date-fns";
|
|
||||||
|
|
||||||
const isUnixTimestamp = (value: unknown): boolean => {
|
const isUnixTimestamp = (value: unknown): boolean => {
|
||||||
if (typeof value !== "number" && typeof value !== "string") return false;
|
if (typeof value !== "number" && typeof value !== "string") return false;
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ export * as Certificates from "./Certificates.md";
|
|||||||
export * as DeadHosts from "./DeadHosts.md";
|
export * as DeadHosts from "./DeadHosts.md";
|
||||||
export * as ProxyHosts from "./ProxyHosts.md";
|
export * as ProxyHosts from "./ProxyHosts.md";
|
||||||
export * as RedirectionHosts from "./RedirectionHosts.md";
|
export * as RedirectionHosts from "./RedirectionHosts.md";
|
||||||
export * as Streams from "./Streams.md";
|
export * as Streams from "./Streams.md";
|
||||||
@@ -22,18 +22,17 @@ import * as hu from "./hu/index";
|
|||||||
|
|
||||||
const items: any = { en, de, pt, es, et, ja, sk, cs, zh, pl, ru, it, vi, nl, bg, ko, ga, id, fr, tr, hu };
|
const items: any = { en, de, pt, es, et, ja, sk, cs, zh, pl, ru, it, vi, nl, bg, ko, ga, id, fr, tr, hu };
|
||||||
|
|
||||||
|
|
||||||
const fallbackLang = "en";
|
const fallbackLang = "en";
|
||||||
|
|
||||||
export const getHelpFile = (lang: string, section: string): string => {
|
export const getHelpFile = (lang: string, section: string): string => {
|
||||||
if (typeof items[lang] !== "undefined" && typeof items[lang][section] !== "undefined") {
|
if (typeof items[lang] !== "undefined" && typeof items[lang][section] !== "undefined") {
|
||||||
return items[lang][section].default;
|
return items[lang][section].default;
|
||||||
}
|
}
|
||||||
// Fallback to English
|
// Fallback to English
|
||||||
if (typeof items[fallbackLang] !== "undefined" && typeof items[fallbackLang][section] !== "undefined") {
|
if (typeof items[fallbackLang] !== "undefined" && typeof items[fallbackLang][section] !== "undefined") {
|
||||||
return items[fallbackLang][section].default;
|
return items[fallbackLang][section].default;
|
||||||
}
|
}
|
||||||
throw new Error(`Cannot load help doc for ${lang}-${section}`);
|
throw new Error(`Cannot load help doc for ${lang}-${section}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default items;
|
export default items;
|
||||||
@@ -4,4 +4,3 @@ export * as DeadHosts from "./DeadHosts.md";
|
|||||||
export * as ProxyHosts from "./ProxyHosts.md";
|
export * as ProxyHosts from "./ProxyHosts.md";
|
||||||
export * as RedirectionHosts from "./RedirectionHosts.md";
|
export * as RedirectionHosts from "./RedirectionHosts.md";
|
||||||
export * as Streams from "./Streams.md";
|
export * as Streams from "./Streams.md";
|
||||||
|
|
||||||
@@ -4,4 +4,3 @@ export * as DeadHosts from "./DeadHosts.md";
|
|||||||
export * as ProxyHosts from "./ProxyHosts.md";
|
export * as ProxyHosts from "./ProxyHosts.md";
|
||||||
export * as RedirectionHosts from "./RedirectionHosts.md";
|
export * as RedirectionHosts from "./RedirectionHosts.md";
|
||||||
export * as Streams from "./Streams.md";
|
export * as Streams from "./Streams.md";
|
||||||
|
|
||||||
@@ -70,11 +70,7 @@ const DNSCertificateModal = EasyModal.create(({ visible, remove }: InnerModalPro
|
|||||||
<label htmlFor="keyType" className="form-label">
|
<label htmlFor="keyType" className="form-label">
|
||||||
<T id="certificates.key-type" />
|
<T id="certificates.key-type" />
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select id="keyType" className="form-select" {...field}>
|
||||||
id="keyType"
|
|
||||||
className="form-select"
|
|
||||||
{...field}
|
|
||||||
>
|
|
||||||
<option value="rsa">
|
<option value="rsa">
|
||||||
<T id="certificates.key-type-rsa" />
|
<T id="certificates.key-type-rsa" />
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
@@ -151,11 +151,7 @@ const HTTPCertificateModal = EasyModal.create(({ visible, remove }: InnerModalPr
|
|||||||
<label htmlFor="keyType" className="form-label">
|
<label htmlFor="keyType" className="form-label">
|
||||||
<T id="certificates.key-type" />
|
<T id="certificates.key-type" />
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select id="keyType" className="form-select" {...field}>
|
||||||
id="keyType"
|
|
||||||
className="form-select"
|
|
||||||
{...field}
|
|
||||||
>
|
|
||||||
<option value="rsa">
|
<option value="rsa">
|
||||||
<T id="certificates.key-type-rsa" />
|
<T id="certificates.key-type-rsa" />
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
@@ -162,7 +162,9 @@ const RedirectionHostModal = EasyModal.create(({ id, visible, remove }: Props) =
|
|||||||
required
|
required
|
||||||
{...field}
|
{...field}
|
||||||
>
|
>
|
||||||
<option value="auto"><T id="auto" /></option>
|
<option value="auto">
|
||||||
|
<T id="auto" />
|
||||||
|
</option>
|
||||||
<option value="http">http</option>
|
<option value="http">http</option>
|
||||||
<option value="https">https</option>
|
<option value="https">https</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -224,12 +226,24 @@ const RedirectionHostModal = EasyModal.create(({ id, visible, remove }: Props) =
|
|||||||
required
|
required
|
||||||
{...field}
|
{...field}
|
||||||
>
|
>
|
||||||
<option value="300"><T id="redirection-hosts.http-code.300" /></option>
|
<option value="300">
|
||||||
<option value="301"><T id="redirection-hosts.http-code.301" /></option>
|
<T id="redirection-hosts.http-code.300" />
|
||||||
<option value="302"><T id="redirection-hosts.http-code.302" /></option>
|
</option>
|
||||||
<option value="303"><T id="redirection-hosts.http-code.303" /></option>
|
<option value="301">
|
||||||
<option value="307"><T id="redirection-hosts.http-code.307" /></option>
|
<T id="redirection-hosts.http-code.301" />
|
||||||
<option value="308"><T id="redirection-hosts.http-code.308" /></option>
|
</option>
|
||||||
|
<option value="302">
|
||||||
|
<T id="redirection-hosts.http-code.302" />
|
||||||
|
</option>
|
||||||
|
<option value="303">
|
||||||
|
<T id="redirection-hosts.http-code.303" />
|
||||||
|
</option>
|
||||||
|
<option value="307">
|
||||||
|
<T id="redirection-hosts.http-code.307" />
|
||||||
|
</option>
|
||||||
|
<option value="308">
|
||||||
|
<T id="redirection-hosts.http-code.308" />
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
{form.errors.forwardHttpCode ? (
|
{form.errors.forwardHttpCode ? (
|
||||||
<div className="invalid-feedback">
|
<div className="invalid-feedback">
|
||||||
|
|||||||
@@ -154,7 +154,9 @@ const StreamModal = EasyModal.create(({ id, visible, remove }: Props) => {
|
|||||||
type="text"
|
type="text"
|
||||||
className={`form-control ${form.errors.forwardingHost && form.touched.forwardingHost ? "is-invalid" : ""}`}
|
className={`form-control ${form.errors.forwardingHost && form.touched.forwardingHost ? "is-invalid" : ""}`}
|
||||||
required
|
required
|
||||||
placeholder={intl.formatMessage({ id: "stream.forward-host.placeholder" })}
|
placeholder={intl.formatMessage({
|
||||||
|
id: "stream.forward-host.placeholder",
|
||||||
|
})}
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
{form.errors.forwardingHost ? (
|
{form.errors.forwardingHost ? (
|
||||||
|
|||||||
@@ -3,13 +3,7 @@ import { Field, Form, Formik } from "formik";
|
|||||||
import { type ReactNode, useCallback, useEffect, useState } from "react";
|
import { type ReactNode, useCallback, useEffect, useState } from "react";
|
||||||
import { Alert } from "react-bootstrap";
|
import { Alert } from "react-bootstrap";
|
||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
import {
|
import { disable2FA, enable2FA, get2FAStatus, regenerateBackupCodes, start2FASetup } from "src/api/backend";
|
||||||
disable2FA,
|
|
||||||
enable2FA,
|
|
||||||
get2FAStatus,
|
|
||||||
regenerateBackupCodes,
|
|
||||||
start2FASetup,
|
|
||||||
} from "src/api/backend";
|
|
||||||
import { Button } from "src/components";
|
import { Button } from "src/components";
|
||||||
import { T } from "src/locale";
|
import { T } from "src/locale";
|
||||||
import { validateString } from "src/modules/Validations";
|
import { validateString } from "src/modules/Validations";
|
||||||
@@ -137,12 +131,7 @@ const TwoFactorModal = EasyModal.create(({ id, visible, remove }: Props) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{!isEnabled ? (
|
{!isEnabled ? (
|
||||||
<Button
|
<Button fullWidth color="azure" onClick={handleStartSetup} isLoading={isSubmitting}>
|
||||||
fullWidth
|
|
||||||
color="azure"
|
|
||||||
onClick={handleStartSetup}
|
|
||||||
isLoading={isSubmitting}
|
|
||||||
>
|
|
||||||
<T id="2fa.enable" />
|
<T id="2fa.enable" />
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { IconDotsVertical, IconEdit, IconTrash } from "@tabler/icons-react";
|
import { IconDotsVertical, IconEdit, IconTrash } from "@tabler/icons-react";
|
||||||
import { createColumnHelper, getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
import { createColumnHelper, useTable } from "@tanstack/react-table";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import type { AccessList } from "src/api/backend";
|
import type { AccessList } from "src/api/backend";
|
||||||
import { EmptyData, GravatarFormatter, HasPermission, ValueWithDateFormatter } from "src/components";
|
import { EmptyData, GravatarFormatter, HasPermission, ValueWithDateFormatter } from "src/components";
|
||||||
|
import { type Features, features } from "src/components/Table/features";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl, T } from "src/locale";
|
||||||
import { ACCESS_LISTS, MANAGE } from "src/modules/Permissions";
|
import { ACCESS_LISTS, MANAGE } from "src/modules/Permissions";
|
||||||
@@ -16,7 +17,7 @@ interface Props {
|
|||||||
onNew?: () => void;
|
onNew?: () => void;
|
||||||
}
|
}
|
||||||
export default function Table({ data, isFetching, isFiltered, onEdit, onDelete, onNew }: Props) {
|
export default function Table({ data, isFetching, isFiltered, onEdit, onDelete, onNew }: Props) {
|
||||||
const columnHelper = createColumnHelper<AccessList>();
|
const columnHelper = createColumnHelper<Features, AccessList>();
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
columnHelper.accessor((row: any) => row.owner, {
|
columnHelper.accessor((row: any) => row.owner, {
|
||||||
@@ -114,11 +115,10 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
[columnHelper, onEdit, onDelete],
|
[columnHelper, onEdit, onDelete],
|
||||||
);
|
);
|
||||||
|
|
||||||
const tableInstance = useReactTable<AccessList>({
|
const tableInstance = useTable({
|
||||||
|
features,
|
||||||
columns,
|
columns,
|
||||||
data,
|
data,
|
||||||
getCoreRowModel: getCoreRowModel(),
|
|
||||||
rowCount: data.length,
|
|
||||||
meta: {
|
meta: {
|
||||||
isFetching,
|
isFetching,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { createColumnHelper, getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
import { createColumnHelper, useTable } from "@tanstack/react-table";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import type { AuditLog } from "src/api/backend";
|
import type { AuditLog } from "src/api/backend";
|
||||||
import { EventFormatter, GravatarFormatter } from "src/components";
|
import { EventFormatter, GravatarFormatter } from "src/components";
|
||||||
|
import { type Features, features } from "src/components/Table/features";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl, T } from "src/locale";
|
||||||
|
|
||||||
@@ -11,10 +12,10 @@ interface Props {
|
|||||||
onSelectItem?: (id: number) => void;
|
onSelectItem?: (id: number) => void;
|
||||||
}
|
}
|
||||||
export default function Table({ data, isFetching, onSelectItem }: Props) {
|
export default function Table({ data, isFetching, onSelectItem }: Props) {
|
||||||
const columnHelper = createColumnHelper<AuditLog>();
|
const columnHelper = createColumnHelper<Features, AuditLog>();
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
columnHelper.accessor((row: AuditLog) => row.user, {
|
columnHelper.accessor((row: any) => row.user, {
|
||||||
id: "user.avatar",
|
id: "user.avatar",
|
||||||
cell: (info: any) => {
|
cell: (info: any) => {
|
||||||
const value = info.getValue();
|
const value = info.getValue();
|
||||||
@@ -24,7 +25,7 @@ export default function Table({ data, isFetching, onSelectItem }: Props) {
|
|||||||
className: "w-1",
|
className: "w-1",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor((row: AuditLog) => row, {
|
columnHelper.accessor((row: any) => row, {
|
||||||
id: "objectType",
|
id: "objectType",
|
||||||
header: intl.formatMessage({ id: "column.event" }),
|
header: intl.formatMessage({ id: "column.event" }),
|
||||||
cell: (info: any) => {
|
cell: (info: any) => {
|
||||||
@@ -55,11 +56,10 @@ export default function Table({ data, isFetching, onSelectItem }: Props) {
|
|||||||
[columnHelper, onSelectItem],
|
[columnHelper, onSelectItem],
|
||||||
);
|
);
|
||||||
|
|
||||||
const tableInstance = useReactTable<AuditLog>({
|
const tableInstance = useTable({
|
||||||
|
features,
|
||||||
columns,
|
columns,
|
||||||
data,
|
data,
|
||||||
getCoreRowModel: getCoreRowModel(),
|
|
||||||
rowCount: data.length,
|
|
||||||
meta: {
|
meta: {
|
||||||
isFetching,
|
isFetching,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { IconDotsVertical, IconDownload, IconRefresh, IconTrash } from "@tabler/icons-react";
|
import { IconDotsVertical, IconDownload, IconRefresh, IconTrash } from "@tabler/icons-react";
|
||||||
import { createColumnHelper, getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
import { createColumnHelper, useTable } from "@tanstack/react-table";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import type { Certificate } from "src/api/backend";
|
import type { Certificate } from "src/api/backend";
|
||||||
import {
|
import {
|
||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
GravatarFormatter,
|
GravatarFormatter,
|
||||||
HasPermission,
|
HasPermission,
|
||||||
} from "src/components";
|
} from "src/components";
|
||||||
|
import { type Features, features } from "src/components/Table/features";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl, T } from "src/locale";
|
||||||
import { showCustomCertificateModal, showDNSCertificateModal, showHTTPCertificateModal } from "src/modals";
|
import { showCustomCertificateModal, showDNSCertificateModal, showHTTPCertificateModal } from "src/modals";
|
||||||
@@ -24,7 +25,7 @@ interface Props {
|
|||||||
onDownload?: (id: number) => void;
|
onDownload?: (id: number) => void;
|
||||||
}
|
}
|
||||||
export default function Table({ data, isFetching, onDelete, onRenew, onDownload, isFiltered }: Props) {
|
export default function Table({ data, isFetching, onDelete, onRenew, onDownload, isFiltered }: Props) {
|
||||||
const columnHelper = createColumnHelper<Certificate>();
|
const columnHelper = createColumnHelper<Features, Certificate>();
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
columnHelper.accessor((row: any) => row.owner, {
|
columnHelper.accessor((row: any) => row.owner, {
|
||||||
@@ -164,11 +165,10 @@ export default function Table({ data, isFetching, onDelete, onRenew, onDownload,
|
|||||||
[columnHelper, onDelete, onRenew, onDownload],
|
[columnHelper, onDelete, onRenew, onDownload],
|
||||||
);
|
);
|
||||||
|
|
||||||
const tableInstance = useReactTable<Certificate>({
|
const tableInstance = useTable({
|
||||||
|
features,
|
||||||
columns,
|
columns,
|
||||||
data,
|
data,
|
||||||
getCoreRowModel: getCoreRowModel(),
|
|
||||||
rowCount: data.length,
|
|
||||||
meta: {
|
meta: {
|
||||||
isFetching,
|
isFetching,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -193,9 +193,7 @@ export default function Login() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="card card-md">
|
<div className="card card-md">
|
||||||
<div className="card-body">
|
<div className="card-body">{twoFactorChallenge ? <TwoFactorForm /> : <LoginForm />}</div>
|
||||||
{twoFactorChallenge ? <TwoFactorForm /> : <LoginForm />}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="text-center text-secondary mt-3">{getVersion()}</div>
|
<div className="text-center text-secondary mt-3">{getVersion()}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-react";
|
import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-react";
|
||||||
import {
|
import { createColumnHelper, type SortingState, useTable } from "@tanstack/react-table";
|
||||||
createColumnHelper,
|
|
||||||
getCoreRowModel,
|
|
||||||
getSortedRowModel,
|
|
||||||
type SortingState,
|
|
||||||
useReactTable,
|
|
||||||
} from "@tanstack/react-table";
|
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import type { DeadHost } from "src/api/backend";
|
import type { DeadHost } from "src/api/backend";
|
||||||
import {
|
import {
|
||||||
@@ -16,6 +10,7 @@ import {
|
|||||||
HasPermission,
|
HasPermission,
|
||||||
TrueFalseFormatter,
|
TrueFalseFormatter,
|
||||||
} from "src/components";
|
} from "src/components";
|
||||||
|
import { type Features, features } from "src/components/Table/features";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl, T } from "src/locale";
|
||||||
import { DEAD_HOSTS, MANAGE } from "src/modules/Permissions";
|
import { DEAD_HOSTS, MANAGE } from "src/modules/Permissions";
|
||||||
@@ -30,7 +25,7 @@ interface Props {
|
|||||||
onNew?: () => void;
|
onNew?: () => void;
|
||||||
}
|
}
|
||||||
export default function Table({ data, isFetching, onEdit, onDelete, onDisableToggle, onNew, isFiltered }: Props) {
|
export default function Table({ data, isFetching, onEdit, onDelete, onDisableToggle, onNew, isFiltered }: Props) {
|
||||||
const columnHelper = createColumnHelper<DeadHost>();
|
const columnHelper = createColumnHelper<Features, DeadHost>();
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
columnHelper.accessor((row: any) => row.owner, {
|
columnHelper.accessor((row: any) => row.owner, {
|
||||||
@@ -47,7 +42,7 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
columnHelper.accessor((row: any) => row, {
|
columnHelper.accessor((row: any) => row, {
|
||||||
id: "domainNames",
|
id: "domainNames",
|
||||||
header: intl.formatMessage({ id: "column.source" }),
|
header: intl.formatMessage({ id: "column.source" }),
|
||||||
sortingFn: (a, b) => {
|
sortFn: (a, b) => {
|
||||||
const aVal = a.original.domainNames?.[0] ?? "";
|
const aVal = a.original.domainNames?.[0] ?? "";
|
||||||
const bVal = b.original.domainNames?.[0] ?? "";
|
const bVal = b.original.domainNames?.[0] ?? "";
|
||||||
return aVal.localeCompare(bVal);
|
return aVal.localeCompare(bVal);
|
||||||
@@ -143,14 +138,12 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
|
|
||||||
const [sorting, setSorting] = useState<SortingState>([]);
|
const [sorting, setSorting] = useState<SortingState>([]);
|
||||||
|
|
||||||
const tableInstance = useReactTable<DeadHost>({
|
const tableInstance = useTable({
|
||||||
|
features,
|
||||||
columns,
|
columns,
|
||||||
data,
|
data,
|
||||||
state: { sorting },
|
state: { sorting },
|
||||||
onSortingChange: setSorting,
|
onSortingChange: setSorting,
|
||||||
getCoreRowModel: getCoreRowModel(),
|
|
||||||
getSortedRowModel: getSortedRowModel(),
|
|
||||||
rowCount: data.length,
|
|
||||||
meta: {
|
meta: {
|
||||||
isFetching,
|
isFetching,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-react";
|
import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-react";
|
||||||
import {
|
import { createColumnHelper, type SortingState, useTable } from "@tanstack/react-table";
|
||||||
createColumnHelper,
|
|
||||||
getCoreRowModel,
|
|
||||||
getSortedRowModel,
|
|
||||||
type SortingState,
|
|
||||||
useReactTable,
|
|
||||||
} from "@tanstack/react-table";
|
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import type { ProxyHost } from "src/api/backend";
|
import type { ProxyHost } from "src/api/backend";
|
||||||
import {
|
import {
|
||||||
@@ -17,6 +11,7 @@ import {
|
|||||||
HasPermission,
|
HasPermission,
|
||||||
TrueFalseFormatter,
|
TrueFalseFormatter,
|
||||||
} from "src/components";
|
} from "src/components";
|
||||||
|
import { type Features, features } from "src/components/Table/features";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl, T } from "src/locale";
|
||||||
import { MANAGE, PROXY_HOSTS } from "src/modules/Permissions";
|
import { MANAGE, PROXY_HOSTS } from "src/modules/Permissions";
|
||||||
@@ -31,7 +26,7 @@ interface Props {
|
|||||||
onNew?: () => void;
|
onNew?: () => void;
|
||||||
}
|
}
|
||||||
export default function Table({ data, isFetching, onEdit, onDelete, onDisableToggle, onNew, isFiltered }: Props) {
|
export default function Table({ data, isFetching, onEdit, onDelete, onDisableToggle, onNew, isFiltered }: Props) {
|
||||||
const columnHelper = createColumnHelper<ProxyHost>();
|
const columnHelper = createColumnHelper<Features, ProxyHost>();
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
columnHelper.accessor((row: any) => row.owner, {
|
columnHelper.accessor((row: any) => row.owner, {
|
||||||
@@ -48,7 +43,7 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
columnHelper.accessor((row: any) => row, {
|
columnHelper.accessor((row: any) => row, {
|
||||||
id: "domainNames",
|
id: "domainNames",
|
||||||
header: intl.formatMessage({ id: "column.source" }),
|
header: intl.formatMessage({ id: "column.source" }),
|
||||||
sortingFn: (a, b) => {
|
sortFn: (a, b) => {
|
||||||
const aVal = a.original.domainNames?.[0] ?? "";
|
const aVal = a.original.domainNames?.[0] ?? "";
|
||||||
const bVal = b.original.domainNames?.[0] ?? "";
|
const bVal = b.original.domainNames?.[0] ?? "";
|
||||||
return aVal.localeCompare(bVal);
|
return aVal.localeCompare(bVal);
|
||||||
@@ -61,7 +56,7 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
columnHelper.accessor((row: any) => row, {
|
columnHelper.accessor((row: any) => row, {
|
||||||
id: "forwardHost",
|
id: "forwardHost",
|
||||||
header: intl.formatMessage({ id: "column.destination" }),
|
header: intl.formatMessage({ id: "column.destination" }),
|
||||||
sortingFn: (a, b) => {
|
sortFn: (a, b) => {
|
||||||
const aVal = `${a.original.forwardHost}:${a.original.forwardPort}`;
|
const aVal = `${a.original.forwardHost}:${a.original.forwardPort}`;
|
||||||
const bVal = `${b.original.forwardHost}:${b.original.forwardPort}`;
|
const bVal = `${b.original.forwardHost}:${b.original.forwardPort}`;
|
||||||
return aVal.localeCompare(bVal);
|
return aVal.localeCompare(bVal);
|
||||||
@@ -165,14 +160,12 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
|
|
||||||
const [sorting, setSorting] = useState<SortingState>([]);
|
const [sorting, setSorting] = useState<SortingState>([]);
|
||||||
|
|
||||||
const tableInstance = useReactTable<ProxyHost>({
|
const tableInstance = useTable({
|
||||||
|
features,
|
||||||
columns,
|
columns,
|
||||||
data,
|
data,
|
||||||
state: { sorting },
|
state: { sorting },
|
||||||
onSortingChange: setSorting,
|
onSortingChange: setSorting,
|
||||||
getCoreRowModel: getCoreRowModel(),
|
|
||||||
getSortedRowModel: getSortedRowModel(),
|
|
||||||
rowCount: data.length,
|
|
||||||
meta: {
|
meta: {
|
||||||
isFetching,
|
isFetching,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-react";
|
import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-react";
|
||||||
import {
|
import { createColumnHelper, type SortingState, useTable } from "@tanstack/react-table";
|
||||||
createColumnHelper,
|
|
||||||
getCoreRowModel,
|
|
||||||
getSortedRowModel,
|
|
||||||
type SortingState,
|
|
||||||
useReactTable,
|
|
||||||
} from "@tanstack/react-table";
|
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import type { RedirectionHost } from "src/api/backend";
|
import type { RedirectionHost } from "src/api/backend";
|
||||||
import {
|
import {
|
||||||
@@ -16,6 +10,7 @@ import {
|
|||||||
HasPermission,
|
HasPermission,
|
||||||
TrueFalseFormatter,
|
TrueFalseFormatter,
|
||||||
} from "src/components";
|
} from "src/components";
|
||||||
|
import { type Features, features } from "src/components/Table/features";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl, T } from "src/locale";
|
||||||
import { MANAGE, REDIRECTION_HOSTS } from "src/modules/Permissions";
|
import { MANAGE, REDIRECTION_HOSTS } from "src/modules/Permissions";
|
||||||
@@ -30,7 +25,7 @@ interface Props {
|
|||||||
onNew?: () => void;
|
onNew?: () => void;
|
||||||
}
|
}
|
||||||
export default function Table({ data, isFetching, onEdit, onDelete, onDisableToggle, onNew, isFiltered }: Props) {
|
export default function Table({ data, isFetching, onEdit, onDelete, onDisableToggle, onNew, isFiltered }: Props) {
|
||||||
const columnHelper = createColumnHelper<RedirectionHost>();
|
const columnHelper = createColumnHelper<Features, RedirectionHost>();
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
columnHelper.accessor((row: any) => row.owner, {
|
columnHelper.accessor((row: any) => row.owner, {
|
||||||
@@ -47,7 +42,7 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
columnHelper.accessor((row: any) => row, {
|
columnHelper.accessor((row: any) => row, {
|
||||||
id: "domainNames",
|
id: "domainNames",
|
||||||
header: intl.formatMessage({ id: "column.source" }),
|
header: intl.formatMessage({ id: "column.source" }),
|
||||||
sortingFn: (a, b) => {
|
sortFn: (a, b) => {
|
||||||
const aVal = a.original.domainNames?.[0] ?? "";
|
const aVal = a.original.domainNames?.[0] ?? "";
|
||||||
const bVal = b.original.domainNames?.[0] ?? "";
|
const bVal = b.original.domainNames?.[0] ?? "";
|
||||||
return aVal.localeCompare(bVal);
|
return aVal.localeCompare(bVal);
|
||||||
@@ -164,14 +159,12 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
|
|
||||||
const [sorting, setSorting] = useState<SortingState>([]);
|
const [sorting, setSorting] = useState<SortingState>([]);
|
||||||
|
|
||||||
const tableInstance = useReactTable<RedirectionHost>({
|
const tableInstance = useTable({
|
||||||
|
features,
|
||||||
columns,
|
columns,
|
||||||
data,
|
data,
|
||||||
state: { sorting },
|
state: { sorting },
|
||||||
onSortingChange: setSorting,
|
onSortingChange: setSorting,
|
||||||
getCoreRowModel: getCoreRowModel(),
|
|
||||||
getSortedRowModel: getSortedRowModel(),
|
|
||||||
rowCount: data.length,
|
|
||||||
meta: {
|
meta: {
|
||||||
isFetching,
|
isFetching,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-react";
|
import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-react";
|
||||||
import {
|
import { createColumnHelper, type SortingState, useTable } from "@tanstack/react-table";
|
||||||
createColumnHelper,
|
|
||||||
getCoreRowModel,
|
|
||||||
getSortedRowModel,
|
|
||||||
type SortingState,
|
|
||||||
useReactTable,
|
|
||||||
} from "@tanstack/react-table";
|
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import type { Stream } from "src/api/backend";
|
import type { Stream } from "src/api/backend";
|
||||||
import {
|
import {
|
||||||
@@ -16,6 +10,7 @@ import {
|
|||||||
TrueFalseFormatter,
|
TrueFalseFormatter,
|
||||||
ValueWithDateFormatter,
|
ValueWithDateFormatter,
|
||||||
} from "src/components";
|
} from "src/components";
|
||||||
|
import { type Features, features } from "src/components/Table/features";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl, T } from "src/locale";
|
||||||
import { MANAGE, STREAMS } from "src/modules/Permissions";
|
import { MANAGE, STREAMS } from "src/modules/Permissions";
|
||||||
@@ -30,7 +25,7 @@ interface Props {
|
|||||||
onNew?: () => void;
|
onNew?: () => void;
|
||||||
}
|
}
|
||||||
export default function Table({ data, isFetching, isFiltered, onEdit, onDelete, onDisableToggle, onNew }: Props) {
|
export default function Table({ data, isFetching, isFiltered, onEdit, onDelete, onDisableToggle, onNew }: Props) {
|
||||||
const columnHelper = createColumnHelper<Stream>();
|
const columnHelper = createColumnHelper<Features, Stream>();
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
columnHelper.accessor((row: any) => row.owner, {
|
columnHelper.accessor((row: any) => row.owner, {
|
||||||
@@ -47,7 +42,7 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
columnHelper.accessor((row: any) => row, {
|
columnHelper.accessor((row: any) => row, {
|
||||||
id: "incomingPort",
|
id: "incomingPort",
|
||||||
header: intl.formatMessage({ id: "column.incoming-port" }),
|
header: intl.formatMessage({ id: "column.incoming-port" }),
|
||||||
sortingFn: (a, b) => (a.original.incomingPort ?? 0) - (b.original.incomingPort ?? 0),
|
sortFn: (a, b) => (a.original.incomingPort ?? 0) - (b.original.incomingPort ?? 0),
|
||||||
cell: (info: any) => {
|
cell: (info: any) => {
|
||||||
const value = info.getValue();
|
const value = info.getValue();
|
||||||
return <ValueWithDateFormatter value={value.incomingPort} createdOn={value.createdOn} />;
|
return <ValueWithDateFormatter value={value.incomingPort} createdOn={value.createdOn} />;
|
||||||
@@ -56,7 +51,7 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
columnHelper.accessor((row: any) => row, {
|
columnHelper.accessor((row: any) => row, {
|
||||||
id: "forwardHttpCode",
|
id: "forwardHttpCode",
|
||||||
header: intl.formatMessage({ id: "column.destination" }),
|
header: intl.formatMessage({ id: "column.destination" }),
|
||||||
sortingFn: (a, b) => {
|
sortFn: (a, b) => {
|
||||||
const aVal = `${a.original.forwardingHost}:${a.original.forwardingPort}`;
|
const aVal = `${a.original.forwardingHost}:${a.original.forwardingPort}`;
|
||||||
const bVal = `${b.original.forwardingHost}:${b.original.forwardingPort}`;
|
const bVal = `${b.original.forwardingHost}:${b.original.forwardingPort}`;
|
||||||
return aVal.localeCompare(bVal);
|
return aVal.localeCompare(bVal);
|
||||||
@@ -174,14 +169,12 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
|
|
||||||
const [sorting, setSorting] = useState<SortingState>([]);
|
const [sorting, setSorting] = useState<SortingState>([]);
|
||||||
|
|
||||||
const tableInstance = useReactTable<Stream>({
|
const tableInstance = useTable({
|
||||||
|
features,
|
||||||
columns,
|
columns,
|
||||||
data,
|
data,
|
||||||
state: { sorting },
|
state: { sorting },
|
||||||
onSortingChange: setSorting,
|
onSortingChange: setSorting,
|
||||||
getCoreRowModel: getCoreRowModel(),
|
|
||||||
getSortedRowModel: getSortedRowModel(),
|
|
||||||
rowCount: data.length,
|
|
||||||
meta: {
|
meta: {
|
||||||
isFetching,
|
isFetching,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
IconShield,
|
IconShield,
|
||||||
IconTrash,
|
IconTrash,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import { createColumnHelper, getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
import { createColumnHelper, useTable } from "@tanstack/react-table";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import type { User } from "src/api/backend";
|
import type { User } from "src/api/backend";
|
||||||
import {
|
import {
|
||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
TrueFalseFormatter,
|
TrueFalseFormatter,
|
||||||
ValueWithDateFormatter,
|
ValueWithDateFormatter,
|
||||||
} from "src/components";
|
} from "src/components";
|
||||||
|
import { type Features, features } from "src/components/Table/features";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl, T } from "src/locale";
|
||||||
|
|
||||||
@@ -47,7 +48,7 @@ export default function Table({
|
|||||||
onNewUser,
|
onNewUser,
|
||||||
onLoginAs,
|
onLoginAs,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const columnHelper = createColumnHelper<User>();
|
const columnHelper = createColumnHelper<Features, User>();
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
columnHelper.accessor((row: any) => row, {
|
columnHelper.accessor((row: any) => row, {
|
||||||
@@ -216,11 +217,10 @@ export default function Table({
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
const tableInstance = useReactTable<User>({
|
const tableInstance = useTable({
|
||||||
|
features,
|
||||||
columns,
|
columns,
|
||||||
data,
|
data,
|
||||||
getCoreRowModel: getCoreRowModel(),
|
|
||||||
rowCount: data.length,
|
|
||||||
meta: {
|
meta: {
|
||||||
isFetching,
|
isFetching,
|
||||||
},
|
},
|
||||||
|
|||||||
+857
-679
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user