mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-11-28 08:57:53 +01:00
More react
- consolidated lang items - proxy host paths work
This commit is contained in:
56 files changed
+946
-928
No files matched your search
@@ -1,36 +0,0 @@
|
||||
import type { Table as ReactTable } from "@tanstack/react-table";
|
||||
import { Button } from "src/components";
|
||||
import { T } from "src/locale";
|
||||
|
||||
interface Props {
|
||||
tableInstance: ReactTable<any>;
|
||||
onNew?: () => void;
|
||||
isFiltered?: boolean;
|
||||
}
|
||||
export default function Empty({ tableInstance, onNew, isFiltered }: Props) {
|
||||
return (
|
||||
<tr>
|
||||
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
||||
<div className="text-center my-4">
|
||||
{isFiltered ? (
|
||||
<h2>
|
||||
<T id="empty-search" />
|
||||
</h2>
|
||||
) : (
|
||||
<>
|
||||
<h2>
|
||||
<T id="access.empty" />
|
||||
</h2>
|
||||
<p className="text-muted">
|
||||
<T id="empty-subtitle" />
|
||||
</p>
|
||||
<Button className="btn-cyan my-3" onClick={onNew}>
|
||||
<T id="access.add" />
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
@@ -2,10 +2,9 @@ import { IconDotsVertical, IconEdit, IconTrash } from "@tabler/icons-react";
|
||||
import { createColumnHelper, getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
||||
import { useMemo } from "react";
|
||||
import type { AccessList } from "src/api/backend";
|
||||
import { GravatarFormatter, ValueWithDateFormatter } from "src/components";
|
||||
import { EmptyData, GravatarFormatter, ValueWithDateFormatter } from "src/components";
|
||||
import { TableLayout } from "src/components/Table/TableLayout";
|
||||
import { intl, T } from "src/locale";
|
||||
import Empty from "./Empty";
|
||||
|
||||
interface Props {
|
||||
data: AccessList[];
|
||||
@@ -36,12 +35,12 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
||||
columnHelper.accessor((row: any) => row.items, {
|
||||
id: "items",
|
||||
header: intl.formatMessage({ id: "column.authorization" }),
|
||||
cell: (info: any) => <T id="access.auth-count" data={{ count: info.getValue().length }} />,
|
||||
cell: (info: any) => <T id="access-list.auth-count" data={{ count: info.getValue().length }} />,
|
||||
}),
|
||||
columnHelper.accessor((row: any) => row.clients, {
|
||||
id: "clients",
|
||||
header: intl.formatMessage({ id: "column.access" }),
|
||||
cell: (info: any) => <T id="access.access-count" data={{ count: info.getValue().length }} />,
|
||||
cell: (info: any) => <T id="access-list.access-count" data={{ count: info.getValue().length }} />,
|
||||
}),
|
||||
columnHelper.accessor((row: any) => row.satisfyAny, {
|
||||
id: "satisfyAny",
|
||||
@@ -50,7 +49,7 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
||||
}),
|
||||
columnHelper.accessor((row: any) => row.proxyHostCount, {
|
||||
id: "proxyHostCount",
|
||||
header: intl.formatMessage({ id: "proxy-hosts.title" }),
|
||||
header: intl.formatMessage({ id: "proxy-hosts" }),
|
||||
cell: (info: any) => <T id="proxy-hosts.count" data={{ count: info.getValue() }} />,
|
||||
}),
|
||||
columnHelper.display({
|
||||
@@ -68,7 +67,11 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
||||
</button>
|
||||
<div className="dropdown-menu dropdown-menu-end">
|
||||
<span className="dropdown-header">
|
||||
<T id="access.actions-title" data={{ id: info.row.original.id }} />
|
||||
<T
|
||||
id="object.actions-title"
|
||||
tData={{ object: "access-list" }}
|
||||
data={{ id: info.row.original.id }}
|
||||
/>
|
||||
</span>
|
||||
<a
|
||||
className="dropdown-item"
|
||||
@@ -119,7 +122,16 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
||||
return (
|
||||
<TableLayout
|
||||
tableInstance={tableInstance}
|
||||
emptyState={<Empty tableInstance={tableInstance} onNew={onNew} isFiltered={isFiltered} />}
|
||||
emptyState={
|
||||
<EmptyData
|
||||
object="access-list"
|
||||
objects="access-lists"
|
||||
tableInstance={tableInstance}
|
||||
onNew={onNew}
|
||||
isFiltered={isFiltered}
|
||||
color="cyan"
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -4,9 +4,9 @@ import Alert from "react-bootstrap/Alert";
|
||||
import { deleteAccessList } from "src/api/backend";
|
||||
import { Button, LoadingPage } from "src/components";
|
||||
import { useAccessLists } from "src/hooks";
|
||||
import { intl, T } from "src/locale";
|
||||
import { T } from "src/locale";
|
||||
import { showAccessListModal, showDeleteConfirmModal } from "src/modals";
|
||||
import { showSuccess } from "src/notifications";
|
||||
import { showObjectSuccess } from "src/notifications";
|
||||
import Table from "./Table";
|
||||
|
||||
export default function TableWrapper() {
|
||||
@@ -23,7 +23,7 @@ export default function TableWrapper() {
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
await deleteAccessList(id);
|
||||
showSuccess(intl.formatMessage({ id: "notification.access-deleted" }));
|
||||
showObjectSuccess("access-list", "deleted");
|
||||
};
|
||||
|
||||
let filtered = null;
|
||||
@@ -44,7 +44,7 @@ export default function TableWrapper() {
|
||||
<div className="row w-full">
|
||||
<div className="col">
|
||||
<h2 className="mt-1 mb-0">
|
||||
<T id="access.title" />
|
||||
<T id="access-lists" />
|
||||
</h2>
|
||||
</div>
|
||||
{data?.length ? (
|
||||
@@ -63,7 +63,7 @@ export default function TableWrapper() {
|
||||
/>
|
||||
</div>
|
||||
<Button size="sm" className="btn-cyan" onClick={() => showAccessListModal("new")}>
|
||||
<T id="access.add" />
|
||||
<T id="object.add" tData={{ object: "access-list" }} />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -80,7 +80,7 @@ export default function TableWrapper() {
|
||||
title: "access.delete.title",
|
||||
onConfirm: () => handleDelete(id),
|
||||
invalidations: [["access-lists"], ["access-list", id]],
|
||||
children: <T id="access.delete.content" />,
|
||||
children: <T id="object.delete.content" tData={{ object: "access-list" }} />,
|
||||
})
|
||||
}
|
||||
onNew={() => showAccessListModal("new")}
|
||||
|
||||
Reference in new issue
Block a user