diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsx index 76d3e65777..94ca7df732 100644 --- a/frontend-modern/src/components/Dashboard/GuestRow.tsx +++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx @@ -63,27 +63,6 @@ export function GuestRow(props: GuestRowProps) { } }); - // Also check localStorage for backward compatibility during transition - createEffect(() => { - // Only use localStorage if we haven't loaded from backend yet - if (!customUrl()) { - const guestURLs = JSON.parse(localStorage.getItem('guestURLs') || '{}'); - const config = guestURLs[guestId()]; - if (config && config.url) { - setCustomUrl(config.url); - // Migrate to backend - GuestMetadataAPI.updateMetadata(guestId(), { customUrl: config.url }).catch(() => {}); - } else if (config && config.host) { - // Support old format for backward compatibility - const port = config.port ? `:${config.port}` : ''; - const url = `${config.protocol}://${config.host}${port}`; - setCustomUrl(url); - // Migrate to backend - GuestMetadataAPI.updateMetadata(guestId(), { customUrl: url }).catch(() => {}); - } - } - }); - const cpuPercent = createMemo(() => (props.guest.cpu || 0) * 100); const memPercent = createMemo(() => { if (!props.guest.memory) return 0; diff --git a/frontend-modern/src/components/Dashboard/GuestUrlEditor.tsx b/frontend-modern/src/components/Dashboard/GuestUrlEditor.tsx deleted file mode 100644 index bd86b91a6b..0000000000 --- a/frontend-modern/src/components/Dashboard/GuestUrlEditor.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import { Component, createSignal, Show } from 'solid-js'; -import { GuestMetadataAPI } from '@/api/guestMetadata'; - -interface GuestUrlEditorProps { - guestId: string; - guestName: string; - currentUrl?: string; - onUpdate: (url: string | undefined) => void; - onClose: () => void; -} - -export const GuestUrlEditor: Component = (props) => { - const [url, setUrl] = createSignal(props.currentUrl || ''); - const [saving, setSaving] = createSignal(false); - const [error, setError] = createSignal(null); - - const handleSave = async () => { - const urlValue = url().trim(); - - // Validate URL if provided - if (urlValue && !urlValue.startsWith('http://') && !urlValue.startsWith('https://')) { - setError('URL must start with http:// or https://'); - return; - } - - setSaving(true); - setError(null); - - try { - await GuestMetadataAPI.updateMetadata(props.guestId, { - customUrl: urlValue || undefined - }); - props.onUpdate(urlValue || undefined); - // onClose is handled by onUpdate in Dashboard - } catch (err) { - setError('Failed to save URL'); - console.error('Failed to save guest URL:', err); - } finally { - setSaving(false); - } - }; - - const handleDelete = async () => { - setSaving(true); - setError(null); - - try { - await GuestMetadataAPI.updateMetadata(props.guestId, { - customUrl: undefined - }); - props.onUpdate(undefined); - // onClose is handled by onUpdate in Dashboard - } catch (err) { - setError('Failed to remove URL'); - console.error('Failed to remove guest URL:', err); - } finally { - setSaving(false); - } - }; - - return ( -
-
-

- Edit URL for {props.guestName} -

- -
-
- - setUrl(e.currentTarget.value)} - placeholder="https://example.com" - class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-gray-100" - /> -

- Leave empty to remove the custom URL -

-
- - -
- {error()} -
-
- -
- - - - - -
-
-
-
- ); -}; \ No newline at end of file