diff --git a/apps/web/src/components/health-check-config-fields.tsx b/apps/web/src/components/health-check-config-fields.tsx index 380a2c9..5a48d43 100644 --- a/apps/web/src/components/health-check-config-fields.tsx +++ b/apps/web/src/components/health-check-config-fields.tsx @@ -10,6 +10,7 @@ import { } from '@cfdm/ui/components/select' import { Switch } from '@cfdm/ui/components/switch' import { Label } from '@cfdm/ui/components/label' +import { cn } from '@cfdm/ui/lib/utils' export type LbMode = 'round_robin' | 'failover' | 'weighted' export type HealthCheckType = 'tcp' | 'http' @@ -46,6 +47,7 @@ interface HealthCheckConfigFieldsProps { lbModeOptions?: { value: string; label: string }[] idPrefix?: string showLbMode?: boolean + className?: string } export function HealthCheckConfigFields({ @@ -55,13 +57,16 @@ export function HealthCheckConfigFields({ lbModeOptions = defaultLbModeOptions, idPrefix = 'health', showLbMode = true, + className, }: HealthCheckConfigFieldsProps) { function patch(next: Partial) { onChange({ ...value, ...next }) } + const isHttp = value.type === 'http' + return ( - +
{showLbMode && ( patch({ type: (v ?? 'tcp') as HealthCheckType })} - > - - - - - {healthCheckTypes.map((item) => ( - - {item.label} - - ))} - - - + {value.enabled && ( +
+

+ Параметры проверки +

+ + + + - - - patch({ port: e.target.value === '' ? null : Number(e.target.value) }) - } - /> - + + + patch({ port: e.target.value === '' ? null : Number(e.target.value) }) + } + /> + - - - patch({ path: e.target.value === '' ? null : e.target.value }) - } - /> - + {isHttp && ( + + + patch({ path: e.target.value === '' ? null : e.target.value }) + } + /> + + )} - - - patch({ - expected_status: - e.target.value === '' ? null : Number(e.target.value), - }) - } - /> - + {isHttp && ( + + + patch({ + expected_status: + e.target.value === '' ? null : Number(e.target.value), + }) + } + /> + + )} -
- - - patch({ - interval_sec: - e.target.value === '' ? 30 : Number(e.target.value), - }) - } - /> - - - - patch({ - timeout_ms: - e.target.value === '' ? 3000 : Number(e.target.value), - }) - } - /> - -
-
+
+ + + patch({ + interval_sec: + e.target.value === '' ? 30 : Number(e.target.value), + }) + } + /> + + + + patch({ + timeout_ms: + e.target.value === '' ? 3000 : Number(e.target.value), + }) + } + /> + +
+ +
+ )} +
) } diff --git a/apps/web/src/components/service-edit-sheet.tsx b/apps/web/src/components/service-edit-sheet.tsx index fbb9e8e..35fc4b8 100644 --- a/apps/web/src/components/service-edit-sheet.tsx +++ b/apps/web/src/components/service-edit-sheet.tsx @@ -295,12 +295,6 @@ export function ServiceEditSheet({ ) } - function handleBindingLbModeChange(index: number, lbMode: LbMode) { - setBindings((current) => - current.map((item, i) => (i === index ? { ...item, lb_mode: lbMode } : item)), - ) - } - function handleBindingMetaChange( index: number, ip: string, @@ -604,54 +598,29 @@ export function ServiceEditSheet({ )} {showLbBlock && ( - + Балансировка и Health-check (multi-A) - - - - Режим балансировки - - - - - handleBindingHealthChange(index, next) - } - showLbMode={false} - idPrefix={`binding-${index}-health`} - /> - + + handleBindingHealthChange(index, next) + } + lbModeLabel="Режим балансировки" + idPrefix={`binding-${index}-health`} + /> diff --git a/apps/web/src/components/service-group-edit-sheet.tsx b/apps/web/src/components/service-group-edit-sheet.tsx index 93958ed..1fed143 100644 --- a/apps/web/src/components/service-group-edit-sheet.tsx +++ b/apps/web/src/components/service-group-edit-sheet.tsx @@ -29,7 +29,6 @@ import { AccordionItem, AccordionTrigger, } from '@cfdm/ui/components/accordion' -import { Separator } from '@cfdm/ui/components/separator' const groupTypes = [ { value: 'vpn', label: 'VPN' }, @@ -201,22 +200,19 @@ export function ServiceGroupEditSheet({
{hasDomain && ( - <> - - - - Балансировка и Health-check - - - - - - + + + Балансировка и Health-check + + + + + )} )