网管列表表格操作按钮优化
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
"use client"
|
||||
import {
|
||||
Activity,
|
||||
BarChart3,
|
||||
ChevronsLeft,
|
||||
ChevronsRight,
|
||||
CircleDollarSign,
|
||||
|
||||
@@ -14,6 +14,12 @@ import { Auth } from "@/components/auth"
|
||||
import { DataTable, useDataTable } from "@/components/data-table"
|
||||
import { Page } from "@/components/page"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
import { ScopeChannelWriteClearExpired, ScopeProxyWrite } from "@/lib/scopes"
|
||||
import type { Gateway } from "@/models/gateway"
|
||||
import CreatePage from "./create"
|
||||
@@ -168,34 +174,52 @@ export default function GatewayPage() {
|
||||
id: "action",
|
||||
meta: { pin: "right" },
|
||||
header: "操作",
|
||||
cell: ({ row }) => (
|
||||
<div className="flex gap-2 ">
|
||||
<Button
|
||||
onClick={() =>
|
||||
handleToggle(row.original.id, row.original.status)
|
||||
}
|
||||
disabled={loading}
|
||||
variant={
|
||||
row.original.status === 0 ? "default" : "destructive"
|
||||
}
|
||||
>
|
||||
{row.original.status === 0 ? "启用" : "停用"}
|
||||
</Button>
|
||||
<Auth scope={ScopeChannelWriteClearExpired}>
|
||||
<Button onClick={() => clearExpired(row.original)}>
|
||||
清理过期连接
|
||||
cell: ({ row }) => {
|
||||
return (
|
||||
<div className="flex gap-2 ">
|
||||
<Button
|
||||
onClick={() =>
|
||||
handleToggle(row.original.id, row.original.status)
|
||||
}
|
||||
disabled={loading}
|
||||
variant={
|
||||
row.original.status === 0 ? "default" : "destructive"
|
||||
}
|
||||
size="sm"
|
||||
>
|
||||
{row.original.status === 0 ? "启用" : "停用"}
|
||||
</Button>
|
||||
</Auth>
|
||||
<Auth scope={ScopeProxyWrite}>
|
||||
<Button onClick={() => createPort(row.original)}>
|
||||
重建端口池
|
||||
</Button>
|
||||
<Button onClick={() => createChains(row.original)}>
|
||||
重建代理链
|
||||
</Button>
|
||||
</Auth>
|
||||
</div>
|
||||
),
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button size="sm" variant="outline">
|
||||
打开菜单
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-8">
|
||||
<Auth scope={ScopeChannelWriteClearExpired}>
|
||||
<DropdownMenuItem
|
||||
onClick={() => clearExpired(row.original)}
|
||||
>
|
||||
清理过期连接
|
||||
</DropdownMenuItem>
|
||||
</Auth>
|
||||
<Auth scope={ScopeProxyWrite}>
|
||||
<DropdownMenuItem
|
||||
onClick={() => createPort(row.original)}
|
||||
>
|
||||
重建端口池
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() => createChains(row.original)}
|
||||
>
|
||||
重建代理链
|
||||
</DropdownMenuItem>
|
||||
</Auth>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -439,6 +439,7 @@ function CheckOrder(props: { trade: Trade; onSuccess: () => void }) {
|
||||
trade_no: props.trade.inner_no,
|
||||
method: Number(props.trade.method),
|
||||
})
|
||||
console.log(res, "res")
|
||||
|
||||
if (res.success) {
|
||||
setData(res.data)
|
||||
@@ -555,7 +556,7 @@ function CheckOrder(props: { trade: Trade; onSuccess: () => void }) {
|
||||
</div>
|
||||
)}
|
||||
{props && props.trade.status === 0 && (
|
||||
<>
|
||||
<div className="flex gap-4 items-center justify-center">
|
||||
<Button size="sm" className="w-32" onClick={headerClick}>
|
||||
完成订单
|
||||
</Button>
|
||||
@@ -565,7 +566,7 @@ function CheckOrder(props: { trade: Trade; onSuccess: () => void }) {
|
||||
<Button size="sm" className="w-32" onClick={cancel}>
|
||||
取消订单
|
||||
</Button>
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<DialogFooter>
|
||||
|
||||
Reference in New Issue
Block a user