-
- Фильтры
+
+
+
+
+
+ Фильтры
+
+ }
+ />
+
+
+
+
+
+ {units.length === 0 ? (
+
+ {
+ setTab('all')
+ setFilters(createDefaultServiceFilters())
+ }}
+ >
+ Сбросить
}
/>
-
-
-
-
- {treeData.length === 0 ? (
-
-
{
- setTab('all')
- setFilters(createDefaultServiceFilters())
- }}
- >
- Сбросить
-
- }
+ ) : (
+
+ {units.map((unit) => (
+
-
- ) : (
- <>
-
-
-
-
-
-
-
- >
- )}
-
-
-
+ ))}
+
+ )}
+
+
)
}
diff --git a/apps/web/src/components/services/services-grouped-columns.tsx b/apps/web/src/components/services/services-grouped-columns.tsx
deleted file mode 100644
index 36f88a8..0000000
--- a/apps/web/src/components/services/services-grouped-columns.tsx
+++ /dev/null
@@ -1,308 +0,0 @@
-import { useMemo } from 'react'
-import { Link } from '@tanstack/react-router'
-import type { ColumnDef } from '@tanstack/react-table'
-import {
- ChevronRightIcon,
- FolderIcon,
- MoreHorizontalIcon,
- PlusIcon,
-} from 'lucide-react'
-
-import { DataGridColumnHeader } from '@/components/reui/data-grid/data-grid-column-header'
-import { HealthCheckBadge } from '@/components/health-check-badge'
-import { StatusBadge } from '@/components/status-badge'
-import type { ServiceGroupView, ServiceView } from '@/lib/schemas'
-import { ServiceFqdnList } from '@/components/services/service-fqdn-list'
-import { Button } from '@cfdm/ui/components/button'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
-} from '@cfdm/ui/components/dropdown-menu'
-import { Switch } from '@cfdm/ui/components/switch'
-import { Badge } from '@/components/reui/badge'
-import { cn } from '@cfdm/ui/lib/utils'
-
-export type ServiceTreeServiceRow = {
- kind: 'service'
- id: string
- service: ServiceView
- groupId: number | null
- groupName: string | null
-}
-
-export type ServiceTreeGroupRow = {
- kind: 'group'
- id: string
- group: ServiceGroupView | null
- subRows: ServiceTreeServiceRow[]
-}
-
-export type ServiceCatalogTreeRow = ServiceTreeGroupRow | ServiceTreeServiceRow
-
-function isServiceRow(row: ServiceCatalogTreeRow): row is ServiceTreeServiceRow {
- return row.kind === 'service'
-}
-
-export function createServicesGroupedColumns({
- onEditService,
- onDeleteService,
- onToggleService,
- onEditGroup,
- onDeleteGroup,
- onAddServiceToGroup,
- togglingId,
-}: {
- onEditService: (service: ServiceView) => void
- onDeleteService: (service: ServiceView) => void
- onToggleService: (serviceId: number, enabled: boolean) => void
- onEditGroup: (group: ServiceGroupView) => void
- onDeleteGroup: (group: ServiceGroupView) => void
- onAddServiceToGroup: (groupId: number | null) => void
- togglingId: number | null
-}): ColumnDef[] {
- return [
- {
- id: 'name',
- accessorFn: (row) =>
- isServiceRow(row) ? row.service.name : (row.group?.name ?? 'Без группы'),
- header: ({ column }) => (
-
- ),
- cell: ({ row }) => {
- const original = row.original
- if (!isServiceRow(original)) {
- const title = original.group?.name ?? 'Без группы'
- const domain = original.group?.domain
- return (
-
-
-
-
-
- {title}
-
- {original.subRows.length}
-
-
- {domain ? (
-
- {domain}
-
- ) : null}
-
-
- )
- }
-
- return (
-
-
- {original.service.name}
-
-
-
- )
- },
- enableSorting: false,
- minSize: 260,
- meta: { headerTitle: 'Группа / сервис', autoSize: true },
- },
- {
- id: 'health',
- header: ({ column }) => (
-
- ),
- cell: ({ row }) => {
- const original = row.original
- if (!isServiceRow(original)) {
- return (
-
- )
- }
- return (
-
- )
- },
- size: 120,
- enableSorting: false,
- },
- {
- id: 'enabled',
- header: ({ column }) => (
-
- ),
- cell: ({ row }) => {
- const original = row.original
- if (!isServiceRow(original)) return null
- return (
-
-
- onToggleService(original.service.id, Boolean(checked))
- }
- aria-label={
- original.service.enabled
- ? 'Выключить сервис'
- : 'Включить сервис'
- }
- />
-
-
- )
- },
- size: 140,
- enableSorting: false,
- },
- {
- id: 'actions',
- enableSorting: false,
- header: () => Действия,
- cell: ({ row }) => {
- const original = row.original
- if (!isServiceRow(original)) {
- if (!original.group) {
- return (
-
- )
- }
- return (
-
-
- }
- >
-
-
-
- onAddServiceToGroup(original.group!.id)}
- >
-
- Добавить сервис
-
- onEditGroup(original.group!)}>
- Изменить группу
-
-
- onDeleteGroup(original.group!)}
- >
- Удалить группу
-
-
-
- )
- }
-
- return (
-
-
- }
- >
-
-
-
-
- }
- >
- Обзор
-
- onEditService(original.service)}>
- Изменить
-
- onDeleteService(original.service)}
- >
- Удалить
-
-
-
- )
- },
- size: 56,
- },
- ]
-}
-
-export function useServicesGroupedColumns(
- args: Parameters[0],
-) {
- return useMemo(() => createServicesGroupedColumns(args), [
- args.onEditService,
- args.onDeleteService,
- args.onToggleService,
- args.onEditGroup,
- args.onDeleteGroup,
- args.onAddServiceToGroup,
- args.togglingId,
- ])
-}
diff --git a/apps/web/src/routes/_auth/services/index.tsx b/apps/web/src/routes/_auth/services/index.tsx
index ccc8a43..639ae16 100644
--- a/apps/web/src/routes/_auth/services/index.tsx
+++ b/apps/web/src/routes/_auth/services/index.tsx
@@ -494,7 +494,7 @@ function ServicesPage() {
const pageDescription = filteredDomain
? `Сервисы с привязками к домену ${filteredDomain.zone_name}`
- : 'Группы, FQDN и доступность сервисов'
+ : 'Группы, общий домен и FQDN сервисов'
const sheets = (
<>