fix: hide NetUP server URL field in agent mode, derive from device config

- TvWelcomePage: hide server URL input when connection_type=agent
- Test button enabled in agent mode without serverUrl
- Backend test endpoint: derive server_url from workstation netup device
- getNetupCfg: resolve URL from netup device in agent mode

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-27 21:06:33 +03:00
parent 30257a6079
commit bf785b763f
2 changed files with 45 additions and 17 deletions

View File

@@ -290,20 +290,20 @@ export function TvWelcomePage() {
<hr className="border-slate-100 dark:border-slate-700" />
{/* Server URL */}
<div className="space-y-1.5">
<label className="text-sm font-medium text-slate-700 dark:text-slate-300">Адрес сервера NetUP</label>
<input
type="text" value={serverUrl} onChange={e => setServerUrl(e.target.value)}
placeholder={connectionType === 'agent' ? 'http://172.16.0.12:8880' : 'http://192.168.1.100:8880'}
className="input w-full font-mono text-sm"
/>
<p className="text-xs text-slate-400 dark:text-slate-500">
{connectionType === 'agent'
? 'Локальный адрес NetUP в сети отеля (агент обращается к нему напрямую)'
: 'Внешний адрес и порт, на который пробрасывается 172.16.0.12:80'}
</p>
</div>
{/* Server URL — только для прямого подключения */}
{connectionType !== 'agent' && (
<div className="space-y-1.5">
<label className="text-sm font-medium text-slate-700 dark:text-slate-300">Адрес сервера NetUP</label>
<input
type="text" value={serverUrl} onChange={e => setServerUrl(e.target.value)}
placeholder="http://192.168.1.100:8880"
className="input w-full font-mono text-sm"
/>
<p className="text-xs text-slate-400 dark:text-slate-500">
Внешний адрес и порт, на который пробрасывается 172.16.0.12:80
</p>
</div>
)}
{/* Credentials */}
<div className="grid grid-cols-2 gap-4">
@@ -356,7 +356,7 @@ export function TvWelcomePage() {
{/* Actions */}
<div className="flex gap-3 pt-1">
<button onClick={handleTest} disabled={testing || !serverUrl} className="btn-secondary flex items-center gap-2">
<button onClick={handleTest} disabled={testing || (connectionType !== 'agent' && !serverUrl)} className="btn-secondary flex items-center gap-2">
{testing ? <Loader2 size={14} className="animate-spin" /> : <Plug size={14} />}
Проверить подключение
</button>