feat(services): enhance service health management with IP health tracking
quality / commitlint (push) Skipped
CD / update-wiki (push) Successful in 6s
quality / changes (push) Successful in 5s
quality / docker-check (push) Skipped
quality / web (push) Successful in 55s
quality / api (push) Successful in 41s
CD / quality (push) Successful in 1m45s
CD / publish (push) Successful in 1m33s
quality / commitlint (push) Skipped
CD / update-wiki (push) Successful in 6s
quality / changes (push) Successful in 5s
quality / docker-check (push) Skipped
quality / web (push) Successful in 55s
quality / api (push) Successful in 41s
CD / quality (push) Successful in 1m45s
CD / publish (push) Successful in 1m33s
- Introduced IP health tracking in service views, allowing for detailed monitoring of individual IP statuses and latencies. - Updated the service configuration to include an `ip_health` array, providing structured health data for each IP. - Enhanced the `attachServiceHealth` function to aggregate IP health data alongside overall service health. - Modified relevant components to display IP health information, improving visibility and user experience in service management interfaces. This commit significantly improves the health monitoring capabilities of services, enabling better insights into the status of individual IPs associated with each service.
This commit is contained in:
@@ -307,6 +307,7 @@ async function buildView(db: Db, serviceId: number): Promise<ServiceView> {
|
|||||||
domains: domainViews,
|
domains: domainViews,
|
||||||
health_status: "unknown",
|
health_status: "unknown",
|
||||||
health_latency_ms: null,
|
health_latency_ms: null,
|
||||||
|
ip_health: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,16 +315,27 @@ function attachServiceHealth(
|
|||||||
db: Db,
|
db: Db,
|
||||||
views: ServiceView[],
|
views: ServiceView[],
|
||||||
): ServiceView[] {
|
): ServiceView[] {
|
||||||
const healthByService = repos.aggregateIpHealthByServiceIds(
|
const ids = views.map((v) => v.id);
|
||||||
db,
|
const healthByService = repos.aggregateIpHealthByServiceIds(db, ids);
|
||||||
views.map((v) => v.id),
|
const ipHealthByService = repos.listIpHealthByServiceIds(db, ids);
|
||||||
);
|
|
||||||
return views.map((view) => {
|
return views.map((view) => {
|
||||||
const health = healthByService.get(view.id);
|
const health = healthByService.get(view.id);
|
||||||
|
const byIp = new Map(
|
||||||
|
(ipHealthByService.get(view.id) ?? []).map((row) => [row.ip, row]),
|
||||||
|
);
|
||||||
|
const ip_health = (view.ips ?? []).map((ip) => {
|
||||||
|
const row = byIp.get(ip);
|
||||||
|
return {
|
||||||
|
ip,
|
||||||
|
status: row?.status ?? ("unknown" as const),
|
||||||
|
latency_ms: row?.latency_ms ?? null,
|
||||||
|
};
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
...view,
|
...view,
|
||||||
health_status: health?.health_status ?? "unknown",
|
health_status: health?.health_status ?? "unknown",
|
||||||
health_latency_ms: health?.health_latency_ms ?? null,
|
health_latency_ms: health?.health_latency_ms ?? null,
|
||||||
|
ip_health,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -372,7 +384,7 @@ export async function listGroupViews(db: Db): Promise<ServiceGroupsResponse> {
|
|||||||
|
|
||||||
const groupViews = groupViewsRaw.map((group) => {
|
const groupViews = groupViewsRaw.map((group) => {
|
||||||
const services = group.services.map(
|
const services = group.services.map(
|
||||||
(s) => healthById.get(s.id) ?? { ...s, health_status: "unknown" as const, health_latency_ms: null },
|
(s) => healthById.get(s.id) ?? { ...s, health_status: "unknown" as const, health_latency_ms: null, ip_health: [] },
|
||||||
);
|
);
|
||||||
const groupScopeHealth = groupHealthById.get(group.id);
|
const groupScopeHealth = groupHealthById.get(group.id);
|
||||||
// Only enabled services feed the group badge — a disabled service with a
|
// Only enabled services feed the group badge — a disabled service with a
|
||||||
@@ -401,6 +413,7 @@ export async function listGroupViews(db: Db): Promise<ServiceGroupsResponse> {
|
|||||||
...s,
|
...s,
|
||||||
health_status: "unknown" as const,
|
health_status: "unknown" as const,
|
||||||
health_latency_ms: null,
|
health_latency_ms: null,
|
||||||
|
ip_health: [],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ describe("service groups health enrichment", () => {
|
|||||||
const service = repos.createService(app.db, "Panel", "panel");
|
const service = repos.createService(app.db, "Panel", "panel");
|
||||||
repos.setServiceGroup(app.db, service.id, group.id);
|
repos.setServiceGroup(app.db, service.id, group.id);
|
||||||
repos.setServiceEnabled(app.db, service.id, true);
|
repos.setServiceEnabled(app.db, service.id, true);
|
||||||
|
repos.replaceServiceIps(app.db, service.id, ["1.2.3.4"]);
|
||||||
const binding = repos.insertBinding(
|
const binding = repos.insertBinding(
|
||||||
app.db,
|
app.db,
|
||||||
domain.id,
|
domain.id,
|
||||||
@@ -85,6 +86,11 @@ describe("service groups health enrichment", () => {
|
|||||||
id: number;
|
id: number;
|
||||||
health_status: string;
|
health_status: string;
|
||||||
health_latency_ms: number | null;
|
health_latency_ms: number | null;
|
||||||
|
ip_health: Array<{
|
||||||
|
ip: string;
|
||||||
|
status: string;
|
||||||
|
latency_ms: number | null;
|
||||||
|
}>;
|
||||||
}>;
|
}>;
|
||||||
}>;
|
}>;
|
||||||
};
|
};
|
||||||
@@ -92,6 +98,9 @@ describe("service groups health enrichment", () => {
|
|||||||
expect(groupView).toBeDefined();
|
expect(groupView).toBeDefined();
|
||||||
expect(groupView!.services[0]?.health_status).toBe("degraded");
|
expect(groupView!.services[0]?.health_status).toBe("degraded");
|
||||||
expect(groupView!.services[0]?.health_latency_ms).toBe(120);
|
expect(groupView!.services[0]?.health_latency_ms).toBe(120);
|
||||||
|
expect(groupView!.services[0]?.ip_health).toEqual([
|
||||||
|
{ ip: "1.2.3.4", status: "degraded", latency_ms: 120 },
|
||||||
|
]);
|
||||||
// group worst = degraded (from service) over up (group scope)
|
// group worst = degraded (from service) over up (group scope)
|
||||||
expect(groupView!.health_status).toBe("degraded");
|
expect(groupView!.health_status).toBe("degraded");
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,11 @@ export function ServiceKanbanCard({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex min-w-0 flex-col gap-0.5">
|
<div className="flex min-w-0 flex-col gap-0.5">
|
||||||
<span className="text-muted-foreground text-xs">IP</span>
|
<span className="text-muted-foreground text-xs">IP</span>
|
||||||
<ServiceIpList copyable ips={service.ips ?? []} />
|
<ServiceIpList
|
||||||
|
copyable
|
||||||
|
ips={service.ips ?? []}
|
||||||
|
ipHealth={service.ip_health ?? []}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</ItemContent>
|
</ItemContent>
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ import { PlusIcon, Trash2Icon } from 'lucide-react'
|
|||||||
import { ConfirmDialog } from '@/components/confirm-dialog'
|
import { ConfirmDialog } from '@/components/confirm-dialog'
|
||||||
import { TaggedInput, isValidIpv4 } from '@/components/tagged-input'
|
import { TaggedInput, isValidIpv4 } from '@/components/tagged-input'
|
||||||
import { ServiceBindingIpInput } from '@/components/service-binding-ip-input'
|
import { ServiceBindingIpInput } from '@/components/service-binding-ip-input'
|
||||||
import type {
|
import {
|
||||||
LbMode,
|
HealthCheckConfigFields,
|
||||||
HealthCheckType,
|
type LbAndHealthConfig,
|
||||||
|
type LbMode,
|
||||||
|
type HealthCheckType,
|
||||||
} from '@/components/health-check-config-fields'
|
} from '@/components/health-check-config-fields'
|
||||||
import type {
|
import type {
|
||||||
CreateServiceWithConfigInput,
|
CreateServiceWithConfigInput,
|
||||||
@@ -319,6 +321,43 @@ export function ServiceEditSheet({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function healthFromConfig(next: LbAndHealthConfig): BindingHealthConfig {
|
||||||
|
return {
|
||||||
|
enabled: next.enabled,
|
||||||
|
type: next.type,
|
||||||
|
port: next.port,
|
||||||
|
path: next.path,
|
||||||
|
expected_status: next.expected_status,
|
||||||
|
interval_sec: next.interval_sec,
|
||||||
|
timeout_ms: next.timeout_ms,
|
||||||
|
verify_tls: next.verify_tls,
|
||||||
|
provider: next.provider,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePrimaryHealthChange(next: LbAndHealthConfig) {
|
||||||
|
const health = healthFromConfig(next)
|
||||||
|
setBindings((current) => {
|
||||||
|
if (current.length === 0) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
...withPoolIps(emptyBindingDraft(commonFqdn), ips),
|
||||||
|
lb_mode: next.lb_mode,
|
||||||
|
health,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
return current.map((item, index) =>
|
||||||
|
index === 0 ? { ...item, lb_mode: next.lb_mode, health } : item,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const primaryHealthValue: LbAndHealthConfig = {
|
||||||
|
lb_mode: bindings[0]?.lb_mode ?? 'round_robin',
|
||||||
|
...(bindings[0]?.health ?? defaultHealth),
|
||||||
|
}
|
||||||
|
|
||||||
function resolveServiceGroupId(): number | null {
|
function resolveServiceGroupId(): number | null {
|
||||||
return serviceGroupId === 'none' ? null : Number(serviceGroupId)
|
return serviceGroupId === 'none' ? null : Number(serviceGroupId)
|
||||||
}
|
}
|
||||||
@@ -464,6 +503,15 @@ export function ServiceEditSheet({
|
|||||||
</FieldGroup>
|
</FieldGroup>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section className="flex flex-col gap-3">
|
||||||
|
<h3 className="text-sm font-medium">Health check</h3>
|
||||||
|
<HealthCheckConfigFields
|
||||||
|
idPrefix="service-health"
|
||||||
|
value={primaryHealthValue}
|
||||||
|
onChange={handlePrimaryHealthChange}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section className="flex flex-col gap-3">
|
<section className="flex flex-col gap-3">
|
||||||
<div className="flex items-center justify-between gap-2">
|
<div className="flex items-center justify-between gap-2">
|
||||||
<h3 className="text-sm font-medium">Доп. FQDN</h3>
|
<h3 className="text-sm font-medium">Доп. FQDN</h3>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { CheckIcon, CopyIcon } from 'lucide-react'
|
import { CheckIcon, CopyIcon } from 'lucide-react'
|
||||||
import { toast } from 'sonner'
|
import { toast } from 'sonner'
|
||||||
|
|
||||||
|
import { HealthCheckBadge } from '@/components/health-check-badge'
|
||||||
import { Badge } from '@/components/reui/badge'
|
import { Badge } from '@/components/reui/badge'
|
||||||
import { TruncatedText } from '@/components/truncated-text'
|
import { TruncatedText } from '@/components/truncated-text'
|
||||||
import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'
|
import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'
|
||||||
@@ -119,6 +120,7 @@ const VISIBLE_IP_LIMIT = 6
|
|||||||
|
|
||||||
interface ServiceIpListProps {
|
interface ServiceIpListProps {
|
||||||
ips: string[]
|
ips: string[]
|
||||||
|
ipHealth?: ServiceView['ip_health']
|
||||||
className?: string
|
className?: string
|
||||||
emptyLabel?: string
|
emptyLabel?: string
|
||||||
copyable?: boolean
|
copyable?: boolean
|
||||||
@@ -127,6 +129,7 @@ interface ServiceIpListProps {
|
|||||||
|
|
||||||
export function ServiceIpList({
|
export function ServiceIpList({
|
||||||
ips,
|
ips,
|
||||||
|
ipHealth = [],
|
||||||
className,
|
className,
|
||||||
emptyLabel = 'Нет IP',
|
emptyLabel = 'Нет IP',
|
||||||
copyable = false,
|
copyable = false,
|
||||||
@@ -140,20 +143,33 @@ export function ServiceIpList({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const healthByIp = new Map(ipHealth.map((row) => [row.ip, row]))
|
||||||
const visible = ips.slice(0, VISIBLE_IP_LIMIT)
|
const visible = ips.slice(0, VISIBLE_IP_LIMIT)
|
||||||
const extraCount = ips.length - visible.length
|
const extraCount = ips.length - visible.length
|
||||||
const copyValue = ips.join('\n')
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn('flex min-w-0 items-center gap-1.5', className)}>
|
<div className={cn('flex min-w-0 flex-col gap-1', className)}>
|
||||||
<TruncatedText
|
{visible.map((ip) => {
|
||||||
className={cn(
|
const health = healthByIp.get(ip)
|
||||||
'text-muted-foreground min-w-0 font-mono text-xs',
|
return (
|
||||||
textClassName,
|
<div key={ip} className="flex min-w-0 items-center gap-1.5">
|
||||||
)}
|
<HealthCheckBadge
|
||||||
>
|
status={health?.status ?? 'unknown'}
|
||||||
{visible.join(' · ')}
|
latencyMs={health?.latency_ms}
|
||||||
</TruncatedText>
|
size="xs"
|
||||||
|
/>
|
||||||
|
<TruncatedText
|
||||||
|
className={cn(
|
||||||
|
'text-muted-foreground min-w-0 font-mono text-xs',
|
||||||
|
textClassName,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{ip}
|
||||||
|
</TruncatedText>
|
||||||
|
{copyable ? <CopyFqdnButton value={ip} /> : null}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
{extraCount > 0 ? (
|
{extraCount > 0 ? (
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
@@ -162,7 +178,7 @@ export function ServiceIpList({
|
|||||||
<Badge
|
<Badge
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="xs"
|
size="xs"
|
||||||
className="shrink-0 tabular-nums"
|
className="w-fit shrink-0 tabular-nums"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -170,7 +186,7 @@ export function ServiceIpList({
|
|||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent className="max-w-xs">
|
<TooltipContent className="max-w-xs">
|
||||||
<ul className="flex flex-col gap-0.5 font-mono text-xs">
|
<ul className="flex flex-col gap-0.5 font-mono text-xs">
|
||||||
{ips.map((ip) => (
|
{ips.slice(VISIBLE_IP_LIMIT).map((ip) => (
|
||||||
<li key={ip}>{ip}</li>
|
<li key={ip}>{ip}</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
@@ -178,7 +194,6 @@ export function ServiceIpList({
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
) : null}
|
) : null}
|
||||||
{copyable ? <CopyFqdnButton value={copyValue} /> : null}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Link } from '@tanstack/react-router'
|
import { Link } from '@tanstack/react-router'
|
||||||
import { MoreHorizontalIcon, ServerIcon } from 'lucide-react'
|
import { MoreHorizontalIcon, ServerIcon } from 'lucide-react'
|
||||||
|
|
||||||
import { HealthCheckBadge } from '@/components/health-check-badge'
|
|
||||||
import {
|
import {
|
||||||
Frame,
|
Frame,
|
||||||
FrameDescription,
|
FrameDescription,
|
||||||
@@ -40,9 +39,9 @@ export function ServiceUnitCard({
|
|||||||
onToggleService,
|
onToggleService,
|
||||||
}: ServiceUnitCardProps) {
|
}: ServiceUnitCardProps) {
|
||||||
return (
|
return (
|
||||||
<Frame dense spacing="sm" className="h-full min-w-0">
|
<Frame dense spacing="sm" className="h-full min-w-0 overflow-hidden">
|
||||||
<FrameHeader className="flex-row items-start justify-between gap-2">
|
<FrameHeader className="flex-row items-center justify-between gap-2">
|
||||||
<div className="flex min-w-0 items-start gap-2">
|
<div className="flex min-w-0 items-center gap-2">
|
||||||
<IconTile
|
<IconTile
|
||||||
variant="elevated"
|
variant="elevated"
|
||||||
size="sm"
|
size="sm"
|
||||||
@@ -67,11 +66,6 @@ export function ServiceUnitCard({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex shrink-0 items-center gap-1">
|
<div className="flex shrink-0 items-center gap-1">
|
||||||
<HealthCheckBadge
|
|
||||||
status={service.health_status ?? 'unknown'}
|
|
||||||
latencyMs={service.health_latency_ms}
|
|
||||||
size="xs"
|
|
||||||
/>
|
|
||||||
<Switch
|
<Switch
|
||||||
size="sm"
|
size="sm"
|
||||||
checked={service.enabled}
|
checked={service.enabled}
|
||||||
@@ -121,13 +115,13 @@ export function ServiceUnitCard({
|
|||||||
</div>
|
</div>
|
||||||
</FrameHeader>
|
</FrameHeader>
|
||||||
|
|
||||||
<FramePanel className="flex flex-col gap-1 pt-0 shadow-none!">
|
<FramePanel className="flex min-w-0 flex-col gap-1.5 pt-0 shadow-none!">
|
||||||
<ServiceFqdnList
|
<ServiceFqdnList copyable service={service} emptyLabel="Не задан" />
|
||||||
|
<ServiceIpList
|
||||||
copyable
|
copyable
|
||||||
service={service}
|
ips={service.ips ?? []}
|
||||||
emptyLabel="Не задан"
|
ipHealth={service.ip_health ?? []}
|
||||||
/>
|
/>
|
||||||
<ServiceIpList copyable ips={service.ips ?? []} />
|
|
||||||
</FramePanel>
|
</FramePanel>
|
||||||
</Frame>
|
</Frame>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import { useMemo, useState, type ReactNode } from 'react'
|
import { useMemo, useState, type ReactNode } from 'react'
|
||||||
import {
|
import {
|
||||||
ChevronDownIcon,
|
ChevronDownIcon,
|
||||||
FilterIcon,
|
|
||||||
FolderPlusIcon,
|
FolderPlusIcon,
|
||||||
FunnelXIcon,
|
|
||||||
PlusIcon,
|
PlusIcon,
|
||||||
|
SearchIcon,
|
||||||
ServerIcon,
|
ServerIcon,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
|
|
||||||
import { Filters, type Filter } from '@/components/reui/filters'
|
|
||||||
import {
|
import {
|
||||||
Frame,
|
Frame,
|
||||||
FrameDescription,
|
FrameDescription,
|
||||||
@@ -16,21 +14,13 @@ import {
|
|||||||
FramePanel,
|
FramePanel,
|
||||||
FrameTitle,
|
FrameTitle,
|
||||||
} from '@/components/reui/frame'
|
} from '@/components/reui/frame'
|
||||||
import { CountedLineTabs } from '@/components/counted-line-tabs'
|
|
||||||
import { EmptyState } from '@/components/empty-state'
|
import { EmptyState } from '@/components/empty-state'
|
||||||
import {
|
|
||||||
applyFiltersToData,
|
|
||||||
getActiveFilters,
|
|
||||||
} from '@/components/reui-kit/filter-utils'
|
|
||||||
import { ServiceCatalogSection } from '@/components/services/service-catalog-section'
|
import { ServiceCatalogSection } from '@/components/services/service-catalog-section'
|
||||||
import {
|
import {
|
||||||
SERVICE_TABS,
|
|
||||||
createDefaultServiceFilters,
|
|
||||||
serviceFilterFieldValue,
|
|
||||||
serviceTabFilter,
|
serviceTabFilter,
|
||||||
useServiceFilterFields,
|
|
||||||
type ServiceCatalogRow,
|
type ServiceCatalogRow,
|
||||||
} from '@/components/columns/services-columns'
|
} from '@/components/columns/services-columns'
|
||||||
|
import { serviceDisplayFqdns } from '@/lib/service-utils'
|
||||||
import type {
|
import type {
|
||||||
ServiceGroupView,
|
ServiceGroupView,
|
||||||
ServiceGroupsResponse,
|
ServiceGroupsResponse,
|
||||||
@@ -43,23 +33,29 @@ import {
|
|||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from '@cfdm/ui/components/dropdown-menu'
|
} from '@cfdm/ui/components/dropdown-menu'
|
||||||
import { Separator } from '@cfdm/ui/components/separator'
|
import {
|
||||||
|
InputGroup,
|
||||||
|
InputGroupAddon,
|
||||||
|
InputGroupInput,
|
||||||
|
InputGroupText,
|
||||||
|
} from '@cfdm/ui/components/input-group'
|
||||||
import { Skeleton } from '@cfdm/ui/components/skeleton'
|
import { Skeleton } from '@cfdm/ui/components/skeleton'
|
||||||
|
|
||||||
const HEALTH_TABS = [
|
|
||||||
{ id: 'health-ok', label: 'OK' },
|
|
||||||
{ id: 'health-slow', label: 'Slow' },
|
|
||||||
{ id: 'health-down', label: 'Down' },
|
|
||||||
{ id: 'health-unknown', label: '—' },
|
|
||||||
] as const
|
|
||||||
|
|
||||||
const ALL_TABS = [...SERVICE_TABS, ...HEALTH_TABS] as const
|
|
||||||
|
|
||||||
function serviceMatchesDomain(service: ServiceView, domainId?: number) {
|
function serviceMatchesDomain(service: ServiceView, domainId?: number) {
|
||||||
if (domainId == null) return true
|
if (domainId == null) return true
|
||||||
return service.domains.some((d) => d.domain_id === domainId)
|
return service.domains.some((d) => d.domain_id === domainId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function serviceMatchesQuery(service: ServiceView, query: string) {
|
||||||
|
const needle = query.trim().toLowerCase()
|
||||||
|
if (!needle) return true
|
||||||
|
if (service.name.toLowerCase().includes(needle)) return true
|
||||||
|
if (service.slug.toLowerCase().includes(needle)) return true
|
||||||
|
return serviceDisplayFqdns(service).some((fqdn) =>
|
||||||
|
fqdn.toLowerCase().includes(needle),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function toCatalogRow(
|
function toCatalogRow(
|
||||||
service: ServiceView,
|
service: ServiceView,
|
||||||
groupId: number | null,
|
groupId: number | null,
|
||||||
@@ -77,18 +73,6 @@ function toCatalogRow(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function catalogTabFilter(row: ServiceCatalogRow, tabId: string) {
|
|
||||||
if (tabId.startsWith('health-')) {
|
|
||||||
const status = row.service.health_status ?? 'unknown'
|
|
||||||
if (tabId === 'health-ok') return status === 'up'
|
|
||||||
if (tabId === 'health-slow') return status === 'degraded'
|
|
||||||
if (tabId === 'health-down') return status === 'down'
|
|
||||||
if (tabId === 'health-unknown') return status === 'unknown'
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return serviceTabFilter(row, tabId)
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GroupUnitData {
|
interface GroupUnitData {
|
||||||
id: string
|
id: string
|
||||||
group: ServiceGroupView | null
|
group: ServiceGroupView | null
|
||||||
@@ -195,8 +179,7 @@ export function ServicesGroupedCatalog({
|
|||||||
primaryAction,
|
primaryAction,
|
||||||
hideHeader = false,
|
hideHeader = false,
|
||||||
togglingId,
|
togglingId,
|
||||||
activeTab: controlledTab,
|
activeTab = 'all',
|
||||||
onTabChange,
|
|
||||||
onEditService,
|
onEditService,
|
||||||
onDeleteService,
|
onDeleteService,
|
||||||
onToggleService,
|
onToggleService,
|
||||||
@@ -205,13 +188,7 @@ export function ServicesGroupedCatalog({
|
|||||||
onAddServiceToGroup,
|
onAddServiceToGroup,
|
||||||
emptyAction,
|
emptyAction,
|
||||||
}: ServicesGroupedCatalogProps) {
|
}: ServicesGroupedCatalogProps) {
|
||||||
const [internalTab, setInternalTab] = useState('all')
|
const [query, setQuery] = useState('')
|
||||||
const tab = controlledTab ?? internalTab
|
|
||||||
const setTab = onTabChange ?? setInternalTab
|
|
||||||
const [filters, setFilters] = useState<Filter[]>(() =>
|
|
||||||
createDefaultServiceFilters(),
|
|
||||||
)
|
|
||||||
const filterFields = useServiceFilterFields()
|
|
||||||
|
|
||||||
const flatRows = useMemo(() => {
|
const flatRows = useMemo(() => {
|
||||||
const rows: ServiceCatalogRow[] = []
|
const rows: ServiceCatalogRow[] = []
|
||||||
@@ -228,24 +205,16 @@ export function ServicesGroupedCatalog({
|
|||||||
return rows
|
return rows
|
||||||
}, [data, domainId])
|
}, [data, domainId])
|
||||||
|
|
||||||
const tabCounts = useMemo(() => {
|
|
||||||
const counts: Record<string, number> = {}
|
|
||||||
for (const t of ALL_TABS) {
|
|
||||||
counts[t.id] = flatRows.filter((row) => catalogTabFilter(row, t.id)).length
|
|
||||||
}
|
|
||||||
return counts
|
|
||||||
}, [flatRows])
|
|
||||||
|
|
||||||
const filteredIds = useMemo(() => {
|
const filteredIds = useMemo(() => {
|
||||||
const afterTab = flatRows.filter((row) => catalogTabFilter(row, tab))
|
const afterTab = flatRows.filter((row) => serviceTabFilter(row, activeTab))
|
||||||
const afterFilters = applyFiltersToData(afterTab, filters, (item, field) =>
|
const afterQuery = afterTab.filter((row) =>
|
||||||
serviceFilterFieldValue(item, field),
|
serviceMatchesQuery(row.service, query),
|
||||||
)
|
)
|
||||||
return new Set(afterFilters.map((r) => r.id))
|
return new Set(afterQuery.map((r) => r.id))
|
||||||
}, [flatRows, tab, filters])
|
}, [flatRows, activeTab, query])
|
||||||
|
|
||||||
const showEmptyGroups =
|
const showEmptyGroups =
|
||||||
tab === 'all' && domainId == null && getActiveFilters(filters).length === 0
|
activeTab === 'all' && domainId == null && query.trim().length === 0
|
||||||
|
|
||||||
const units = useMemo(
|
const units = useMemo(
|
||||||
() => buildGroupUnits(data, filteredIds, domainId, showEmptyGroups),
|
() => buildGroupUnits(data, filteredIds, domainId, showEmptyGroups),
|
||||||
@@ -260,7 +229,7 @@ export function ServicesGroupedCatalog({
|
|||||||
<Skeleton className="h-4 w-72" />
|
<Skeleton className="h-4 w-72" />
|
||||||
</FrameHeader>
|
</FrameHeader>
|
||||||
<FramePanel className="flex flex-col gap-3 p-4">
|
<FramePanel className="flex flex-col gap-3 p-4">
|
||||||
<Skeleton className="h-9 w-full max-w-md" />
|
<Skeleton className="h-8 w-full max-w-md" />
|
||||||
{Array.from({ length: 3 }).map((_, i) => (
|
{Array.from({ length: 3 }).map((_, i) => (
|
||||||
<Skeleton key={i} className="h-36 w-full rounded-xl" />
|
<Skeleton key={i} className="h-36 w-full rounded-xl" />
|
||||||
))}
|
))}
|
||||||
@@ -307,70 +276,28 @@ export function ServicesGroupedCatalog({
|
|||||||
</FrameHeader>
|
</FrameHeader>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<FramePanel className="p-0 shadow-none!">
|
<FramePanel className="flex flex-col gap-4">
|
||||||
<div className="px-(--frame-panel-header-px) pt-(--frame-panel-header-py)">
|
<InputGroup className="max-w-md">
|
||||||
<CountedLineTabs
|
<InputGroupAddon>
|
||||||
tabs={ALL_TABS.map((t) => ({
|
<InputGroupText>
|
||||||
id: t.id,
|
<SearchIcon aria-hidden />
|
||||||
label: t.label,
|
</InputGroupText>
|
||||||
count: tabCounts[t.id] ?? 0,
|
</InputGroupAddon>
|
||||||
}))}
|
<InputGroupInput
|
||||||
value={tab}
|
value={query}
|
||||||
onValueChange={setTab}
|
onChange={(event) => setQuery(event.target.value)}
|
||||||
|
placeholder="Поиск по названию"
|
||||||
|
aria-label="Поиск по названию"
|
||||||
/>
|
/>
|
||||||
</div>
|
</InputGroup>
|
||||||
|
|
||||||
<Separator />
|
|
||||||
|
|
||||||
<div className="flex flex-wrap items-center justify-between gap-3 px-(--frame-panel-header-px) py-(--frame-panel-header-py)">
|
|
||||||
<Filters
|
|
||||||
filters={filters}
|
|
||||||
fields={filterFields}
|
|
||||||
onChange={setFilters}
|
|
||||||
size="default"
|
|
||||||
trigger={
|
|
||||||
<Button type="button" variant="outline" aria-label="Фильтры">
|
|
||||||
<FilterIcon className="size-4" aria-hidden />
|
|
||||||
Фильтры
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
variant="outline"
|
|
||||||
onClick={() => {
|
|
||||||
setTab('all')
|
|
||||||
setFilters(createDefaultServiceFilters())
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<FunnelXIcon className="size-4" aria-hidden />
|
|
||||||
Сбросить
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Separator />
|
|
||||||
|
|
||||||
{units.length === 0 ? (
|
{units.length === 0 ? (
|
||||||
<div className="p-6">
|
<EmptyState
|
||||||
<EmptyState
|
title="Нет совпадений"
|
||||||
title="Нет совпадений"
|
description="Измените запрос поиска."
|
||||||
description="Измените фильтры или вкладку."
|
/>
|
||||||
action={
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
variant="outline"
|
|
||||||
onClick={() => {
|
|
||||||
setTab('all')
|
|
||||||
setFilters(createDefaultServiceFilters())
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Сбросить
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-col gap-6 px-(--frame-panel-header-px) py-(--frame-panel-header-py)">
|
<div className="flex flex-col gap-6">
|
||||||
{units.map((unit) => (
|
{units.map((unit) => (
|
||||||
<ServiceCatalogSection
|
<ServiceCatalogSection
|
||||||
key={unit.id}
|
key={unit.id}
|
||||||
|
|||||||
@@ -94,6 +94,12 @@ export const serviceDomainBindingSchema = z
|
|||||||
: (binding.record_type ?? 'A'),
|
: (binding.record_type ?? 'A'),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
export const serviceIpHealthSchema = z.object({
|
||||||
|
ip: z.string(),
|
||||||
|
status: z.enum(['up', 'down', 'degraded', 'unknown']),
|
||||||
|
latency_ms: z.number().nullable(),
|
||||||
|
})
|
||||||
|
|
||||||
export const serviceViewSchema = serviceSchema.extend({
|
export const serviceViewSchema = serviceSchema.extend({
|
||||||
subdomain: z.string().default(''),
|
subdomain: z.string().default(''),
|
||||||
enabled: z.coerce.boolean().default(false),
|
enabled: z.coerce.boolean().default(false),
|
||||||
@@ -101,6 +107,7 @@ export const serviceViewSchema = serviceSchema.extend({
|
|||||||
domains: z.array(serviceDomainBindingSchema).default([]),
|
domains: z.array(serviceDomainBindingSchema).default([]),
|
||||||
health_status: z.enum(['up', 'down', 'degraded', 'unknown']).default('unknown'),
|
health_status: z.enum(['up', 'down', 'degraded', 'unknown']).default('unknown'),
|
||||||
health_latency_ms: z.number().nullable().default(null),
|
health_latency_ms: z.number().nullable().default(null),
|
||||||
|
ip_health: z.array(serviceIpHealthSchema).default([]),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const serviceGroupViewSchema = serviceGroupSchema.extend({
|
export const serviceGroupViewSchema = serviceGroupSchema.extend({
|
||||||
|
|||||||
Vendored
+10
-1
File diff suppressed because one or more lines are too long
Vendored
+34
@@ -631,6 +631,7 @@ __export(repos_exports, {
|
|||||||
listGroups: () => listGroups,
|
listGroups: () => listGroups,
|
||||||
listHealthCheckTargets: () => listHealthCheckTargets,
|
listHealthCheckTargets: () => listHealthCheckTargets,
|
||||||
listHealthChecks: () => listHealthChecks,
|
listHealthChecks: () => listHealthChecks,
|
||||||
|
listIpHealthByServiceIds: () => listIpHealthByServiceIds,
|
||||||
listIpHealthStatus: () => listIpHealthStatus,
|
listIpHealthStatus: () => listIpHealthStatus,
|
||||||
listNodes: () => listNodes,
|
listNodes: () => listNodes,
|
||||||
listNotificationLog: () => listNotificationLog,
|
listNotificationLog: () => listNotificationLog,
|
||||||
@@ -1822,6 +1823,39 @@ function aggregateIpHealthByServiceIds(db, serviceIds) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
function listIpHealthByServiceIds(db, serviceIds) {
|
||||||
|
const result = /* @__PURE__ */ new Map();
|
||||||
|
if (serviceIds.length === 0) return result;
|
||||||
|
const idList = sql2.join(
|
||||||
|
serviceIds.map((id) => sql2`${id}`),
|
||||||
|
sql2`, `
|
||||||
|
);
|
||||||
|
const rows = db.all(sql2`
|
||||||
|
SELECT sb.service_id AS service_id,
|
||||||
|
ihs.ip AS ip,
|
||||||
|
${WORST_HEALTH_SQL} AS health_status,
|
||||||
|
MAX(ihs.latency_ms) AS health_latency_ms
|
||||||
|
FROM ip_health_status ihs
|
||||||
|
INNER JOIN service_bindings sb
|
||||||
|
ON ihs.scope = 'binding' AND ihs.ref_id = sb.id
|
||||||
|
WHERE sb.service_id IN (${idList})
|
||||||
|
GROUP BY sb.service_id, ihs.ip
|
||||||
|
`);
|
||||||
|
for (const row of rows) {
|
||||||
|
const parsed = parseHealthAggregateRow({
|
||||||
|
health_status: row.health_status,
|
||||||
|
health_latency_ms: row.health_latency_ms
|
||||||
|
});
|
||||||
|
const list = result.get(row.service_id) ?? [];
|
||||||
|
list.push({
|
||||||
|
ip: row.ip,
|
||||||
|
status: parsed.health_status,
|
||||||
|
latency_ms: parsed.health_latency_ms
|
||||||
|
});
|
||||||
|
result.set(row.service_id, list);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
function mergeHealthAggregates(parts) {
|
function mergeHealthAggregates(parts) {
|
||||||
const rank = {
|
const rank = {
|
||||||
unknown: 0,
|
unknown: 0,
|
||||||
|
|||||||
@@ -2070,6 +2070,55 @@ export function aggregateIpHealthByServiceIds(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ServiceIpHealthRow = {
|
||||||
|
ip: string;
|
||||||
|
status: IpHealthState;
|
||||||
|
latency_ms: number | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Per-IP binding-scope health, worst status if the same IP is on several bindings. */
|
||||||
|
export function listIpHealthByServiceIds(
|
||||||
|
db: Db,
|
||||||
|
serviceIds: number[],
|
||||||
|
): Map<number, ServiceIpHealthRow[]> {
|
||||||
|
const result = new Map<number, ServiceIpHealthRow[]>();
|
||||||
|
if (serviceIds.length === 0) return result;
|
||||||
|
const idList = sql.join(
|
||||||
|
serviceIds.map((id) => sql`${id}`),
|
||||||
|
sql`, `,
|
||||||
|
);
|
||||||
|
const rows = db.all<{
|
||||||
|
service_id: number;
|
||||||
|
ip: string;
|
||||||
|
health_status: string | null;
|
||||||
|
health_latency_ms: number | null;
|
||||||
|
}>(sql`
|
||||||
|
SELECT sb.service_id AS service_id,
|
||||||
|
ihs.ip AS ip,
|
||||||
|
${WORST_HEALTH_SQL} AS health_status,
|
||||||
|
MAX(ihs.latency_ms) AS health_latency_ms
|
||||||
|
FROM ip_health_status ihs
|
||||||
|
INNER JOIN service_bindings sb
|
||||||
|
ON ihs.scope = 'binding' AND ihs.ref_id = sb.id
|
||||||
|
WHERE sb.service_id IN (${idList})
|
||||||
|
GROUP BY sb.service_id, ihs.ip
|
||||||
|
`);
|
||||||
|
for (const row of rows) {
|
||||||
|
const parsed = parseHealthAggregateRow({
|
||||||
|
health_status: row.health_status,
|
||||||
|
health_latency_ms: row.health_latency_ms,
|
||||||
|
});
|
||||||
|
const list = result.get(row.service_id) ?? [];
|
||||||
|
list.push({
|
||||||
|
ip: row.ip,
|
||||||
|
status: parsed.health_status,
|
||||||
|
latency_ms: parsed.health_latency_ms,
|
||||||
|
});
|
||||||
|
result.set(row.service_id, list);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
export function mergeHealthAggregates(
|
export function mergeHealthAggregates(
|
||||||
parts: Array<HealthAggregate | undefined | null>,
|
parts: Array<HealthAggregate | undefined | null>,
|
||||||
): HealthAggregate {
|
): HealthAggregate {
|
||||||
|
|||||||
Vendored
+58
-1
@@ -132,6 +132,7 @@ interface ServiceView$1 {
|
|||||||
domains: ServiceDomainBindingView[];
|
domains: ServiceDomainBindingView[];
|
||||||
health_status: IpHealthState;
|
health_status: IpHealthState;
|
||||||
health_latency_ms: number | null;
|
health_latency_ms: number | null;
|
||||||
|
ip_health: ServiceIpHealth$1[];
|
||||||
}
|
}
|
||||||
interface SyncJob {
|
interface SyncJob {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -192,6 +193,11 @@ interface IpHealthStatus {
|
|||||||
last_checked_at: string | null;
|
last_checked_at: string | null;
|
||||||
last_error: string | null;
|
last_error: string | null;
|
||||||
}
|
}
|
||||||
|
interface ServiceIpHealth$1 {
|
||||||
|
ip: string;
|
||||||
|
status: IpHealthState;
|
||||||
|
latency_ms: number | null;
|
||||||
|
}
|
||||||
interface ServiceNode {
|
interface ServiceNode {
|
||||||
id: number;
|
id: number;
|
||||||
service_id: number;
|
service_id: number;
|
||||||
@@ -372,6 +378,17 @@ declare const ipHealthStatusSchema: z.ZodObject<{
|
|||||||
last_checked_at: z.ZodNullable<z.ZodString>;
|
last_checked_at: z.ZodNullable<z.ZodString>;
|
||||||
last_error: z.ZodNullable<z.ZodString>;
|
last_error: z.ZodNullable<z.ZodString>;
|
||||||
}, z.core.$strip>;
|
}, z.core.$strip>;
|
||||||
|
declare const serviceIpHealthSchema: z.ZodObject<{
|
||||||
|
ip: z.ZodString;
|
||||||
|
status: z.ZodEnum<{
|
||||||
|
unknown: "unknown";
|
||||||
|
up: "up";
|
||||||
|
down: "down";
|
||||||
|
degraded: "degraded";
|
||||||
|
}>;
|
||||||
|
latency_ms: z.ZodNullable<z.ZodNumber>;
|
||||||
|
}, z.core.$strip>;
|
||||||
|
type ServiceIpHealth = z.infer<typeof serviceIpHealthSchema>;
|
||||||
declare const groupSchema: z.ZodObject<{
|
declare const groupSchema: z.ZodObject<{
|
||||||
id: z.ZodNumber;
|
id: z.ZodNumber;
|
||||||
name: z.ZodString;
|
name: z.ZodString;
|
||||||
@@ -619,6 +636,16 @@ declare const serviceViewSchema: z.ZodObject<{
|
|||||||
degraded: "degraded";
|
degraded: "degraded";
|
||||||
}>>;
|
}>>;
|
||||||
health_latency_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
health_latency_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
||||||
|
ip_health: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
||||||
|
ip: z.ZodString;
|
||||||
|
status: z.ZodEnum<{
|
||||||
|
unknown: "unknown";
|
||||||
|
up: "up";
|
||||||
|
down: "down";
|
||||||
|
degraded: "degraded";
|
||||||
|
}>;
|
||||||
|
latency_ms: z.ZodNullable<z.ZodNumber>;
|
||||||
|
}, z.core.$strip>>>;
|
||||||
}, z.core.$strip>;
|
}, z.core.$strip>;
|
||||||
declare const serviceGroupViewSchema: z.ZodObject<{
|
declare const serviceGroupViewSchema: z.ZodObject<{
|
||||||
id: z.ZodNumber;
|
id: z.ZodNumber;
|
||||||
@@ -752,6 +779,16 @@ declare const serviceGroupViewSchema: z.ZodObject<{
|
|||||||
degraded: "degraded";
|
degraded: "degraded";
|
||||||
}>>;
|
}>>;
|
||||||
health_latency_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
health_latency_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
||||||
|
ip_health: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
||||||
|
ip: z.ZodString;
|
||||||
|
status: z.ZodEnum<{
|
||||||
|
unknown: "unknown";
|
||||||
|
up: "up";
|
||||||
|
down: "down";
|
||||||
|
degraded: "degraded";
|
||||||
|
}>;
|
||||||
|
latency_ms: z.ZodNullable<z.ZodNumber>;
|
||||||
|
}, z.core.$strip>>>;
|
||||||
}, z.core.$strip>>>;
|
}, z.core.$strip>>>;
|
||||||
health_status: z.ZodDefault<z.ZodEnum<{
|
health_status: z.ZodDefault<z.ZodEnum<{
|
||||||
unknown: "unknown";
|
unknown: "unknown";
|
||||||
@@ -894,6 +931,16 @@ declare const serviceGroupsResponseSchema: z.ZodObject<{
|
|||||||
degraded: "degraded";
|
degraded: "degraded";
|
||||||
}>>;
|
}>>;
|
||||||
health_latency_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
health_latency_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
||||||
|
ip_health: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
||||||
|
ip: z.ZodString;
|
||||||
|
status: z.ZodEnum<{
|
||||||
|
unknown: "unknown";
|
||||||
|
up: "up";
|
||||||
|
down: "down";
|
||||||
|
degraded: "degraded";
|
||||||
|
}>;
|
||||||
|
latency_ms: z.ZodNullable<z.ZodNumber>;
|
||||||
|
}, z.core.$strip>>>;
|
||||||
}, z.core.$strip>>>;
|
}, z.core.$strip>>>;
|
||||||
health_status: z.ZodDefault<z.ZodEnum<{
|
health_status: z.ZodDefault<z.ZodEnum<{
|
||||||
unknown: "unknown";
|
unknown: "unknown";
|
||||||
@@ -1002,6 +1049,16 @@ declare const serviceGroupsResponseSchema: z.ZodObject<{
|
|||||||
degraded: "degraded";
|
degraded: "degraded";
|
||||||
}>>;
|
}>>;
|
||||||
health_latency_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
health_latency_ms: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
||||||
|
ip_health: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
||||||
|
ip: z.ZodString;
|
||||||
|
status: z.ZodEnum<{
|
||||||
|
unknown: "unknown";
|
||||||
|
up: "up";
|
||||||
|
down: "down";
|
||||||
|
degraded: "degraded";
|
||||||
|
}>;
|
||||||
|
latency_ms: z.ZodNullable<z.ZodNumber>;
|
||||||
|
}, z.core.$strip>>>;
|
||||||
}, z.core.$strip>>>;
|
}, z.core.$strip>>>;
|
||||||
}, z.core.$strip>;
|
}, z.core.$strip>;
|
||||||
declare const domainSchema: z.ZodObject<{
|
declare const domainSchema: z.ZodObject<{
|
||||||
@@ -1835,4 +1892,4 @@ declare const ingestAuditEventSchema: z.ZodObject<{
|
|||||||
}, z.core.$strip>;
|
}, z.core.$strip>;
|
||||||
type IngestAuditEvent = z.infer<typeof ingestAuditEventSchema>;
|
type IngestAuditEvent = z.infer<typeof ingestAuditEventSchema>;
|
||||||
|
|
||||||
export { AUDIT_SEVERITIES, AUDIT_SOURCE_APPS, AUDIT_TARGET_TYPES, type AppSettingsPatch, type AppSwitcherConfig, type AppSwitcherEntry, type AuditListQuery, type AuditLogEntry, type AuditSeverity, type AuditSourceApp, type AuditTargetType, type BulkUpdateDomainsInput, CERT_ERROR, CERT_EXPIRED, CERT_MONITORING_VALUES, CERT_MONITOR_AUTO, CERT_MONITOR_REQUIRED, CERT_MONITOR_SKIPPED, CERT_OK, CERT_UNKNOWN, CERT_WARNING, type CertMonitoring, type Certificate, type CfDnsRecord, type CfHealthCheck, type CfZone, type CfdmBindingSyncItem, type ChangeDomainInput, type ChangeIpInput, type CreateDnsRecordInput, type CreateDnsRecordPayload, type CreateDomainInput, type CreateDomainMonitorInput, type CreateGroupInput, type CreateOriginHealthCheckInput, type CreateServiceBindingInput, type CreateServiceGroupInput, type CreateServiceInput, type CreateServiceNodeInput, type CreateServiceWithConfigInput, type CreateSubdomainInput, type DnsRecord, type Domain, type DomainEnvironment, type DomainListItem, type DomainMonitor, type DomainMonitorResult, type DomainMonitorType, type Group, type GroupWithStats, type HealthCheckConfig, type HealthCheckProvider, type HealthCheckScope, type HealthCheckTarget, type HealthCheckType, type HealthStatusQuery, type IngestAuditEvent, type IpHealthState, type IpHealthStatus, type JwtClaims, type LbMode, type LoginInput, type LoginRequest, type LoginResponse, type NodeHealthState, type NotificationLog, type OriginHealthCheck, type OriginHealthCheckRecord, type ParsedFqdn, type PatchDnsRecordPayload, type ReorderServicesInput, SYNC_CONFLICT, SYNC_ERROR, SYNC_PENDING_DELETE, SYNC_PENDING_PUSH, SYNC_SYNCED, type Service, type ServiceBinding, type ServiceBindingView, type ServiceDomainBinding, type ServiceDomainBindingView, type ServiceGroup, type ServiceGroupView, type ServiceGroupsResponse, type ServiceNode, type ServiceNodeRecord, type ServiceOverview, type ServiceView, type Subdomain, type SubdomainRecord, type SyncJob, type ToggleEnabledInput, type UpdateDomainInput, type UpdateServiceConfigInput, type UpdateServiceGroupInput, type UpdateServiceNodeInput, type UpdateSubdomainInput, ValidationError, type VpsTrackerEvent, appSettingsPatchSchema, appSwitcherConfigSchema, appSwitcherEntrySchema, appSwitcherIconSchema, auditListQuerySchema, auditLogEntrySchema, auditSeveritySchema, auditSourceAppSchema, auditTargetTypeSchema, bindingToFqdn, bulkUpdateDomainsSchema, certMonitoringSchema, certStatusFromExpiry, certificateSchema, cfdmBindingSyncItemSchema, cfdmSyncBindingsBodySchema, changeDomainSchema, changeIpSchema, createDnsRecordSchema, createDomainMonitorSchema, createDomainSchema, createGroupSchema, createOriginHealthCheckSchema, createServiceBindingSchema, createServiceGroupSchema, createServiceNodeSchema, createServiceSchema, createServiceWithConfigSchema, createSubdomainSchema, dnsNameToSubdomainLabel, dnsRecordNamesMatch, dnsRecordSchema, domainEnvironmentSchema, domainListItemSchema, domainMonitorResultSchema, domainMonitorSchema, domainMonitorTypeSchema, domainSchema, fqdnToDisplay, groupSchema, groupWithStatsSchema, healthCheckConfigSchema, healthCheckProviderSchema, healthCheckScopeSchema, healthCheckTypeSchema, healthStatusQuerySchema, ingestAuditEventSchema, ipHealthStateSchema, ipHealthStatusSchema, isIpLiteral, isValidIpv4, lbModeSchema, loginSchema, nodeHealthStateSchema, normalizeDnsRecordName, notificationLogSchema, originHealthCheckSchema, parseFqdn, reorderServicesSchema, serviceBindingSchema, serviceDomainBindingSchema, serviceGroupSchema, serviceGroupTypeSchema, serviceGroupViewSchema, serviceGroupsResponseSchema, serviceNodeSchema, serviceSchema, serviceViewSchema, shouldMonitorService, subdomainLabelToFqdn, subdomainSchema, toggleEnabledSchema, updateDomainGroupSchema, updateDomainSchema, updateServiceConfigSchema, updateServiceGroupSchema, updateServiceNodeSchema, updateSubdomainSchema, validateDnsRecord, vpsTrackerEventSchema };
|
export { AUDIT_SEVERITIES, AUDIT_SOURCE_APPS, AUDIT_TARGET_TYPES, type AppSettingsPatch, type AppSwitcherConfig, type AppSwitcherEntry, type AuditListQuery, type AuditLogEntry, type AuditSeverity, type AuditSourceApp, type AuditTargetType, type BulkUpdateDomainsInput, CERT_ERROR, CERT_EXPIRED, CERT_MONITORING_VALUES, CERT_MONITOR_AUTO, CERT_MONITOR_REQUIRED, CERT_MONITOR_SKIPPED, CERT_OK, CERT_UNKNOWN, CERT_WARNING, type CertMonitoring, type Certificate, type CfDnsRecord, type CfHealthCheck, type CfZone, type CfdmBindingSyncItem, type ChangeDomainInput, type ChangeIpInput, type CreateDnsRecordInput, type CreateDnsRecordPayload, type CreateDomainInput, type CreateDomainMonitorInput, type CreateGroupInput, type CreateOriginHealthCheckInput, type CreateServiceBindingInput, type CreateServiceGroupInput, type CreateServiceInput, type CreateServiceNodeInput, type CreateServiceWithConfigInput, type CreateSubdomainInput, type DnsRecord, type Domain, type DomainEnvironment, type DomainListItem, type DomainMonitor, type DomainMonitorResult, type DomainMonitorType, type Group, type GroupWithStats, type HealthCheckConfig, type HealthCheckProvider, type HealthCheckScope, type HealthCheckTarget, type HealthCheckType, type HealthStatusQuery, type IngestAuditEvent, type IpHealthState, type IpHealthStatus, type JwtClaims, type LbMode, type LoginInput, type LoginRequest, type LoginResponse, type NodeHealthState, type NotificationLog, type OriginHealthCheck, type OriginHealthCheckRecord, type ParsedFqdn, type PatchDnsRecordPayload, type ReorderServicesInput, SYNC_CONFLICT, SYNC_ERROR, SYNC_PENDING_DELETE, SYNC_PENDING_PUSH, SYNC_SYNCED, type Service, type ServiceBinding, type ServiceBindingView, type ServiceDomainBinding, type ServiceDomainBindingView, type ServiceGroup, type ServiceGroupView, type ServiceGroupsResponse, type ServiceIpHealth, type ServiceNode, type ServiceNodeRecord, type ServiceOverview, type ServiceView, type Subdomain, type SubdomainRecord, type SyncJob, type ToggleEnabledInput, type UpdateDomainInput, type UpdateServiceConfigInput, type UpdateServiceGroupInput, type UpdateServiceNodeInput, type UpdateSubdomainInput, ValidationError, type VpsTrackerEvent, appSettingsPatchSchema, appSwitcherConfigSchema, appSwitcherEntrySchema, appSwitcherIconSchema, auditListQuerySchema, auditLogEntrySchema, auditSeveritySchema, auditSourceAppSchema, auditTargetTypeSchema, bindingToFqdn, bulkUpdateDomainsSchema, certMonitoringSchema, certStatusFromExpiry, certificateSchema, cfdmBindingSyncItemSchema, cfdmSyncBindingsBodySchema, changeDomainSchema, changeIpSchema, createDnsRecordSchema, createDomainMonitorSchema, createDomainSchema, createGroupSchema, createOriginHealthCheckSchema, createServiceBindingSchema, createServiceGroupSchema, createServiceNodeSchema, createServiceSchema, createServiceWithConfigSchema, createSubdomainSchema, dnsNameToSubdomainLabel, dnsRecordNamesMatch, dnsRecordSchema, domainEnvironmentSchema, domainListItemSchema, domainMonitorResultSchema, domainMonitorSchema, domainMonitorTypeSchema, domainSchema, fqdnToDisplay, groupSchema, groupWithStatsSchema, healthCheckConfigSchema, healthCheckProviderSchema, healthCheckScopeSchema, healthCheckTypeSchema, healthStatusQuerySchema, ingestAuditEventSchema, ipHealthStateSchema, ipHealthStatusSchema, isIpLiteral, isValidIpv4, lbModeSchema, loginSchema, nodeHealthStateSchema, normalizeDnsRecordName, notificationLogSchema, originHealthCheckSchema, parseFqdn, reorderServicesSchema, serviceBindingSchema, serviceDomainBindingSchema, serviceGroupSchema, serviceGroupTypeSchema, serviceGroupViewSchema, serviceGroupsResponseSchema, serviceIpHealthSchema, serviceNodeSchema, serviceSchema, serviceViewSchema, shouldMonitorService, subdomainLabelToFqdn, subdomainSchema, toggleEnabledSchema, updateDomainGroupSchema, updateDomainSchema, updateServiceConfigSchema, updateServiceGroupSchema, updateServiceNodeSchema, updateSubdomainSchema, validateDnsRecord, vpsTrackerEventSchema };
|
||||||
|
|||||||
Vendored
+8
-1
@@ -192,6 +192,11 @@ var ipHealthStatusSchema = z.object({
|
|||||||
last_checked_at: z.string().nullable(),
|
last_checked_at: z.string().nullable(),
|
||||||
last_error: z.string().nullable()
|
last_error: z.string().nullable()
|
||||||
});
|
});
|
||||||
|
var serviceIpHealthSchema = z.object({
|
||||||
|
ip: z.string(),
|
||||||
|
status: ipHealthStateSchema,
|
||||||
|
latency_ms: z.number().nullable()
|
||||||
|
});
|
||||||
var groupSchema = z.object({
|
var groupSchema = z.object({
|
||||||
id: z.number(),
|
id: z.number(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
@@ -277,7 +282,8 @@ var serviceViewSchema = serviceSchema.extend({
|
|||||||
ips: z.array(z.string()).default([]),
|
ips: z.array(z.string()).default([]),
|
||||||
domains: z.array(serviceDomainBindingSchema).default([]),
|
domains: z.array(serviceDomainBindingSchema).default([]),
|
||||||
health_status: ipHealthStateSchema.default("unknown"),
|
health_status: ipHealthStateSchema.default("unknown"),
|
||||||
health_latency_ms: z.number().nullable().default(null)
|
health_latency_ms: z.number().nullable().default(null),
|
||||||
|
ip_health: z.array(serviceIpHealthSchema).default([])
|
||||||
});
|
});
|
||||||
var serviceGroupViewSchema = serviceGroupSchema.extend({
|
var serviceGroupViewSchema = serviceGroupSchema.extend({
|
||||||
services: z.array(serviceViewSchema).default([]),
|
services: z.array(serviceViewSchema).default([]),
|
||||||
@@ -843,6 +849,7 @@ export {
|
|||||||
serviceGroupTypeSchema,
|
serviceGroupTypeSchema,
|
||||||
serviceGroupViewSchema,
|
serviceGroupViewSchema,
|
||||||
serviceGroupsResponseSchema,
|
serviceGroupsResponseSchema,
|
||||||
|
serviceIpHealthSchema,
|
||||||
serviceNodeSchema,
|
serviceNodeSchema,
|
||||||
serviceSchema,
|
serviceSchema,
|
||||||
serviceViewSchema,
|
serviceViewSchema,
|
||||||
|
|||||||
@@ -49,6 +49,14 @@ export const ipHealthStatusSchema = z.object({
|
|||||||
|
|
||||||
export type IpHealthStatus = z.infer<typeof ipHealthStatusSchema>
|
export type IpHealthStatus = z.infer<typeof ipHealthStatusSchema>
|
||||||
|
|
||||||
|
export const serviceIpHealthSchema = z.object({
|
||||||
|
ip: z.string(),
|
||||||
|
status: ipHealthStateSchema,
|
||||||
|
latency_ms: z.number().nullable(),
|
||||||
|
})
|
||||||
|
|
||||||
|
export type ServiceIpHealth = z.infer<typeof serviceIpHealthSchema>
|
||||||
|
|
||||||
export const groupSchema = z.object({
|
export const groupSchema = z.object({
|
||||||
id: z.number(),
|
id: z.number(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
@@ -150,6 +158,7 @@ export const serviceViewSchema = serviceSchema.extend({
|
|||||||
domains: z.array(serviceDomainBindingSchema).default([]),
|
domains: z.array(serviceDomainBindingSchema).default([]),
|
||||||
health_status: ipHealthStateSchema.default('unknown'),
|
health_status: ipHealthStateSchema.default('unknown'),
|
||||||
health_latency_ms: z.number().nullable().default(null),
|
health_latency_ms: z.number().nullable().default(null),
|
||||||
|
ip_health: z.array(serviceIpHealthSchema).default([]),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const serviceGroupViewSchema = serviceGroupSchema.extend({
|
export const serviceGroupViewSchema = serviceGroupSchema.extend({
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ export interface ServiceView {
|
|||||||
domains: ServiceDomainBindingView[];
|
domains: ServiceDomainBindingView[];
|
||||||
health_status: IpHealthState;
|
health_status: IpHealthState;
|
||||||
health_latency_ms: number | null;
|
health_latency_ms: number | null;
|
||||||
|
ip_health: ServiceIpHealth[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GroupWithStats extends Group {
|
export interface GroupWithStats extends Group {
|
||||||
@@ -293,6 +294,12 @@ export interface IpHealthStatus {
|
|||||||
last_error: string | null;
|
last_error: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ServiceIpHealth {
|
||||||
|
ip: string;
|
||||||
|
status: IpHealthState;
|
||||||
|
latency_ms: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ServiceNode {
|
export interface ServiceNode {
|
||||||
id: number;
|
id: number;
|
||||||
service_id: number;
|
service_id: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user