Enhance dialogs and configuration handling in the admin interface
CI / Backend (build + test) (push) Successful in 1m14s
CI / Frontend (lint + typecheck + build) (push) Successful in 31s

- Updated `EditNodeDialog` and `RegisterNodeDialog` to prevent interaction outside the dialog, improving user experience.
- Added data attributes to password fields in both dialogs for better password management.
- Refactored `CreateConfigDialog` to accept inbounds as a prop, improving data handling and user feedback when no inbounds are available.
- Introduced a warning banner in the root layout to inform users about the necessity of linking their Telegram account for notifications and password recovery.
- Updated translations for improved clarity regarding available inbounds and Telegram linking requirements.
This commit is contained in:
Leonid Pershin
2026-07-02 17:06:53 +03:00
parent 0d0fc2c86b
commit 7dcc8889a0
7 changed files with 72 additions and 16 deletions
@@ -1,5 +1,5 @@
import { useState } from 'react'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { useTranslation } from 'react-i18next'
import { Plus } from 'lucide-react'
import { toast } from '@/shared/ui/toast-store'
@@ -9,9 +9,10 @@ import { Label } from '@/shared/ui/label'
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/shared/ui/dialog'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/shared/ui/select'
import { HttpError } from '@/shared/api/client'
import { createConfig, listAvailableInbounds } from './api'
import type { AvailableInboundDto } from '@/shared/api/types'
import { createConfig } from './api'
export function CreateConfigDialog() {
export function CreateConfigDialog({ inbounds }: { inbounds: AvailableInboundDto[] }) {
const { t } = useTranslation()
const queryClient = useQueryClient()
const [open, setOpen] = useState(false)
@@ -19,8 +20,6 @@ export function CreateConfigDialog() {
const [label, setLabel] = useState('')
const [deviceLimit, setDeviceLimit] = useState('')
const inboundsQuery = useQuery({ queryKey: ['available-inbounds'], queryFn: listAvailableInbounds, enabled: open })
const createMutation = useMutation({
mutationFn: () => createConfig(inboundId, label.trim() || undefined, deviceLimit ? Number(deviceLimit) : undefined),
onSuccess: async () => {
@@ -64,16 +63,13 @@ export function CreateConfigDialog() {
<SelectValue placeholder={t('configs.selectLocation')} />
</SelectTrigger>
<SelectContent>
{inboundsQuery.data?.map((inbound) => (
{inbounds.map((inbound) => (
<SelectItem key={inbound.inboundId} value={inbound.inboundId}>
{inbound.displayName} ({inbound.protocol})
</SelectItem>
))}
</SelectContent>
</Select>
{inboundsQuery.data?.length === 0 && (
<p className="text-xs text-muted-foreground">{t('configs.noInboundsAvailable')}</p>
)}
</div>
<div className="flex flex-col gap-1.5">
<Label htmlFor="label">{t('configs.label')}</Label>