2026-06-11 14:38:36 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/index';
|
|
|
|
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/index';
|
|
|
|
|
import { Button } from '@/components/ui/index';
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
import { Play, Trash2, RefreshCw } from 'lucide-react';
|
|
|
|
|
import { HaResource } from '@/lib/proxmoxClient';
|
2026-06-11 14:38:36 +00:00
|
|
|
|
|
|
|
|
interface HAResourcesListProps {
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
resources: HaResource[];
|
2026-06-11 14:38:36 +00:00
|
|
|
onRefresh?: () => void;
|
|
|
|
|
isLoading?: boolean;
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
onEnable?: (resource: HaResource) => void;
|
|
|
|
|
onRemove?: (resource: HaResource) => void;
|
2026-06-11 14:38:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function HAResourcesList({
|
|
|
|
|
resources,
|
|
|
|
|
onRefresh,
|
|
|
|
|
isLoading,
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
onEnable,
|
|
|
|
|
onRemove,
|
2026-06-11 14:38:36 +00:00
|
|
|
}: HAResourcesListProps) {
|
|
|
|
|
return (
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
|
|
|
|
<CardTitle>HA Resources</CardTitle>
|
|
|
|
|
<div className="flex space-x-2">
|
|
|
|
|
<Button variant="outline" size="sm" onClick={onRefresh} disabled={isLoading}>
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
<RefreshCw className="mr-2 h-4 w-4" />
|
2026-06-11 14:38:36 +00:00
|
|
|
Refresh
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
|
|
|
|
<div className="overflow-auto">
|
|
|
|
|
<Table>
|
|
|
|
|
<TableHeader>
|
|
|
|
|
<TableRow>
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
<TableHead>Resource ID</TableHead>
|
2026-06-11 14:38:36 +00:00
|
|
|
<TableHead>Group</TableHead>
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
<TableHead>State</TableHead>
|
|
|
|
|
<TableHead>Max Restart</TableHead>
|
|
|
|
|
<TableHead>Max Relocate</TableHead>
|
2026-06-11 14:38:36 +00:00
|
|
|
<TableHead className="text-right">Actions</TableHead>
|
|
|
|
|
</TableRow>
|
|
|
|
|
</TableHeader>
|
|
|
|
|
<TableBody>
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
{resources.length === 0 ? (
|
|
|
|
|
<TableRow>
|
|
|
|
|
<TableCell colSpan={6} className="text-center text-muted-foreground py-8">
|
|
|
|
|
No HA resources configured
|
2026-06-11 14:38:36 +00:00
|
|
|
</TableCell>
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
</TableRow>
|
|
|
|
|
) : (
|
|
|
|
|
resources.map((resource) => (
|
|
|
|
|
<TableRow key={resource.sid}>
|
|
|
|
|
<TableCell className="font-medium font-mono text-xs">{resource.sid}</TableCell>
|
|
|
|
|
<TableCell>{resource.group ?? '-'}</TableCell>
|
|
|
|
|
<TableCell>
|
|
|
|
|
<span className={`inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${
|
|
|
|
|
resource.state === 'started' ? 'bg-green-100 text-green-800' :
|
|
|
|
|
resource.state === 'stopped' ? 'bg-gray-100 text-gray-600' :
|
|
|
|
|
resource.state === 'error' ? 'bg-red-100 text-red-800' :
|
|
|
|
|
'bg-yellow-100 text-yellow-800'
|
|
|
|
|
}`}>
|
|
|
|
|
{resource.state}
|
|
|
|
|
</span>
|
|
|
|
|
</TableCell>
|
|
|
|
|
<TableCell>{resource.maxRestart ?? '-'}</TableCell>
|
|
|
|
|
<TableCell>{resource.maxRelocate ?? '-'}</TableCell>
|
|
|
|
|
<TableCell className="text-right">
|
|
|
|
|
<div className="flex items-center justify-end space-x-2">
|
2026-06-11 14:38:36 +00:00
|
|
|
<button
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
className="rounded-md p-1 hover:bg-green-100 hover:text-green-600"
|
|
|
|
|
onClick={() => onEnable?.(resource)}
|
|
|
|
|
title="Enable"
|
2026-06-11 14:38:36 +00:00
|
|
|
>
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
<Play className="h-4 w-4" />
|
2026-06-11 14:38:36 +00:00
|
|
|
</button>
|
|
|
|
|
<button
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
className="rounded-md p-1 hover:bg-red-100 hover:text-red-600"
|
|
|
|
|
onClick={() => onRemove?.(resource)}
|
|
|
|
|
title="Remove"
|
2026-06-11 14:38:36 +00:00
|
|
|
>
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
<Trash2 className="h-4 w-4" />
|
2026-06-11 14:38:36 +00:00
|
|
|
</button>
|
feat(proxmox): implement HA groups manager and user management UI (phases 8-9)
- HAGroupsList: replace stub with real HaGroup type from proxmoxClient;
columns: Name, Nodes, Restricted, No-Quorum Policy, Comment, Actions;
empty state; onCreate/onEdit/onDelete props wired
- HAResourcesList: replace stub with real HaResource type; columns:
Resource ID, Group, State, Max Restart, Max Relocate, Actions;
onEnable/onRemove props; empty state
- HAPage: add useEffect data fetching for listHaGroups/listHaResources;
auto-selects first cluster from listProxmoxClusters; multi-cluster
dropdown when >1 cluster; wires deleteHaGroup and enableHaResource
- AclList: migrate from local AclInfo to canonical AclEntry type
(ugid/roleid fields); composite key for rows without unique id
- UserList: migrate from local UserInfo to ProxmoxUser type; adds
Realm, Name, Expire columns; deriveRealm helper; proper icon buttons
- RealmList: migrate from local RealmInfo to AuthRealm type (realm/type/
comment); trimmed to three columns matching backend shape
- ACLPage: replace hardcoded dummy ACL array with real data fetching;
add Tabs (ACL / Users / Auth Realms) with controlled state; calls
listAcls, listUsers, listRealms on mount and cluster change; removes
all hardcoded stub data
2026-06-13 02:55:35 +00:00
|
|
|
</div>
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
))
|
|
|
|
|
)}
|
2026-06-11 14:38:36 +00:00
|
|
|
</TableBody>
|
|
|
|
|
</Table>
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
}
|