fix(servers): исправить сохранение и опрос серверов
This commit is contained in:
1 parent
88326d9851
commit
c30f817926
10 files changed
+635
-62
No files matched your search
@@ -86,6 +86,7 @@ function RosBadge({ os }: { os: string }) {
|
||||
}
|
||||
|
||||
interface ServerRowActionsProps {
|
||||
busy: boolean
|
||||
server: Server
|
||||
isLive: boolean
|
||||
isPolling: boolean
|
||||
@@ -96,6 +97,7 @@ interface ServerRowActionsProps {
|
||||
}
|
||||
|
||||
function ServerRowActions({
|
||||
busy,
|
||||
server,
|
||||
isLive,
|
||||
isPolling,
|
||||
@@ -114,6 +116,7 @@ function ServerRowActions({
|
||||
<DropdownMenuTrigger
|
||||
render={
|
||||
<Button
|
||||
disabled={busy}
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="icon"
|
||||
@@ -148,7 +151,7 @@ function ServerRowActions({
|
||||
)}
|
||||
<DropdownMenuItem onClick={() => onToggleStatus(server.id)}>
|
||||
<PowerIcon className="size-4" />
|
||||
{server.status === "offline" ? "Включить" : "Отключить"}
|
||||
{server.enabled ? "Отключить" : "Включить"}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem variant="destructive" onClick={() => onDelete(server.id)}>
|
||||
@@ -162,6 +165,7 @@ function ServerRowActions({
|
||||
}
|
||||
|
||||
interface ServersDataGridProps {
|
||||
busy?: boolean
|
||||
servers: Server[]
|
||||
isLive: boolean
|
||||
pollingIds: Set<string>
|
||||
@@ -172,6 +176,7 @@ interface ServersDataGridProps {
|
||||
}
|
||||
|
||||
function ServersDataGrid({
|
||||
busy = false,
|
||||
servers,
|
||||
isLive,
|
||||
pollingIds,
|
||||
@@ -326,7 +331,7 @@ function ServersDataGrid({
|
||||
id: "status",
|
||||
accessorKey: "status",
|
||||
header: ({ column }) => <DataGridSortHeader column={column} title="Статус" />,
|
||||
cell: ({ row }) => <StatusBadge status={row.original.status} />,
|
||||
cell: ({ row }) => <div className="flex flex-col gap-1"><StatusBadge status={row.original.status} />{!row.original.enabled && <span className="text-xs text-muted-foreground">Отключён</span>}</div>,
|
||||
meta: { headerTitle: "Статус", headerClassName: DATA_GRID_CELL_PAD, cellClassName: DATA_GRID_CELL_PAD },
|
||||
},
|
||||
{
|
||||
@@ -336,6 +341,7 @@ function ServersDataGrid({
|
||||
const s = row.original
|
||||
return (
|
||||
<ServerRowActions
|
||||
busy={busy}
|
||||
server={s}
|
||||
isLive={isLive}
|
||||
isPolling={pollingIds.has(s.id)}
|
||||
@@ -354,7 +360,7 @@ function ServersDataGrid({
|
||||
},
|
||||
},
|
||||
],
|
||||
[isLive, onDelete, onEdit, onPoll, onToggleStatus, pollingIds],
|
||||
[busy, isLive, onDelete, onEdit, onPoll, onToggleStatus, pollingIds],
|
||||
)
|
||||
|
||||
const table = useReactTable({
|
||||
|
||||
Reference in new issue
Block a user