2026-06-13 02:20:09 +00:00
|
|
|
import React, { useState, useEffect } from 'react';
|
feat: implement 100% Proxmox PDM feature parity - UI components
- Add 8 new UI components: AclList, AddRemoteForm, ContainerConsole, ContainerOverview, EditRemoteForm, RemoveRemoteDialog, VMConsole, VMOverview
- Add 13 Proxmox management pages: ACLPage, BackupPage, CephPage, CertificatesPage, ContainersPage, FirewallPage, HAPage, NetworkPage, RemotesPage, SDNPage, StoragePage, TasksPage, VMsPage
- Add 13 new routes to App.tsx for Proxmox management pages
- All components use existing UI components from src/components/ui/index.tsx
- TypeScript and ESLint pass with 0 errors
- All tests pass
Files changed: 24 files, +2199 insertions
2026-06-11 18:47:09 +00:00
|
|
|
import { Button } from '@/components/ui/index';
|
|
|
|
|
import { RefreshCw } from 'lucide-react';
|
|
|
|
|
import { RemotesList } from '@/components/Proxmox';
|
|
|
|
|
import { AddRemoteForm } from '@/components/Proxmox';
|
|
|
|
|
import { EditRemoteForm } from '@/components/Proxmox';
|
|
|
|
|
import { RemoveRemoteDialog } from '@/components/Proxmox';
|
|
|
|
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/index';
|
2026-06-13 02:20:09 +00:00
|
|
|
import { listProxmoxClusters, addProxmoxCluster, removeProxmoxCluster } from '@/lib/proxmoxClient';
|
|
|
|
|
import { ClusterType } from '@/lib/domain';
|
feat: implement 100% Proxmox PDM feature parity - UI components
- Add 8 new UI components: AclList, AddRemoteForm, ContainerConsole, ContainerOverview, EditRemoteForm, RemoveRemoteDialog, VMConsole, VMOverview
- Add 13 Proxmox management pages: ACLPage, BackupPage, CephPage, CertificatesPage, ContainersPage, FirewallPage, HAPage, NetworkPage, RemotesPage, SDNPage, StoragePage, TasksPage, VMsPage
- Add 13 new routes to App.tsx for Proxmox management pages
- All components use existing UI components from src/components/ui/index.tsx
- TypeScript and ESLint pass with 0 errors
- All tests pass
Files changed: 24 files, +2199 insertions
2026-06-11 18:47:09 +00:00
|
|
|
|
|
|
|
|
interface RemoteInfo {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
url: string;
|
|
|
|
|
username: string;
|
|
|
|
|
type: 'pve' | 'pbs';
|
|
|
|
|
status: 'connected' | 'disconnected' | 'error';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function ProxmoxRemotesPage() {
|
2026-06-11 20:55:04 +00:00
|
|
|
const [remotes, setRemotes] = useState<RemoteInfo[]>([]);
|
feat: implement 100% Proxmox PDM feature parity - UI components
- Add 8 new UI components: AclList, AddRemoteForm, ContainerConsole, ContainerOverview, EditRemoteForm, RemoveRemoteDialog, VMConsole, VMOverview
- Add 13 Proxmox management pages: ACLPage, BackupPage, CephPage, CertificatesPage, ContainersPage, FirewallPage, HAPage, NetworkPage, RemotesPage, SDNPage, StoragePage, TasksPage, VMsPage
- Add 13 new routes to App.tsx for Proxmox management pages
- All components use existing UI components from src/components/ui/index.tsx
- TypeScript and ESLint pass with 0 errors
- All tests pass
Files changed: 24 files, +2199 insertions
2026-06-11 18:47:09 +00:00
|
|
|
const [showAddDialog, setShowAddDialog] = useState(false);
|
|
|
|
|
const [editingRemote, setEditingRemote] = useState<RemoteInfo | null>(null);
|
|
|
|
|
const [removingRemote, setRemovingRemote] = useState<RemoteInfo | null>(null);
|
|
|
|
|
|
2026-06-13 02:20:09 +00:00
|
|
|
const loadRemotes = async () => {
|
2026-06-11 20:55:04 +00:00
|
|
|
try {
|
2026-06-13 02:20:09 +00:00
|
|
|
const clusters = await listProxmoxClusters();
|
|
|
|
|
// TODO: Implement actual status checking via backend connection test
|
|
|
|
|
const remotesList: RemoteInfo[] = clusters.map((c) => ({
|
2026-06-11 20:55:04 +00:00
|
|
|
id: c.id,
|
|
|
|
|
name: c.name,
|
2026-06-13 02:20:09 +00:00
|
|
|
url: c.url,
|
2026-06-11 20:55:04 +00:00
|
|
|
username: c.username,
|
|
|
|
|
type: c.clusterType === 've' ? 'pve' : 'pbs',
|
2026-06-13 02:20:09 +00:00
|
|
|
status: 'connected' as const, // Placeholder - actual status requires connection test
|
2026-06-11 20:55:04 +00:00
|
|
|
}));
|
2026-06-13 02:20:09 +00:00
|
|
|
setRemotes(remotesList);
|
2026-06-11 20:55:04 +00:00
|
|
|
} catch (err) {
|
2026-06-13 02:20:09 +00:00
|
|
|
console.error('Failed to load remotes:', err);
|
2026-06-11 20:55:04 +00:00
|
|
|
}
|
2026-06-13 02:20:09 +00:00
|
|
|
};
|
2026-06-11 20:55:04 +00:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
2026-06-13 02:20:09 +00:00
|
|
|
void loadRemotes();
|
|
|
|
|
}, []);
|
2026-06-11 20:55:04 +00:00
|
|
|
|
2026-06-13 02:20:09 +00:00
|
|
|
const generateId = (): string => {
|
|
|
|
|
return Date.now().toString(36) + Math.random().toString(36).substr(2);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2026-06-11 20:55:04 +00:00
|
|
|
const handleAddRemote = async (config: any) => {
|
|
|
|
|
try {
|
2026-06-13 02:20:09 +00:00
|
|
|
const clusterType = config.type === 'pve' ? 've' : 'pbs';
|
|
|
|
|
const url = config.url.replace(/^https?:\/\//, '');
|
|
|
|
|
const port = config.type === 'pve' ? 8006 : 8007;
|
|
|
|
|
const id = config.id || generateId();
|
|
|
|
|
await addProxmoxCluster(
|
|
|
|
|
id,
|
2026-06-11 20:55:04 +00:00
|
|
|
config.name,
|
2026-06-13 02:20:09 +00:00
|
|
|
clusterType as ClusterType,
|
|
|
|
|
{ url, port },
|
2026-06-11 20:55:04 +00:00
|
|
|
config.username,
|
|
|
|
|
config.password || ''
|
|
|
|
|
);
|
2026-06-13 02:20:09 +00:00
|
|
|
await loadRemotes();
|
2026-06-11 20:55:04 +00:00
|
|
|
setShowAddDialog(false);
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('Failed to add remote:', err);
|
2026-06-13 02:20:09 +00:00
|
|
|
alert('Failed to add remote: ' + String(err));
|
2026-06-11 20:55:04 +00:00
|
|
|
}
|
feat: implement 100% Proxmox PDM feature parity - UI components
- Add 8 new UI components: AclList, AddRemoteForm, ContainerConsole, ContainerOverview, EditRemoteForm, RemoveRemoteDialog, VMConsole, VMOverview
- Add 13 Proxmox management pages: ACLPage, BackupPage, CephPage, CertificatesPage, ContainersPage, FirewallPage, HAPage, NetworkPage, RemotesPage, SDNPage, StoragePage, TasksPage, VMsPage
- Add 13 new routes to App.tsx for Proxmox management pages
- All components use existing UI components from src/components/ui/index.tsx
- TypeScript and ESLint pass with 0 errors
- All tests pass
Files changed: 24 files, +2199 insertions
2026-06-11 18:47:09 +00:00
|
|
|
};
|
|
|
|
|
|
2026-06-13 02:20:09 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2026-06-11 20:55:04 +00:00
|
|
|
const handleEditRemote = async (config: any) => {
|
|
|
|
|
try {
|
2026-06-13 02:20:09 +00:00
|
|
|
const clusterType = config.type === 'pve' ? 've' : 'pbs';
|
|
|
|
|
const url = config.url.replace(/^https?:\/\//, '');
|
|
|
|
|
const port = config.type === 'pve' ? 8006 : 8007;
|
|
|
|
|
await removeProxmoxCluster(config.id);
|
|
|
|
|
await addProxmoxCluster(
|
2026-06-11 20:55:04 +00:00
|
|
|
config.id,
|
|
|
|
|
config.name,
|
2026-06-13 02:20:09 +00:00
|
|
|
clusterType as ClusterType,
|
|
|
|
|
{ url, port },
|
2026-06-11 20:55:04 +00:00
|
|
|
config.username,
|
2026-06-13 02:20:09 +00:00
|
|
|
config.password || ''
|
2026-06-11 20:55:04 +00:00
|
|
|
);
|
2026-06-13 02:20:09 +00:00
|
|
|
await loadRemotes();
|
2026-06-11 20:55:04 +00:00
|
|
|
setEditingRemote(null);
|
|
|
|
|
} catch (err) {
|
2026-06-13 02:20:09 +00:00
|
|
|
console.error('Failed to edit remote:', err);
|
|
|
|
|
alert('Failed to edit remote: ' + String(err));
|
2026-06-11 20:55:04 +00:00
|
|
|
}
|
feat: implement 100% Proxmox PDM feature parity - UI components
- Add 8 new UI components: AclList, AddRemoteForm, ContainerConsole, ContainerOverview, EditRemoteForm, RemoveRemoteDialog, VMConsole, VMOverview
- Add 13 Proxmox management pages: ACLPage, BackupPage, CephPage, CertificatesPage, ContainersPage, FirewallPage, HAPage, NetworkPage, RemotesPage, SDNPage, StoragePage, TasksPage, VMsPage
- Add 13 new routes to App.tsx for Proxmox management pages
- All components use existing UI components from src/components/ui/index.tsx
- TypeScript and ESLint pass with 0 errors
- All tests pass
Files changed: 24 files, +2199 insertions
2026-06-11 18:47:09 +00:00
|
|
|
};
|
|
|
|
|
|
2026-06-11 20:55:04 +00:00
|
|
|
const handleRemoveRemote = async () => {
|
feat: implement 100% Proxmox PDM feature parity - UI components
- Add 8 new UI components: AclList, AddRemoteForm, ContainerConsole, ContainerOverview, EditRemoteForm, RemoveRemoteDialog, VMConsole, VMOverview
- Add 13 Proxmox management pages: ACLPage, BackupPage, CephPage, CertificatesPage, ContainersPage, FirewallPage, HAPage, NetworkPage, RemotesPage, SDNPage, StoragePage, TasksPage, VMsPage
- Add 13 new routes to App.tsx for Proxmox management pages
- All components use existing UI components from src/components/ui/index.tsx
- TypeScript and ESLint pass with 0 errors
- All tests pass
Files changed: 24 files, +2199 insertions
2026-06-11 18:47:09 +00:00
|
|
|
if (removingRemote) {
|
2026-06-11 20:55:04 +00:00
|
|
|
try {
|
2026-06-13 02:20:09 +00:00
|
|
|
await removeProxmoxCluster(removingRemote.id);
|
|
|
|
|
await loadRemotes();
|
2026-06-11 20:55:04 +00:00
|
|
|
setRemovingRemote(null);
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('Failed to remove remote:', err);
|
2026-06-13 02:20:09 +00:00
|
|
|
alert('Failed to remove remote: ' + String(err));
|
2026-06-11 20:55:04 +00:00
|
|
|
}
|
feat: implement 100% Proxmox PDM feature parity - UI components
- Add 8 new UI components: AclList, AddRemoteForm, ContainerConsole, ContainerOverview, EditRemoteForm, RemoveRemoteDialog, VMConsole, VMOverview
- Add 13 Proxmox management pages: ACLPage, BackupPage, CephPage, CertificatesPage, ContainersPage, FirewallPage, HAPage, NetworkPage, RemotesPage, SDNPage, StoragePage, TasksPage, VMsPage
- Add 13 new routes to App.tsx for Proxmox management pages
- All components use existing UI components from src/components/ui/index.tsx
- TypeScript and ESLint pass with 0 errors
- All tests pass
Files changed: 24 files, +2199 insertions
2026-06-11 18:47:09 +00:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-4">
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<div>
|
|
|
|
|
<h1 className="text-2xl font-bold">Remotes</h1>
|
|
|
|
|
<p className="text-muted-foreground">Manage Proxmox VE and Backup Server connections</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex space-x-2">
|
2026-06-13 02:52:05 +00:00
|
|
|
<Button variant="outline" size="sm" onClick={() => { void loadRemotes(); }}>
|
2026-06-13 02:20:09 +00:00
|
|
|
<RefreshCw className="mr-2 h-4 w-4" />
|
feat: implement 100% Proxmox PDM feature parity - UI components
- Add 8 new UI components: AclList, AddRemoteForm, ContainerConsole, ContainerOverview, EditRemoteForm, RemoveRemoteDialog, VMConsole, VMOverview
- Add 13 Proxmox management pages: ACLPage, BackupPage, CephPage, CertificatesPage, ContainersPage, FirewallPage, HAPage, NetworkPage, RemotesPage, SDNPage, StoragePage, TasksPage, VMsPage
- Add 13 new routes to App.tsx for Proxmox management pages
- All components use existing UI components from src/components/ui/index.tsx
- TypeScript and ESLint pass with 0 errors
- All tests pass
Files changed: 24 files, +2199 insertions
2026-06-11 18:47:09 +00:00
|
|
|
Refresh
|
|
|
|
|
</Button>
|
|
|
|
|
<Button onClick={() => setShowAddDialog(true)}>
|
|
|
|
|
<span className="mr-2 h-4 w-4">+</span>
|
|
|
|
|
Add Remote
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<RemotesList
|
|
|
|
|
remotes={remotes}
|
2026-06-13 02:52:05 +00:00
|
|
|
onRefresh={() => { void loadRemotes(); }}
|
feat: implement 100% Proxmox PDM feature parity - UI components
- Add 8 new UI components: AclList, AddRemoteForm, ContainerConsole, ContainerOverview, EditRemoteForm, RemoveRemoteDialog, VMConsole, VMOverview
- Add 13 Proxmox management pages: ACLPage, BackupPage, CephPage, CertificatesPage, ContainersPage, FirewallPage, HAPage, NetworkPage, RemotesPage, SDNPage, StoragePage, TasksPage, VMsPage
- Add 13 new routes to App.tsx for Proxmox management pages
- All components use existing UI components from src/components/ui/index.tsx
- TypeScript and ESLint pass with 0 errors
- All tests pass
Files changed: 24 files, +2199 insertions
2026-06-11 18:47:09 +00:00
|
|
|
onEdit={(remote) => {
|
|
|
|
|
setEditingRemote(remote as RemoteInfo | null);
|
|
|
|
|
}}
|
|
|
|
|
onDelete={(remote) => {
|
|
|
|
|
setRemovingRemote(remote as RemoteInfo | null);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
{showAddDialog && (
|
|
|
|
|
<Dialog open={showAddDialog} onOpenChange={setShowAddDialog}>
|
|
|
|
|
<DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto">
|
|
|
|
|
<DialogHeader>
|
|
|
|
|
<DialogTitle>Add New Remote</DialogTitle>
|
|
|
|
|
</DialogHeader>
|
|
|
|
|
<AddRemoteForm onAdd={handleAddRemote} onCancel={() => setShowAddDialog(false)} />
|
|
|
|
|
</DialogContent>
|
|
|
|
|
</Dialog>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{editingRemote !== null && (
|
|
|
|
|
<Dialog open={true} onOpenChange={() => setEditingRemote(null)}>
|
|
|
|
|
<DialogContent className="max-w-2xl">
|
|
|
|
|
<DialogHeader>
|
|
|
|
|
<DialogTitle>Edit Remote</DialogTitle>
|
|
|
|
|
</DialogHeader>
|
|
|
|
|
<EditRemoteForm
|
|
|
|
|
remote={editingRemote}
|
|
|
|
|
onSave={handleEditRemote}
|
|
|
|
|
onCancel={() => setEditingRemote(null)}
|
|
|
|
|
/>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
</Dialog>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{removingRemote !== null && (
|
|
|
|
|
<Dialog open={true} onOpenChange={() => setRemovingRemote(null)}>
|
|
|
|
|
<DialogContent>
|
|
|
|
|
<DialogHeader>
|
|
|
|
|
<DialogTitle>Remove Remote</DialogTitle>
|
|
|
|
|
</DialogHeader>
|
|
|
|
|
<RemoveRemoteDialog
|
|
|
|
|
remote={removingRemote}
|
|
|
|
|
onConfirm={handleRemoveRemote}
|
|
|
|
|
onCancel={() => setRemovingRemote(null)}
|
|
|
|
|
/>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
</Dialog>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|